ACER: Automatic Language Model Context Extension via Retrieval

## Abstract

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.

## 1 Introduction

The field of Artificial Intelligence (AI) and Natural Language Processing (NLP) have made substantial progress in building and teaching neural language models (LMs) to understand and generate language (Radford et al., ; Brown et al., ; OpenAI, ; Anthropic, ; ; Touvron et al., ; ; MetaAI et al., ). Large-scale deep learning has enabled large LMs to learn from massive amounts of human-generated text (Radford et al., ; Brown et al., ). However, new challenges emerge as researchers consider building capabilities beyond those of humans. One popular example, also the focus of this paper, is understanding long-contexts of text (Dai et al., ; Su et al., ; Xiong et al., ). Despite the advancements in modeling (Dao et al., ; Su et al., ; Xiong et al., ), data keeps being lacking simply because humans no longer produce them naturally. Specifically, while longer contexts give more degrees of freedom in forming possible language sequences and long-interaction/complex-information tasks, the existing long texts are limited to organized and compact ones like novels and code (Fu et al., ).

A common methodology in building long-context LM is to incorporate a context extension phase into the model building cycle after the general pre-training phase and before the task-aware post-training phase (Xiong et al., ; Rozière et al., ; MetaAI et al., ). As the standard pre-training stage builds into the model the general capabilities over diverse text distributions, the long-context extension phase is designed with the hope to extend generalist capabilities further to long-context patterns. The subsequent post-training is supposed to activate and align these extra long-context capabilities to task instructions.

Despite the exciting promise of this context extension scheme, the limited portion of model training dedicated to long-context contradicts the aforementioned increasingly more complex space language and task patterns when the text gets longer (Xiong et al., ; MetaAI et al., ). In other words, using a context extension phase to cover all long-context understanding tasks can be mathematically intractable, and consequently, building a long-context generalist may not succeed. To investigate this, in this paper, we conduct experiments and demonstrate empirically that practical tasks like long-context retrieval augmented generation can easily break existing long-context models.
While creating domain-specific supervised training may help fix this. Unlike short-context training data that can be collected from everyday people (Kopf et al., ), long-context training can be much harder to curate. Reading long pieces of text is inherently hard for humans, which could make the annotation process not only costly but also very demanding and, therefore, less reliable.

In this paper, to alleviate this problem and provide an intermediate solution, we propose a new approach which Automates Context Extension via Retrieval (ACER; Figure 1). Overall, ACER is a two-stage method. We start with synthesizing *imperfect* data by combining retrieval with an LM *excels in short context*. In the subsequent stage, we will fine-tune a large LM to bootstrap over this data. ACER will start with some pairs of question and its long context, while no labeling is required. In the synthesis pipeline, the long context is broken into chunks and a retrieval model will score and rank the chunks. A small set of top-ranked chunks will be fed into the short-context LM to produce answer *with chain-of-thought* (CoT; Wei et al. ()) reasoning. Then, in the fine-tuning stage, we train the model using the context, question, and the CoT. On the other hand, the retrieval-based data synthesis process will be hidden from the model. We desire that the deep model will learn a generic long-context understanding function by fitting over the full context and the CoT reasoning. We hypothesize that the model may discover a better latent function that transcends the original ranking mechanism used in the first stage. This also shares some spirit with LM pre-training. Whereas typically pre-training bootstrap from existing human data, due to the apparent data scarcity, ACER will bootstrap from synthetic long-context data generated using retrieval.

Our experiments demonstrated the effectiveness of ACER. We found model trained with ACER without supervision can outperform contemporary generalist long-context models. It also outperforms its own retrieval-based answering pipeline if applied to the test sets.

## 2 ACER

In this section, we will give an overview of ACER. The ACER method consists of two major stages: 1) automatic data synthesis, and 2) self training, as illustrated in Figure 1.
In this chapter, we will describe how each of these stages work.

Figure: Figure 1: The full process of ACER involves a data synthesis stage and a fine-tuning stage. (top) The data synthesis stage splits and retrieves a set of relevant text chunks for a problem and use a short-context model to generate an answer with CoT (Wei et al., ). (bottom) The fine-tuning stage use the original long-context data and the synthetic CoT answer to fine-tune a long-context model.
Refer to caption: extracted/5920405/fig/main.drawio.curr.png

