RePo: Language Models with Context Re-Positioning

Huayang Li, Tianyu Zhao, Richard Sproat · OpenReview

Abstract: In-context learning is fundamental to modern Large Language Models (LLMs); however, prevailing architectures impose a rigid and fixed contextual structure by assigning linear or constant positional indices. Drawing on Cognitive Load Theory (CLT), we argue that this uninformative structure increases extraneous cognitive load, consuming finite working memory capacity that should be allocated to deep reasoning and attention allocation. To address this, we propose RePo, a novel mechanism that reduces extraneous load via context re-positioning. Unlike standard approaches, RePo utilizes a differentiable module, $f_\phi$, to assign token positions that capture contextual dependencies, rather than relying on pre-defined integer range. By continually pre-training on the OLMo-2 1B backbone, we demonstrate that RePo significantly enhances performance on tasks involving noisy contexts, structured data, and longer context length, while maintaining competitive performance on general short-context tasks. Detailed analysis reveals that RePo successfully allocates higher attention to distant but relevant information, assigns positions in dense and non-linear space, and captures the intrinsic structure of the input context.

Introduction

Standard Large Language Models (LLMs) treat context as a rigid sequence, assigning every token a fixed integer index (0, 1, 2, ...). While this provides order, it imposes a high extraneous cognitive load on the model. Drawing from Cognitive Load Theory (CLT) in psychology, we suggest that poorly organized information consumes finite "working memory" capacity that should be used for reasoning. In LLMs, this manifests as "locality bias"—the tendency to focus on nearby tokens while losing track of distant but critical information, often referred to as the "needle in the haystack" problem. Current architectures lack the flexibility to re-group related information or ignore irrelevant noise within their internal positional representation.

The RePo Mechanism

We introduce RePo (Context Re-Positioning), a lightweight, differentiable module ($f_\phi$) that assigns real-valued positions to tokens in a continuous, non-linear space.

Key technical components include:

  1. Position Representation: A lightweight SwiGLU sub-layer extracts positional features from the hidden states of tokens, recognizing that content and position are often entangled.
  2. Position Assignment: A linear transformation maps these features to a specific position value ($z_i$) for each attention head.
  3. Integration with RoPE: Instead of using a standard integer distance ($j - i$) in the Rotary Position Embedding (RoPE) formula, RePo utilizes the difference between learned positions ($z_j - z_i$).

RePo is applied starting from the middle layers (the top 2/3rds) of the model, as higher layers benefit most from the global reorganization of context, while lower layers handle local syntax.

Experimental Results

We evaluated RePo by continually pre-training OLMo-2 (1B and 7B) models on 50 billion tokens. The models were tested across noisy contexts (RULER), structured data (HybridQA), and long context (LongBench).

Performance in Long and Noisy Contexts

On the OLMo-2 1B model, RePo outperformed standard RoPE by 5.4 points on average across RULER tasks. Notably, RePo maintains significantly higher Exact Match (EM) scores as context length increases compared to standard RoPE and other variants like NoPE.

RePo demonstrates superior performance and stability in long-context QA and Needle-in-a-Haystack (NIAH) tasks compared to baseline position encoding methods.

In structured data tasks, RePo showed a +4.09 point improvement in EM on the HybridQA dataset for the 7B model, suggesting a superior ability to parse the latent structure of linearized tables. On LongBench, RePo improved average scores by 6.93 points (1B) and 6.38 points (7B) over vanilla RoPE.

Key Insights and Analysis

Analysis reveals that RePo achieves "System 2-like" context reorganization with negligible overhead, adding only 0.9% more parameters.

Beyond Linear Order

One of the most significant findings is that RePo rarely chooses a simple monotonic (0, 1, 2...) or constant pattern. Instead, it adopts "Hybrid" patterns that capture the intrinsic semantic structure of the input, such as automatically segmenting different examples in a few-shot prompt.

The distribution of learned position patterns shows a strong preference for Hybrid structures over simple Monotonic or Constant assignments.

By assigning positions in a dense, non-linear space, the model generalizes better to context lengths it has not seen during training. For instance, models trained on 4K tokens performed robustly at 16K tokens, effectively breaking the locality bias inherent in standard architectures.

Conclusion

RePo offers a scalable and efficient way to improve LLM reasoning in complex contexts by learning to "re-organize" how tokens are perceived in space. While it requires continual pre-training, the resulting performance gains in long-context and structured data tasks are substantial. Future work will explore how these learned positional patterns evolve in frontier-scale models exceeding 100B parameters.

Summary updated

BibTeX
@inproceedings{li2026repo,
  author = {Huayang Li and Tianyu Zhao and Richard Sproat},
  title = {{RePo: Language Models with Context Re-Positioning}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=RsLH9NuYKK},
}
Figure