Abstract
Long-context modeling is one of the critical capabilities of language AI for digesting and reasoning over complex information pieces. In practice, long-context capabilities are typically built into a pre-trained language model (LM) through a carefully designed context extension stage, with the goal of producing generalist long-context capabilities. In our preliminary experiments, however, we discovered that the current open-weight generalist long-context models are still lacking in practical long-context processing tasks. While this means perfectly effective long-context modeling demands task-specific data, the cost can be prohibitive. In this paper, we draw inspiration from how humans process a large body of information: a lossy retrieval stage ranks a large set of documents while the reader ends up reading deeply only the top candidates. We build an automatic data synthesis pipeline that mimics this process using short-context LMs. The short-context LMs are further tuned using these self-generated data to obtain task-specific long-context capabilities. Similar to how pre-training learns from imperfect data, we hypothesize and further demonstrate that the short-context model can bootstrap over the synthetic data, outperforming not only long-context generalist models but also the retrieval and read pipeline used to synthesize the training data in real-world tasks such as long-context retrieval augmented generation.
Introduction
Modern Large Language Models (LLMs) often boast context windows exceeding 100k tokens. However, their ability to perform complex reasoning over these vast inputs frequently falls short of expectations. Generalist long-context training, often conducted on broad corpora like books or code, does not necessarily equip models for specific tasks like Long-Context Retrieval Augmented Generation (RAG). The primary obstacle is the lack of high-quality, human-annotated data for reasoning over extremely long contexts, as creating such datasets is both expensive and cognitively taxing.
Methodology: The ACER Framework
To address the data scarcity problem, we introduce ACER (Automatic Context Extension via Retrieval), a two-stage pipeline designed to bootstrap long-context capabilities using short-context models.
1. Automatic Data Synthesis
The first stage mimics a "retrieve-then-read" strategy. A Short-Context Ranker identifies relevant chunks from a long document, and a Short-Context Generator (both based on Llama-3-8B-Instruct) produces a Chain-of-Thought (CoT) answer based on these top-ranked chunks. This CoT answer provides a reasoning path from the retrieved evidence to the final conclusion.
2. Self-Training and Fine-tuning
In the second stage, the model is fine-tuned to predict the synthetic CoT answer using the entire original long context as input, rather than just the retrieved chunks. By training on the full context to reach a high-quality reasoning target, the model learns to internally navigate and prioritize information across the entire document, effectively surpassing the simple heuristic ranker used for synthesis.
Experimental Evaluation
We evaluated ACER on two key benchmarks:
- Long-Context RAG: Natural Question (NQ) and TriviaQA (TQA), involving 100 retrieved Wikipedia passages (~32k tokens).
- Long-Context Reading Comprehension: NarrativeQA, involving full-book reasoning (up to 64k tokens).
The experiments utilized Llama-3-8B-ProLong-Base as the starting point, which already possesses basic long-context handling through unsupervised pre-training.
Results and Discussion
ACER demonstrates a significant performance advantage over generalist models. On the NQ dataset, ACER achieved an Exact Match (EM) score of 0.446, compared to 0.312 for Llama-3.1-8B-Instruct.
A key finding is the bootstrapping effect: the fine-tuned ACER model eventually outperforms the retrieval-and-read pipeline that generated its training data. This suggests that the model develops a more integrated and robust internal attention mechanism than the discrete chunk-based retrieval system. Furthermore, while generalist models like Llama 3.1 often show performance degradation as context size increases, ACER maintains or improves its accuracy, demonstrating superior "task fitness."
Conclusion and Future Work
ACER provides a scalable method for extending LLM context windows through self-supervision. While highly effective, it currently relies on a base model with some pre-existing long-context capability and is limited by the reasoning quality of the short-context "teacher" model. Future research will explore scaling this approach to larger models (70B+ parameters) and further refining the synthetic data generation process.
Summary updated