### 2.1 Automatic Data Synthesis

Our data synthesis process combines a heuristic-based retrieval pipeline and a short-context generator. We use the following ingredients,

- $\bullet$
Prompts: a set of prompts/problems, $\{p_{1},p_{2},..,p_{N}\}$, each of which consists of a pair of context and question $p_{i}=(c_{i},q_{i})$
- $\bullet$
Short-Context Ranker: A ranker model $r(q,t)\rightarrow\mathbb{R}$ which takes a question $q$ and a piece of *short* text $t$. This ranker determines a relevance score corresponding to how helpful the text $t$ in answering the question $q$.
- $\bullet$
Short-Context Generator: A generator model $g(x)\rightarrow a$ that takes some short prompt $x$ and returns an answer $a$. This will be an aligned instruction-tuned model like many existing contemporary LM.

We start the data synthesis process from the set of prompts. For one prompt $p_{i}=(c_{i},q_{i})$, we break the context into a set of text chunks $\{t_{i1},t_{i2},t_{i3},...\}$. The ranking model will assign chunk $t_{ij}$ a relevance score $s_{ij}=r(q_{i},t_{ij})$. Based on these scores, we can produce a ranking of the text chunk indices using the estimated helpfulness, [$r_{i1},r_{i2},r_{i3}$, …]. We collect the top $M$ ranked text chunks while making sure that their concatenation can still fit in the short generator. These “most helpful” chunks will together be fed into a generator to produce an answer,

$$ $\hat{a}_{i}=g(\texttt{INST}\circ q_{i}\circ t_{r_{i1}}\circ t_{r_{i2}}\circ.. \circ t_{r_{iM}})$ (1) $$

Here INST denotes an instruction to the model to elicit an explicit reasoning in a chain-of-thought like form. This makes sure that the model can describe how it compares the information in the provided text pieces to identify the most useful ones, as well as how it combines them to arrive at the final answer. This reasoning process will be used in the next stage to help train the model in the fine-tuning stage.

This data synthesis process leverages two critical capabilities in the original LM, relevance/usefulness analysis and understanding of short pieces of text. We combine them heuristically to build a surrogate long-context pipeline. Readers familiar with the concept of map-reduce may recognize our data synthesis as such a process.

### 2.2 Fine-tuning

During data synthesis, we produce for each prompt, a full document ranking, a small set of helpful documents and an answer. For fine-tuning, we discard the ranking and the document set and use only the generated answer, because we do not want our model to be exposed to and learn from the *lossy* retrieval pipeline. We fine-tune an LM $f_{\theta}$ to produce the CoT answer $\hat{a_{i}}$, i.e.,

$$ $\hat{\theta}=\text{argmin}_{\theta}\sum_{i}f(\hat{a_{i}}|(c_{i},q_{i}))$ (2) $$

In this setup, we provide the model a lossless, unfiltered access to the full context. In addition, we pair it with an answer with extra training signals, a CoT describing an information extraction process of picking up useful pieces of information and sorting through. As with any other deep learning application, we desire that the large over-parametrized LM can learn during the optimization process to fit a long-context understanding function that will lead to similar reasoning and answer. To keep it simple, we fine-tune the model with teacher forcing using a log likelihood loss. Only the answer tokens participate in loss computation with the context token loss masked out during training.

## 3 Experimental Setup

### 3.1 Tasks

We consider two realistic tasks, long-context retrieval augmented generation (Jiang et al. ()) and long-context reading comprehension. We pick long-context RAG as our major evaluation since the task, while being very useful, has only very recently be carefully studied. This is more aligned with our desired setup, distinct yet useful long context tasks with little supervision.
We consider the following two datasets:
Natural Question (NQ) (Kwiatkowski et al., )
and TriviaQA (TQA) (Joshi et al., )
We use Wikipedia as the knowledge source,
and BGE (Xiao et al., ) which is a dense retriever Karpukhin et al. ().
We report the exact match (EM) metric.

