PolicyLong: Towards On-Policy Context Extension

Junlong Jia, Ziyang Chen, Xing W, Chaochen Gao, TingHao Yu, feng zhang, Songlin Hu, Binghui Guo

TL;DR

PolicyLong introduces a dynamic, "on-policy" framework for extending the context window of Large Language Models (LLMs). By iteratively refreshing training data based on the model's evolving uncertainty, it bridges the "off-policy gap" found in static datasets, creating an implicit self-curriculum that significantly improves performance on long-context benchmarks like RULER and HELMET.

What Problem Does This Paper Address?

Extending the context window of an LLM (e.g., from 32K to 128K tokens) is notoriously difficult because high-quality, long-form data is scarce. Recent state-of-the-art methods synthesize this data by concatenating short documents and using a base model to verify that a specific "context" actually helps predict a "target" word (information-theoretic verification).

However, these methods suffer from an off-policy gap. They construct the entire training set once using a fixed base model. As the model trains and improves, the dependencies that were once challenging become trivial. The authors demonstrate that the predictive entropy of these positions drops significantly during training, meaning the static dataset eventually fails to provide a useful optimization signal. The training data becomes a "moving target" that the static approach cannot hit.

Figure 2: Empirical evidence for the off-policy gap. (a) The entropy distribution of positions initially identified as high-entropy by the base model shifts significantly across stages, demonstrating progressive data–model misalignment. (b) Target-word loss with the posi- tive context decreases rapidly, indicating that base-model-identified dependencies become trivially easy for the trained model.

Methods

The core innovation of PolicyLong is shifting data construction from a static preprocessing step to a closed-loop, iterative process.

  1. Iterative Self-Curriculum: The training is divided into $T$ stages. At each stage, the current model ($M_t$) is used to re-screen the entire data pool. It identifies new high-entropy positions—the model's current "learning frontier"—and retrieves contexts that reduce that specific uncertainty.
  2. On-Policy Hard Negatives: Unlike previous methods that use random distractors, PolicyLong performs a "secondary retrieval." For every verified positive context, it finds semantically similar but irrelevant chunks. These act as "hard negatives," forcing the model to learn fine-grained distinctions rather than relying on simple keyword matching.
  3. Dynamic Thresholding: The entropy threshold for selecting data increases across stages. This ensures the model stays focused on increasingly difficult dependencies as it masters the easier ones.
  4. Pipelined Construction: To avoid massive training delays, the authors pipeline the process: while the GPU is training on data from stage $t$, the CPU and a small portion of GPU resources are already screening and retrieving data for stage $t+1$.
Overview of the PolicyLong pipeline, showing the iterative stages and the 5-step data construction process.

Datasets

  • Training/Retrieval Source: The models were trained using documents sampled from FineWeb-Edu and Cosmopedia.
  • Evaluation Benchmarks:
    • RULER: A suite of synthetic long-range retrieval and reasoning tasks (8K to 128K).
  • HELMET: A benchmark for holistic long-context understanding.
  • LongBench-v2: A set of instruction-following tasks requiring deep document-level comprehension.
  • Models: The primary experiments used Qwen2.5-3B, with cross-scale validation performed on OLMo3-7B.

Key Insights and Ideas

  • The "Aha" Moment on Hard Negatives: Ablation studies revealed that on-policy hard negatives are the single most impactful component. Training the model on what to resist (plausible distractors) is just as important as training it on what to exploit.
  • Implicit vs. Explicit Curriculum: PolicyLong doesn't need a manually designed curriculum. The curriculum emerges naturally because the model's own uncertainty landscape dictates what data is "hard" at any given moment.
  • Widening Gains: The performance gap between PolicyLong and static baselines grows as the context length increases. This suggests that the off-policy gap is a compounding problem that becomes more severe at extreme scales.

Key Results

PolicyLong consistently outperformed strong baselines like EntropyLong and NExtLong across all benchmarks.

  • RULER: At 128K context, PolicyLong achieved a score of 65.99, a +2.54 improvement over EntropyLong.
  • LongBench-v2: Notable gains were seen in the "Long" subset (128K–2M tokens), where PolicyLong improved by +2.8 points.
  • Generalization: The benefits held true when scaling from a 3B to a 7B model and across different model families, proving the method isn't overfitted to a specific architecture.
Table 1: Long-context benchmark results (>32K) on Qwen2.5-3B. PolicyLong consistently outperforms all baselines, with the advantage widening at longer contexts (e.g., +2.54 over EntropyLong at 128K on RULER). RULER and HELMET are evaluated before SFT; LongBench-v2 is evaluated after SFT. LongBench-v2 Med.: 32K–128K input; Long: 128K–2M input.

Limitations and Future Work

  • Computational Scale: While pipelining hides the overhead, re-screening data for models larger than 30B or context windows beyond 256K remains computationally expensive.
  • Diminishing Returns: The authors noted that the benefit of adding more stages saturates around $T=5$. Future work is needed to design more adaptive refresh schedules that can sustain improvements over longer training runs.
  • Unstructured Tasks: While PolicyLong excels at structured reasoning (like Variable Tracking), the authors hypothesize that current benchmarks might not fully capture the scaling advantages for more unstructured, creative long-form tasks.

Summary updated

BibTeX
@inproceedings{jia2026policylong,
  author = {Junlong Jia and Ziyang Chen and Xing W and Chaochen Gao and TingHao YU and feng zhang and Songlin Hu and Binghui Guo},
  title = {{PolicyLong: Towards On-Policy Context Extension}},
  booktitle = {COLM},
  year = {2026},
  url = {https://openreview.net/forum?id=jgdMN9TcOk},
}
Figure