Deep Learning: Sequence Models / DEEP LEARNING III

Beyond the Training Window: Position, Distance, and Extrapolation in Transformers

A larger accepted context does not establish reliable use of distant information.

Cite article

English original. Translations of this new review are not yet available.

AI-generated conceptual cover: A precise sequence of engraved but unlettered brass arches recedes across a warm stone surface; near arches align perfectly, distant arches progressively diverge into different paths. Low diagonal perspective.
Conceptual cover · ImageGen

Abstract

A larger accepted context does not establish reliable use of distant information. This review separates positional representability, distribution shift, attention competition and algorithmic length generalization. Two exact controls show how rescaling rotations alters local resolution and how a linear distance penalty creates a finite effective attention horizon. The resulting protocol tests location, distractors and composition separately, without presenting synthetic curves as model accuracy.

In this paper
  1. 1. The window is an interface, not a capability
  2. 2. What six primary records contribute
  3. 3. Four kinds of extrapolation
  4. 4. A rotation has exact relative structure
  5. 5. Compression buys range by changing resolution
  6. 6. Periodicity is not automatically a collision
  7. 7. Linear distance penalties induce a measurable horizon
  8. 8. Content must compete against the prior
  9. 9. Moving evidence changes more than its index
  10. 10. Retrieval and composition require separate controls
  11. 11. Training exposure is a distribution, not a maximum
  12. 12. Cost accounting must include the served workload
  13. 13. A factorial evaluation protocol
  14. 14. What the program verifies
  15. 15. Interpreting improvements without overclaiming
  16. 16. Research directions and remaining limits

1. The window is an interface, not a capability

A sequence model can accept a long input and still fail to use information embedded within it. The maximum accepted token count describes an interface and a resource allocation. It does not specify the tasks that remain reliable at that length. A model may retrieve a conspicuous marker yet fail to combine two ordinary facts, or preserve average language-model loss while ignoring a rare decisive clause.

Position mechanisms are one part of this problem. They determine how ordering and distance can enter the computation, but they operate alongside learned content representations, attention normalization, training examples and decoding policy. This review separates those ingredients rather than assigning every long-context failure to positional embeddings. We analyze two simple controls: a rotated two-dimensional representation and an attention distribution with a linear distance penalty. Both can be evaluated beyond any chosen training window without a neural model. Their mathematical behavior exposes tradeoffs that a real extension method must manage. The controls do not predict a particular model's retrieval accuracy; they establish what must be measured before a context-window extension is described as successful.

2. What six primary records contribute

RoFormer introduces rotary position embedding, combining rotations with attention comparisons. ALiBi introduces a distance-proportional score bias and reports extrapolation experiments. Position Interpolation rescales indices for extending RoPE-based models, while YaRN studies another context-extension procedure. These records establish that position representation is an actionable design choice, not that any one rule guarantees arbitrary-length performance.

Lost in the Middle examines how moving relevant information within a context changes performance on selected retrieval and question-answering tasks. Exploring Length Generalization investigates extrapolation to longer reasoning instances and studies prompting and training choices. These two studies address use of context and task complexity rather than merely the numerical validity of a position representation. Our source review is limited to the inspected original metadata and abstracts. Historical benchmark claims remain claims about their original setups; we neither reproduce their measurements nor transfer their rankings to current systems. The mathematical examples below are authored controls designed to connect representation-level arguments with evaluation design. They explain why positional mechanisms and behavioral generalization deserve separate axes in a report.

Sources: [1], [2], [3], [4], [5], [6]

3. Four kinds of extrapolation

First, representational extrapolation asks whether the position function is defined at an unseen index. A sinusoid is defined for arbitrarily large real inputs, while a finite learned lookup table needs an extension rule. Second, distributional extrapolation asks whether the resulting features resemble combinations encountered during training. A function can be defined everywhere while producing unfamiliar phases or distances.

Third, attentional extrapolation concerns competition among many keys. Adding distractors changes a softmax denominator even if every individual query-key comparison remains numerically familiar. Fourth, algorithmic extrapolation asks whether the model can perform a longer computation, such as combining more constraints or following more steps. None follows automatically from another. A successful representation extension can leave attention competition unresolved; successful marker retrieval can leave multi-step reasoning unresolved. An evaluation should therefore name the target kind of extrapolation and avoid treating a single score as a universal measure. The distinction is operational: a regression test for accepted length catches a different failure than a test for correct use of a distant exception in a document.