For long-context reading comprehension, we used the NarrativeQA dataset Kočiský et al. (). The dataset has been out for several years at the time of writing and has since been a standard evaluation for long context. We expect many long-context models being trained on some form of its train set. Nevertheless, we still use it as reference to understand how our self-supervised approach compares to the supervised ones. We used the curated test set from LongBench Bai et al. (). We report the token-level F1 metric.

While these datasets have short gold answer, modern LMs tend to produce long answers. In order to evaluate EM or F1 scores, we employ an additional short answer extraction step by few-shot prompting a Llama-3-8B-Instruct model using the prompt introduced by Jiang et al. ().

### 3.2 Data Synthesis

For data synthesis, in order to keep it simple, we implement the ranker and the short context generator by prompting the same LM, Llama-3-8B-Instruct. This is the short-context version of the latest generation of Llama models (MetaAI et al., ). We use the 8B variant instead of the 70B or 405B to demonstrate the applicability of ACER in a cost efficient setup.

##### Ranker Model

We show the prompt of the ranker model in Figure 2. We instruct the model to read the question and context chunk (referred to as passage in the prompt) and *think step-by-step* to decide the helpfulness of the passage for answering the question. We formulate it as a multiple choice question where the model is instructed to choose from 5 options from the most a) “providing exact answer” to e) “not related”.

Figure: Figure 2: Prompts given to the LM to produce relevance judgement.

##### Generator Model

We show the prompt for the generator model in Figure 3. The model is instructed to read the given passages and extract *several* pieces of potentially helpful information before it makes decision on what evidence to use and then use it to answer the question.

Figure: Figure 3: Prompts given to the LM to produce the final CoT answer.

We use prompts in the corresponding dataset’s training set. For RAG tasks, we obtain the context by using a dense retriever to retrieve 100 passages from Wikipedia. We use the DPR version of Wikipedia dump, where the documents are splited into chunks of 100 words.
For NarrativeQA, the context is simply the original full book. We do not make any additional edit over it.
We apply an addition data augmentation technique to the RAG data: we perform a sliding window shuffle of candidates passages. We use window size of 30 and a stride of 20. This is used to efficiently emulate a ranking noise where the absolute change in position decays with the change size. One copy of the noised data is used as well as one with original ranking.

For the creation of the final data, we reuse the generator prompt template (Figure 3) with the full context as question. We combine it with the generated answer using a chat template.

### 3.3 Fine-tuning

We directly fine-tune the ACER models over long context without approximation. This section describes the training details as well as contemporary training technologies/techniques we adopted.

#### 3.3.1 Implementation

We train over the synthesized data for 1 epoch with a batch size of 128 examples. We use a max sequence length of 32k for RAG and 64k for reading comprehension, and therefore this amounts up to 4M tokens and 8M tokens batch, respectively. These lengths are picked to cover most of the test lengths while at the same time keeping training on our accelerators viable and efficient. At the test time, RoPE extrapolation (Su et al., ) is utilized for sequences of longer length. We use a $3e-6$ learning rate with Adam optimizer (Kingma & Ba, ). For model initialization, we still require a model that has a sufficiently long context length. This can be achieved unsupervisedly by training on long-context corpora. To save cost, we borrow Llama-3-8B-ProLong-Base model (Gao et al., )(^1^11[princeton-nlp/Llama-3-8B-ProLong-512k-Base](princeton-nlp/Llama-3-8B-ProLong-512k-Base)), an open model unsupervisedly context-extended from our data synthesizer model Llama-3-8B-Instruct (The authors made decision to build a base model from an instruction tuned version.)

#### 3.3.2 Infrastructure

