NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Bootstrap Your Own Context Length

Liang Wang, Nan Yang, Xingxing Zhang, Xiaolong Huang, Furu WeiarXiv 2024 · DOI

Abstract

Modern Large Language Models (LLMs) often struggle to maintain performance as input context lengths scale toward one million tokens, a limitation primarily driven by the scarcity of high-quality long-context instruction data. We present a "bootstrapping" framework that utilizes short-context agents to synthesize diverse long-context training examples. By decomposing long-form tasks into manageable sub-tasks, we trained the SelfLong model family. Our results show that SelfLong-8B-1M significantly outperforms existing open-source models on the RULER benchmark and achieves near-perfect retrieval accuracy up to 1M tokens, overcoming the data hunger bottleneck in long-context training.

Introduction

While the "claimed" context length of modern LLMs has reached 128k tokens or more, the "effective" context length—where the model maintains reasoning and retrieval accuracy—is often much shorter. Extending this limit to 1 million tokens is hindered by a significant data scarcity problem. High-quality, diverse, long-context instruction data is rare; natural long-form data like books or code repositories often lacks the task diversity required for instruction following, and manual annotation of 100k+ token documents is prohibitively expensive.

Methodology: Agentic Data Synthesis

The core innovation of this work is a data synthesis workflow that enables a model to create its own long-context training curriculum using only its existing short-context capabilities. This process effectively uses short-context "thinking" to generate long-context data.

The agentic data synthesis workflow for generating long-context instruction data.

As illustrated in the workflow, the creation of a training example is decomposed into four primary stages:

  1. Instruction Generation: An LLM is prompted to generate a complex, multi-faceted task (e.g., planning a trip) and associated search queries.
  2. Document Retrieval: An off-the-shelf retriever identifies relevant documents from a high-quality corpus (e.g., Fineweb-Edu).
  3. Recursive Summarization (QFS): Because retrieved documents are too long for a single pass, Query-Focused Summarization agents recursively condense the text into summaries that fit within standard short-context windows.
  4. Response Generation: A final answer is synthesized based on these condensed summaries.

The resulting long-context training example uses the original long documents as input and the synthesized answer as the target, "bootstrapping" the model's ability to handle massive contexts.

Training Strategy

To handle sequences of this magnitude, the researchers employed a Progressive Training Strategy. The model's context length was doubled at each stage (256k → 512k → 1M) while quadrupling the Rotary Positional Embedding (RoPE) base frequency to maintain stability. This gradual "stretching" proved more effective and stable than jumping directly to 1M tokens.

Experimental Results

SelfLong-8B-1M achieved a score of 69.6 on the RULER benchmark at 1M tokens, significantly outperforming other open-source models like LWM (60.1) and the base Llama-3-8B-1M (64.3).

Needle-in-a-Haystack performance comparison across Llama-3.1-8B-Instruct, Llama-3-8B-1M, and SelfLong-8B-1M.

Crucially, the model demonstrates robust retrieval capabilities across the entire 1M token range. As shown in the Needle-in-a-Haystack heatmaps, while standard models like Llama-3.1-8B-Instruct exhibit significant performance degradation (the "lost-in-the-middle" phenomenon) beyond 128k tokens, SelfLong-8B-1M maintains near-perfect recall (indicated by the green regions) up to the 1M token limit.

Conclusion and Future Work

This research demonstrates that long-context capabilities can be synthesized from short-context reasoning. By using an agentic RAG-based workflow, researchers can overcome the data bottleneck and train models that effectively utilize 1M-token contexts. However, challenges remain: performance still trends downward as context length increases, and the inference costs for 1M+ tokens are substantial. Future work will focus on architectural optimizations and improving the instruction-following quality of very long generations.

Summary updated

BibTeX
@misc{wang2024bootstrap,
  author = {Liang Wang and Nan Yang and Xingxing Zhang and Xiaolong Huang and Furu Wei},
  title = {{Bootstrap Your Own Context Length}},
  year = {2024},
  eprint = {2412.18860},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.18860},
}
Figure