FocuSFT:基于稀释意识的长上下文微调的双层优化
FocuSFT: Bilevel Optimization for Dilution-Aware Long-Context Fine-Tuning
AI总结:
FocuSFT通过双层优化框架解决长上下文微调中注意力稀释问题,提升模型在长上下文下的准确性和表现。
摘要:
大型语言模型现在能够处理越来越长的输入,但其有效利用长上下文中的信息能力仍然有限。我们发现这一差距源于监督微调(SFT)过程中对长序列中注意力预算的分配方式:位置偏差和注意力 sinks 导致模型将大部分注意力分配给位置优势的token,而非语义相关的内容。这种训练时的注意力稀释(内容token在注意力分布中的饥饿)会削弱梯度信号,限制模型学习鲁棒长上下文能力的能力。我们引入FocuSFT,一种双层优化框架,解决这一问题。内层循环在训练上下文中调整轻量级快速权重参数,形成参数化的记忆,集中注意力于相关内容,外层循环在这一增强的表示基础上进行SFT。两个循环在上下文token上应用双向注意力,同时保留因果掩码以响应,减少导致注意力 sinks 的因果不对称性,并对齐内层和外层的行为。在BABILong上,FocuSFT在4K至32K上下文长度上将准确率提高高达+14pp;在RULER上,它将CWE聚合从72.9%提升到81.1%在16K;在GPQA中使用代理工具时,它在pass@1上产生24%的相对增益。注意力分析显示,FocuSFT将注意力 sinks 质量减少529倍,并在训练过程中将上下文参与度提高三倍。代码:https://github.com/JarvisPei/FocuSFT
英文摘要:
Large language models can now process increasingly long inputs, yet their ability to effectively use information spread across long contexts remains limited. We trace this gap to how attention budget is spent during supervised fine-tuning (SFT) on long sequences: positional biases and attention sinks cause the model to allocate most of its attention to positionally privileged tokens rather than semantically relevant content. This training-time attention dilution (the starvation of content tokens in the attention distribution) weakens the gradient signal, limiting the model's ability to learn robust long-context capabilities. We introduce FocuSFT, a bilevel optimization framework that addresses this problem at training time. An inner loop adapts lightweight fast-weight parameters on the training context to form a parametric memory that concentrates attention on relevant content, and the outer loop performs SFT conditioned on this sharpened representation. Both loops apply bidirectional attention over context tokens while preserving causal masking for responses, reducing the causal asymmetry that gives rise to attention sinks and aligning inner-outer behavior. On BABILong, FocuSFT improves accuracy by up to +14pp across 4K--32K context lengths; on RULER, it raises CWE aggregation from 72.9\% to 81.1\% at 16K; and on GPQA with agentic tool use, it yields a 24\% relative gain in pass@1. Attention analysis shows that FocuSFT reduces attention sink mass by 529$\times$ and triples context engagement during training. Code: https://github.com/JarvisPei/FocuSFT
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。