We train our models using JAX (Bradbury et al., ) on cloud TPUv4s (Jouppi et al., ) provided by TPU Research Cloud. These 4th generation TPUs are built with relatively small-size 32GB HBM per chip while interconnected with high bandwidth fibers. We therefore opt to partition computation and perform our training with 3D parallelism of data parallelism, sequence parallelism, and tensor parallelism. We train on 32 TPUv4 chips in a $(2,4,4)$ configuration mesh and map these axes to data, sequence, and tensor parallelism axes respectively.
Optimizer states as well as the full-precision copy of model weights are kept fully sharded over the mesh, over the entire course of training. We manually shard model, optimizer, and critical activation in attention and feed-forward network. We use JAX’s shard_map to shard flash attention (Dao et al., ; Dao, ) TPU kernels(^2^22[https://github.com/jax-ml/jax/blob/main/jax/experimental/pallas/ops/tpu/flash_attention.py](https://github.com/jax-ml/jax/blob/main/jax/experimental/pallas/ops/tpu/flash_attention.py)) across model axis by heads. The rest of the shardings are decided by the XLA SPMD compiler (Xu et al., ).

We compute loss only over the answer, with the long context receiving only implicit gradients. Taking advantage of this to save memory and flops, on top of using a loss mask, we (dynamically) slice the last layer of hidden states at each batch instance into a smaller answer tensor. Only this smaller tensor is passed to the LM head for out-projection and loss computation. In the backward pass, this will translate into a (dynamic) update of the gradient tensor.

### 3.4 Compared Models

For comparison, we consider models that are relatively open and closely related to the base model we use for ACER, Llama-3.1-Instruct. We acknowledge the effectiveness of proprietary models such as GPT4 OpenAI (). We do not include them here, because our focus is to evaluate a method of data synthesis and the models and data they use are not directly comparable.

Specifically, we compare ACER with long-context LMs fine-tuned on open data as well as those fine-tuned on closed data. Specifically, we consider the following,

- $\bullet$
Together-Llama-2-7B-32K-Instruct (Together, ): A model by TogetherAI by extending Llama2 to a 32k context size. It is fine-tuned on an open mixture of long-context question answering and summarization data.
- $\bullet$
Llama-3-8B-ProLong-512k-Instruct (Gao et al., ): This is a Llama3-8B-Instruct context extended on open long context dataset. It is then fine-tuned on UltraChat (Ding et al., ), a large fine-tuning dataset generated by GPT-4. The creator found it most helpful amongst open instruction-tuning datasets. This model closely relates to ours and share the same base model, offering a straightforward comparison.
- $\bullet$
Llama3-8B-Instruct (Truncation) (MetaAI et al., ): Llama3-8B-Instruct is a 8k context model pre-trained and instruction-tuned by MetaAI with closed data. In this setup, we truncate the input to fit it into the context.
- $\bullet$
Llama3-8B-Instruct (RAG) (MetaAI et al., ): This is Llama3-8B-Instruct reading a small set of input chunks generated with the same retrieval pipeline used in the ACER data synthesis.
- $\bullet$
Llama3.1-8B-Instruct (MetaAI et al., ): This is the second iteration of the Llama3 model by MetaAI. Its context is systematically extended by Meta GenAI team.
- $\bullet$
Mistral-Nemo-Instruct-2407 (MistralAI, ): A larger 12B model trained by MistralAI and Nvidia using closed data. It has a native 128k context length.

We perform inference with vLLM (Kwon et al., ) with greedy decoding. Models always read the full context and extrapolate when reading longer context than the original training-time length except in Llama3-8B-Instruct (Truncation).

## 4 Experimental Results

In Table 1, we show the performance of the compared systems as well as ACER on the evaluation datasets. We see a general trend that ACER outperforms the compared systems with decent margins especially on the novel long-context RAG tasks. We observe a general trend that the closed data model performing better than models trained on open data. Specifically, the Together-Llama-2 model, which is based on the previous generation Llama model, significantly underperforms all other model. This is likely due to two facts that the model essentially stems from an earlier generation, and its shorter context requires it to do more extrapolation.

**Table 1: Performance comparison of ACER and baselines on Natural Question (NQ), TriviaQA (TQA), and NarrativeQA. The best performance on each dataset is boldfaced.**
| Model | NQ | TQA | NarrativeQA |
| --- | --- | --- | --- |
| (EM) | (EM) | (F1) |  |
| Supervised Open Data |  |  |  |
| Together-Llama-2-7B-32K-Instruct | 0.172 | 0.299 | 0.013 |
| Llama-3-8B-ProLong-512k-Instruct | 0.260 | 0.457 | 0.150 |
| Supervised Closed Data |  |  |  |
| Llama3-8B-Instruct (Truncation) | 0.388 | 0.567 | 0.076 |
| Llama3-8B-Instruct (RAG) | 0.408 | 0.611 | 0.161 |
| Llama3.1-8B-Instruct | 0.312 | 0.518 | 0.217 |
| Mistral-Nemo-Instruct-2407${}^{\text{12B}}$ | 0.365 | 0.534 | 0.072 |
| Self-Supervised |  |  |  |
| ACER (ours) | 0.446 | 0.648 | 0.189 |

Now, to remind our reader, the rest of the 8B models, all came from the same base model Llama-3-8B-Base. Despite this fact, we see vastly different performance. The ProLong model performs decently on NarrativeQA but falls behind on the RAG tasks. This is not surprising as the UltraChat supervision it uses relates more closely to standard-form question answering but can be very different from tasks in the wild like long-context RAG here. On the other hand, we see with the more involved long-context extension done by MetaAI, the Llama-3.1 model significantly outperforms Prolong. It actually also attains the best performance on NarrativeQA, likely because the data it uses may contain long-context QA data. Our ACER model is the second best on NarrativeQA, still out-performing all other systems, suggesting that our self-supervised method is still competitive when no specific supervised data is present. Nevertheless, ACER is the best-performing on the RAG datasets, again confirming the usefulness of our self-supervised method.

We do also note that the 12B Mistral-Nemo does not always show decisive advantage over the 8B models. This demonstrates further that the model size and capability advantage do not always translate into long-context performance. As we discussed before, long context means more task diversity and a model’s task fitness becomes as critical; here we see the Mistral model performs decently on RAG but is lacking on Narrative QA. This again shows the usefulness of ACER which is able to self-supervisedly teach a model a new task.

When compared with Llama3-8B-Instruct (RAG), which uses Llama-3 with the ACER retrieval pipeline in a test-time ad-hoc manner, we still see a decent performance boost in ACER. This suggests that learning and bootstrapping from ACER generated data can transcend the original data synthesis pipeline, as we desired.

## 5 Analysis

### 5.1 Comparing Llama-3.1 and ACER at Different Context Sizes

Figure: Figure 4: Performance comparison between Llama3.1 and ACER when reading different context sizes on the Natural Question and Trivia QA datasets.

To get a more fine-grained understanding of how context extension affects each model, in this section, we compare models at a variety of context lengths.
Specifically, we varies the number of retrieved passages fed into the model for generating the final answer.
Recall that Llama-3.1 and ACER both derive from the same pre-trained Llama-3 base model using different context extension processes.
In Figure 4, we plot the two models’ performance against number of passages on both Natural Question and TriviaQA (1k subset to reduce inference cost.)

We observed a very interesting yet intuitive phenomenon. Here the two models perform very similarly when reading a small context. This means they possesses similar capability and alignment behavior at short context, as *sibling models*. However, as context increases, the performance keeps diverge. While ACER can keep digesting more useful information from the context, Llama-3.1 seemingly suffers from the longer contexts with performance decaying. This shows one other example that ACER achieved the goal we set for it and successfully extended the model’s capability presented in a shorter context onto a much longer context.

### 5.2 Using an Unsupervised Retriever

**Table 2: Performance of ACER and baselines with different base retrievers.**
| Retriever | Model | NQ | TQA |
| --- | --- | --- | --- |
| (EM) | (EM) |  |  |
| BM25 | Llama3 (Truncation) | 0.260 | 0.542 |
| Llama3 (RAG) | 0.354 | 0.576 |  |
| Llama3.1 | 0.305 | 0.507 |  |
| ACER | 0.383 | 0.632 |  |
| Dense | Llama3 (Truncation) | 0.388 | 0.567 |
| Llama3 (RAG) | 0.408 | 0.611 |  |
| Llama3.1 | 0.312 | 0.518 |  |
| ACER | 0.446 | 0.648 |  |

The previously discussed ACER pipeline for RAG tasks adopts a supervisedly trained dense retriever. In certain situations where even retrieval data is scarce, obtaining such a retriever may not even be possible. People instead need to fall back to the classical BM25 retrievers. In this section, we consider such a situation by running ACER and some of the baseline systems with BM25. This means the top-100 candidates will be different and of lower quality. In Table 2, we show the results of this BM25 setup compared with the original dense setup. While using BM25, all systems take a hit in performance because of lower-quality candidates, the general performance order of the systems remain the same. Our ACER method still outperforms the other systems by decent margins. In fact, when looking at the the absolute numbers, we can observe that ACER with BM25 attains close or even better performance than best-performing baseline systems. The results suggest that ACER is relatively agnostic to the retriever used and attains good performance to warm-start a system without requiring extra supervision.

## 6 Related Works

##### Language Modeling

Recent advancements of large language models have shown strong language understanding ability and ace a wide range of natural language processing tasks. Based on the Transformer structure (Vaswani et al., ), LMs can be broadly categorized as decoder-only models (e.g., GPT (Radford et al., ; )), encoder-only models (e.g., BERT (Devlin et al., ) and RoBERTa (Liu et al., )), and encoder-decoder models (e.g., BART Lewis et al. () and T5 Raffel et al. ()). Most recently, the large language models such as the GPT family (Brown et al., ; OpenAI, ), Gemini (GeminiTeam et al., ; ), Llama Touvron et al. (; ); MetaAI et al. (), and Claude Anthropic (; ) have attract great attention by achieving human-level performance on various tasks and showing structure-following ability. These models are typically trained in several stages, including pre-training on web-scale text data with auto-regressive language modeling, supervised fine-tuning on specific applications, and human preference alignment. Going beyond the scope of this paper, for production models, the last step plays the pivotal role to steer the LMs as a dialogue system to answer human’s instruction and generate responses that are in desired quality and style, safe, and ethical. Some recent LM alignment methods include reinforcement learning from human feedback (RLHF) (Ouyang et al., ), proximal policy optimization (PPO) (Schulman et al., ), direct policy optimization (DPO) (Rafailov et al., ), and Kahneman-Tversky optimization (KTO) (Ethayarajh et al., ).

##### Long Context Modeling

Transformer (Vaswani et al., ) is the foundation architecture for recent advancements in language models. However, its quadratic temporal and computation complexity to the sequence length poses great challenge to scale to long input sequence, and the lack of robust position embeddings also degrades the performance of long context understanding. Therefore, tremendous efforts are made to improve the long-context modeling of language models from different aspects, including more efficient attention mechanism for long context Beltagy et al. (); Kwon et al. (); Dao et al. (); Dao (); Xiao et al. (), a (recurrent) internal or external memory bank (Dai et al., ; Wu et al., ; ), and length extrapolation through positional encoding (Press et al., ; Su et al., ; Peng et al., ; Zhu et al., ) and adaptation (Xiong et al., ; Fu et al., ; Rozière et al., ; MetaAI et al., ). To evaluate the long-context modeling ability of LLMs, several synthetic benchmarks are proposed, such as Lost in the Middle (Liu et al., ), Needle in a Haystack (Kamradt, ), and Ruler (Hsieh et al., ). Because we are proposing new data synthesis method for long-context LM training, we do not include the synthetic benchmarks.

##### Retrieval Augmented Generation

Retrieval-augmented generation, or RAG, enhances LLMs’ ability in knowledge intensive tasks. Originated from open-domain question answering (Chen et al., ; Xiong et al., ), RAG will enrich the prompt (i.e., a question) with additional relevant context retrieved from an external corpus to help a reader better answer the question (Lewis et al., ; Guu et al., ; Izacard et al., ). The retrieval methods range from sparse features (Robertson & Zaragoza, ; Roberts et al., ) and deep-learning based dense representations (Karpukhin et al., ; Lewis et al., ) to direct generation by LLMs (Sun et al., ; Yu et al., ). Recent studies have explored various ways to enhance RAG, such as better query understanding (Kim et al., ; Chan et al., ), a better retriever (Karpukhin et al., ; Xiong et al., ; Yao et al., ), and a better reading model (Izacard & Grave, ; Cheng et al., ; Borgeaud et al., ). Specifically, Self-RAG (Asai et al., ) trains a critique model that reflects the retrieved passages and the generation to adaptively decide whether the retrieval is necessary. Jiang et al. () explored the granularity of retrieval units and usage of long-context for better retrieval.

## 7 Conclusion

In this paper, we argue that building long-context multi-task generalist model can be prohibitively hard due to the diverse space of possible tasks. To avoid curating data for each long-context task of interest,
we propose ACER, a method for automatically extending language model capabilities to longer contexts without using human generated supervision. ACER pivots through a retrieval pipeline to help a short-context model to heuristically process long pieces of text and produce a synthetic *imperfect* answer. We demonstrate that this model can then bootstrap over this synthetic answer to gain even stronger long context capabilities, often outperforms carefully built long-context generalist models. We believe ACER demonstrate an effective unsupervised approach to extend short context capabilities into longer contexts. It can be a useful tool to improve specific long-context task performance where little training data exists. Users only need to write a few prompts to run the pipeline.
Broadly, we introduce automating capabilities extension onto longer context as a new research problem; future works may consider better data synthesis processes and paths to produce better extension results.

#### Acknowledgments

The compute resource in this research is provided partly by the TPU Research Cloud (TRC) program, for which the authors are very grateful.
The authors would like to thank Akari Asai, Minyang Tian and Xueguang Ma for helpful discussions.

## Peer Reviews

confidence: 3
contribution: 3
initial_rating: 5
presentation: 2
questions: - The capabilities of Llama-3-8b-it can sometimes be limited, and it may not consistently follow human instructions well in certain cases. How does this limitation impact the performance of your proposed method? Would using a larger backbone model (e.g., Llama-3.1-70b-it) provide greater benefits for the proposed approach?
soundness: 2
strengths: - The topic of long-context modeling is both compelling and critical, and this paper provides valuable new insights into addressing this task.

- The proposed method is well-conceived and alleviates the need for extensive resources for human-annotated data. 

- The approach demonstrates the potential for practical application, making it a meaningful contribution to long-context modeling research.
summary: This paper explores the challenge of building language models with strong long-context processing capabilities, which are essential for tasks that require digesting and reasoning over complex information. The authors note that current generalist long-context models still fall short in practical applications, and that building task-specific long-context models can be prohibitively costly. To address this, the paper proposes an approach inspired by how humans process information - using a short-context language model to perform a lossy retrieval and ranking of a large document set, then fine-tuning that short-context model on the synthetically generated data to obtain task-specific long-context capabilities.
weaknesses: - My primary concern with this paper is the limited evaluation. The experiments provide only a narrow comparison of long-context benchmarks, such as Infinibench [1] and LongBench [2]. Additionally, the paper misses several important approaches mentioned in paper [3] such as self-extend [4] and lm-infinite [5], but lacks a comparative analysis or discussion of these methods, which would strengthen the evaluation.

- There is also a lack of case studies and in-depth analysis of the model’s long-context modeling capabilities. Providing examples on synthetic data or offering a more detailed examination of attention patterns would help demonstrate that the model genuinely improves long-context handling, beyond the benchmark performance alone.

References:

[1] InfiniBench: Extending Long Context Evaluation Beyond 100K Tokens: Extending Long Context Evaluation Beyond 100K Tokens

[2] Longbench: A bilingual, multitask benchmark for long context understanding

[3] A controlled study on long context extension and generalization in llms

[4] Llm maybe longlm: Self-extend llm context window without tuning

[5] Lm-infinite: Simple on-the-fly length generalization for large language models

---

confidence: 3
contribution: 2
initial_rating: 5
presentation: 3
questions: Please kindly address the weaknesses.
soundness: 2
strengths: 1. The paper is well-written.
2. The methodology is clear and effective.
summary: This paper addresses the limitations of current open-weight generalist long-context models in practical long-context processing tasks and proposes an innovative approach inspired by human information processing. By developing an automatic data synthesis pipeline that uses short-context language models to mimic human document retrieval and reading processes, the authors aim to enhance task-specific long-context capabilities. The study demonstrates that short-context LMs, when further tuned with self-generated data, can surpass both long-context generalist models and the foundational retrieval-read pipeline in effectiveness for tasks such as long-context retrieval augmented generation.
weaknesses: 1. The evaluation was conducted solely on long-context RAG tasks, where improvement is natural given the methodology. However, it was not assessed on more general long-context evaluation sets, such as LV-Eval and Needle in a Haystack.
2. The approach seems to be too simplistic and straightforward, lacking innovation and contribution.
3. Experiments are conducted on only one size and one type of language model.

---

confidence: 4
contribution: 3
initial_rating: 5
presentation: 2
questions: Please check weaknesses section.
soundness: 3
strengths: An effective pipeline for automatically generating RAG training data, achieving significant performance improvements even with just an 8B model as a data generator. The scores for downstream RAG tasks are also impressive.
summary: This paper introduces a new method for extending the long-context capabilities of language models, called ACER (Automatic Context Extension via Retrieval). ACER enhances the long-context processing abilities of a short-context language model through a two-stage automated process.

Experimental results show that ACER outperforms other mainstream long-context models across multiple tasks and datasets, particularly excelling in long-context Retrieval Augmented Generation (RAG) tasks.
weaknesses: 1.	Most comparisons in the experiments are with Long-Context Models. I believe additional RAG strategies should be included for comparison.

2.	It would be helpful to see some comparative data statistics, such as a table showing Big Context length and CoT Answer length from Figure 1, as well as length comparisons in the experimental section.

3.	Figure 1 needs a higher-resolution version. Using a PDF image is recommended.

---

confidence: 5
contribution: 2
initial_rating: 3
presentation: 3
questions: （1）Chunking strategies in long documents can disrupt the contextual flow and background information, resulting in some chunks containing incomplete data. This fragmentation may prompt LLMs to reference unrelated contexts or revert to their internal, parameterized knowledge, which can lead to inaccurate responses. How should ACER deal with this problem?
（2）Different question may need different (M) ranker text chunks, how can we set up a M for different problems?
soundness: 3
strengths: (1) The paper presents an effective approach to extend the capabilities of LMs into longer contexts by leveraging retrieval mechanisms and synthetic data generation. 
(2) The experimental results are positive, with ACER being tested on standard benchmarks like Natural Questions (NQ), TriviaQA (TQA), and NarrativeQA. The paper also provides a detailed comparison with other models, which strengthens the quality of the evaluation.
(3) The paper is well-structured and easy to follow.
summary: The paper introduces a novel two-stage approach for enhancing the long-context capabilities of large language models without the need for human-generated supervision data. The first stage involves automatic data synthesis where a retrieval model and a short-context generator work in tandem to produce synthetic long-context data. The second stage is a fine-tuning process where a large LM is trained on the synthetic data to acquire long-context understanding abilities. The paper presents experiments on long-context retrieval augmented generation and long-context reading comprehension tasks, demonstrating the effectiveness of ACER.
weaknesses: (1) While the paper demonstrates the effectiveness of ACER on certain tasks, it does not explore the generalizability of the approach across different domains or longcontext evaluations. Additional experiments in this regard could strengthen the paper's claims.
(2) The idea is valid but lacks novelty. It is more like an engineering trick than a research idea.
(3) The article lacks some more in-depth analysis and ablation on experimental settings, such as the impact of chunk size and the potential relationship with context length.

Meta-review: Long-context language modeling remains challenging for open-weight models. This paper presents a new approach for long-context LM that leverages retrieval and data synthesis. This method first uses retrieval to identify a small number of relevant documents, generates CoT answers from these documents, and then fine-tunes a long-context LM on this new data with the CoT generation. Experiments conducted on long-context RAG and long-context QA benchmarks demonstrate notable performance improvements.

Strengths
- The paper tackles an important problem of long-context language modeling, and the new method that uses data synthesis is valuable (hFE4, WdtJ, NhPs).
- Empirical results are impressive (WdtJ, NhPs).
- The paper is well written (37rX, NhPs).

Weaknesses
- Limited evaluation, due to lack of evaluation benchmarks and baselines (hFE4, 37rX, NhPs, WdtJ)
    - The paper mainly shows improvements on long-context RAG tasks, where improvements are expected as it exactly matches how synthetic data was generated (37rX). Whether it improves general long-context LM benchmarks that are beyond RAG remains underexplored (37rX, NhPs).
    - Lack of comparison to an approach that uses RAG at test time (WdtJ).
- Insufficient technical contribution (37rX, NhPs)
- Lack of details/analysis, such as examples of the generated data, data statistics, and analysis on attention scores (hFE4, WdtJ).

Decision: Reject