4. A rotation has exact relative structure

Consider a unit vector rotated by angle omega times position. The inner product of vectors at positions i and j is cosine of omega times their difference. A common translation of both positions leaves this inner product unchanged. This exact relative property is useful because the pairwise comparison does not depend on the arbitrary origin of the sequence.

The property does not imply monotone distance awareness. Cosine is periodic, so distinct distances can produce identical or nearly identical comparisons. With several frequencies, the full vector of phases can distinguish many distances, but learned query and key content determines how those components are used. The construction here uses one frequency to expose periodicity plainly, not to model the full frequency spectrum of a deployed Transformer. Figure one plots similarities before and after index compression. At each distance, the values follow the stated cosine formula. The graph contains no training measurements and no estimate of retrieval success. Its role is to make the geometric consequence of rescaling visible without relying on an unexplained performance curve.

5. Compression buys range by changing resolution

Suppose positions are divided by a scale s greater than one. A previously unseen distance d is represented at phase omega d/s. This reduces phase excursion over a long interval. At the same time, neighboring positions become closer in representation space. For unit vectors separated by one position, their Euclidean distance becomes twice the absolute sine of omega divided by twice s.

Thus extending range by compression also changes local resolution. Whether that change matters depends on the tasks and on subsequent adaptation. A model identifying a broad document region may tolerate it; a model relying on precise order among neighboring delimiters may not. This is not an impossibility theorem for interpolation. Additional frequencies, learned content and fine-tuning can compensate. It is an accounting requirement: preserving the numerical interval of position inputs does not preserve every pairwise distinction at the old resolution. A useful experiment tests short-range order and long-range retrieval together, including tasks within the original window. Reporting only the newly supported maximum length can conceal degradation in ordinary short prompts.

6. Periodicity is not automatically a collision

A single frequency repeats exactly after a full turn. A vector containing multiple incommensurate frequencies need not repeat at the same integer distance. Practical representations use a finite set of frequencies and finite precision, so the relevant issue is approximate distinguishability under the learned comparison, not merely an exact symbolic period.

It is therefore too strong to infer that every periodic component creates a catastrophic ambiguity at its first cycle. Other components may distinguish the positions, and content can supply additional cues. The opposite inference is also unsafe: a mathematically unique phase vector does not guarantee that a trained network uses its differences reliably. One should examine the distance distribution of representations, their interaction with query-key projections, and performance on adversarially similar positions. An experimental collision threshold should be fixed before inspecting failures. Otherwise a researcher can retrospectively choose a tolerance that makes almost any case look explanatory. The controlled cosine graph is valuable precisely because its limited scope is explicit: it illustrates one component's resolution, not the entire model's positional identifiability.

7. Linear distance penalties induce a measurable horizon

Now remove content differences and assign a causal key at lag d a score of minus m times d, with m positive. Over lags zero through L-1, the normalized weight is proportional to exp(-md). This is a truncated geometric distribution. Its normalizer is a finite geometric sum, and the total probability within the most recent h positions has a closed form.

As L grows, the recent-h mass approaches one minus exp(-mh). A fixed positive slope therefore retains a finite recency scale in this content-neutral construction. Figure two shows the mass assigned to the most recent sixteen positions for several slopes and context lengths. It does not state that an actual biased attention head cannot access distant evidence. A sufficiently large content score can offset the distance penalty. The construction instead identifies the amount of content advantage needed to overcome a known prior. This creates a useful calibration task: compare the same relevant key at different lags while controlling the content score margin, rather than attributing all changes in retrieval to length itself.

8. Content must compete against the prior

If a distant relevant key has content advantage delta over a recent distractor and lies d positions farther away, its score advantage is delta-md in the linear-bias construction. Equal pairwise weight occurs when delta equals md. A growing distance therefore requires a growing content advantage under this simplified comparison.

Pairwise comparison is still insufficient when there are many distractors. Their combined probability can dominate even if no single distractor wins. If N distractors share the same lower score, the relevant key's normalized probability is one divided by one plus N times the exponential of the negative score margin. Maintaining a fixed probability then requires a margin that grows logarithmically with N. This is a separate mechanism from position representation. A context-extension study should vary distance and distractor count independently whenever possible. Otherwise an observed decline with context length cannot distinguish a distance prior from denominator competition. Real documents also change semantic density and redundancy with length, so synthetic controls should be supplemented with naturally structured tasks rather than promoted into a complete benchmark.

