通过重复序列让解码器模型获得双向感知能力,提升文本标注效果。
Sequence Repetition Enhances Token Embeddings and Improves Sequence Labeling with Decoder-only Language Models
- 用重复输入序列的方式让解码器自动具备双向上下文理解能力。
- 重复次数增加不降低性能,中间层嵌入效果接近最终层且计算更高效。
- 适合想用解码器做标注等词粒度任务的研究者和开发者。
现代语言模型采用自回归训练,仅依赖前缀上下文。而序列标注任务需对每个词分配标签,天然需要双向上下文。这导致传统上序列标注依赖编码器-解码器结构的模型。随着解码器模型快速发展,如何将其适配序列标注成为新问题。现有方法如去除因果掩码虽有效,但需修改模型架构。本文提出序列重复(SR)作为更轻量的替代方案,通过重复输入序列使解码器实现双向感知。实验表明,该方法能显著提升词嵌入质量,优于编码器和未加掩码的解码器。我们发现增加重复次数不会损害性能,且中间层嵌入表现接近最终层,但计算开销更低。结果表明,序列重复可有效缓解解码器的结构局限,提升模型在词级任务中的适用性与效率。
原文摘要 · Abstract (English)
Modern language models (LMs) are trained in an autoregressive manner, conditioned only on the prefix. In contrast, sequence labeling (SL) tasks assign labels to each individual input token, naturally benefiting from bidirectional context. This discrepancy has historically led SL to rely on inherently bidirectional encoder-only models. However, the rapid development of decoder-only models has raised the question of whether they can be adapted to SL. While causal mask removal has emerged as a viable technique for adapting decoder-only models to leverage the full context for SL, it requires considerable changes to the base model functionality. In this work, we explore sequence repetition (SR) as a less invasive alternative for enabling bidirectionality in decoder-only models. Through fine-tuning experiments, we show that SR inherently makes decoders bidirectional, improving the quality of token-level embeddings and surpassing encoders and unmasked decoders. Contrary to earlier claims, we find that increasing the number of repetitions does not degrade SL performance. Finally, we demonstrate that embeddings from intermediate layers are highly effective for SR, comparable to those from final layers, while being significantly more efficient to compute. Our findings underscore that SR alleviates the structural limitations of decoders, enabling more efficient and adaptable LMs and broadening their applicability to other token-level tasks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。