用可学习的元标记提升模型长距离依赖建模能力。
Language Modeling with Learned Meta-Tokens
- 引入元标记与元注意力机制,让模型在预训练中学会利用特殊标记
- 仅用不到1000亿词元预训练,微调后任务表现优异
- 元标记作为内容相关的可训练地标,实现上下文压缩与推理时长度外推
尽管基于Transformer的语言模型在多任务泛化上取得显著成功,但在其上下文窗口内捕捉长距离依赖仍存在困难。本文提出一种新方法:在预训练阶段注入特殊元标记,并结合专用的元注意力机制引导模型使用这些标记。我们基于改进的GPT-2架构,在预训练中加入元注意力,研究其在一系列合成任务上的影响。结果表明,仅使用少于100B词元的数据进行高效预训练,配合元标记与元注意力机制,微调后模型在任务中表现强劲。我们认为性能提升源于元标记强化了位置编码,使其成为可训练、基于内容的地标,隐式压缩前序上下文并“缓存”于元标记中。推理时,元标记可指向相关上下文,实现长达两倍于原上下文窗口的长度泛化,即使在使用YaRN扩展后依然有效。通过可视化残差流及信息论分析率失真权衡,进一步验证了该机制的压缩能力。研究发现,通过元标记预训练语言模型,是一种简单且数据高效的增强长上下文建模的方法,并为模型在长度泛化方面的行为提供了新见解。
原文摘要 · Abstract (English)
While modern Transformer-based language models (LMs) have achieved major success in multi-task generalization, they often struggle to capture long-range dependencies within their context window. This work introduces a novel approach using meta-tokens, special tokens injected during pre-training, along with a dedicated meta-attention mechanism to guide LMs to use these tokens. We pre-train a language model with a modified GPT-2 architecture equipped with meta-attention in addition to causal multi-head attention, and study the impact of these tokens on a suite of synthetic tasks. We find that data-efficient language model pre-training on fewer than 100B tokens utilizing meta-tokens and our meta-attention mechanism achieves strong performance on these tasks after fine-tuning. We suggest that these gains arise due to the meta-tokens sharpening the positional encoding. This enables them to operate as trainable, content-based landmarks, implicitly compressing preceding context and "caching" it in the meta-token. At inference-time, the meta-token points to relevant context, facilitating length generalization up to 2$\times$ its context window, even after extension with YaRN. We provide further evidence of these behaviors by visualizing model internals to study the residual stream, and assessing the compression quality by information-theoretic analysis on the rate-distortion tradeoff. Our findings suggest that pre-training LMs with meta-tokens offers a simple, data-efficient method to enhance long-context language modeling performance, while introducing new insights into the nature of their behavior towards length generalization.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。