9. Moving evidence changes more than its index

Moving a sentence from the beginning to the middle of a document can alter local neighbors, discourse cues and the distance to the question. A naive position sweep may therefore confound index with content relationships. A careful intervention preserves surrounding context or explicitly measures the effect of changing it.

One design inserts the same evidence block into controlled gaps of a fixed distractor scaffold. Another keeps the evidence fixed and moves the question. A third duplicates neutral padding while holding the number of relevant facts constant. These designs answer different questions and should not be averaged without annotation. For natural documents, maintaining grammatical coherence may require edits, which themselves can change difficulty. The report should retain the actual prompts and distinguish controlled synthetic placement from coherent document relocation. A long-context claim becomes stronger when it survives both. It becomes weaker when success is restricted to a unique marker whose syntax makes it unlike ordinary evidence. The position mechanism may be unchanged across these tasks, yet the learned retrieval behavior can differ substantially.

10. Retrieval and composition require separate controls

A model that returns one hidden key has demonstrated a useful ability, but many research tasks require joining several facts or applying an exception. To isolate composition, place two individually retrievable facts at controlled locations and ask a question requiring both. Include separate questions about each fact to establish whether failure occurs before or after combination.

The same principle applies to contradictions. A later correction, an earlier definition and a local qualification can have different logical roles even when their token distances are identical. Evaluation should specify which source is authoritative rather than counting any mention of a fact as successful retrieval. A context window can contain the answer without containing enough evidence to justify it. Conversely, a model can answer correctly from parametric memory while ignoring the supplied document. Counterfactual documents help distinguish these possibilities, provided the task clearly instructs the model to reason from the supplied material. Such controls are proposed here; no behavioral accuracy claims are inferred from the geometric curves. The evidence needed for robust document reasoning is richer than a maximum-length passkey score.

11. Training exposure is a distribution, not a maximum

Two training corpora with the same longest sequence can provide very different exposure to distant dependencies. One may contain long independent paragraphs with mostly local prediction; another may repeatedly require resolving references across the full span. The maximum sequence length does not summarize the distribution of distances that carry useful supervision.

An extension experiment should record the frequency of long sequences, the placement of meaningful dependencies and the amount of additional training. It should also distinguish continuation pretraining from task-specific adaptation. Improvements after an extension procedure can arise from positional changes, additional data, changed optimization or all three. A clean comparison includes matched-data and matched-compute controls. When those controls are unaffordable, the limitation should be reported rather than hidden behind an architectural name. The same applies to context packing: concatenating unrelated documents may increase numerical length while resetting meaningful dependencies at boundaries. A model exposed to large indices is not necessarily trained to integrate a long coherent argument. This distinction helps explain why numerical validity and task reliability can diverge.

12. Cost accounting must include the served workload

Longer contexts change memory, prefill work, cache behavior and sometimes batching efficiency. A method can extend the accepted window while making the relevant workload impractical. Conversely, a representation change may be inexpensive compared with the cost of processing all additional tokens. The useful unit is a completed task under a declared latency and memory budget.

Measure prefill and generation separately, specify cache reuse, and report the distribution of prompt lengths rather than only the longest case. Repeated questions over one document may amortize some work; isolated requests may not. If a method truncates, summarizes or retrieves portions of the document, record that information path because it changes the task's available evidence. Cost comparisons should use the same output requirements and failure policy. A timeout counted as missing rather than incorrect can make an expensive model appear more accurate. None of the curves in this review estimates runtime or hardware throughput. They are dimensionless geometric and probability controls that should accompany, rather than replace, workload-level measurements.

13. A factorial evaluation protocol

A compact but discriminating study crosses context length, evidence location, distractor count and task type. Include single-fact retrieval, two-fact composition, contradiction resolution and short-range order. Preserve a short-context reference set to detect regressions within the original training range. Use several content templates and independent examples so that a memorable marker does not dominate the result.

For every condition, record accuracy, abstention, unsupported answers and resource use. Report uncertainty at the level of independently generated documents or tasks, not individual tokens from the same prompt. Keep decoding settings fixed or account for sampling variation separately. Inspect failure cases without adapting the final test set to the model. A useful release criterion is explicit: for example, a specified lower confidence bound on a particular task family at a particular length. Such a criterion is narrower and more actionable than saying the model supports a certain number of tokens. The protocol is prospective. The present work supplies mathematical checks and source synthesis, not an executed multi-model evaluation campaign.

