FocuSFT: Bilevel Optimization for Dilution-Aware Long-Context Fine-Tuning

Zehua Pei, Hui-Ling Zhen, Xianzhi Yu, Sinno Jialin Pan, Mingxuan Yuan, Bei YuarXiv 2026

TL;DR

While modern Large Language Models (LLMs) boast massive context windows, they often fail to utilize them effectively because standard fine-tuning suffers from "attention dilution"—where the model wastes its attention budget on uninformative tokens. FocuSFT solves this at training time using a bilevel optimization framework that temporarily sharpens attention onto relevant content via an inner-loop parametric memory. This breaks the vicious cycle of poor context utilization, yielding massive long-context performance gains with zero inference overhead.

What Problem Does This Paper Address?

Modern frontier LLMs can ingest tens or hundreds of thousands of tokens, yet a massive gap remains between context capacity and context utilization. Phenomena like "Lost in the Middle" show that models systematically neglect information buried deep within long inputs, failing complex tasks even when the data fits comfortably within their advertised context window.

The authors identify a critical, overlooked bottleneck: training-time attention dilution. During standard Supervised Fine-Tuning (SFT), causal masking and positional biases force the model's forward pass to waste its attention budget on positionally privileged tokens, such as the very first few tokens (known as "attention sinks"). Because the training loss and subsequent gradients are computed from these diluted representations, the model never actually learns how to properly attend to and extract long-context content. Instead, longer training sequences simply reinforce these shallow attention patterns.

Methods

To break this cycle, the authors introduce FocuSFT, a dilution-aware fine-tuning framework based on bilevel optimization.

Overview of FocuSFT

Each training step is split into two nested loops:

  1. Inner Loop (Parametric Memory): For every training sample, the framework temporarily initializes lightweight fast-weight parameters (LoRA adapters on the Feed-Forward Network layers). It runs a small number of gradient steps ($K=2$) on the context to minimize next-token prediction loss. This forces the fast weights to act as a temporary "parametric memory" that sharpens the model's internal representations and concentrates attention on semantically relevant content.
  2. Outer Loop (Standard SFT): The outer loop then performs standard SFT on the response tokens, conditioned on the sharpened representations from the inner loop. Crucially, only the base model parameters ($\theta$) receive permanent gradient updates; the fast weights are discarded after each step, ensuring zero inference overhead.

Additionally, FocuSFT implements Bidirectional Context Attention. Both loops apply bidirectional attention over context tokens while preserving causal masking only for the responses. This eliminates the causal asymmetry that naturally gives rise to attention sinks in the first place.

Datasets

  • Training: The framework was trained using 3,000 multi-turn agentic SFT samples from Open-AgentRL.
  • Evaluation: FocuSFT was evaluated across several rigorous long-context benchmarks:
  • BABILong: Tests fact retrieval and multi-hop reasoning within long narratives at lengths from 4K to 32K tokens.
  • RULER: Evaluates effective context size across retrieval, aggregation, and multi-hop tracing tasks.
  • LongBench QA: Real-world QA datasets (HotpotQA, MultifieldQA, NarrativeQA, Qasper) at an 8K context length.
  • GPQA Diamond: Graduate-level science reasoning evaluated within a complex multi-turn agentic tool-use environment.

Key Insights and Ideas

  • The SFT Vicious Cycle: Simply training on longer sequences doesn't fix long-context utilization; it actually exacerbates attention dilution. Attention sinks absorb an even larger share of the budget, starving actual content tokens of gradients.
  • Sinks are Pervasive: Attention sinks aren't localized to specific layers; standard SFT exhibits a pervasive sink across all 28 layers of the network.
  • Symmetric Visibility Destroys Sinks: Allowing context tokens to look at each other symmetrically removes the structural privilege of the initial tokens, reducing attention sink mass by a staggering 529$\times$.
  • Inner-Outer Consistency: For bilevel optimization to succeed, the inner and outer loops must share the exact same objective and attention mask structure. This ensures the sharpened representations remain perfectly compatible with how the model processes data downstream.

Key Results

  • Attention Budget Redistribution: FocuSFT successfully tripled total context engagement (from 13.5% to 41.4%), replacing uniform sink columns with sharp, content-driven attention peaks.
Figure 2: Training-time attention patterns on a 4096-token multi-turn agentic sample, comparing standard SFT and FOCUSFT (response-query attention averaged across all 28 layers). (a) Standard SFT is dominated by the attention sink with near-zero attention elsewhere; FOCUSFT produces content-driven peaks at meaningful positions. (b) Standard SFT directs only 13.5% of attention to context content; FOCUSFT achieves 41.4% (3.1×).
Figure 3: Attention heatmaps at a representative middle layer on a 4096-token multi-turn sample. (a) Standard SFT: a bright column at initial tokens reveals the attention sink absorbing budget across all query positions. (b) FOCUSFT: the sink vanishes, revealing the multi-turn dialogue structure with bidirectional blocks for context turns and causal blocks for assistant responses.
  • BABILong: FocuSFT outperformed standard SFT by up to +14.2 percentage points (pp) at 4K and maintained a +9.6pp advantage at 32K context lengths.
  • RULER: On the challenging Common Word Extraction (CWE) aggregation task, FocuSFT raised accuracy from 72.9% to 81.1% (+8.2pp) at a 16K context length.
  • GPQA: Yielded a 24% relative gain in pass@1 accuracy (19.4% vs 15.6%), proving that training-time attention improvements successfully transfer to complex agentic reasoning.

Limitations and Future Work

  • Training Overhead: FocuSFT introduces a 1.71$\times$ wall-time training overhead due to the extra inner-loop gradient steps.
  • Scope of Evaluation: The experiments were restricted to a single model family (Qwen2.5-7B) and a relatively small training corpus (3K samples). Scaling behavior across larger model sizes and data regimes remains to be explored.
  • Alignment Integration: The framework currently only targets the SFT stage. Integrating FocuSFT with reinforcement learning alignment methods, such as RLHF or DPO, is an open and promising direction.

Summary updated

BibTeX
@misc{pei2026focusft,
  author = {Zehua Pei and Hui-Ling Zhen and Xianzhi Yu and Sinno Jialin Pan and Mingxuan Yuan and Bei Yu},
  title = {{FocuSFT: Bilevel Optimization for Dilution-Aware Long-Context Fine-Tuning}},
  year = {2026},
  eprint = {2605.09932},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.09932},
}
Figure