14. What the program verifies

The standard-library companion computes rotation similarities and local separation under several scale factors. It verifies translation invariance of the two-dimensional inner product and checks the analytic separation formula against explicit rotated coordinates. It also compares finite summation of the distance-biased attention distribution with the geometric-series expression for recent-window mass.

Boundary tests include zero slope, where the distribution is uniform and the recent-h mass is h/L when h does not exceed L. They include h equal to L, where the mass is one, and increasing context length under positive slope, where the truncated distribution approaches its infinite-support limit. These checks validate the formulas and data used in the two figures. They do not evaluate RoFormer, ALiBi, Position Interpolation or YaRN implementations. They also do not establish a model's actual attention pattern, which depends on content and learned weights. A reader can reproduce the numerical controls without GPU access, while remaining clear about the larger experiment still required to support a deployment claim.

15. Interpreting improvements without overclaiming

A context-extension method can be valuable even if it does not solve every long-context task. The important question is which failure mode it improves and at what cost. A representation-level change may remove an immediate numerical obstacle; additional training may improve use of distant evidence; task-specific prompting may improve composition. A strong report separates these contributions.

The constructed examples suggest two diagnostic questions. How much local positional resolution changes when range is extended, and how strongly distance or distractor competition suppresses relevant evidence? Neither question alone explains a real model, but each identifies a measurable mechanism. Evidence should accumulate from exact controls to controlled learned tasks and then to representative documents. Skipping those levels risks interpreting a successful interface test as a reasoning result. It also makes regressions difficult to diagnose because acceptance length, attention behavior and task accuracy have been bundled into one label. Clear decomposition permits honest progress: an extension can be described as effective for a specific workload while its unresolved composition or cost limits remain visible.

16. Research directions and remaining limits

The most useful next step is a benchmark that links positional geometry to behavior without assuming that geometry is the only cause. Such a benchmark would preserve task semantics while varying distance, expose attention competition independently, and include evidence that the answer actually depends on the supplied context. It would publish short-window regressions alongside long-window gains.

Our analysis remains intentionally small. One rotation frequency does not represent a full positional spectrum, and content-neutral linear bias does not represent a trained head. The formulas establish tradeoffs in declared models, not universal limits on Transformers. Their contribution is a vocabulary for asking better questions and a set of executable controls for catching category errors. A larger context window should ultimately be judged by reliable completion of meaningful tasks under explicit budgets. That standard allows genuine improvements to be recognized without converting a numerical maximum into an unsupported claim about understanding, memory or reasoning over every document of that size.

Core equations and definitions

r(i)=(cos⁡(ωi),sin⁡(ωi))r(i)=(\cos(\omega i),\sin(\omega i))

(1) Unit rotation with dimensionless angular frequency.

r(i)Tr(j)=cos⁡(ω(i−j))r(i)^{\mathsf T}r(j)=\cos(\omega(i-j))

(2) Exact relative-position inner product.

∥r((i+1)/s)−r(i/s)∥2=2∣sin⁡(ω/(2s))∣\|r((i+1)/s)-r(i/s)\|_2=2|\sin(\omega/(2s))|

(3) Adjacent-position separation after compression s.

wd=e−md∑k=0L−1e−mkw_d=\frac{e^{-md}}{\sum_{k=0}^{L-1}e^{-mk}}

(4) Content-neutral causal linear distance bias.

Mh=1−e−mmin⁡(h,L)1−e−mL(m>0)M_h=\frac{1-e^{-m\min(h,L)}}{1-e^{-mL}}\quad(m>0)

(5) Recent-window mass; for m=0 use min(h,L)/L.

Constructed analytical figures

One-frequency author construction, omega=0.1 rad/position. Not a full RoPE spectrum or model retrieval accuracy.
Figure 1. One-frequency author construction, omega=0.1 rad/position. Not a full RoPE spectrum or model retrieval accuracy. Source data (CSV) · Figure specification
Content-neutral causal scores -m*d. All keys have equal content scores; learned content can offset the bias.
Figure 2. Content-neutral causal scores -m*d. All keys have equal content scores; learned content can offset the bias. Source data (CSV) · Figure specification

Comparison and reporting contract

ObjectWhat it establishesWhat it does not establish
Accepted lengthInput can be processedDistant evidence is used
Relative phaseA pairwise positional relationMonotone or behaviorally robust distance
Retrieval successOne fact can be accessedMulti-fact reasoning succeeds

Evaluation protocol

  • Cross length, location, distractor count and task type.
  • Include short-context regression tests.
  • Match training exposure and compute where possible.
  • Distinguish retrieval, composition and acceptance length.

Limitations

  • No learned-model behavior is measured.
  • One rotation frequency is an explanatory control.
  • Content-neutral bias omits learned score advantages.

Open research questions

  • How can positional resolution predict specific behavioral failures?
  • Which dependency distributions matter more than maximum training length?
  • How should task reliability be certified under a context budget?

Evidence and its boundaries

Introduces rotary position embedding.
[1] — Original arXiv bibliographic record and abstract inspected on 2026-10-28; full proof and source experiments not independently audited. Inspected: Primary arXiv abstract and bibliographic record.
Introduces distance-proportional attention bias and studies extrapolation.
[2] — Original arXiv bibliographic record and abstract inspected on 2026-10-28; full proof and source experiments not independently audited. Inspected: Primary arXiv abstract and bibliographic record.
Studies index interpolation for extending RoPE-based models.
[3] — Original arXiv bibliographic record and abstract inspected on 2026-10-28; full proof and source experiments not independently audited. Inspected: Primary arXiv abstract and bibliographic record.
Studies a context-extension method and adaptation efficiency.
[4] — Original arXiv bibliographic record and abstract inspected on 2026-10-28; full proof and source experiments not independently audited. Inspected: Primary arXiv abstract and bibliographic record.
Shows task performance can depend strongly on relevant-information position.
[5] — Original arXiv bibliographic record and abstract inspected on 2026-10-28; full proof and source experiments not independently audited. Inspected: Primary arXiv abstract and bibliographic record.
Studies longer reasoning instances and length-generalization failures.
[6] — Original arXiv bibliographic record and abstract inspected on 2026-10-28; full proof and source experiments not independently audited. Inspected: Primary arXiv abstract and bibliographic record.

References

  1. RoFormer: Enhanced Transformer with Rotary Position Embedding
    Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, Yunfeng Liu. arXiv primary author manuscript (2021). https://arxiv.org/abs/2104.09864
    Source scope

    Original arXiv bibliographic record and abstract inspected on 2026-10-28; full proof and source experiments not independently audited.

  2. Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation
    Ofir Press, Noah A. Smith, Mike Lewis. arXiv primary author manuscript (2021). https://arxiv.org/abs/2108.12409
    Source scope

    Original arXiv bibliographic record and abstract inspected on 2026-10-28; full proof and source experiments not independently audited.

  3. Extending Context Window of Large Language Models via Positional Interpolation
    Shouyuan Chen, Sherman Wong, Liangjian Chen, Yuandong Tian. arXiv primary author manuscript (2023). https://arxiv.org/abs/2306.15595
    Source scope

    Original arXiv bibliographic record and abstract inspected on 2026-10-28; full proof and source experiments not independently audited.

  4. YaRN: Efficient Context Window Extension of Large Language Models
    Bowen Peng, Jeffrey Quesnelle, Honglu Fan, Enrico Shippole. arXiv primary author manuscript (2023). https://arxiv.org/abs/2309.00071
    Source scope

    Original arXiv bibliographic record and abstract inspected on 2026-10-28; full proof and source experiments not independently audited.

  5. Lost in the Middle: How Language Models Use Long Contexts
    Nelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, Percy Liang. arXiv primary author manuscript (2023). https://arxiv.org/abs/2307.03172
    Source scope

    Original arXiv bibliographic record and abstract inspected on 2026-10-28; full proof and source experiments not independently audited.

  6. Exploring Length Generalization in Large Language Models
    Cem Anil, Yuhuai Wu, Anders Andreassen, Aitor Lewkowycz, Vedant Misra, Vinay Ramasesh, Ambrose Slone, Guy Gur-Ari, Ethan Dyer, Behnam Neyshabur. arXiv primary author manuscript (2022). https://arxiv.org/abs/2207.04901
    Source scope

    Original arXiv bibliographic record and abstract inspected on 2026-10-28; full proof and source experiments not independently audited.

Commissioned research review · v1. Cite this review · Original source record · Publication record