ArXiv: 2409.12181

🎯 Pitch

Fine-tuning with exact attention—not fancy approximations—is what really makes long-context LLMs work, and perplexity remains the single best predictor of downstream performance. The popular shortcut methods that avoid full attention systematically fail on real tasks.


1. Executive Summary

This paper conducts a controlled empirical study analyzing how different context extension methods perform when standardized to a common base model (LLaMA2-7B), training data, and evaluation protocol, extending the context window from 4k to 32k tokens. The work compares three classes of methods—exact attention with fine-tuning (e.g., Dynamic NTK-RoPE, YaRN, Position Interpolation), exact attention without fine-tuning applied to frozen models (e.g., NTK-aware scaling applied at inference), and approximate attention (e.g., LM-Infinite sliding window, LongLoRA sparse attention, Landmark retrieval-based attention)—across intrinsic metrics (perplexity on PG19 and Proof-pile, Needle-in-a-Haystack retrieval) and extrinsic benchmarks (LongBench, RULER, Many-shot ICL). The central finding is that continual fine-tuning with exact attention methods, particularly Dynamic NTK-RoPE, consistently outperform approximate attention approaches, with NTK-32K achieving 83.7% on Needle-in-a-Haystack and 35.32 average on LongBench versus 23.9%/25.84 for LM-Infinite and 20.3%/23.30 for LongLoRA, while also successfully extrapolating beyond the fine-tuned context length—establishing that approximate methods systematically trade accuracy for efficiency and that extrapolation to unseen lengths remains viable only when fine-tuning is combined with exact position embedding adjustments like Dynamic NTK.

2. Context and Motivation

The Core Problem: We Don't Know Which Context Extension Method Actually Works Best

The fundamental problem this paper addresses is deceptively straightforward: given that most LLMs today are pretrained with a modest context window (e.g., 4k tokens), and training models from scratch with longer contexts is prohibitively expensive, how should we extend them to handle longer sequences—and which method should we trust? The field has produced a proliferation of techniques for context extension, but because every paper evaluates its proposed method under different conditions (different base models, different training data, different hyperparameters, different benchmarks), there is no reliable way to compare them or understand their relative merits.

The authors frame this explicitly in the introduction:

"owing to differences in data and model classes, it has been challenging to compare these approaches, leading to uncertainty as to how to evaluate long-context performance and whether it differs from standard evaluation."

This is not merely an academic concern about benchmark hygiene. It means that practitioners choosing a context extension method for a production system are making decisions based on incomparable numbers—a method that looks superior on paper may simply have been evaluated on an easier base model or with more carefully tuned hyperparameters. The field lacks a controlled, apples-to-apples comparison that isolates the effect of the extension method itself from all confounding variables.

Why This Matters: The Centrality of Long Context to Modern LLM Use Cases

Long-context windows are not a niche feature—they are increasingly central to how LLMs are deployed in practice. The paper catalogs several application domains that demand extensive textual understanding (Section 1):

  • Information synthesis from textbooks and long documents (Tanzer et al., 2024): translating a new language from a single grammar book requires the model to hold and cross-reference information across hundreds of pages.
  • Summarization of book-length content (Kryściński et al., 2022): novels and long reports exceed standard context windows by orders of magnitude.
  • Many-shot in-context learning (Bertsch et al., 2024; Li et al., 2023a): as the number of in-context examples grows from tens to hundreds to thousands, the prompt length scales proportionally, and the quality of long-context modeling directly determines how much the model can benefit from additional examples.
  • Multi-document question answering and retrieval: tasks like comparing information across multiple lengthy reports, legal documents, or scientific papers require models that can attend over tens of thousands of tokens without degradation.

The practical importance of long contexts is reflected in the industry's trajectory: open models are now pretrained on up to 15T tokens (AI@Meta, 2024), and context windows have expanded from the original 512–1024 tokens of early Transformers to 32k, 128k, and beyond in production systems. Yet the implementation challenges of training models natively at these lengths—quadratic attention complexity, memory constraints, distributed training complexity—mean that most models are still pretrained at modest context lengths and then extended post-hoc. Understanding which extension method to use is therefore a decision that affects nearly every LLM deployment.

The Implementation Wall: Why We Can't Just Train Longer

The paper is grounded in the practical reality that directly training models with long context windows is difficult, not merely expensive (Section 1). The challenges include:

  • Quadratic attention complexity: the computational and memory cost of self-attention scales as O(C2)O(C^2) where CC is the sequence length. Doubling the context window quadruples the attention cost.
  • Distributed training complexity: approaches like Ring Attention (Liu et al., 2023a) can distribute long sequences across devices, but they introduce communication overhead and implementation complexity that make them inaccessible to many research groups.
  • Data availability: while web-scale text is abundant, genuinely long documents (books, comprehensive reports) form a small fraction of most pretraining corpora, and upsampling them can distort the training distribution.

These constraints create a natural trade-off: pretrain at manageable context lengths (4k–8k tokens), then extend. The extension step is where the methodological diversity—and the confusion—arises.

The Proliferation of Incomparable Results

The state of the field before this paper can be characterized by three axes of methodological variation, each of which makes direct comparison impossible.

Axis 1: Different base models. Prior work evaluates methods on different foundation models. For instance, the authors note that LM-Infinite (Han et al., 2023) has been evaluated on different base models in different papers (Xiao et al., 2024; Lu et al., 2024), making it impossible to determine whether performance differences are due to the extension method or the underlying model's capabilities. A method that looks strong on a well-pretrained 13B model might underperform on a weaker 7B model—or vice versa—and without controlling for the base checkpoint, no conclusion about the method itself is valid.

Axis 2: Different training data and recipes. Context extension methods that involve fine-tuning (Position Interpolation, NTK-aware scaling with training, YaRN, LongLoRA, CLEX) each use different training data mixtures, different numbers of tokens, different learning rate schedules, and different sequence length curricula. A method fine-tuned on 5B tokens of carefully curated long documents will naturally outperform one fine-tuned on 500M tokens of generic web text, regardless of the underlying algorithmic differences. Without standardizing the training data and recipe, the comparison is meaningless.

Axis 3: Different evaluation benchmarks and metrics. The field has generated a fragmented evaluation landscape. Some papers report only perplexity on long-document corpora like PG19 (Rae et al., 2019). Others report retrieval accuracy on synthetic tasks like Needle-in-a-Haystack (gkamradt, 2023) or passkey retrieval (Mohtashami and Jaggi, 2023). Still others use comprehensive benchmarks like LongBench (Bai et al., 2023), LEval (An et al., 2023), or LooGLE (Li et al., 2023c). And some papers introduce their own custom evaluations. The result is that different methods are measured against different yardsticks, with no way to map between them.

This fragmentation is not merely inconvenient—it can be actively misleading. The paper demonstrates this concretely: LM-Infinite achieves a good perplexity score at 32k but fails catastrophically on retrieval tasks that require attending beyond its local window (Figure 1). A practitioner who only looked at perplexity would be deceived into thinking LM-Infinite was performing well, when in fact it cannot access information outside its sliding window. This is a direct consequence of evaluating methods on metrics that don't capture the dimensions of long-context behavior that matter for downstream applications.

Conflicting Claims About Perplexity and Downstream Performance

Adding to the confusion is an active debate about whether perplexity—the workhorse intrinsic metric for language modeling—is actually informative for long-context evaluation. Several existing studies (Sun et al., 2021; An et al., 2023) have suggested that perplexity may not consistently correlate with performance on long-range tasks. If true, this would mean that the most computationally cheap and widely reported metric is unreliable for comparing methods, forcing practitioners to run expensive full-benchmark evaluations for every candidate method.

The paper engages with this debate directly (Section 6), hypothesizing that the reported disconnection between perplexity and downstream performance may be an artifact of the very lack of controlled comparison that the paper aims to fix—different studies using different base models, training data, and evaluation sets, introducing noise that obscures the underlying relationship.

The Taxonomy of Approaches and Their Unclear Trade-offs

The field has developed at least three distinct families of context extension methods, each with different computational profiles and design philosophies, but their relative strengths and weaknesses are poorly characterized.

Exact fine-tuned attention methods (Section 3.2) modify the position embedding mechanism—typically RoPE (Su et al., 2021)—to extend the effective context length, then fine-tune the model on long-context data. The key idea is that the model's positional embeddings, which were trained only on positions 0 through C1C-1 (e.g., 0–4095), need to be adjusted so that positions beyond CC (e.g., 4096–32767) map to representations the model can interpret. Different methods propose different scaling strategies: Position Interpolation (PI) linearly compresses all positions so CC' positions fit into the original CC range (Chen et al., 2023a); NTK-aware scaling (bloc97, 2023; emozilla, 2023) applies dimension-dependent scaling that preserves high-frequency features while extending low-frequency ones, based on insights from the Neural Tangent Kernel literature; YaRN (Peng et al., 2023) combines NTK-aware scaling with a temperature adjustment to the attention distribution; CLEX (Chen et al., 2024) models the scaling dynamically as a function of target length. These methods all require fine-tuning, which adds computational cost but produces models that compute exact attention over the full extended context. Their relative merits are unknown because no prior study has trained them on identical data with identical hyperparameters.

Approximate attention methods (Section 3.3) take a fundamentally different approach: rather than adjusting how positions are encoded, they modify the attention mechanism itself to avoid computing the full O(C2)O(C'^2) attention matrix. The approaches are diverse:

  • Sparse attention (LongLoRA; Chen et al., 2023b) computes attention only within blocks of the sequence, with blocks shifted across heads to allow some cross-block information flow, and uses LoRA (Hu et al., 2021) for parameter-efficient fine-tuning. Notably, LongLoRA uses sparse attention during training but reverts to full attention at inference.
  • Retrieval-based attention (Landmark Attention; Mohtashami and Jaggi, 2023) breaks the sequence into chunks, creates trainable "landmark" summary tokens for each chunk, performs global attention between query tokens and landmarks to identify relevant chunks, then computes local attention within the selected chunks.
  • Sliding window + global memory (LM-Infinite; Han et al., 2023; related to StreamLLM; Xiao et al., 2023) retains only a small local window of recent tokens plus a fixed set of initial "attention sink" tokens, discarding all intermediate context. The positional encoding is capped so that distances beyond the pretraining length are mapped back into the trained range.
  • Grouped position mapping (Self-Extend; Jin et al., 2024) maps unseen long-range positions to within the pretraining range by grouping distant tokens and applying floor division to their positions.

These methods promise computational efficiency—reducing attention complexity from O(C2)O(C'^2) to O(C(M+G))O(C'(M+G)) or similar—but their accuracy trade-offs are unclear. Some can be applied to frozen models (LM-Infinite, Self-Extend), while others require fine-tuning (LongLoRA, Landmark Attention). The paper's controlled study is designed to determine whether the efficiency gains come at an unacceptable cost to task performance.

Frozen exact methods occupy an intermediate position: they apply position embedding adjustments (like NTK-aware scaling) at inference time without any fine-tuning. The appeal is zero training cost, but these methods inevitably produce out-of-distribution position embeddings that the model never encountered during pretraining, raising questions about their robustness. The paper includes NTK-Frozen as a representative of this class.

Where Prior Work Falls Short: A Gap in Systematic Comparison

The central gap this paper identifies is not the absence of methods—there are many—but the absence of a controlled framework for comparing them. Every prior study introduces one method and evaluates it under its own conditions, making the literature a collection of incomparable case studies rather than a cumulative body of knowledge. This manifests in several specific ways:

  • No fixed base model: LM-Infinite was evaluated on LLaMA variants in some papers and on different models in others. A method's apparent success may be as much about the base model's inherent long-context capability (which varies significantly across model families and sizes) as about the extension technique itself.
  • No standardized training data: Methods that use fine-tuning each use different corpora at different scales. A method trained on more or better data will appear superior regardless of algorithmic quality.
  • No fixed hyperparameter protocol: Different learning rates, warmup schedules, EMA decay rates, and scale factors can produce dramatically different results from the same underlying algorithm. Without standardization, hyperparameter tuning effort becomes a hidden confound.
  • No unified evaluation: The proliferation of benchmarks and metrics means no two papers report the same numbers, making direct comparison impossible and leaving practitioners to guess which numbers are comparable.
  • No distinction between in-distribution extension and out-of-distribution extrapolation: Some methods are evaluated only at their fine-tuned length, while others are tested on longer sequences, but the boundary between these two regimes is often blurred in reporting.

How This Paper Positions Itself

The paper explicitly positions itself as filling the controlled comparison gap (Section 4, "Long-Context Extension Protocol"). Rather than proposing a new method, it constructs a standardized experimental framework and uses it to answer three concrete questions that the field has been debating without resolution:

  1. Does perplexity actually correlate with downstream task performance in long-context settings? The paper hypothesizes that the reported disconnection is an artifact of uncontrolled comparisons and that, under standardized conditions, a strong correlation will emerge for exact attention methods (Section 6, Figure 4).

  2. Do approximate attention methods genuinely compete with exact attention, or do they systematically underperform? The paper hypothesizes that the efficiency-accuracy trade-off is real and significant, with approximate methods showing degraded performance particularly on tasks that require accessing information across the full context (e.g., retrieval from arbitrary positions).

  3. Can any method successfully extrapolate beyond its fine-tuning context length? The paper tests whether models fine-tuned on 32k sequences can perform at 64k, and whether frozen methods can handle any extension at all beyond their pretraining length.

The standardization is achieved through a deliberate set of design choices (Section 4):

  • Fixed base model: All methods start from an identical LLaMA2-7B checkpoint (Touvron et al., 2023), with Phi-2-base (Javaheripi et al., 2023) used as a secondary validation to check whether findings generalize across model families.
  • Fixed fine-tuning data: All methods that require training use the same 1B tokens sampled from a long-context data mixture from Fu et al. (2024), constructed from SlimPajama (Soboleva et al., 2023) with per-source length upsampling.
  • Fixed training protocol: A single training recipe is applied across all methods, using the hyperparameters from Fu et al. (2024) (learning rate 2×1052 \times 10^{-5}, linear warmup, zero weight decay, EMA with constant decay), with the explicit acknowledgment that this may disadvantage methods that are sensitive to hyperparameter choices—a deliberate trade-off for comparability.
  • Unified evaluation suite: All methods are evaluated on the same set of intrinsic metrics (perplexity on PG19 and Proof-pile, Needle-in-a-Haystack, RULER) and extrinsic benchmarks (LongBench, many-shot ICL on TREC News), at the same context lengths (2k through 64k), with the same evaluation protocols.

The paper draws a direct parallel to the role of controlled studies in other fields: just as medical research requires randomized controlled trials to separate treatment effects from confounds, context extension research requires standardized comparisons to separate algorithmic contributions from implementation details. The contribution is not a new algorithm but a reliable empirical map of the existing algorithmic landscape, enabling practitioners and researchers to make informed decisions based on comparable evidence.

The Unresolved Tensions the Paper Engages

Beyond the methodological gap, the paper engages with several substantive debates that have divided the community:

The perplexity debate. Some researchers argue that perplexity is fundamentally the wrong metric for long contexts because it rewards models that learn local statistical patterns without capturing long-range dependencies. Others maintain that it remains the most reliable single indicator of language modeling quality at any scale. The paper provides empirical evidence to resolve this debate under controlled conditions.

The efficiency-accuracy trade-off. Approximate attention methods are motivated by genuine computational constraints—running exact attention over 32k tokens is expensive, and over 128k or 1M tokens it becomes prohibitive. But are the approximations "good enough" for real tasks? The paper's systematic comparison shows that they often are not, but this conclusion itself raises follow-up questions about whether better approximate attention schemes could close the gap.

The frozen vs. fine-tuned debate. If frozen methods (like LM-Infinite or NTK-Frozen) can extend context without any training cost, they offer an appealing path to democratizing long-context LLMs. The paper tests whether these methods actually work in practice, finding that they generally do not—but the result is important for directing research effort away from dead ends and toward more promising approaches.

The extrapolation frontier. The holy grail of context extension is a model that can handle sequences arbitrarily longer than its training context—true length generalization. The paper tests whether any existing method achieves this, finding that only Dynamic NTK-RoPE with fine-tuning shows meaningful extrapolation from 32k to 64k, and even then with degraded performance. This establishes a clear boundary for current capabilities and a target for future research.

By addressing these tensions through controlled experimentation rather than through yet another method proposal, the paper aims to provide the field with a shared empirical foundation on which future algorithmic work can build—much as the Chinchilla scaling laws (Hoffmann et al., 2022) provided a shared foundation for pretraining compute allocation by systematically isolating the effects of model size and data quantity.

3. Technical Approach

3.1 Reader orientation (approachable technical breakdown)

This paper is a controlled empirical comparison study, not a new method proposal. The "system" being studied is a standardized evaluation protocol where multiple context extension techniques are implemented within a shared software framework, trained on identical data, and tested on identical benchmarks so that their performance differences can be attributed to the methods themselves rather than to confounding variables like base model quality or training data scale. The problem this solves is the field's inability to compare context extension methods head-to-head—every prior paper evaluated its own method under its own conditions, making the literature a collection of incomparable results rather than a cumulative body of knowledge. The "shape" of the solution is a fixed experimental pipeline: start from the same base model checkpoint for every method, apply each extension technique using a standardized recipe, evaluate on a unified suite of intrinsic and extrinsic metrics at multiple context lengths, and report all results transparently so that relative strengths and weaknesses can be observed directly.

3.2 Big-picture architecture (diagram in words)

The experimental pipeline has four major components, applied uniformly to every method under comparison:

  1. Base model checkpoint — LLaMA2-7B (Touvron et al., 2023), pretrained with a 4k-token context window using Rotary Position Embeddings (RoPE). Every extension method starts from this identical set of weights, removing base model quality as a confounding variable. A secondary set of experiments uses Phi-2-base (Javaheripi et al., 2023) to test generalization of findings across model families.

  2. Extension method — one of three classes: exact attention with fine-tuning (Position Interpolation, NTK-Dynamic at 32k and 64k, YaRN, CLEX), exact attention without fine-tuning applied to frozen models (NTK-Frozen, Self-Extend), or approximate attention (LM-Infinite frozen, LongLoRA fine-tuned, Landmark Attention fine-tuned). Each method modifies either the position embedding mechanism (how token positions are encoded), the attention computation itself (which tokens attend to which), or both.

  3. Standardized fine-tuning procedure (applied only to methods that require training) — 1B tokens sampled from a long-context data mixture (Fu et al., 2024) based on SlimPajama, processed with per-source length upsampling, packed into chunks of the target training length, trained with a fixed recipe: learning rate 2×1052 \times 10^{-5}, linear warmup, zero weight decay, exponential moving average of weights with constant decay, 8 NVIDIA A100 GPUs. The recipe is held constant across all methods to prevent hyperparameter tuning from becoming a hidden confound.

  4. Unified evaluation suite — three intrinsic metrics (perplexity on PG19 and Proof-pile using sliding window of size 256; Needle-in-a-Haystack retrieval at depths 0% through 100% and lengths 1k through 64k; RULER with 13 subtasks across four categories) and two extrinsic benchmarks (LongBench with 16 subtasks spanning single-document QA, multi-document QA, summarization, few-shot learning, code completion, and synthetic tasks; many-shot in-context learning on TREC News with 1 to 1000 examples). All evaluations are conducted at context lengths 2k, 4k, 8k, 16k, 32k, and where methods support it, 64k.

Information flows as follows: the base LLaMA2-7B checkpoint is loaded → the extension method's modifications are applied (either to the position embedding parameters, the attention computation, or both) → for methods requiring fine-tuning, the model is trained on the standardized 1B-token dataset → the resulting model is evaluated on all metrics at all supported context lengths → results are tabulated and compared across methods with explicit notation of which methods use exact versus approximate attention and which are frozen versus fine-tuned.

3.3 Roadmap for the deep dive

  • First, the attention mechanism and RoPE foundational concepts, because every context extension method either modifies or works around these components. Understanding what standard attention does and how RoPE encodes positions is prerequisite to understanding why extension is difficult and how each method addresses the difficulty.

  • Second, the exact attention extension methods (RoPE frequency scaling), because these are the most principled approaches and the ones that perform best in the controlled comparison. We will walk through Position Interpolation, NTK-aware scaling, Dynamic NTK, YaRN, and CLEX, explaining the scaling strategy each uses, the mathematical justification, and the key differences between them.

  • Third, the approximate attention methods, because these represent a fundamentally different design philosophy—modifying which tokens attend to which rather than how positions are encoded. We will cover LongLoRA (sparse block-diagonal attention), Landmark Attention (retrieval-based two-stage attention), LM-Infinite (sliding window with global memory), and Self-Extend (grouped position mapping), explaining the attention pattern each produces and its computational cost relative to exact attention.

  • Fourth, the standardized fine-tuning protocol, because it is the methodological innovation that makes the comparison meaningful. We will detail exactly what data is used, how it is constructed, what hyperparameters are fixed across methods, and what design choices were made to maximize comparability while acknowledging limitations.

  • Fifth, the evaluation suite design, because the choice of metrics determines what conclusions can be drawn. We will explain each benchmark—its task structure, what capability it probes, its length characteristics, and why the combination of intrinsic and extrinsic metrics provides complementary information.

3.4 Detailed, sentence-based technical breakdown

This is a controlled experimental comparison paper whose core idea is that by holding the base model, training data, training recipe, and evaluation protocol constant across context extension methods, the resulting performance differences can be confidently attributed to the extension techniques themselves rather than to confounding factors.


Foundational Background: Standard Attention and Rotary Position Embeddings (RoPE)

The computational bottleneck in long-context Transformer modeling is the self-attention mechanism. Understanding why context extension is necessary—and why it is difficult—requires understanding what attention computes and how positional information is injected.

Standard scaled dot-product attention. Given a sequence of CC input embeddings X=[x1,x2,,xC]RC×dX = [x_1, x_2, \ldots, x_C]^\top \in \mathbb{R}^{C \times d} where dd is the model's hidden dimension, three learned weight matrices project each embedding into query, key, and value spaces:

Q=XWq,K=XWk,V=XWvQ = X W_q, \quad K = X W_k, \quad V = X W_v

where WqRd×dkW_q \in \mathbb{R}^{d \times d_k}, WkRd×dkW_k \in \mathbb{R}^{d \times d_k}, and WvRd×dkW_v \in \mathbb{R}^{d \times d_k} are learned projection matrices, and dkd_k is the projected dimension (typically dk=d/hd_k = d / h where hh is the number of attention heads). The attention mechanism then computes:

Attention(Q,K,V)=softmax(QKdk)V\text{Attention}(Q, K, V) = \text{softmax}\left(\frac{Q K^\top}{\sqrt{d_k}}\right) V

where QKRC×CQ K^\top \in \mathbb{R}^{C \times C} is the attention score matrix—each entry (m,n)(m, n) represents how much token at position mm should attend to token at position nn—and the softmax is applied row-wise to produce a valid probability distribution over attended-to positions. The scaling factor 1/dk1/\sqrt{d_k} prevents the dot products from growing too large as dkd_k increases, which would push the softmax into regions of extremely low gradient.

What it computes: for each query position mm, a weighted sum of value vectors from all positions 11 through CC, where the weights are the softmax-normalized dot products between the query at mm and the keys at all positions. The output is a matrix of the same shape as VV, representing contextually enriched representations.

Why this form: the dot-product attention mechanism allows every position to attend to every other position in O(1)O(1) sequential operations (unlike recurrent architectures which require O(C)O(C) sequential steps), enabling parallel computation during training. The quadratic O(C2)O(C^2) memory and computation cost is the price paid for this parallelism, and it is the root cause of the long-context modeling challenge—it makes processing sequences longer than a few thousand tokens expensive, and sequences longer than tens of thousands of tokens infeasible without modification.

The missing ingredient: positional information. A critical limitation of the standard attention formulation is that it is permutation-invariant: shuffling the order of the input tokens produces exactly the same attention output (with the values shuffled correspondingly), because the dot product qmknq_m^\top k_n depends only on the token embeddings xmx_m and xnx_n, not on their positions mm and nn. For language, position matters enormously—"dog bites man" and "man bites dog" have the same words but opposite meanings. Transformers must therefore inject positional information into the computation somehow.

Rotary Position Embeddings (RoPE). RoPE (Su et al., 2021, 2024) is the dominant position encoding scheme in modern open-weight LLMs, including the LLaMA family. Rather than adding position vectors to token embeddings (as in absolute position encodings) or adding relative position biases to attention scores (as in T5-style relative position encodings), RoPE rotates the query and key vectors by an angle proportional to their position, encoding relative position information directly into the dot product.

Formally, RoPE defines a transformation fWf_W that applies a position-dependent rotation to projected token embeddings:

fW(xi,θ)=R(θ,i)Wxif_W(x_i, \theta) = R(\theta, i) W^\top x_i

where xiRdkx_i \in \mathbb{R}^{d_k} is the embedding for position ii, WW is a projection matrix (either WqW_q or WkW_k), and θRdk/2\theta \in \mathbb{R}^{d_k/2} is a frequency basis that controls how rapidly each dimension rotates with position. The rotation matrix R(θ,i)R(\theta, i) is a block-diagonal matrix of 2×22 \times 2 rotation blocks:

\begin{pmatrix} \cos i\theta_1 & -\sin i\theta_1 & \cdots & 0 & 0 \\ \sin i\theta_1 & \cos i\theta_1 & \cdots & 0 & 0 \\ \vdots & \vdots & \ddots & \vdots & \vdots \\ 0 & 0 & \cdots & \cos i\theta_{d_k/2} & -\sin i\theta_{d_k/2} \\ 0 & 0 & \cdots & \sin i\theta_{d_k/2} & \cos i\theta_{d_k/2} \end{pmatrix}$$ > **What this means in plain language:** for each pair of dimensions $(2j-1, 2j)$ in the projected embedding, RoPE rotates the 2D vector formed by those two dimensions by an angle of $i \theta_j$. The angle is the product of the position index $i$ and a frequency $\theta_j$. Higher frequencies (larger $\theta_j$) produce faster rotation with position; lower frequencies (smaller $\theta_j$) produce slower rotation. The frequency basis is set to $\theta_j = b^{-2j/d_k}$ with base $b = 10000$, meaning dimensions with small $j$ rotate slowly (capturing long-range positional relationships) and dimensions with large $j$ rotate quickly (capturing short-range positional relationships). The crucial property that makes RoPE useful is how query-key dot products behave under this rotation. For query at position $m$ and key at position $n$, the dot product becomes: $$q_m^\top k_n = f_{W_q}(x_m, \theta)^\top f_{W_k}(x_n, \theta) = x_m^\top W_q R(\theta, n-m) W_k^\top x_n$$ where $R(\theta, n-m) = R(\theta, m)^\top R(\theta, n)$ by Ptolemy's identity for rotation matrices. The critical observation is that the dot product depends on the **relative position** $n-m$ rather than the absolute positions $m$ and $n$ individually. This is what makes RoPE a relative position encoding: the attention score between two tokens is a function of their content (via $x_m$ and $x_n$) and their relative distance (via the rotation matrix $R$), but not their absolute positions. > **Why this form for position encoding:** relative position encodings have been shown to generalize better to unseen sequence lengths than absolute position encodings because the model learns to attend based on distance rather than memorizing position-specific patterns. RoPE achieves this with a particularly elegant mathematical property—the rotation representation—that also has numerical stability advantages and can be implemented efficiently by interleaving dimensions and applying trigonometric functions. For context extension, the key implication is that RoPE's generalization depends on whether the model has seen all relevant values of $n-m$ during training. If the model was trained on sequences of up to 4k tokens, it has only seen relative positions $|n-m| \leq 4095$. For longer sequences, it encounters relative positions it has never seen, and the learned functions of those relative positions may be poorly behaved. This is the problem that all RoPE scaling methods address. --- #### Exact Attention Extension Methods: Scaling RoPE Frequencies When a model pretrained with context length $C$ needs to handle length $C' \gg C$, the RoPE mechanism encounters an out-of-distribution problem: the rotation angles for positions $i > C$ produce values of $\cos(i\theta_j)$ and $\sin(i\theta_j)$ that the model never observed during training, because $i$ itself was never seen (for absolute rotations) and relative distances $|n-m| > C$ were never seen. The model's learned mappings from these rotation angles to attention behaviors may not generalize, causing perplexity to explode (see LLaMA2 in Table 2: perplexity at 2k is 6.61 but the model cannot even process 8k without modification because the attention pattern breaks down). All exact attention extension methods address this problem by **scaling the RoPE frequencies** so that positions $0$ through $C'-1$ produce rotation angles within the range the model was trained on. The general form is: $$f_W(x_i) = f(x_i, \alpha \odot \theta)$$ where $\alpha \in \mathbb{R}^{d_k/2}$ is a dimension-wise scaling vector applied to the frequency basis $\theta$, and $\odot$ denotes element-wise multiplication. Each method defines $\alpha$ differently, but all share the same intuition: slow down the rotations so that the full extended length $C'$ "fits" into the angular range originally spanned by length $C$. **Position Interpolation (PI).** PI (Chen et al., 2023a) applies the simplest possible scaling: divide all frequencies uniformly by the extension ratio. Let the target length ratio be $t = C' / C$. Then: $$\alpha_j^{\text{PI}} = \frac{C}{C'} = \frac{1}{t}$$ for all dimensions $j = 1, \ldots, d_k/2$. > **What this computes:** every RoPE frequency is divided by the same factor $t$. If the original context was 4k and the target is 32k, then $t = 8$ and every frequency becomes $1/8$ of its original value. This means a token at position $i = 32000$ in the extended model experiences the same rotation angles as a token at position $i = 4000$ in the original model would have experienced. > > **Why this works:** the model's attention patterns were learned as functions of the rotation angles produced by RoPE. By mapping the extended positions into the same angular range as the training positions, PI ensures the model never encounters an out-of-distribution rotation angle. The model has already learned what attention pattern to produce for every rotation angle in the training range; PI arranges for extended positions to produce those same angles. The cost is that positional resolution is reduced—positions that were distinct in the original encoding (e.g., 4000 and 4001) are now compressed into a smaller angular difference, potentially making it harder for the model to distinguish nearby tokens. > > **Why this specific scaling factor:** the factor $1/t$ is chosen so that the maximum position $C'-1$ maps exactly to the original maximum position $C-1$ after scaling. This is the minimal compression necessary to fit the extended range. A larger scaling factor (compressing more) would unnecessarily sacrifice resolution; a smaller scaling factor (compressing less) would leave some extended positions mapping outside the training range, defeating the purpose. PI has been integrated into several production models including LLaMA2-7B-32K (Together.AI, 2023), Vicuna-7B-v1.5 (Chiang et al., 2023), and LongAlpaca (Chen et al., 2023b). **Neural Tangent Kernel-aware RoPE (NTK-RoPE).** NTK-RoPE (bloc97, 2023) improves on PI by recognizing that not all RoPE dimensions are equally important for long-range versus short-range modeling, and that compressing all dimensions uniformly sacrifices information that could be preserved. The method is motivated by findings from the Neural Tangent Kernel literature showing that MLPs struggle to learn high-frequency features—that is, features that vary rapidly with input changes. In the RoPE context, "high-frequency" dimensions are those with large $\theta_j$ values, which rotate quickly with position and are important for distinguishing nearby tokens (precise local structure). "Low-frequency" dimensions rotate slowly and are important for modeling long-range dependencies. The key insight is that high-frequency dimensions cannot be compressed much without losing the ability to distinguish adjacent positions, but low-frequency dimensions can be compressed substantially because their original angular range was more than needed for the training length. NTK-RoPE implements dimension-dependent scaling: $$\alpha_j^{\text{NTK-RoPE}} = \kappa^{-2j/d_k}$$ where $\kappa = (t)^{d_k/(d_k-2)}$ is chosen so that the lowest-frequency dimension ($j = 0$, approximately) is scaled by $1/t$ (matching PI at that extreme) and the highest-frequency dimension ($j = d_k/2 - 1$, approximately) is scaled by approximately $1$ (preserving the original frequency). > **What this computes:** each dimension $j$ receives its own scaling factor. Low-$j$ dimensions (slow frequencies) are scaled similarly to PI—substantially compressed to accommodate the extended length. High-$j$ dimensions (fast frequencies) are barely scaled at all—they continue to rotate at nearly their original rates, preserving the model's ability to distinguish nearby positions. The intermediate dimensions receive intermediate scaling, producing a smooth transition between the two extremes. > > **Why this specific form for $\kappa$:** the value of $\kappa$ is derived by requiring that the scaling factor for the lowest-frequency dimension ($j$ near 0, where $-2j/d_k \approx 0$, so $\alpha_j \approx \kappa^0 = 1$—wait, this appears contradictory; let me re-examine the derivation). Actually, the derivation works as follows: the lowest frequency $\theta_{\text{min}} = b^{-2(d_k/2 - 1)/d_k} \approx b^{-1}$ and the highest frequency $\theta_{\text{max}} = b^0 = 1$. NTK-RoPE replaces the base $b$ with a scaled base $\tilde{b} = b \cdot \kappa$, so that $\tilde{\theta}_j = \tilde{b}^{-2j/d_k} = (b\kappa)^{-2j/d_k} = b^{-2j/d_k} \cdot \kappa^{-2j/d_k} = \theta_j \cdot \kappa^{-2j/d_k}$. The scaling factor for dimension $j$ is therefore $\kappa^{-2j/d_k}$. The value $\kappa = t^{d_k/(d_k-2)}$ is chosen so that the lowest frequency after scaling matches the PI-scaled lowest frequency. For $j$ near $d_k/2$, the exponent $-2j/d_k \approx -1$, so $\alpha_j \approx \kappa^{-1} = t^{-d_k/(d_k-2)} \approx 1/t$ for large $d_k$, matching PI at the low-frequency extreme. For $j=0$, $\alpha_0 = 1$, preserving the highest frequency entirely. The intermediate dimensions transition smoothly. > > **Why this approach over uniform PI:** the model's ability to distinguish adjacent tokens depends on having sufficiently different rotation angles for positions $i$ and $i+1$. After PI scaling by $1/t$, the angular difference between adjacent positions is reduced by a factor of $t$, potentially making them indistinguishable. NTK-RoPE avoids this problem for the high-frequency dimensions that matter most for local structure, while still extending the range of the low-frequency dimensions that matter for long-range dependencies. This is a more efficient use of the model's representational capacity—it preserves precision where precision matters and sacrifices it only where there is excess capacity. **Dynamic NTK-RoPE.** An extension proposed by emozilla (2023) and refined by Fu et al. (2024) observes that the optimal scaling factor depends on the actual sequence length being processed, which varies across examples during inference. Rather than fixing a single scaling factor based on the maximum expected length, Dynamic NTK adjusts the scaling on-the-fly based on the current sequence length $C_{\text{test}}$: $$\alpha_j^{\text{Dynamic NTK}} = \left(s \cdot \frac{\max(C', C_{\text{test}})}{C} - (s - 1)\right)^{-2j/d_k}$$ where $s$ is a hyperparameter (set to $C' / (2C)$ in this paper's experiments, following Fu et al., 2024) and $C'$ is the maximum context length seen during fine-tuning. > **What this computes:** instead of a fixed base scaling factor, Dynamic NTK uses an effective length ratio that depends on the current input length $C_{\text{test}}$. When processing a short sequence (e.g., 4k tokens), the effective ratio is close to 1, meaning the frequencies are barely modified and the model operates near its pretraining regime—this avoids the degradation on short sequences that fixed scaling can cause (which the paper observes and addresses with grid search, as described in Section 4 and Appendix 9.5). When processing a very long sequence (e.g., 32k tokens), the effective ratio grows, compressing the frequencies to accommodate the extended range. The hyperparameter $s$ controls the aggressiveness of the scaling: larger $s$ means more frequency compression for any given $C_{\text{test}}$. > > **Why dynamic over static:** static scaling forces a trade-off: the scaling factor must be large enough to handle the longest expected sequence, which degrades performance on shorter sequences because the positions are unnecessarily compressed. Dynamic scaling resolves this by adapting to each input, providing the best of both worlds—minimal modification for short inputs, sufficient extension for long inputs. The paper demonstrates this empirically through the grid search in Appendix 9.5 (Table 9), which shows that different scale factors are optimal for different input lengths, and that dynamic selection recovers performance across the range. **YaRN (Yet another RoPE extensioN).** YaRN (Peng et al., 2023) combines two innovations: a "NTK-by-parts" interpolation strategy that applies different scaling to different frequency bands based on their wavelength, and a temperature factor that adjusts the sharpness of the attention distribution for long inputs. The per-dimension scaling factor is: $$\alpha_j^{\text{YaRN}} = \frac{1}{\sqrt{T}} \left( (1 - \gamma_j) \frac{1}{t} + \gamma_j \right)$$ where $T$ is a temperature parameter (tuned as needed, reducing the overall attention logit magnitudes to prevent the softmax from becoming too peaked on long sequences where more tokens compete for attention mass), and $\gamma_j \in [0, 1]$ is a ramp function that determines how much each dimension interpolates between PI scaling ($1/t$) and no scaling ($1$): $$\gamma_j = \begin{cases} 0, & \text{if } \theta_j < p \\ 1, & \text{if } \theta_j > q \\ \frac{\theta_j - p}{q - p}, & \text{otherwise} \end{cases}$$ where $p$ and $q$ are wavelength thresholds (hyperparameters). Dimensions with very high frequencies (small wavelengths $\ll$ context length, meaning they oscillate many times within the training context) receive $\gamma_j = 1$ and are not scaled—they already have sufficient resolution and compressing them would hurt local discrimination. Dimensions with very low frequencies (large wavelengths $>$ context length, meaning they complete fewer than one full cycle within the training context) receive $\gamma_j = 0$ and are fully scaled by $1/t$—they have excess representational capacity and can safely accommodate the extended range. Dimensions in between are linearly interpolated. > **What this computes:** each RoPE frequency is scaled by a factor that is a weighted combination of the PI factor $1/t$ and the identity factor $1$, with the weight $\gamma_j$ determined by whether the dimension's wavelength falls below, within, or above the interval $[p, q]$. The result is then multiplied by $1/\sqrt{T}$ to globally reduce attention logit magnitudes, preventing the softmax from becoming overly concentrated (almost one-hot) on long sequences where many tokens compete for finite attention probability mass. > > **Why "NTK-by-parts" over smooth NTK scaling:** the smooth NTK scaling curve (exponential function of $j$) treats all dimensions along a continuum, but the authors argue there are qualitatively different regimes: dimensions whose wavelength is much shorter than the context length (they fully capture local structure and should not be compressed), dimensions whose wavelength is much longer (they are underutilized at the training length and can be compressed freely), and a transition region. The ramp function with thresholds $p$ and $q$ makes this tripartite distinction explicit and tunable. The temperature adjustment via $T$ addresses a separate problem: on very long sequences, the softmax over many positions can become extremely peaked (near-deterministic) because a few positions dominate the dot products, reducing the model's ability to integrate information from multiple sources. Scaling all attention logits down by $\sqrt{T}$ flattens the distribution, encouraging broader attention. > > **Why this form with hyperparameters $p, q, T$:** the authors acknowledge that the optimal thresholds and temperature depend on the specific model, training data, and target extension length, and provide these as tunable knobs. The paper uses the original scale factor as described in the YaRN paper but notes in Section 4 that "this base factor significantly degrades continual fine-tuned models, particularly causing performance deterioration in shorter sequences," necessitating grid search and improvement upon Fu et al. (2024)'s settings for the NTK method—implying that YaRN's hyperparameters are sensitive and not universally optimal without tuning. **CLEX (Continuous Length Extrapolation).** CLEX (Chen et al., 2024) takes a different approach: rather than using a fixed scaling formula, it models the frequency scaling vector as a function of the target length, learned during fine-tuning. The scaling vector $\alpha$ is produced by a small neural network (trained jointly with the language model) that takes the target context length as input and outputs dimension-wise scaling factors. The paper specifies that CLEX uses "the max scale factor to 32 and the SiLU activation function" (Section 4). The max scale factor of 32 means the network can produce scaling factors up to 32 for individual frequency dimensions (corresponding to a maximum extension of $32\times$ the pretraining length, though in practice the effective extension is determined by the learned function). SiLU (Sigmoid Linear Unit, also known as Swish) is the activation function $f(x) = x \cdot \sigma(x)$ where $\sigma$ is the sigmoid, providing smooth gradients and non-monotonic behavior that can help the network learn complex scaling patterns. > **What this computes:** instead of a formulaic scaling vector, CLEX learns a mapping $\alpha = g(C_{\text{target}}; \phi)$ where $g$ is a small neural network with parameters $\phi$ that are trained during the fine-tuning phase. The network outputs a $d_k/2$-dimensional vector of scaling factors given the desired target context length. The model can therefore learn to produce different scaling patterns for different target lengths, potentially generalizing beyond the lengths seen during fine-tuning. > > **Why a learned approach:** the formulaic methods (PI, NTK, YaRN) make assumptions about how frequencies should be scaled—uniformly, exponentially by dimension, or by wavelength thresholds. A learned approach can discover the optimal scaling pattern from data, potentially outperforming hand-designed heuristics. The risk is that the learned function may not generalize well to lengths far outside its training distribution, but the continuous nature of the function (it takes a real-valued length and outputs a vector) provides an inductive bias toward smooth extrapolation. The paper tests one frozen exact method in addition to these fine-tuned methods: **NTK-Frozen** applies NTK-aware scaling (the same dimension-dependent scaling as NTK-RoPE) at inference time without any fine-tuning. The scaling factors are computed based on the target length $C_{\text{test}}$ using the same formula, but the model weights are never updated. This tests whether the position embedding adjustment alone, without adapting the model's attention patterns through training, is sufficient for context extension. The results in Table 1, Figure 1, and Table 2 show that it is not: NTK-Frozen achieves 14.52 perplexity at 32k (versus 5.79 for NTK-32K fine-tuned), 18.8% on Needle-in-a-Haystack (versus 83.7%), and 0.72 average on RULER (versus 59.42), demonstrating that while the frequency scaling prevents catastrophic failure, the model's attention patterns trained at 4k do not seamlessly generalize to the rescaled positions without further training. --- #### Approximate Attention Methods: Modifying the Attention Pattern Rather than modifying how positions are encoded (RoPE scaling), approximate attention methods modify **which tokens attend to which**—that is, they change the structure of the attention matrix $A$ to avoid computing all $O(C'^2)$ pairwise dot products. This reduces computational cost and memory usage but introduces an information bottleneck: tokens can only attend to a subset of other tokens, potentially losing access to relevant context. **LongLoRA (sparse shifted block attention).** LongLoRA (Chen et al., 2023b) replaces full attention with block-diagonal attention during the fine-tuning phase, then uses standard full attention during inference. Given a sequence of length $C'$, LongLoRA divides it into $M$ blocks of size $B$ (so $M \cdot B = C'$). The training-time attention matrix has a block-diagonal structure: $$A = \begin{pmatrix} A_1 & 0 & \cdots & 0 \\ 0 & A_2 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & A_M \end{pmatrix}$$ where each $A_i \in \mathbb{R}^{B \times B}$ is a full self-attention matrix computed within block $i$. Blocks do not attend to each other, so the cost is reduced from $O(C'^2)$ to $O(M \cdot B^2) = O(C' \cdot B)$. When $B \ll C'$, this is a substantial reduction. > **What this computes:** tokens in block 1 only attend to other tokens in block 1, tokens in block 2 only attend to block 2, and so on. There is no cross-block information flow through attention. The model processes each contiguous chunk of $B$ tokens independently, learning local patterns but unable to integrate information across chunks. > > **Why shifted blocks:** to allow some cross-block information flow, LongLoRA shifts the block boundaries for half of the attention heads. For unshifted heads, the blocks are partitions of the sequence into contiguous $B$-token segments. For shifted heads, the blocks are offset by $B/2$ so that each token appears in a different block context. Since different heads process the same sequence with different block assignments, information can flow between chunks indirectly—a token in one block of an unshifted head may attend to a token that appears in a different block of a shifted head, and the multi-head output aggregation mixes these perspectives. > > **Why sparse during training but full during inference:** this is the crucial design choice that makes LongLoRA an "approximate attention" method despite using full attention at test time. The training phase uses sparse attention with LoRA (Low-Rank Adaptation; Hu et al., 2021) for parameter-efficient fine-tuning, where only small low-rank adapter matrices are trained rather than full model weights. The LoRA adapters, combined with trainable embedding and normalization layers, learn to handle long contexts under the sparse attention constraint. At inference, these adapted weights are merged back into the base model, and full attention is computed. The hypothesis is that the model learns useful long-context representations during sparse training that transfer to full-attention inference. The paper finds this does not work well: LongLoRA achieves 9.89 perplexity at 32k (worse than all exact methods), 20.3% on Needle-in-a-Haystack (versus 83.7% for NTK-32K), and 3.53 on RULER (versus 59.42), suggesting that the sparse training signal is insufficient to teach the model to utilize long-range dependencies effectively. **Landmark Attention (retrieval-based two-stage attention).** Landmark Attention (Mohtashami and Jaggi, 2023) addresses long sequences by compressing chunks into learned summary tokens ("landmarks"), using these landmarks to identify which chunks are relevant, and then computing fine-grained attention only within selected chunks. The sequence of $C'$ embeddings is divided into $M$ chunks of size $B$. Each chunk is summarized by a trainable landmark vector $\ell_i \in \mathbb{R}^{d_k}$, producing a landmark matrix $L = [\ell_1, \ell_2, \ldots, \ell_M]^\top \in \mathbb{R}^{M \times d_k}$. The attention process has two stages: **Stage 1—Global retrieval:** all query vectors $Q \in \mathbb{R}^{C' \times d_k}$ attend to all landmark vectors $L$ to compute a global relevance score for each chunk: $$A_1 = \text{softmax}\left(\frac{Q L^\top}{\sqrt{d_k}}\right) \in \mathbb{R}^{C' \times M}$$ For each query token, the $n$ chunks with the highest global attention scores are selected for fine-grained attention. **Stage 2—Local attention within selected chunks:** for each selected chunk, the query tokens within that chunk attend to the key tokens within that chunk: $$A_{2,i} = \text{softmax}\left(\frac{Q_i K_i^\top}{\sqrt{d_k}}\right) \in \mathbb{R}^{B \times B}$$ The final attention output for each token is a combination of the global and local attention—essentially, the model retrieves relevant chunks using the landmark summary tokens, then reads the selected chunks in detail. > **What this computes:** instead of computing a $C' \times C'$ attention matrix, Landmark Attention computes a $C' \times M$ retrieval matrix (mapping all tokens to chunk summaries) and then $n$ separate $B \times B$ local attention matrices (one per selected chunk). The total cost is $O(C' \cdot M + n \cdot B^2) = O(C' \cdot (C'/B) + n \cdot B^2)$, which for $B \ll C'$ and $n \ll M$ is much smaller than $O(C'^2)$. > > **Why landmarks:** the landmark vectors act as compressed representations of chunks, similar to how a document retrieval system uses query-document similarity to select which documents to read carefully. By learning these landmarks during fine-tuning, the model can develop chunk representations that are predictive of which chunks contain information relevant to any given query token. This is an information-theoretic bottleneck: if the landmark vectors cannot adequately summarize chunk content, the retrieval stage will miss relevant chunks and the model will lose access to information. The paper's results show this limitation: Landmark Attention achieves 50.9% on Needle-in-a-Haystack but only 28.19 on LongBench average and 13.56 on RULER at 32k, indicating significant information loss compared to exact attention methods. > > **Why a two-stage approach:** direct $O(C'^2)$ attention becomes infeasible as $C'$ grows. The two-stage approach decouples the expensive full comparison from the sequence length—the retrieval stage is $O(C' \cdot M)$ which is linear in $C'$ for fixed chunk size $B$, and the local attention is $O(B^2)$ per chunk, independent of $C'$. This makes the method theoretically scalable to arbitrarily long sequences, but the paper's empirical results demonstrate that the scalability comes at a substantial accuracy cost. **LM-Infinite (sliding window with global memory and capped positions).** LM-Infinite (Han et al., 2023), closely related to StreamLLM (Xiao et al., 2023), takes the most aggressive approach to reducing attention cost: it discards all tokens except a small local window of recent tokens and a fixed set of initial "attention sink" tokens. Given $C'$ embeddings, LM-Infinite computes attention over only $M + G$ key-value pairs: $M$ tokens in a local sliding window (the most recent $M$ positions) and $G$ global memory tokens (the first $G$ positions of the sequence, which serve as "attention sinks" that absorb excess attention probability and help stabilize the softmax). All intermediate tokens—everything between position $G$ and position $C' - M$—are completely discarded and cannot be attended to. Additionally, LM-Infinite modifies the positional encoding to prevent out-of-distribution relative positions. Rather than using the true relative position $n - m$, it caps the distance to the pretraining context length: $$\text{pos}(m, n) = \min(n - m, C)$$ where $C$ is the original pretraining context length. This ensures that even when tokens are far apart, the RoPE rotation uses an angle the model has seen during training. > **What this computes:** attention is restricted to a fixed-size window of $M + G$ tokens regardless of total sequence length. The model can attend to the very beginning of the sequence (the global memory) and the very recent past (the local window), but has zero access to anything in between. The positional distance used for RoPE is clamped to at most $C$, preventing the model from encountering unseen large relative positions. > > **Why this approach:** the intuition is that language has a strong recency bias—the most relevant context for predicting the next token is typically the immediately preceding text—and that the beginning of a document often contains important framing information. By keeping only these two regions, LM-Infinite achieves $O(C' \cdot (M+G))$ complexity, which is linear in $C'$ for fixed window sizes. For the paper's default configuration ($M = 4096$, $G = 10$), the attention cost is essentially the same as the original 4k model regardless of how long the sequence grows. The cost is catastrophic loss of information: any content between the beginning and the local window is invisible. > > **Why the position capping:** without capping, tokens at the end of a long sequence would have relative positions up to tens of thousands, producing RoPE rotations unseen during training. The capping maps all large relative positions to the maximum training-relative position $C$, effectively compressing the entire long-range distance spectrum into a single value. This prevents perplexity explosion but makes the model unable to distinguish between different long-range distances—a token 5000 positions away and a token 50000 positions away produce the same positional encoding. > > **Empirical consequences:** the paper's results reveal the severe limitations. LM-Infinite achieves a respectable perplexity of 6.71 at 32k (Table 2), because language modeling relies heavily on local context and most tokens can be predicted from the preceding 4k tokens. But on Needle-in-a-Haystack (Figure 1), LM-Infinite can only retrieve the needle when it falls within the local window—when the needle is placed early or in the middle of the document (beyond the 4k local window), retrieval fails completely (the heatmap is green only at the very bottom, corresponding to the local window region). On LongBench (Table 4), LM-Infinite averages 25.84, substantially below the base LLaMA2's 32.92 and far below NTK-32K's 35.32, because many LongBench tasks require synthesizing information from across the document, not just from the most recent passage. **Self-Extend (grouped position mapping for frozen models).** Self-Extend (Jin et al., 2024) is designed for frozen models—no fine-tuning required. It addresses the out-of-distribution position problem by mapping unseen long-range relative positions to within the pretraining range through a grouping mechanism. The method maintains a local window of $M$ positions within which standard relative position encoding is used. Beyond $M$, positions are divided into groups of size $N$, and all positions within a group are assigned the same mapped relative position. For a relative distance $d = n - m$: $$r = \begin{cases} d, & \text{if } d \leq M \\ M + \left\lfloor \frac{d - M}{N} \right\rfloor, & \text{if } d > M \end{cases}$$ where $\lfloor \cdot \rfloor$ denotes floor division. The mapped relative position $r$ is then used in the RoPE rotation instead of the true relative distance $d$. > **What this computes:** nearby tokens (within distance $M$) use their true relative positions, so local attention resolution is preserved at full fidelity. Beyond $M$, tokens are grouped—every group of $N$ consecutive positions maps to the same relative position value. The mapping is $M + 0$ for distances $M$ through $M+N-1$, $M+1$ for distances $M+N$ through $M+2N-1$, and so on. The maximum context length supported is $(C - M) \cdot N + M$, where $C$ is the pretraining context length. With the paper's settings ($M = 1024$, $N = 64$, $C = 4096$), the maximum extended length is $(4096 - 1024) \cdot 64 + 1024 = 197632$ tokens. > > **Why this grouping:** unlike LM-Infinite which completely discards intermediate tokens, Self-Extend preserves access to all tokens—the attention pattern is still dense (every token can attend to every other token), but the positional encoding is quantized beyond the local window. The grouping assumes that for long-range dependencies, precise position information is less important than coarse ordering—a token 5000 positions away and a token 5063 positions away are both "far" and the model treats them similarly positionally. The floor division by $N$ provides a logarithmic-like compression: the effective positional resolution decreases with distance, similar to how humans perceive time (recent events are distinguished by minutes, events months ago are distinguished by weeks or months). > > **Why a frozen approach:** Self-Extend can be applied to any pretrained RoPE model without fine-tuning, making it immediately deployable. The results show this comes at a cost: on RULER, Self-Extend achieves 29.50 average at 32k (versus 59.42 for NTK-32K), and on Needle-in-a-Haystack the heatmap in Figure 1 shows patchy retrieval with notable failures, particularly when the needle is deep (far from the beginning and not in the very recent window). The performance is better than LM-Infinite but substantially worse than fine-tuned exact methods, confirming that position mapping alone cannot fully substitute for training the model to use the mapped positions. --- #### The Standardized Fine-Tuning Protocol The methodological core of the paper is not any individual extension technique but the **controlled experimental framework** that enables fair comparison. The fine-tuning protocol is designed to eliminate all sources of variation except the extension method itself. **Base model unification.** Every method starts from the identical LLaMA2-7B checkpoint (Touvron et al., 2023), which was pretrained with a 4k context window using RoPE with base frequency $b = 10000$. The model has 7 billion parameters, 32 transformer layers, 32 attention heads, and a hidden dimension of 4096. This fixed starting point ensures that differences in final performance are due to the extension method and training procedure, not differences in pretrained capabilities. To test whether findings generalize across model families, the paper also replicates key experiments with Phi-2-base (Javaheripi et al., 2023), a 2.7B parameter model with a 2k context window. The Phi-2 results are reported in Appendix 9.1 and show "consistent with our observations in the original submission" patterns—exact fine-tuned methods (particularly NTK) outperform approximate and frozen approaches, and only NTK generalizes beyond the fine-tuned length. **Training data.** The paper uses 1 billion tokens sampled from a long-context data mixture following Fu et al. (2024). The source corpus is SlimPajama (Soboleva et al., 2023), an open-source replication of the LLaMA pretraining data mixture comprising 82% web data (67% CommonCrawl, 15% C4), 4.5% code (GitHub), 4.5% Wikipedia, 4.5% books, 2.5% Arxiv papers, and 2.0% StackExchange. The key processing step is **per-source length upsampling**: within each data source, longer documents are sampled with higher probability to increase the proportion of long sequences in the training mixture while preserving the overall domain distribution. The sampled data is packed into chunks of the training context length (32k for most methods, 64k for NTK-64K) without regard to document boundaries, following standard practice (Touvron et al., 2023; Fu et al., 2024). This means a single training example may span multiple documents with no separator, which is known to be effective for long-context training because it forces the model to learn to ignore spurious cross-document dependencies while utilizing genuine within-document structure. > **Why 1B tokens:** this is the budget the authors could afford given computational constraints (8 NVIDIA A100 GPUs). The paper acknowledges this limitation explicitly (Section 7) and notes that "longer models require more tokens for effective training"—the NTK-64K model initially underperforms NTK-32K on 1B tokens, but shows significant improvement when trained on 2B tokens (Appendix 9.4, Figure 5). The 1B token budget is therefore a pragmatic choice that enables broad comparison at the cost of potentially undertraining methods that converge more slowly. **Fixed training recipe.** The training hyperparameters are held constant across all methods that require fine-tuning, following the protocol of Fu et al. (2024) with modifications noted in the paper: - **Learning rate:** $2 \times 10^{-5}$, with linear warmup (the paper does not specify the warmup duration explicitly, but it follows Fu et al., 2024) - **Weight decay:** 0 (no regularization on weights beyond what the optimization dynamics provide) - **Exponential moving average (EMA):** applied to model weights with a constant decay rate (the specific decay rate is not stated in the paper but follows Chen et al., 2023b) - **Hardware:** 8 NVIDIA A100 GPUs (total batch size is not explicitly stated, but the per-GPU batch size is documented for each method in Table 7) - **Batch size:** 32 across all methods (Table 7), meaning 4 per GPU with 8 GPUs - **Sequence length:** 32k for most methods, 64k for NTK-64K (Table 7) The paper explicitly acknowledges that this fixed recipe may disadvantage methods that are sensitive to hyperparameter choices: "We also acknowledge that the standardized training recipe with fixed hyperparameters may bias some models more than the other models" (Section 7). This is a deliberate trade-off: comparability is prioritized over individually optimal tuning for each method. **Method-specific adjustments.** While the overall training recipe is fixed, certain methods require additional implementation choices that the paper documents: - **LongLoRA:** uses LoRA adapters with trainable embedding and normalization layers. The LoRA weights are merged with the base model for evaluation. The paper validates its LongLoRA implementation by reproducing the original Llama-2-7b-longlora-32k model using LongLoRA's published training data and recipe, achieving comparable perplexity (Table 10): 7.32 vs. 7.22 at 32k on PG19, and 2.61 vs. 2.50 on Proof-pile. - **Landmark Attention:** training context length is set to 512 with a block size of 64. This means during training, the model processes short sequences (512 tokens) partitioned into 8 blocks, learning the landmark representations and retrieval mechanism at a small scale that must generalize to 32k at inference. - **CLEX:** max scale factor set to 32 (meaning the learned scaling network can produce scaling factors up to 32 for individual frequency dimensions), SiLU activation function used in the scaling network. - **NTK methods:** the scale factor requires special treatment because the original formula degrades performance on shorter sequences after fine-tuning. The paper conducts a grid search over scale factors for different input lengths (documented in Appendix 9.5, Table 9) and follows and improves upon Fu et al. (2024) to set the scale factor to $C' / (2C)$ during both training and inference. Table 8 documents the specific scale factors used at each evaluation length: for NTK-32K, the factor is 29.0 for lengths 4k through 32k, and 61.0 at 64k; for NTK-64K, the factor is uniformly 57.0 across all lengths. The relationship between scale factor and perplexity is explored in Table 9, which shows that higher scale factors generally increase perplexity at shorter lengths while enabling lower perplexity at longer lengths, creating a trade-off that the dynamic selection resolves. - **YaRN:** the paper uses the original scale factor (8.0, corresponding to $t = 8$ for 4k→32k extension) but notes that this "significantly degrades" performance on short sequences, implying YaRN's hyperparameters ($p$, $q$, $T$) may need adjustment for optimal results—but the paper does not perform this adjustment, keeping the standardized protocol. - **PI:** uses a scale factor of 8.0 uniformly (Table 8), corresponding to the 8× extension from 4k to 32k. **Inference configurations.** For methods that require inference-time modifications, the paper documents specific settings: - **LM-Infinite:** global memory $G = 10$ (the first 10 tokens of the sequence are always retained) and local window $M = 4096$ (matching the original context length). This configuration means the model attends to at most 4106 tokens regardless of total sequence length. - **Landmark Attention:** maintains the training settings of context length 512 and block size 64 at inference, meaning the retrieval operates on 64-token chunks summarized by learned landmarks. - **Self-Extend:** local window $M = 1024$ (positions within 1024 use true relative positions) and group size $N = 64$ (positions beyond 1024 are grouped in blocks of 64 with shared mapped position). These values determine the maximum extended length of $(4096 - 1024) \times 64 + 1024 = 197,632$ tokens. - **Dynamic NTK:** at inference, the effective scale factor is computed using the formula with $s = C' / (2C)$ and $C_{\text{test}}$ set to the current input length. Table 8 documents the resulting effective factors: 29.0 for NTK-32K at lengths up to 32k, and 61.0 at 64k (the jump reflects the formula when $C_{\text{test}} > C'$, i.e., extrapolation beyond training length). --- #### The Unified Evaluation Suite The evaluation protocol measures both intrinsic language modeling quality and extrinsic task performance, at multiple context lengths, to create a comprehensive profile of each method's capabilities. **Perplexity evaluation.** Perplexity is computed on two long-document corpora: - **PG19** (Rae et al., 2019): a collection of books published before 1919, representing long-form narrative text with coherent long-range structure. The paper uses a sliding window approach (window size 256) following Press et al. (2022), meaning perplexity at each position is computed using a context window of the 256 most recent tokens, and these windowed perplexities are averaged. The sliding window ensures that the perplexity measurement reflects the model's language modeling quality at the evaluation length without conflating it with memory constraints. - **Proof-pile** (Azerbayev et al., 2023): a corpus of mathematical proofs, representing structured technical text with different long-range dependency patterns than narrative text. The use of both PG19 and Proof-pile tests whether perplexity trends are consistent across domains. Evaluation lengths are 2k, 4k, 8k, 16k, 32k, and 64k (where the method supports it—PI, YaRN, LongLoRA, and Landmark are only evaluated up to their training length of 32k, while NTK and CLEX are evaluated at 64k). The LLaMA2 base model serves as the baseline at 2k and 4k (its pretraining length) and cannot be evaluated beyond 4k without modification. **Needle-in-a-Haystack (NIAH).** This retrieval task (gkamradt, 2023) embeds a specific piece of information (the "needle"—a sentence stating "The magic number is [X]" where X is a random value) at a designated depth within a long "haystack" document (typically filler text about a generic topic). The model must read the entire document and answer a question that requires retrieving the needle (e.g., "What is the magic number?"). The evaluation sweeps over: - **Document lengths:** 1k, 8k, 16k, 32k, and 64k tokens - **Needle depths:** from 0% (beginning of document) to 100% (end of document) - **Scoring:** a retrieval is considered successful if the model's answer contains the correct magic number; each (length, depth) combination is tested, producing a heatmap where green indicates high success rate and white indicates failure. The white dashed line in the heatmaps (Figure 1) marks the longest length seen during fine-tuning, visually separating in-distribution extension (within the training context length) from extrapolation (beyond it). This task directly tests whether the model can access information from arbitrary positions in long documents—a capability that approximate attention methods with limited windows fundamentally lack. **RULER.** RULER (Hsieh et al., 2024) extends the NIAH concept with greater variety and difficulty. It includes 13 subtasks across four categories: - **Needle-in-a-Haystack variants:** single needle (NIAH_S1, S2, S3), multi-needle with 2, 4, or 6 keys (NIAH_M1, M2, M3), multi-value (NIAH_MV) where multiple needles share keys, and multi-query (NIAH_MQ) where multiple questions target different needles. - **Variable Tracking (VT):** a multi-hop tracing task where the model must follow a chain of variable assignments (e.g., "x = 5; y = x + 3; z = y * 2; What is z?") through a long document, testing sequential reasoning over long contexts. - **Common/Frequent Word Extraction (CWE/FWE):** the model must extract words that appear with specific frequency patterns from a long document, testing aggregation abilities. - **Question Answering (QA_1, QA_2):** standard reading comprehension questions embedded in long contexts. Each model is evaluated with 500 examples per subtask at lengths 4k, 8k, 16k, 32k, and 64k. The scores are averaged across all 13 tasks to produce a single aggregate RULER score for each length (Table 3). The breakdown by subtask is provided in Appendix 9.8 (Tables 12–16), revealing that the aggregate trends are consistent across task types—exact fine-tuned methods dominate, approximate methods degrade severely with length, and frozen methods fail beyond minimal extension. **LongBench.** LongBench (Bai et al., 2023) is a comprehensive bilingual benchmark for long-context understanding, comprising 16 subtasks grouped into six categories: - **Single-document QA:** NarrativeQA (NQA, avg. length 18,409 tokens), Qasper (QAPR, 3,619), MultiFieldQA (MFQA, 4,559) - **Multi-document QA:** HotpotQA (HPQA, 9,151), 2WikiMultihopQA (WMQA, 4,887), MuSiQue (MSQ, 11,214) - **Summarization:** GovReport (GR, 8,734), QMSum (QMSM, 10,614), MultiNews (MNWS, 2,113) - **Few-shot learning:** TREC (TRE, 5,177), TriviaQA (TRVQA, 8,209), SAMSum (SMSM, 6,258) - **Code completion:** LCC (1,235), RepoBench-P (REPO, 4,206) - **Synthetic tasks:** PassageCount (PSC, 11,141), PassageRetrieval (PSR, 9,289) The average length across all LongBench tasks is approximately 7,425 tokens—substantially shorter than the 32k context window. This is a critical observation that the paper uses to explain why LongBench scores do not show dramatic improvements from context extension: "the average length of LongBench test data (approximately 7.5k) being considerably shorter than the 32k context window of the long-context methods" means most tasks do not stress the extended context, so the benefits of extension are not fully realized. Instead, LongBench serves as a check that context extension does not catastrophically degrade performance on moderate-length tasks that the base model already handles reasonably well. When tasks exceed the designated evaluation context window (32k), the prompt is truncated from the middle following Bai et al. (2023)—the beginning and end are preserved, and the excess content is removed from the center. This truncation strategy is based on the "lost in the middle" phenomenon (Liu et al., 2023b) where models tend to best utilize information at the beginning and end of their context, so preserving these regions while discarding the middle is the least harmful truncation approach. **Many-shot in-context learning.** The TREC News dataset (Li and Roth, 2002; Kontonis et al., 2024) is used to evaluate many-shot ICL: the model is given 1 to 1000 labeled examples as context, followed by a test question, and must classify the question into one of six news categories. The evaluation sweeps over the number of in-context examples (1, 5, 10, 25, 50, 75, 100, 200, 300, 400, 500, 625, 750, 875, 1000) and measures classification accuracy. As the number of examples grows, the prompt length increases proportionally, making this a natural test of whether the model can effectively utilize very long contexts for in-context learning. With 1000 examples, the prompt length exceeds 32k tokens for typical example lengths, stressing the model's full extended context. **Correlation analysis.** Section 6 (Figure 4) plots perplexity against downstream task performance (Needle-in-a-Haystack, LongBench, and RULER averages) for each method. The linear fits show strong correlations for exact attention methods, supporting the paper's claim that "perplexity as a general-purpose performance indicator even in longer-context tasks." Approximate attention methods show some deviation from the trend (LongLoRA and Landmark on RULER), but "still roughly fit into the linear relationship." The paper hypothesizes that previous studies reporting poor perplexity-task correlation were affected by uncontrolled comparisons and noisy data, and that under controlled conditions the correlation re-emerges. --- #### Summary of Design Choices and Their Justifications - **LLaMA2-7B as base model over other options:** LLaMA2 is the most widely used open-weight model family for context extension research, making results comparable to the largest body of prior work. The 7B size balances capability (sufficient to show meaningful variation across methods) with computational feasibility (8 A100 GPUs can fine-tune it at 32k context). The use of Phi-2-base as a secondary validation tests generalization across model families without requiring full replication of all experiments. - **1B token fine-tuning budget over larger budgets:** computational constraints. The paper acknowledges that "longer models require more tokens for effective training" and demonstrates this with the NTK-64K 1B vs. 2B comparison. The fixed budget enables broad comparison at the cost of potentially undertraining some methods. This is a deliberate trade-off for comparability. - **Per-source length upsampling over uniform sampling:** ensures that the training data contains sufficient long sequences for the model to learn long-range dependencies, while preserving the domain mixture of the original pretraining data. Without upsampling, long documents (which are rare in web corpora) would be underrepresented, and the model would receive insufficient signal for long-context modeling. - **Fixed hyperparameter recipe over per-method tuning:** comparability is prioritized over individually optimal performance. The paper explicitly acknowledges this limitation and notes that methods sensitive to hyperparameters (particularly LongLoRA and YaRN) may be disadvantaged. This is the right choice for a controlled comparison study—the goal is to measure the methods under identical conditions, not to achieve the best possible results for each. - **Sliding window perplexity (stride 256) over full-context perplexity:** isolates the model's language modeling quality from its ability to maintain context over the full sequence. Full-context perplexity confounds modeling quality with context utilization strategy—a model with a poor long-context mechanism might achieve better full-context perplexity by learning to ignore distant context and focus on local patterns, which is not the behavior we want to reward. - **Needle-in-a-Haystack and RULER over perplexity alone:** perplexity measures local language modeling quality but does not directly test whether the model can access and utilize information from arbitrary positions. Retrieval-based tests probe this capability directly, and their failure modes (e.g., LM-Infinite's success only within its local window) reveal mechanistic limitations that perplexity obscures. - **LongBench with middle truncation over other truncation strategies:** the "lost in the middle" phenomenon means that information at the extremes (beginning and end) is better utilized by most models. Truncating from the middle preserves the most useful information while fitting the task into the evaluation window. This choice is standard in the field (following Bai et al., 2023) and ensures comparability with prior LongBench evaluations. - **Dynamic NTK scale factor $s = C' / (2C)$ over other settings:** the paper follows and improves upon Fu et al. (2024) in setting this value. The grid search in Appendix 9.5 (Table 9) provides empirical justification: scale factors that are too aggressive (large $s$) cause high perplexity on short sequences, while factors that are too conservative (small $s$) fail to extend to the target length. The value $C' / (2C) = 32k / (2 \cdot 4k) = 4$ (before the max formula adjustment) represents a compromise that the grid search shows works reasonably across the length spectrum. - **Scale factor $61.0$ at 64k for NTK-32K (Table 8):** this reflects the Dynamic NTK formula when $C_{\text{test}} = 64k > C' = 32k$. The effective ratio becomes $s \cdot C_{\text{test}} / C - (s-1) = 4 \cdot 64k / 4k - 3 = 64 - 3 = 61$, providing substantially more compression than the in-distribution 32k factor of 29 to accommodate the extrapolated length. The fact that NTK-32K with this factor successfully performs at 64k (46.26 RULER, green cells in the NIAH heatmap) demonstrates the extrapolation capability enabled by the dynamic scaling mechanism. ## 4. Key Insights and Innovations ### Innovation 1: Controlled Comparison as a First-Class Scientific Contribution in Long-Context Research The paper's most fundamental contribution is not any algorithmic finding but a **methodological intervention**: it demonstrates that the field's inability to compare context extension methods stems from a lack of experimental control, and it constructs the first large-scale framework to provide that control. Prior work on context extension, as cataloged in Sections 1–2, operated in a regime of systematic confound: each proposed method was evaluated on a different base model, with different training data, different hyperparameter tuning effort, and different evaluation benchmarks. The result was a literature of incomparable claims—LM-Infinite (Han et al., 2023) appeared strong or weak depending on which paper evaluated it against which baseline (Xiao et al., 2024; Lu et al., 2024), and no practitioner could determine whether apparent performance differences were due to algorithmic quality or to the choice of starting checkpoint. This is not merely a matter of "we ran the experiments more carefully." The paper's contribution is **the argument that controlled comparison is the bottleneck to progress**, not another new method. By fixing the base model (LLaMA2-7B), training data (1B tokens from the SlimPajama-based mixture of Fu et al., 2024), training recipe (fixed learning rate, batch size, EMA schedule, and hardware configuration), and evaluation protocol (perplexity on PG19/Proof-pile, NIAH, RULER, LongBench, many-shot ICL, all at standardized lengths), the paper creates conditions where performance differences **can be attributed to the extension methods themselves**. This is the long-context analog of what Chinchilla scaling laws (Hoffmann et al., 2022) did for pretraining compute allocation—replacing a landscape of incomparable empirical claims with a shared experimental foundation on which cumulative knowledge can be built. The significance of this framing is that it **changes what counts as a valid contribution** in the area. Before this paper, proposing a new context extension method and evaluating it under bespoke conditions was the norm. After this paper, the burden of proof shifts: a new method should demonstrate improvement *within a controlled comparison framework*, or at minimum explain why its claimed advantages would survive standardization. This is a conceptual shift from "our method achieves X on benchmark Y" to "our method outperforms the established best-in-class under identical conditions." The paper does not argue this explicitly in a philosophical register, but its entire experimental design instantiates the argument. The strength of this contribution is validated by the paper's own findings: several popular methods that looked competitive in their original papers (LongLoRA, LM-Infinite, Landmark Attention) perform substantially worse under controlled conditions than their original reports might suggest (Table 1, Figure 1). This is not because the original papers were flawed—it is because they used different base models, training data, and evaluation protocols that made cross-paper comparison impossible. The controlled framework reveals that the apparent competitiveness was partly an artifact of uncontrolled variables. This is precisely the diagnostic value that controlled experiments provide in any mature scientific field, and the paper brings it to long-context research for the first time at this scale. A subtle but important aspect of this contribution is the paper's **epistemic honesty about its own limitations**. The authors explicitly acknowledge that the fixed recipe may disadvantage certain methods ("We also acknowledge that the standardized training recipe with fixed hyperparameters may bias some models more than the other models," Section 7), that the 1B token budget is a computational constraint not a theoretically optimal choice, and that findings may not generalize to larger models or longer contexts. This acknowledgment is not a weakness—it is part of the methodology. A controlled comparison that pretends to be perfectly fair is less useful than one that transparently documents its biases. The paper's openness about where standardization might disadvantage particular methods (e.g., YaRN's hyperparameter sensitivity, LongLoRA's training recipe sensitivity) allows future work to probe those boundaries systematically rather than dismissing the entire comparison as unfair. This is a **fundamental** rather than incremental contribution because it changes the methodological norms of the research area. Future papers on context extension will need to engage with this controlled framework—either by adopting it, extending it, or arguing explicitly why their method requires different conditions—rather than simply reporting results under their own unique setup. The paper's open-source release of code, models, and checkpoints (Section 1, confirmed in the abstract's GitHub link) lowers the barrier for others to adopt the framework, making this normative shift practical rather than merely aspirational. ### Innovation 2: The Empirical Reconciliation of Perplexity and Downstream Task Performance Under Controlled Conditions A persistent debate in long-context language modeling has been whether perplexity—the standard intrinsic metric for language model quality—actually correlates with performance on downstream tasks that require utilizing long contexts. Prior work (Sun et al., 2021; An et al., 2023) had suggested that the correlation breaks down at long ranges, leading to arguments that new evaluation metrics were needed and that perplexity should not be trusted for comparing context extension methods. If true, this would mean that every method comparison requires expensive full-benchmark evaluation, and that the most computationally cheap and widely available metric is fundamentally unreliable. The paper provides a **clear empirical resolution** to this debate, but the resolution carries an important qualification that defines its novelty. Under the controlled experimental framework—where base model, training data, and evaluation protocol are held constant—**perplexity does correlate strongly with downstream task performance for exact attention methods**. Figure 4 plots this relationship across three benchmarks (NIAH, LongBench, RULER) and shows a clear linear trend: methods with lower perplexity at 32k achieve higher downstream accuracy. The relationship is strongest for exact fine-tuned methods (PI, YaRN, NTK-32K, NTK-64K, CLEX), which cluster tightly around the linear fit. What is novel is not simply the observation of correlation—it is the **diagnosis of why prior work found no correlation**. The paper argues that previous studies conflated multiple sources of variation (different base models, different training data, different evaluation protocols) that introduced noise obscuring the underlying relationship. When these confounds are removed, the signal emerges. This is an instance of a broader scientific pattern: Simpson's paradox, where relationships that are obscured by uncontrolled stratification become clear when strata are properly separated. The qualification is equally important: **approximate attention methods deviate from the linear trend**. LongLoRA achieves worse perplexity (9.89 at 32k) than its downstream performance would predict from the exact-attention trendline, while Landmark Attention shows the opposite pattern on some benchmarks. LM-Infinite achieves perplexity of 6.71 at 32k—competitive with exact fine-tuned methods—but fails catastrophically on retrieval tasks because its sliding window cannot access most of the context. This is not a failure of perplexity as a metric; it is a reflection of the fact that perplexity measures local language modeling quality (how well can the model predict the next token given its effective context), while downstream tasks measure whether the model can actually *use* the full context. For approximate attention methods that restrict the effective context, these two quantities diverge: the model predicts well locally (good perplexity) but cannot retrieve from arbitrary positions (bad downstream performance). The paper's framing—that perplexity correlates well *for exact attention methods* but must be supplemented with retrieval-based evaluation for approximate methods—is a **conceptual unification** of the previously conflicting findings. This contribution is **incremental at the empirical level** (it confirms a correlation that many researchers suspected existed under controlled conditions) but **fundamental at the interpretive level** (it provides a principled explanation for when and why perplexity is informative, and what additional metrics are needed to fill the gaps). It eliminates a source of confusion in the field and provides clear guidance for evaluation methodology: if you are comparing exact attention methods, perplexity suffices for relative ranking; if you are evaluating approximate attention methods, you must also test retrieval from arbitrary positions, because perplexity alone will be misleading. The evidence is anchored in Figure 4, which visualizes the correlation, and in the contrast between LM-Infinite's perplexity (6.71) and its NIAH heatmap in Figure 1 (retrieval succeeds only within the local window, producing a green strip at the bottom and failure everywhere else). The paper's concision on this point—it does not belabor the statistical significance or run formal correlation tests—is appropriate for the claim being made. The visual evidence is compelling because the pattern is clear: exact methods form a line, approximate methods sit off the line in ways that correspond to their mechanistic limitations. ### Innovation 3: The Systematic Empirical Demonstration That Approximate Attention Methods Trade Accuracy for Efficiency—and the Trade-Off Is Steep The paper provides the first comprehensive, controlled evidence that the class of approximate attention methods—which reduce the computational cost of long contexts by restricting which tokens can attend to which—**systematically underperform exact attention methods across a broad range of tasks**, and that the performance gap is large enough to be practically consequential. This is not a surprising finding in principle (restricting information access should reduce capability), but its empirical magnitude and consistency across methods and benchmarks were not previously established, and they carry implications for how the field should invest research effort. Prior to this work, approximate attention methods were presented as competitive alternatives to exact attention, with each paper demonstrating performance on its own chosen benchmarks. LongLoRA (Chen et al., 2023b) showed strong perplexity and reasonable task performance using sparse block-diagonal attention during training with LoRA. Landmark Attention (Mohtashami and Jaggi, 2023) demonstrated retrieval capability using learned chunk summaries. LM-Infinite (Han et al., 2023) showed that a simple sliding window with position capping could maintain perplexity at arbitrary lengths without any fine-tuning. Self-Extend (Jin et al., 2024) offered a frozen approach with dense attention but grouped position mapping. Each paper made a reasonable case for its method under its own evaluation conditions. The controlled comparison reveals a starker picture. As Table 1 summarizes, the best approximate attention methods achieve: - **LM-Infinite**: 6.71 perplexity at 32k (competitive), but 23.9% NIAH, 25.84 LongBench, 12.34 RULER—far below exact fine-tuned methods and even below the LLaMA2 base model (32.92 LongBench, 80.94 RULER at 4k) - **Self-Extend**: better than LM-Infinite across the board (6.11 perplexity, 25.8% NIAH, 33.62 LongBench, 29.50 RULER), competitive with exact fine-tuned methods on LongBench, but substantially worse on retrieval-heavy tasks (NIAH, RULER) - **LongLoRA**: 9.89 perplexity at 32k (worst of all methods), 20.3% NIAH, 23.30 LongBench, 3.53 RULER—catastrophic degradation from the base model's performance - **Landmark Attention**: 8.13 perplexity, 50.9% NIAH (better retrieval than other approximate methods), but 28.19 LongBench and 13.56 RULER The key insight is not simply that approximate methods are worse—it is **the pattern of where they fail**. LM-Infinite's perplexity is competitive because language modeling relies heavily on local context, and the sliding window captures that. But its retrieval performance collapses except within the local window, as the NIAH heatmap (Figure 1) visually demonstrates: the green retrieval-success region is a thin strip at the bottom of the heatmap, corresponding to needle positions within the 4k-token local window. For any needle placed earlier in the document, retrieval fails completely. This is a **mechanistically interpretable failure mode**: the model cannot retrieve what it cannot see, and LM-Infinite cannot see anything beyond its local window. The good perplexity is therefore misleading as an indicator of downstream capability. Self-Extend is the most interesting case among approximate methods. It uses dense attention—every token attends to every other token—but groups distant positions to map unseen relative positions into the training range. Its LongBench score (33.62) is competitive with exact fine-tuned methods (NTK-32K achieves 35.32, PI achieves 33.48), suggesting that for many tasks, the coarse position mapping is sufficient. But on RULER (29.50 vs. 59.42 for NTK-32K) and NIAH (25.8% vs. 83.7%), the gap is enormous. This reveals that **position resolution matters for retrieval-intensive tasks**: when the model needs to locate a specific piece of information at an exact position, the grouped position mapping of Self-Extend introduces enough positional ambiguity to degrade performance substantially. This is a finding with diagnostic value—it tells us *which* aspects of exact position encoding are critical for which downstream capabilities. LongLoRA's poor performance is particularly notable because the method uses full attention at inference time—the approximation is only during training. The degradation (3.53 RULER, 23.30 LongBench) suggests that sparse attention during training provides an insufficient training signal for the model to learn how to utilize long contexts at inference. The paper explicitly flags this in its limitation discussion: "We argue that this may be due to the sensitivity of the training procedures for LongLoRA." This is not a dismissal—it is a finding. LongLoRA's training procedure is more fragile than other methods under standardized conditions, and this fragility is itself an important practical characteristic. The significance of this innovation for the field is that it **redirects research effort**. Before this paper, approximate attention methods were presented as promising avenues for efficient long-context modeling, and a researcher might reasonably invest effort in improving them. After this paper, the evidence suggests that approximate attention methods face a fundamental accuracy ceiling that exact fine-tuned methods do not, at least at the 32k scale. For practitioners, the implication is clear: if you can afford the computational cost of exact attention fine-tuning (which is substantial but feasible on modern hardware for 7B models at 32k), the accuracy gains are large enough to justify the investment. Approximate methods should be reserved for regimes where exact attention is genuinely infeasible (e.g., context lengths of 128k or 1M tokens on consumer hardware), with the understanding that accuracy will be significantly degraded. This contribution is **incremental at the level of individual method comparisons** (each method had been evaluated before) but **fundamental at the level of comparative understanding** (no prior work had established the systematic ranking and the magnitude of the gaps). It transforms the conversation from "here are several approaches, each with their own strengths" to "exact fine-tuned methods dominate within their extension range; approximate methods pay a steep price for efficiency that makes them unsuitable for retrieval-intensive applications." ### Innovation 4: The Identification and Characterization of Extrapolation as the Central Unresolved Challenge, with Dynamic NTK as the Only Viable Approach The paper makes a clear-eyed empirical assessment of which methods can **extrapolate**—handle sequences longer than the context length they were extended to—and finds that this capability is rare, fragile, and currently achievable only through the combination of Dynamic NTK-RoPE scaling with continual fine-tuning. This finding is significant because it identifies the boundary of current capability and establishes extrapolation as the primary challenge for the next generation of context extension research. The distinction between **extension** (handling lengths up to the fine-tuned context window) and **extrapolation** (handling lengths beyond it) is conceptually straightforward but was muddied in prior work. Methods were often evaluated only at their training length, leaving their out-of-distribution behavior at longer lengths unknown. The paper systematically tests extrapolation by evaluating 32k-trained models at 64k—a 2× extension beyond the training regime—across multiple metrics. The results are striking in their clarity. Among all methods tested: - **Position Interpolation** fails completely at 64k (RULER score of 0.00 in Table 3, no evaluation possible in Table 2 because the method cannot process sequences beyond its training length). The uniform frequency scaling of PI means that positions beyond $C'$ map to rotation angles beyond the scaled training range, producing out-of-distribution embeddings the model cannot handle. PI offers no extrapolation mechanism—its extension is rigidly tied to the chosen target length. - **YaRN** similarly fails at 64k (RULER 0.00, perplexity on Proof-pile explodes to 106.38 at 64k in Table 2—more than 40× worse than at 32k). YaRN's NTK-by-parts scaling and temperature adjustment are designed for a fixed target length; beyond that length, the assumptions break down. The wavelength-based ramp function does not provide a natural mechanism for further extension, and the catastrophic perplexity increase confirms that the model's attention patterns disintegrate. - **LM-Infinite** maintains its performance at 64k (perplexity 8.49 on PG19, RULER 10.56) but only because its sliding window mechanism is length-agnostic—it always attends to the same fixed window regardless of total sequence length. The performance is consistent but consistently poor. This is extrapolation in a trivial sense (the method doesn't degrade further) but not in a useful sense (it was already inadequate at 32k). - **CLEX** shows partial extrapolation: RULER declines from 52.17 at 32k to 30.61 at 64k, and perplexity remains stable (5.79 at 32k, 5.79 at 64k on PG19). The learned scaling network generalizes somewhat beyond its training range, but with noticeable degradation. The continuous nature of the learned function provides an inductive bias toward smooth extrapolation, but it is not sufficient to maintain full performance at 2× the training length. This is a partial success that points toward a promising direction but does not yet constitute a solution. - **Dynamic NTK-RoPE** is the only method that shows meaningful extrapolation: NTK-32K achieves RULER 46.26 at 64k (down from 59.42 at 32k—a 22% relative decline but still functional), and the NIAH heatmap (Figure 1) shows substantial green regions beyond the 32k training boundary (marked by the dashed white line). NTK-64K, trained directly at 64k with 1B tokens, achieves RULER 49.31 at 64k—only marginally better than the extrapolated NTK-32K, suggesting that Dynamic NTK's extrapolation is approaching the performance achievable with actual training at the longer length. When NTK-64K is trained on 2B tokens (Appendix 9.4, Figure 5), performance improves further, suggesting that data scale rather than the scaling mechanism is the limiting factor. What makes this innovation significant is not simply that Dynamic NTK extrapolates—it is the **diagnosis of why it extrapolates when other methods do not**. The key is the dynamic scaling formula (described in Section 3.2 and detailed in Section 3.4): the effective scale factor adapts to the current sequence length $C_{\text{test}}$, so when the model encounters a 64k sequence (despite being trained at 32k), the formula automatically computes a larger scale factor (61.0 vs. 29.0, as documented in Table 8) that further compresses the RoPE frequencies to accommodate the extended range. This is not a learned behavior—it is an algorithmic property of the Dynamic NTK formulation. The model has been trained to handle the compressed positional representations at various effective scale factors (because the dynamic formula was used during training as well, varying the effective scaling based on training sequence length), so the extrapolated scale factor is within the distribution of scaling factors the model experienced during training. This reveals a **general principle**: extrapolation in RoPE-based models requires (1) a mechanism for adjusting the frequency scaling to accommodate longer sequences, and (2) training that exposes the model to the range of scaling factors that will be used at inference. Dynamic NTK satisfies both conditions because the scaling formula is continuous in $C_{\text{test}}$ and was applied during training. PI and YaRN fail the first condition (their scaling is fixed to a target length). LM-Infinite avoids the problem entirely by capping relative positions, which preserves perplexity but destroys retrieval capability. CLEX partially satisfies both conditions (the learned scaling network is continuous, and training exposed it to a range of lengths) but the learned function may not generalize robustly. The practical implication is clear: **if you need a model that can handle sequences longer than your fine-tuning budget allows, Dynamic NTK-RoPE with continual fine-tuning is currently the only demonstrated approach**. The paper's findings on this point are not merely a benchmark ranking—they identify a capability boundary that the field must work to extend. Future research on extrapolation should focus on understanding why Dynamic NTK's mechanism works (the interaction between dynamic scaling and training exposure) and on developing methods that can extrapolate further—perhaps by training with a wider range of scale factors, or by learning the scaling function in a way that explicitly encourages generalization beyond the training range. This contribution is **fundamental** despite being a finding about an existing method rather than a new method proposal. It establishes extrapolation as the frontier problem, provides a clear empirical characterization of which approaches reach that frontier and which do not, and offers a mechanistic explanation for the difference that can guide future work. The evidence is anchored in Table 2 (perplexity at 64k), Table 3 (RULER at 64k), Figure 1 (NIAH beyond the white dashed line), and Appendix 9.4 (NTK-64K with additional training data). ### Innovation 5: The Identification of Short-Sequence Degradation as a Hidden Cost of Context Extension, and Dynamic Scaling as a Mitigation A non-obvious finding that emerges from the paper's controlled comparisons is that several context extension methods **degrade performance on short sequences** relative to the base model—a cost that is invisible if evaluation focuses only on the extended context length. The paper quantifies this degradation and identifies Dynamic NTK-RoPE's dynamic scaling as an effective mitigation, turning what could be a limitation into a design principle. The phenomenon is visible in the perplexity data (Table 2) and in the NIAH heatmaps (Figure 1). At 2k and 4k—context lengths within the base LLaMA2-7B's pretraining range—the base model achieves perplexity of 6.61/6.30 on PG19 and 3.34/3.04 on Proof-pile. Several fine-tuned extension methods are *worse* than the base model at these short lengths: - **LongLoRA**: 12.80 at 2k on PG19, nearly double the base model's perplexity. This is a catastrophic degradation that makes the model worse at its original task (short-context language modeling) even as it gains long-context capability. - **CLEX**: 6.85 at 2k on PG19, worse than the base model's 6.61. The learned scaling network apparently compromises short-context performance slightly to achieve long-context extension. - **PI**: 6.88 at 2k, also slightly worse than the base model. The uniform frequency compression that enables 32k context comes at the cost of reduced positional resolution at short lengths, where the model was originally optimized. - **YaRN**: 6.70 at 2k, worse than the base model. The NTK-by-parts scaling and temperature adjustment, designed for long contexts, apparently interfere with short-context modeling. - **NTK-32K**: 6.63 at 2k on PG19 (essentially tied with the base model at 6.61) and 3.27 at 2k on Proof-pile (better than the base model's 3.34). NTK-Dynamic with the chosen scale factor setting largely preserves short-context performance, unlike the other fine-tuned methods. The paper explicitly discusses this issue in Section 4 when describing the grid search over scale factors: "We reuse the original scale factor to maintain consistency for NTK, YaRN, and Position Interpolation methods. However, this base factor significantly degrades continual fine-tuned models, particularly causing performance deterioration in shorter sequences." The grid search in Appendix 9.5 (Table 9) quantifies the trade-off: for NTK-32K, a scale factor of 1 (no scaling) gives perplexity 12.64 at 4k—worse than the base model—while a scale factor of 29 (the chosen value) gives 7.69 at 4k, competitive with the base model's 6.30. Higher scale factors (61, 125) progressively degrade short-sequence perplexity while improving long-sequence perplexity. The optimal choice is a compromise that balances the two regimes. What makes this finding an innovation rather than a minor observation is the **conceptual reframing** it enables. Before this work, context extension was framed as a pure gain—the model gets strictly better at handling longer contexts, with the assumption that short-context performance would be preserved. The paper's controlled comparison reveals that this assumption is false for most methods: context extension typically involves a trade-off where gains at long ranges come at the cost of degradation at short ranges. Dynamic NTK-RoPE's dynamic scaling—which adjusts the effective scale factor based on the current input length so that short sequences receive minimal frequency modification—is the mechanism that resolves this trade-off. The model operates essentially in its original pretraining regime on short sequences (scale factor near 1) and progressively shifts to the extended regime as sequences grow longer. This finding has immediate practical significance for deployment. A model that achieves strong long-context performance but is noticeably worse than the base model on short tasks (which may constitute the majority of user queries in many applications) is not a clear upgrade. The paper's results suggest that Dynamic NTK-RoPE is the method of choice not just because it performs best at 32k, but because it is the only method that preserves (or slightly improves) short-context performance while gaining long-context capability. For practitioners, this means the decision of which extension method to use should consider performance across the full length spectrum, not just at the target extension length. This contribution is **incremental in its empirical observation** (the degradation can be seen by comparing perplexity at different lengths) but **fundamental in its implications for method selection and design**. It identifies Dynamic NTK-RoPE's dynamic scaling not as a minor variant but as the key mechanism for achieving what context extension ideally should provide: a model that is at least as good as the base model at all lengths and substantially better at long lengths. Future extension methods should be evaluated on this criterion—not just "how well does it handle 32k?" but "does it preserve performance at 4k, 8k, and 16k?"—and the paper's controlled framework makes such multi-length evaluation straightforward. ## 5. Experimental Analysis ### Evaluation Methodology - **Dataset.** The primary fine-tuning corpus is 1B tokens sampled from SlimPajama (Soboleva et al., 2023), an open-source replication of the LLaMA pretraining data mixture comprising 82% web data, 4.5% code, 4.5% Wikipedia, 4.5% books, 2.5% Arxiv, and 2.0% StackExchange. The data is processed with per-source length upsampling following Fu et al. (2024) to increase the proportion of long sequences while preserving the domain distribution, then packed into chunks of the training context length (32k for most methods, 64k for NTK-64K) without regard to document boundaries. For evaluation, the paper uses PG19 (Rae et al., 2019) and Proof-pile (Azerbayev et al., 2023) for perplexity; a custom Needle-in-a-Haystack implementation (gkamradt, 2023) sweeping lengths 1k–64k and depths 0–100%; RULER (Hsieh et al., 2024) with 13 subtasks across four categories; LongBench (Bai et al., 2023) with 16 subtasks; and TREC News (Li and Roth, 2002; Kontonis et al., 2024) for many-shot ICL with 1–1000 examples. - **Base model.** All experiments start from LLaMA2-7B (Touvron et al., 2023), a 7B-parameter model pretrained on 2T tokens with a 4k-token context window using RoPE with base frequency b = 10000. The model has 32 transformer layers, 32 attention heads, and hidden dimension 4096. This checkpoint is chosen because LLaMA2 is the most widely used open-weight base for context extension research, enabling comparison to the largest body of prior work, and the 7B scale balances capability with computational feasibility. To test generalization across model families, a secondary set of experiments uses Phi-2-base (Javaheripi et al., 2023), a 2.7B-parameter model with a 2k context window. - **Metrics.** Five metric families are used. (1) **Perplexity** on PG19 and Proof-pile, computed using a sliding window of size 256 (Press et al., 2022) at evaluation lengths 2k, 4k, 8k, 16k, 32k, and 64k where the method supports it; this isolates local language modeling quality from context utilization strategy. (2) **Needle-in-a-Haystack (NIAH)** retrieval accuracy, scored as binary success/failure for each (length, depth) combination and visualized as heatmaps where green indicates retrieval success. (3) **RULER** aggregate accuracy, computed as the average across 13 subtasks (each with 500 examples) at each evaluation length (4k, 8k, 16k, 32k, 64k); subtask-level breakdowns are provided in Appendix 9.8. (4) **LongBench** per-task and average scores across 16 subtasks spanning single-document QA, multi-document QA, summarization, few-shot learning, code completion, and synthetic tasks; prompts are truncated from the middle when exceeding the 32k evaluation window. (5) **Many-shot ICL accuracy** on TREC News, measured at 15 example counts from 1 to 1000. - **Baselines.** The LLaMA2-7B base model serves as the primary baseline at its pretraining length (2k, 4k). Among extension methods, the paper establishes several comparison axes: exact fine-tuned methods (PI, Chen et al., 2023a; NTK-32K and NTK-64K based on Dynamic NTK-RoPE, emozilla, 2023; YaRN, Peng et al., 2023; CLEX, Chen et al., 2024) versus approximate attention methods (LM-Infinite, Han et al., 2023; Self-Extend, Jin et al., 2024; LongLoRA, Chen et al., 2023b; Landmark Attention, Mohtashami and Jaggi, 2023), and fine-tuned versus frozen (NTK-Frozen as a non-fine-tuned exact method, LM-Infinite and Self-Extend as frozen approximate methods). No single method is designated as "the baseline" — the contribution is the comparative ranking itself. - **Generation budget / compute accounting.** The paper does not use "generations" as a compute unit since it studies context extension rather than test-time sampling. Instead, compute is implicitly accounted for through two mechanisms: (1) all fine-tuned methods use the identical 1B token training budget, making training cost equal across methods; (2) for approximate attention methods, the computational savings are part of the method's design (e.g., LM-Infinite's O(C'(M+G)) vs. exact attention's O(C'^2)), and the paper evaluates whether these savings justify the accuracy trade-off. The training infrastructure is fixed at 8 NVIDIA A100 GPUs across all methods. - **Cross-validation / statistical protocol.** The paper does not employ cross-validation or statistical significance testing. Strategy selection for Dynamic NTK's scale factor uses a grid search over candidate values (Appendix 9.5, Table 9), with the chosen value determined by perplexity on the first 2 documents of PG19 — a minimal validation procedure. For LongLoRA, implementation correctness is validated by reproducing the original model's perplexity (Table 10). Results are reported as point estimates without confidence intervals or error bars, which the paper does not explicitly justify. --- ### Main Quantitative Results #### Perplexity Scaling with Context Length Table 2 reports perplexity on PG19 and Proof-pile at evaluation lengths from 2k to 64k. The core finding is that exact fine-tuned methods maintain or improve perplexity within their training context length, while approximate and frozen methods either degrade or fail to extend. **Within the training length (2k–32k)**: All exact fine-tuned methods achieve perplexity at 32k that is *better* than the base LLaMA2-7B at its 4k training length. On PG19, the base model achieves 6.30 at 4k; NTK-32K achieves 5.79 at 32k, PI achieves 5.95, YaRN achieves 5.93, and CLEX achieves 5.82 — all representing improvements over the base model despite operating at 8× the context length. On Proof-pile, the pattern is similar: base model 3.04 at 4k vs. NTK-32K 2.54 at 32k, PI 2.58, CLEX 2.55. The improvement reflects both the benefits of continued training on long-context data and the effectiveness of RoPE frequency scaling in making the extended positions learnable. **Degradation on short sequences**: A non-obvious finding is that several fine-tuned methods perform *worse* than the base model at short lengths (2k–4k). On PG19 at 2k, the base model achieves 6.61, while PI achieves 6.88, YaRN 6.70, CLEX 6.85, and LongLoRA a catastrophic 12.80. Only NTK-32K (6.63) roughly matches the base model. On Proof-pile at 2k, the base model is 3.34; NTK-32K is better at 3.27, but CLEX is worse at 3.37. This quantifies the short-sequence degradation that the paper identifies as a hidden cost of context extension (discussed in Section 4 as Innovation 5). **Approximate attention perplexity**: Among approximate methods, LM-Infinite achieves the best perplexity (6.71 at 32k on PG19), competitive with exact fine-tuned methods. Self-Extend achieves 6.11 at 32k — better than all methods except NTK-32K. This is because both methods maintain strong local language modeling: LM-Infinite through its 4k sliding window and Self-Extend through its dense attention with grouped positions. However, as subsequent metrics show, this perplexity is misleading for downstream capability. Landmark Attention achieves 8.13 at 32k, and LongLoRA achieves 9.89 — substantially worse than all other methods, suggesting that the sparse training signal (LongLoRA) and the retrieval bottleneck (Landmark) impair basic language modeling quality. **Frozen method perplexity**: NTK-Frozen achieves 14.52 at 32k on PG19 — more than 2× worse than NTK-32K fine-tuned (5.79), and catastrophically worse on Proof-pile (4.06 at 32k vs. 2.54 for NTK-32K). This demonstrates that RoPE frequency scaling alone, without training the model to use the rescaled positions, is insufficient for maintaining language modeling quality. Self-Extend (frozen) achieves 6.11 at 32k, substantially better than NTK-Frozen, because its grouped position mapping avoids out-of-distribution rotation angles while preserving dense attention. **Extrapolation beyond training length (64k)**: Only NTK-32K, NTK-64K, CLEX, and LM-Infinite are evaluated at 64k (other methods cannot process sequences beyond their training length). NTK-32K extrapolates from 32k training to 64k evaluation with minimal degradation: PG19 perplexity goes from 5.79 at 32k to 5.76 at 64k; Proof-pile from 2.54 to 2.48. This is the clearest evidence of extrapolation capability — the model is *better* at 64k than at 32k, suggesting the dynamic scaling mechanism not only preserves but continues to benefit from additional context. NTK-64K, trained at 64k, achieves 5.85 at 64k on PG19 and 2.51 on Proof-pile — slightly worse than the extrapolated NTK-32K, suggesting the 1B token budget may be insufficient for 64k training (confirmed in Appendix 9.4). CLEX achieves 5.79 at 64k on PG19 and 2.48 on Proof-pile, matching NTK-32K, demonstrating that its learned scaling network generalizes. LM-Infinite achieves 8.49 at 64k on PG19 (vs. 6.71 at 32k) and 3.12 on Proof-pile (vs. 3.11) — the sliding window mechanism provides consistent but mediocre perplexity regardless of length. YaRN's Proof-pile perplexity explodes to 106.38 at 64k (vs. 2.59 at 32k), a >40× degradation confirming that its fixed NTK-by-parts scaling does not extrapolate. #### Needle-in-a-Haystack Retrieval Figure 1 shows NIAH heatmaps for all methods. The white dashed line marks the longest context length seen during training or fine-tuning, separating in-distribution extension (below the line) from extrapolation (above). Green indicates successful retrieval; white indicates failure. **Exact fine-tuned methods**: NTK-32K achieves near-perfect retrieval (solid green) across all depths up to its 32k training boundary, and maintains substantial green coverage beyond it at 64k — retrieval succeeds at most depths even in the extrapolation regime, with some degradation when the needle is placed very early in very long documents. This is the strongest extrapolation result. PI achieves solid green across all depths up to 32k (its training length) but shows no capability beyond (no data at 64k because PI cannot process sequences beyond its fixed target length). YaRN similarly achieves good retrieval within 32k but shows zero capability beyond. CLEX achieves good retrieval within 32k and partial coverage at 64k (patchy green, similar to but weaker than NTK-32K). **Frozen exact methods**: NTK-Frozen shows retrieval capability only up to approximately 8k (Figure 1, top row, rightmost panel in the first group of three), with performance degrading rapidly beyond that. At 32k, retrieval is almost entirely white (failure) except for a thin strip at the very end of documents (the local recency region). This is consistent with the perplexity results: NTK-aware scaling without fine-tuning prevents catastrophic perplexity explosion at 8k (Table 2 shows 6.82 at 8k), but the model never learned to attend based on the rescaled positions, so retrieval — which requires precise position-dependent attention — fails. **Approximate attention methods**: LM-Infinite (Figure 1, second row, left panel) shows retrieval success *only* within its local window — the heatmap is green exclusively at the bottom (depths near 100%), corresponding to needle positions within the most recent 4k tokens. For needle positions earlier in the document (even at short total document lengths), retrieval fails completely. This is the most visually striking demonstration of the approximate attention accuracy trade-off: the model literally cannot retrieve information it cannot see. Self-Extend (Figure 1, second row, right panel) shows better but still limited retrieval — patchy green coverage up to 32k, with notable failures particularly when the needle is in the middle of documents (the "lost in the middle" phenomenon is exacerbated by the grouped position mapping). At 64k, retrieval degrades substantially. **Fine-tuned approximate methods**: LongLoRA (Figure 1, third row, left panel) shows retrieval failure across nearly all lengths and depths — the heatmap is almost entirely white except for a few scattered green cells at very short lengths. This is the worst NIAH performance of any method, consistent with LongLoRA's poor perplexity (9.89 at 32k) and suggesting that sparse attention during training with LoRA does not teach the model to locate information at arbitrary positions. Landmark Attention (Figure 1, third row, middle panel) shows moderate retrieval capability — green coverage is better than LM-Infinite and LongLoRA but substantially worse than exact fine-tuned methods, with degradation as document length increases. The landmark retrieval mechanism provides some access to non-local information, but the chunk-level summarization bottleneck limits precision. **Quantitative scores**: Table 1 reports aggregate NIAH scores. NTK-32K achieves 83.7%, nearly 4× better than the best approximate method (Landmark at 50.9%) and more than 3× better than the best frozen method (Self-Extend at 25.8%). The base LLaMA2-7B at its 4k training length achieves a hypothetical perfect score (needle always within the training context). The gap between NTK-32K (83.7%) and the second-best fine-tuned method (CLEX at 71.1%) suggests that Dynamic NTK's scaling mechanism provides better positional precision than CLEX's learned approach, at least for retrieval tasks. #### RULER: Comprehensive Retrieval and Reasoning Tables 3 and 12–16 report RULER results. Table 3 provides aggregate scores across all 13 subtasks at lengths 4k–64k; Tables 12–16 (Appendix 9.8) provide per-subtask breakdowns. **Aggregate results at training length (32k)**: Exact fine-tuned methods dominate. NTK-32K achieves 59.42, followed by PI at 57.66, CLEX at 52.17, YaRN at 36.95. The substantial gap between NTK-32K/PI and YaRN is notable: YaRN's NTK-by-parts scaling and temperature adjustment, which were designed to improve attention distribution for long contexts, appear to underperform simpler scaling approaches on RULER's diverse task set. Among approximate methods, Self-Extend achieves 29.50 (best of the approximate class), Landmark achieves 13.56, LM-Infinite 12.34, and LongLoRA a near-zero 3.53. The 5× gap between NTK-32K (59.42) and the best approximate method (Self-Extend, 29.50) quantifies the steep accuracy-efficiency trade-off. **Length scaling behavior**: The performance trajectory as context length increases reveals method-specific patterns. NTK-32K degrades gracefully: 86.58 at 4k → 77.75 at 8k → 70.01 at 16k → 59.42 at 32k → 46.26 at 64k. The decline is approximately linear, with no catastrophic drop at any length boundary. PI maintains strong performance through 32k (84.56 → 76.04 → 69.64 → 57.66) but drops to 0.00 at 64k because the method cannot process sequences beyond its training length. YaRN degrades more rapidly: 79.12 at 4k → 65.60 at 8k → 54.21 at 16k → 36.95 at 32k → 0.00 at 64k. CLEX shows an unusual non-monotonic pattern: 50.18 at 4k (worse than at longer lengths) → 63.93 at 8k → 64.35 at 16k → 52.17 at 32k → 30.61 at 64k. The poor 4k performance may reflect the learned scaling function producing suboptimal frequency assignments for short sequences — a short-sequence degradation cost that other exact methods avoid through dynamic scaling or fixed scaling that is closer to identity at short lengths. **Approximate method length scaling**: LM-Infinite maintains relatively stable but low performance: 81.05 at 4k (good, because the 4k context fits within the local window) → 30.01 at 8k → 18.02 at 16k → 12.34 at 32k → 10.56 at 64k. The sharp drop from 4k to 8k confirms that the local window (4k tokens) is the effective context limit — beyond that, the model loses access to relevant information. Self-Extend degrades more gracefully but still substantially: 65.03 → 50.73 → 44.02 → 29.50 → 9.34, reflecting the progressive coarsening of position resolution as sequence length increases. LongLoRA performs poorly at all lengths (10.58 → 6.37 → 3.67 → 3.53 → 0.00), suggesting fundamental failure of the sparse-attention training signal. **Subtask breakdown (Tables 12–16)**: The per-subtask results reveal that the aggregate trends hold across all RULER categories, but with varying magnitude. On the standard single-needle tasks (NIAH_S1, S2, S3), NTK-32K achieves near-perfect accuracy at 32k (97.2, 99.0, 97.0 respectively in Table 15), while LM-Infinite achieves 7.8, 7.0, 6.4 — confirming that the sliding window cannot retrieve from arbitrary positions. On the more challenging multi-needle tasks (NIAH_M3 with 6 keys), all methods degrade: NTK-32K achieves only 5.8 at 32k, highlighting a fundamental difficulty with tracking multiple pieces of information simultaneously even for the best method. On Variable Tracking (VT) — a multi-hop reasoning task — NTK-32K achieves 56.68 at 32k, substantially better than any approximate method (Self-Extend 2.32, LM-Infinite 2.08, LongLoRA 0.00), suggesting that exact attention is particularly important for sequential reasoning over long contexts. On Common Word Extraction (CWE), all methods perform poorly: NTK-32K achieves only 26.72 at 32k, and LM-Infinite achieves 4.48, indicating that aggregation tasks requiring counting or frequency analysis across the full context remain challenging even for the best methods. **NTK-64K at 64k**: Trained at 64k, NTK-64K achieves 49.31 at 64k on RULER (Table 3), compared to 46.26 for NTK-32K extrapolated to 64k — a marginal improvement of ~3 points. This suggests that explicit training at the longer length provides limited additional benefit beyond Dynamic NTK's extrapolation, at least with the 1B token budget. When trained on 2B tokens (Appendix 9.4, Figure 5), NTK-64K shows "significant performance improvement" on NIAH, suggesting the bottleneck is data scale rather than the scaling mechanism. #### LongBench: Downstream Task Performance Table 4 (main results) and Table 11 (complete results with all methods) report LongBench scores. The average length of LongBench tasks is approximately 7,425 tokens — substantially shorter than the 32k evaluation window. **Aggregate performance**: NTK-32K achieves the highest average score of 35.32, followed by Self-Extend (33.62), PI (33.48), CLEX (33.48), YaRN (33.45), and NTK-64K (34.30). The base LLaMA2-7B achieves 32.92 at its 4k context length. The maximum improvement from context extension on LongBench is therefore only ~2.4 points (NTK-32K vs. base) — a 7% relative improvement. The paper explicitly attributes this modest gain to the mismatch between LongBench's average length (~7.5k) and the extended context window (32k): most tasks do not require the extended context, so the benefits of extension are not fully exercised. **Per-task variation**: The sub-15k token tasks show meaningful differentiation across methods. On NarrativeQA (NQA, avg. length 18,409 tokens — one of the longer tasks), NTK-32K achieves 23.73 vs. base LLaMA2's 21.09, a 2.64-point improvement. On QMSum (QMSM, 10,614 tokens), NTK-32K achieves 21.52 vs. base 21.28. On GovReport (GR, 8,734 tokens), NTK-32K achieves 28.27 vs. base 17.32 — the largest single-task improvement, an 11-point gain. On MultiFieldQA (MFQA, 4,559 tokens, relatively short), NTK-32K achieves 38.22 vs. base 32.42 — a nearly 6-point gain despite being within the base model's context length, suggesting that even moderate-length QA benefits from the extended context training. **Approximate methods on LongBench**: Self-Extend (33.62) is the only approximate method competitive with exact fine-tuned methods on LongBench average, and it actually outperforms PI (33.48), YaRN (33.45), and CLEX (33.48) by a small margin. This is the one benchmark where the approximate-exact gap narrows substantially, likely because LongBench's moderate average length means tasks do not stress the full 32k context, reducing the penalty for approximate attention. However, on the longest tasks, the gap reappears: on NarrativeQA (18,409 tokens), Self-Extend achieves 23.49 vs. NTK-32K's 23.73 (small gap), but on GovReport (8,734 tokens), Self-Extend achieves only 13.15 vs. NTK-32K's 28.27 — a massive 15-point gap, suggesting Self-Extend's grouped position mapping fails on summarization tasks that require integrating information from across the document. Landmark Attention (28.19 average) and LM-Infinite (25.84) perform worse than the base model (32.92), meaning context extension with these methods *reduces* LongBench performance. LongLoRA achieves 23.30 — a 9.6-point degradation from the base model, the worst of any method. **Synthetic tasks**: On PassageCount (PSC, 11,141 tokens) and PassageRetrieval (PSR, 9,289 tokens) — synthetic tasks specifically designed to test long-context retrieval — all methods perform poorly. On PSC, NTK-32K achieves only 2.68 (vs. base 2.10), and on PSR, 4.62 (vs. base 9.00 — the base model is *better* than the extended model). These near-floor scores suggest that the synthetic tasks require capabilities (counting passages, retrieving specific passages by index) that even exact fine-tuned methods have not learned from the 1B token training corpus. **Many-shot ICL sub-result within LongBench**: On TREC (TRE, 5,177 tokens), a few-shot classification task, exact methods achieve 69–71% (NTK-32K 69.0, PI 71.0) vs. base 66.0 — modest improvements. On TriviaQA (TRVQA, 8,209 tokens), exact methods achieve 88–90% (NTK-32K 88.86, PI 88.55) vs. base 87.89 — minimal improvement, likely because the task is knowledge-intensive and benefits less from context extension. #### Many-Shot In-Context Learning on TREC News Figure 2 plots many-shot ICL accuracy as the number of in-context examples grows from 1 to 1000. The evaluation directly tests whether context extension enables effective utilization of very long prompts (up to and exceeding 32k tokens with 1000 examples). **Overall scaling behavior**: All exact attention methods show substantial accuracy gains as the number of examples increases. From 10 to 50 examples, exact methods gain approximately +44.0% accuracy; from 100 to 1000 examples, they gain approximately +25.9%. The gains are largest in the 10–50 example range, with diminishing returns beyond 100 examples but continued improvement. This demonstrates that exact fine-tuned context extension unlocks the ability to benefit from many-shot examples — a capability the base 4k model would lack because it cannot fit hundreds of examples in its context. **Method comparison**: NTK-32K and NTK-64K achieve the highest accuracy at 1000 examples (appears to be approximately 71–73% from Figure 2, though exact values are not tabulated). PI, YaRN, and CLEX cluster slightly below (approximately 69–71%). Self-Extend achieves comparable performance to exact methods at moderate example counts (up to ~200 examples) but falls behind at higher counts, likely because the grouped position mapping loses resolution as the prompt lengthens. NTK-Frozen performs well at low example counts (1–10) — suggesting the frozen NTK scaling works for very short extensions — but underperforms substantially at higher counts, consistent with its failure to generalize beyond 8k. **Approximate attention methods**: LM-Infinite and LongLoRA show minimal improvement from additional examples beyond ~25, and their accuracy plateaus or declines at higher counts. Landmark Attention performs intermediately — better than LM-Infinite/LongLoRA but substantially worse than exact methods. The approximate methods' failure to benefit from many-shot examples is directly attributable to their restricted attention: as the prompt grows, most of the earlier examples fall outside the local window (LM-Infinite), cannot be retrieved effectively (Landmark), or were never properly integrated during training (LongLoRA). **Interpretation**: The many-shot ICL results are the clearest demonstration of *why* exact attention matters for long contexts. The task requires the model to attend to examples distributed throughout the prompt — some near the beginning, some in the middle, some near the end. Approximate attention methods that restrict access to arbitrary positions cannot effectively utilize all examples, and their performance saturates early. Exact methods continue to improve as more examples are added, showing that they can integrate information from across the full 32k context. #### Correlation Between Perplexity and Downstream Performance Figure 4 plots perplexity at 32k against average downstream task accuracy for NIAH, LongBench, and RULER. Linear fits are overlaid on the scatter plots. **Exact attention methods**: The correlation is strong across all three benchmarks. For NIAH, lower perplexity is clearly associated with higher retrieval accuracy (R² is not reported, but the visual trend is unambiguous — the exact methods form a tight cluster around the regression line). For LongBench, the correlation is weaker but still present: the spread around the line is larger, reflecting the fact that LongBench tasks are shorter and less sensitive to long-context modeling quality. For RULER, the correlation is strong, with exact methods tightly clustered. **Approximate attention methods**: These methods deviate from the linear trend in systematic ways. LM-Infinite (perplexity 6.71 at 32k) achieves far worse NIAH and RULER performance than its perplexity would predict — it sits well below the regression line, reflecting the fact that good local language modeling (low perplexity) does not translate to retrieval capability when the effective context is restricted to 4k tokens. LongLoRA (perplexity 9.89) performs worse than its perplexity predicts on NIAH but roughly in line with expectations on LongBench. Landmark Attention (perplexity 8.13) shows the opposite pattern — better NIAH than perplexity would suggest (the landmark retrieval mechanism provides some long-range access despite mediocre language modeling) but worse LongBench. These deviations are not random noise — they are mechanistically interpretable consequences of each method's attention pattern. **Interpretation**: The paper uses Figure 4 to support its claim that "perplexity as a general-purpose performance indicator even in longer-context tasks" holds for exact attention methods but requires supplementation with retrieval-based evaluation for approximate methods. The finding is significant because it resolves a prior debate in the literature: perplexity *does* correlate with downstream performance when confounds (different base models, training data, evaluation protocols) are removed, but the correlation is mediated by the attention mechanism. For methods that compute exact attention, perplexity is a reliable quality indicator. For methods that restrict attention, perplexity overestimates downstream capability and must be combined with direct tests of long-range information access. #### Phi-2-base Replication (Appendix 9.1) To test whether findings generalize across model families, the paper replicates key experiments with Phi-2-base (2.7B parameters, 2k pretraining context length). Appendix 9.1 reports perplexity (Table 5) and RULER (Table 6) for seven methods. **Perplexity (Table 5)**: The pattern mirrors LLaMA2-7B results. At 32k, NTK-32K achieves the best perplexity (3.18 on Proof-pile), followed by CLEX (3.42), with Self-Extend achieving 3.48 — competitive with exact methods on this metric. PI achieves 5.83 at 32k (substantially worse than NTK), and NTK-Frozen degrades to 12.58 at 32k. At 64k, NTK-32K extrapolates successfully (3.20, nearly identical to 3.18 at 32k), NTK-64K achieves 3.38, and CLEX achieves 3.60. PI fails at 64k (45.00). The short-sequence degradation pattern also replicates: at 2k, the base Phi-2-base achieves 4.02, while PI achieves 7.53 (nearly 2× worse) and CLEX achieves 5.53. NTK-32K (4.24) again best preserves short-context performance. **RULER (Table 6)**: The LLaMA2-7B trends replicate. At 32k, NTK-32K achieves 32.06 — substantially better than CLEX (25.46), PI (4.78), Self-Extend (7.83), and NTK-Frozen (0.06). At 64k, NTK-32K extrapolates to 12.84, CLEX to 13.03, and NTK-64K achieves 17.69. The absolute scores are lower than LLaMA2-7B (likely due to the smaller model size and shorter pretraining context), but the relative ranking — NTK > CLEX > approximate/frozen methods — is preserved. **Generalization assessment**: The Phi-2-base replication strengthens the paper's central claims by showing they are not artifacts of LLaMA2-7B's specific architecture or pretraining. The key findings — exact fine-tuned methods dominate, Dynamic NTK-RoPE extrapolates, approximate methods underperform on retrieval, and frozen methods fail at significant extension — all replicate. The one difference is the *magnitude* of gaps: the 2.7B Phi-2-base shows larger relative degradation for frozen and approximate methods, suggesting that smaller models may be more sensitive to out-of-distribution position encodings and attention restrictions. --- ### Ablation Studies and Robustness Checks - **Training data scale for NTK-64K**: Appendix 9.4 (Figure 5) compares NTK-64K trained on 1B vs. 2B tokens. The 2B-token model shows "significant performance improvement" on NIAH, with the heatmap transitioning from patchy green (1B) to solid green (2B) at 64k. This confirms that longer context models require proportionally more training data, and that the 1B token budget — while sufficient for 32k — is a bottleneck at 64k. It also suggests that Dynamic NTK-RoPE's extrapolation capability (NTK-32K at 64k) may approach the performance of an explicitly trained 64k model when data is limited, making it a practical alternative when training budget is constrained. - **Scale factor selection for Dynamic NTK**: Appendix 9.5 (Table 9) reports a grid search over scale factors for NTK-Frozen and NTK-32K, evaluating perplexity on PG19 at lengths 4k–64k. For NTK-Frozen, the optimal scale factor shifts dramatically with length: 1–3 works at 4k–8k but fails catastrophically (NaN perplexity) at 16k+; 31 enables 64k processing but with poor perplexity (69.01 at 64k). For NTK-32K, the trade-off is smoother: scale factor 29 achieves the best balance (7.69 at 4k, 6.82 at 32k, 9.11 at 64k), with higher factors improving 64k perplexity but degrading 4k. This ablation empirically justifies the dynamic scaling approach — no single fixed scale factor is optimal across all lengths, and the paper's chosen formula (scale factor 29 for in-distribution, 61 for extrapolation) reflects a Pareto-optimal compromise visible in the grid search. - **LongLoRA implementation validation**: Appendix 9.6 (Table 10) compares the paper's LongLoRA reproduction against the original published model (Llama-2-7b-longlora-32k) on PG19 and Proof-pile. The reproduced model achieves 7.32 at 32k on PG19 vs. the original's 7.22, and 2.61 on Proof-pile vs. 2.50 — differences of 1.4% and 4.4% respectively. This confirms implementation correctness and ensures that LongLoRA's poor performance in the controlled comparison is not due to a bug but to the standardized training recipe (which may not match LongLoRA's original tuned configuration). - **RULER subtask breakdown as robustness check**: Tables 12–16 demonstrate that the aggregate RULER trends are consistent across all 13 subtasks, not driven by a few outlier tasks. On every subtask, the ranking NTK-32K ≈ NTK-64K > PI > CLEX > YaRN > Self-Extend > LM-Infinite ≈ Landmark > LongLoRA holds approximately, with the gaps varying in magnitude but not direction. This consistency strengthens the claim that the findings reflect general long-context processing capability rather than task-specific artifacts. - **Phi-2-base replication as model-family robustness**: As discussed above, Appendix 9.1 replicates the central findings on a different model family (Phi-2, 2.7B, 2k pretraining context). The qualitative patterns (NTK dominance, extrapolation, approximate method underperformance) replicate, though absolute scores are lower. This partially addresses the limitation that all main experiments use LLaMA2-7B, though the paper does not test models larger than 7B or from non-LLaMA/Phi families (e.g., Mistral, Qwen). - **Perplexity evaluation on two corpora (PG19 and Proof-pile)**: Table 2 reports both. The consistent ranking across these linguistically distinct corpora (narrative text vs. mathematical proofs) suggests that perplexity trends are not domain-specific. The only exception is YaRN at 64k on Proof-pile (106.38), which dramatically exceeds its PG19 behavior (no 64k evaluation on PG19 for YaRN since it cannot process that length — the Proof-pile value may reflect a degenerate case where the evaluation code handled the out-of-distribution input differently). - **LongBench with middle truncation**: The paper follows Bai et al. (2023) in truncating prompts from the middle when they exceed 32k. This is not an ablation in the traditional sense, but it is a robustness consideration: the truncation strategy could interact with context extension methods differently. A method that relies heavily on the middle of documents (perhaps because it learned to distribute attention uniformly) would be penalized more by middle truncation than a method that focuses on beginnings and ends. The paper does not ablate this choice (e.g., by comparing with beginning-only or end-only truncation), which is a limitation — but it is a standard choice in the field and ensures comparability with prior LongBench evaluations. --- ### Critical Assessment #### Does the paper demonstrate that exact fine-tuned methods systematically outperform approximate attention methods? Yes, with strong and consistent evidence across all benchmarks. The gaps are large and mechanistically interpretable. At 32k on RULER (Table 3), NTK-32K achieves 59.42 vs. the best approximate method (Self-Extend) at 29.50 — a 2× gap. On NIAH (Table 1), NTK-32K achieves 83.7% vs. Self-Extend 25.8% — a 3.2× gap. On LongBench (Table 4), the gap narrows to 35.32 vs. 33.62 — only 1.7 points — but LongBench's average length (7.5k) means most tasks do not stress the 32k context where approximate methods fail. When LongBench tasks are long (NarrativeQA at 18k, GovReport at 9k), the gap widens substantially. The many-shot ICL results (Figure 2) show that approximate methods plateau early while exact methods continue to benefit from additional examples up to 1000. However, the paper's "approximate attention" category is heterogeneous, and not all methods fail equally. Self-Extend — which uses *dense* attention with grouped position mapping, not restricted attention — performs competitively with exact methods on LongBench and moderately well on RULER. It is LM-Infinite and LongLoRA that fail catastrophically. The paper's taxonomy groups Self-Extend under "approximate attention" because its position mapping is approximate, but its attention pattern is dense — this categorization ambiguity could cause readers to overgeneralize the "approximate methods fail" conclusion to Self-Extend, which is a more nuanced case. A genuine weakness: the paper does not test any approximate attention method that uses *learned sparsity* (e.g., adaptive sparse attention where the sparsity pattern is data-dependent) or *hierarchical attention* beyond Landmark's retrieval approach. Methods like BigBird, Longformer, or Reformer — while older — represent alternative approximate attention paradigms not represented. The paper's conclusion about approximate attention is therefore specific to the four methods tested (LM-Infinite, Self-Extend, LongLoRA, Landmark) and may not generalize to all approximate approaches. #### Does the paper demonstrate that Dynamic NTK-RoPE extrapolates beyond its fine-tuning context length? Yes, with clear evidence, but the extrapolation is bounded and degrades with distance. NTK-32K (trained at 32k) achieves 46.26 RULER at 64k (Table 3) — down from 59.42 at 32k, a 22% relative decline. The NIAH heatmap (Figure 1) shows substantial green coverage at 64k but not the solid green seen at 32k. Perplexity (Table 2) remains stable (5.79 at 32k → 5.76 at 64k on PG19; 2.54 → 2.48 on Proof-pile), but perplexity is less sensitive to retrieval failures. The extrapolation claim is strengthened by the comparison with NTK-64K — explicitly trained at 64k — which achieves 49.31 RULER at 64k (Table 3), only 3 points better than extrapolated NTK-32K. This suggests Dynamic NTK's extrapolation approaches the performance achievable with explicit training at the longer length (at least with 1B tokens). However, when NTK-64K is trained on 2B tokens (Appendix 9.4), performance improves substantially, suggesting that the 1B budget is insufficient for 64k training and that a properly data-scaled 64k model would outperform the extrapolated 32k model by a wider margin. A limitation: the paper only tests 2× extrapolation (32k → 64k). We do not know whether NTK-32K would continue to extrapolate to 128k or 256k, or where the mechanism breaks down. The dynamic scaling formula provides progressively more aggressive frequency compression as length increases, but at some point the compression would degrade positional resolution so severely that retrieval becomes impossible. The paper does not explore this boundary, which is an open question for future work. #### Does the paper demonstrate that perplexity correlates with downstream task performance under controlled conditions? Partially. The correlation is clear for exact attention methods across all three benchmarks in Figure 4 — lower perplexity is associated with higher downstream accuracy. But the paper's claim that "perplexity as a general-purpose performance indicator even in longer-context tasks" is qualified: the correlation holds for exact methods, breaks for approximate methods (which can have competitive perplexity but poor retrieval), and the strength of the correlation varies by benchmark (strongest for NIAH and RULER, weaker for LongBench). The paper does not report correlation coefficients, R² values, or statistical significance tests for Figure 4. The linear fits are overlaid by eye (or via unspecified fitting procedure), and the claim of correlation is based on visual inspection. For a paper whose central methodological contribution is controlled comparison, this is a notable omission — the correlation between perplexity and downstream performance should be quantified, not just plotted. The strength of the paper's claim would be substantially increased by reporting Pearson or Spearman correlation coefficients with confidence intervals. A deeper issue: the paper's argument that previous studies found no correlation due to uncontrolled confounds is plausible but not directly tested. To *demonstrate* that confounds explain the prior negative results, the paper would need to replicate those confounds (e.g., mixing different base models, training on different data, using different evaluation protocols) and show that the correlation disappears — then remove the confounds and show it reappears. The paper does not run this experiment. Instead, it shows a correlation under controlled conditions and attributes prior null results to uncontrolled conditions, which is a reasonable inference but not a demonstrated causal mechanism. #### Does the paper demonstrate that frozen methods are inadequate for substantial context extension? Yes, with the strongest evidence for NTK-Frozen and the most important qualification for Self-Extend. NTK-Frozen achieves 14.52 perplexity at 32k (Table 2) — more than 2× worse than fine-tuned NTK-32K — and 0.72 RULER (Table 3) — essentially zero. This conclusively shows that RoPE frequency scaling without fine-tuning does not enable meaningful long-context processing. The NIAH heatmap (Figure 1) shows NTK-Frozen has some retrieval capability up to ~8k but fails beyond that — a modest extension (2× the pretraining length) but far short of the 8× target. Self-Extend complicates the picture. As a frozen method, it achieves 33.62 LongBench (competitive with fine-tuned exact methods), 29.50 RULER (substantially better than any other frozen method but far below fine-tuned), and 6.11 perplexity (better than NTK-32K at 6.79? — no, wait: NTK-32K is 5.79, better; Self-Extend is 6.11). Self-Extend demonstrates that a frozen method *can* achieve non-trivial long-context performance — just not competitive with fine-tuned exact methods on retrieval-heavy tasks. The paper's "frozen methods fail" narrative is therefore too broad: frozen methods with clever position mapping (Self-Extend) partially succeed, while frozen methods with naive scaling (NTK-Frozen) completely fail. The distinction matters for practitioners who cannot fine-tune — Self-Extend offers a viable path, albeit with significant accuracy costs. #### What is genuinely missing from the experimental design? 1. **Larger base models**: All experiments use LLaMA2-7B (and Phi-2-2.7B for replication). Context extension behavior may differ at larger scales (13B, 70B) where the base model has more capacity to adapt to out-of-distribution positions. The paper acknowledges this limitation (Section 7) but does not provide even a single larger-model datapoint. This is important because the practical decision facing many practitioners is not "which extension method for a 7B model?" but "should I extend a 7B model or use a larger model with its native context?" — a question the paper's experimental design cannot address. 2. **Longer context lengths**: The paper focuses on 4k → 32k extension with some 64k evaluation. Modern production models target 128k, 256k, or 1M token contexts. Do the findings scale? Does Dynamic NTK-RoPE continue to extrapolate to 128k from 32k training? Do approximate attention methods become *more* competitive at extreme lengths where exact attention becomes genuinely infeasible? The paper's 32k focus was a pragmatic choice given computational constraints, but it means the findings are most applicable to the 4k → 32k regime and may not transfer to the frontier of long-context research. 3. **Training data scale ablations**: The 1B token budget is fixed for all methods. While Appendix 9.4 shows that NTK-64K benefits from 2B tokens, the paper does not ablate training data scale for other methods or for 32k training. It is possible that some methods (e.g., YaRN, LongLoRA) would close the gap with NTK-32K if given more training data, and their underperformance is partly due to slower convergence rather than fundamental algorithmic limitations. The paper's standardized 1B budget ensures fairness but cannot distinguish between "method is inherently worse" and "method converges more slowly under this recipe." 4. **Hyperparameter sensitivity analysis**: The paper uses a fixed training recipe for all methods and acknowledges this may disadvantage certain methods (Section 7). But it does not quantify *how much* hyperparameter sensitivity varies across methods. A simple experiment — varying the learning rate by ±50% or the warmup duration — would reveal whether the performance gaps are robust to recipe perturbations or whether some methods are catastrophically sensitive while others are robust. This is particularly important for LongLoRA, where the paper speculates that sensitivity to training procedures explains the poor performance. 5. **Inference-time compute comparison**: Approximate attention methods offer computational savings during inference (e.g., LM-Infinite's attention cost is O(C'·(M+G)) vs. O(C'²) for exact attention). The paper mentions these savings qualitatively but never quantifies them in terms of wall-clock time, memory usage, or FLOPs. A FLOPs-matched comparison — e.g., "at a fixed inference compute budget, which method achieves the highest accuracy?" — would directly address the practical trade-off that motivates approximate attention in the first place. Without this, the paper's conclusion that approximate methods "systematically underperform" answers the accuracy question but not the efficiency question. A practitioner facing a hard latency constraint might choose a 10-point accuracy loss for a 5× speedup, and the paper provides no data to inform that decision. 6. **Statistical rigor**: All results are reported as point estimates. There are no confidence intervals, no significance tests, and no discussion of variance across evaluation examples or random seeds. For a paper with 500 evaluation examples per RULER subtask and varying numbers of LongBench examples, the precision of the reported averages is unknown. A difference of 1–2 points on LongBench (e.g., NTK-32K 35.32 vs. CLEX 33.48) may or may not be statistically significant, and the paper provides no tools to assess this. Given that one of the paper's contributions is establishing a reliable ranking of methods, the absence of uncertainty quantification weakens confidence in the precise ordering, particularly when differences are small. 7. **Missing combination experiments**: The paper studies exact and approximate attention as separate categories but never tests combinations. For example, training with exact attention but evaluating with a sliding window (or vice versa) would reveal whether the training-time attention pattern or the inference-time attention pattern is the critical factor for downstream performance. Similarly, combining Dynamic NTK-RoPE with a retrieval-augmented approach (like Landmark but using NTK as the base) might yield the best of both worlds — the paper does not explore these hybrids. 8. **No baseline of "just train longer natively"**: The paper compares extension methods to each other and to the 4k base model, but does not include a model pretrained from scratch (or from a 4k checkpoint with continued pretraining) at 32k without any position embedding modifications. It is possible that simply continuing to train the LLaMA2-7B model on the 1B-token long-context dataset with *no RoPE scaling at all* — letting the model adapt to out-of-distribution positions through training alone — would work as well as or better than the scaling methods. This baseline would test whether RoPE modification is even necessary for context extension, or whether continued training alone suffices. The paper does not include this experiment. 9. **Attention pattern visualization**: The paper's claims about why approximate methods fail (e.g., "LM-Infinite cannot retrieve what it cannot see") are mechanistically interpretable but not directly verified. Visualizing the actual attention patterns — which tokens each method attends to for representative long-context queries — would provide direct evidence for the proposed failure modes. The paper relies on behavioral outcomes (NIAH heatmaps, RULER scores) to infer mechanisms, which is standard but leaves open alternative explanations (e.g., maybe LM-Infinite fails not because it can't *see* the needle but because the position capping distorts the attention distribution in ways that prevent effective retrieval even when the needle *is* in the local window, which the RULER results for LM-Infinite at 4k — where it achieves 81.05, nearly matching the base model — argue against, but the point is that we don't know for certain without attention visualization). #### Summary of claim-to-evidence mapping - **"Exact fine-tuned methods outperform approximate attention": Strongly supported** within the 32k regime for the four approximate methods tested, with the important qualification that Self-Extend is competitive on tasks that do not require precise long-range retrieval. - **"Dynamic NTK-RoPE extrapolates to 64k": Supported**, with evidence that performance degrades modestly (22% relative on RULER) at 2× extrapolation but remains functional. Whether extrapolation continues to longer lengths is untested. - **"Perplexity correlates with downstream performance": Supported with qualifications** — the correlation is visually clear for exact methods in Figure 4 but not statistically quantified, and approximate methods systematically deviate. - **"Frozen methods are inadequate": Oversimplified** — NTK-Frozen is indeed inadequate (near-zero RULER at 32k), but Self-Extend (frozen) achieves non-trivial performance (29.50 RULER, 33.62 LongBench), making it a viable option when fine-tuning is impossible, albeit with clear accuracy costs. - **"Context extension hurts short-sequence performance": Supported** by the perplexity degradation at 2k–4k for PI, YaRN, CLEX, and LongLoRA (Table 2), though the paper does not test this on downstream tasks at short lengths (only perplexity), which limits the practical significance of the finding. - **"1B tokens is insufficient for 64k training": Supported** by the NTK-64K 1B vs. 2B comparison (Appendix 9.4, Figure 5), but the paper does not test whether the 1B budget is also a bottleneck for 32k training (it may be that some methods would surpass NTK-32K with more data). ## 6. Limitations and Trade-offs ### 6.1 Single Base Model and Single Model Scale **The constraint.** Every experiment in the main paper uses LLaMA2-7B as the starting checkpoint. The paper acknowledges this directly in Section 7: "As we are limited by computing budget, we only experiment with Llama-2-7B as our base model. The findings in this paper may not generalize to other, possibly larger, base models." The secondary replication uses Phi-2-base (2.7B parameters, Appendix 9.1), a smaller model from a different family, but no experiments are conducted at 13B, 70B, or with non-LLaMA/Phi architectures such as Mistral or Qwen. **The consequence.** The paper's central findings — that Dynamic NTK-RoPE with fine-tuning dominates, that approximate attention systematically underperforms, that frozen methods fail beyond minimal extension, and that extrapolation from 32k to 64k is viable — are all established at the 7B scale. Larger models may exhibit different behavior for at least three reasons. First, larger models have more capacity to adapt to out-of-distribution position embeddings, potentially making frozen methods like Self-Extend or even NTK-Frozen more competitive — the Phi-2 replication (Table 6) shows larger relative gaps between fine-tuned and frozen methods than the LLaMA2-7B results, suggesting the gaps may narrow at larger scales, but this is untested in the upward direction. Second, the computational trade-off between exact and approximate attention shifts with model size: exact attention at 32k for a 70B model is substantially more expensive than for a 7B model, making approximate methods more practically attractive. Third, larger models may converge differently on the 1B-token fine-tuning budget — a 70B model might require more data to adapt to extended positions, or might adapt faster per token, and neither possibility is explored. **Evidence in the paper.** The Phi-2-base replication (Appendix 9.1) provides the only cross-model evidence. The qualitative patterns replicate — NTK-32K outperforms all other methods on RULER at 32k (32.06 vs. CLEX 25.46 vs. PI 4.78, Table 6), and NTK-32K extrapolates to 64k (12.84). But the *magnitude* of gaps differs: the gap between NTK-32K (32.06) and CLEX (25.46) on Phi-2 RULER is ~7 points, while on LLaMA2-7B it is ~7 points (59.42 vs. 52.17, Table 3) — proportional gaps are harder to compare at different absolute performance levels. The paper provides no principled way to extrapolate these findings to larger scales. **Mitigation status.** The paper does not attempt to address this limitation beyond the Phi-2 replication and the explicit acknowledgment in Section 7. It does not propose a scaling trend, a theoretical argument for why findings should or should not transfer, or a plan for future larger-model experiments. A practitioner considering context extension for a 13B or 70B model must decide whether to trust the 7B findings or run their own controlled comparison, which is exactly the kind of expensive evaluation burden the paper's framework was designed to eliminate. --- ### 6.2 Difficulty Estimation Cost Is Unaccounted for in Practical Deployment **The constraint.** The paper's controlled comparison framework requires that all methods be evaluated under identical conditions — same base model, same training data, same hyperparameter recipe. This is methodologically essential for the paper's scientific contribution, but it creates a gap between the experimental findings and practical deployment guidance. Specifically, the paper's grid search over Dynamic NTK-RoPE scale factors (Appendix 9.5, Table 9) reveals that the optimal scale factor varies substantially with evaluation length and with whether the model was fine-tuned (NTK-Frozen vs. NTK-32K vs. NTK-64K). The paper arrives at its Dynamic NTK settings ($s = C'/(2C)$, scale factor 29.0 for 32k, 61.0 for 64k extrapolation) through this grid search and through following Fu et al. (2024). A practitioner deploying Dynamic NTK-RoPE on a different base model, with different fine-tuning data, at a different target length would face the same grid search problem — and the paper provides no method for selecting the scale factor without running such a search. **The consequence.** The paper reports Dynamic NTK-32K as the best-performing method (35.32 LongBench, 59.42 RULER, 83.7% NIAH), but these numbers are achieved with a specific scale factor (29.0 at 32k) that was determined through hyperparameter optimization. A practitioner who uses a different scale factor — even one derived from the same formula but without the benefit of the paper's grid search validation — may achieve substantially worse results. Table 9 makes this concrete: for NTK-32K at 32k on PG19, a scale factor of 13 gives perplexity 8.35 while a scale factor of 29 gives 6.82 — a 1.53-point perplexity gap that would translate to significant downstream accuracy differences (as Figure 4 shows, perplexity and downstream performance are strongly correlated for exact methods). The paper does not report how sensitive its headline results are to the scale factor choice. This is a **hidden deployment cost**. The paper's controlled comparison absorbed the cost of optimizing each method's hyperparameters (the grid search for NTK, the fixed recipe for others), but a new deployment would need to either replicate that optimization or accept unknown performance degradation. The paper does not quantify this cost, and the headline "NTK-32K is best" finding is conditional on the optimization having been done. **Evidence in the paper.** Table 9 (Appendix 9.5) directly demonstrates scale factor sensitivity. For NTK-Frozen at 8k, a scale factor of 3 gives perplexity 7.99 while a factor of 7 gives 9.26 — both are "reasonable" choices that produce very different results. For NTK-32K at 64k, scale factor 29 gives 9.11, factor 61 gives 6.63, and factor 125 gives 6.83 — an optimal region that must be found through search. The paper's chosen scale factor of 61.0 for NTK-32K at 64k (Table 8) is the result of this search, not an independently derived optimum. **Mitigation status.** The paper does acknowledge the short-sequence degradation caused by fixed scale factors (Section 4: "this base factor significantly degrades continual fine-tuned models, particularly causing performance deterioration in shorter sequences"), and Dynamic NTK's adaptive scaling is presented as the solution. But Dynamic NTK itself has hyperparameters (the scaling formula, the $s$ parameter) that were tuned through grid search. The paper does not propose a method for hyperparameter-free scale factor selection — for example, a heuristic based on training length, a learned predictor, or a robustness analysis showing that a broad range of scale factors produce similar results. The grid search remains an implicit cost that a practitioner would need to replicate. --- ### 6.3 The 1B-Token Fine-Tuning Budget Is a Computational Constraint, Not a Proven Sufficient Budget **The constraint.** All fine-tuned methods in the main comparison are trained on exactly 1B tokens from the SlimPajama-based long-context mixture. The paper is transparent that this is a computational constraint, not a theoretically motivated choice: the training uses 8 NVIDIA A100 GPUs, and the 1B budget enables broad comparison at a feasible cost. The paper acknowledges in Section 7 that "longer models require more tokens for effective training." However, the 1B budget is applied uniformly to all 32k methods without testing whether it is sufficient to reach convergence for each method individually. **The consequence.** The relative ranking of methods may be confounded by differential convergence rates. A method that converges slowly but would eventually surpass NTK-32K with more training data would appear inferior in the paper's comparison. Conversely, a method that converges quickly might look competitive at 1B tokens but fail to improve further, while slower-converging methods would eventually overtake it. The paper cannot distinguish between "method X is fundamentally worse than method Y" and "method X converges more slowly than method Y under the fixed training recipe." This is not a hypothetical concern. Appendix 9.4 (Figure 5) provides direct evidence: NTK-64K trained on 2B tokens shows "significant performance improvement" on NIAH compared to the 1B-token version, with the heatmap transitioning from patchy to solid green at 64k. This proves that training data scale is a binding constraint at 64k. It is plausible — but untested — that some 32k methods would similarly benefit from additional data and potentially change the relative ranking. For example, YaRN's NTK-by-parts scaling introduces more hyperparameters ($p$, $q$, $T$) that may require more data to optimize effectively; LongLoRA's sparse-attention training signal may be noisier and require more steps to converge. Without data scale ablations at 32k, the possibility of differential convergence cannot be ruled out. **Evidence in the paper.** The NTK-64K 1B vs. 2B comparison (Appendix 9.4) is the only data scale ablation, and it is performed only for one method (NTK) at one length (64k). For 32k training, no data scale ablation is reported for any method. The paper's choice of 1B tokens is based on Fu et al. (2024), who used this budget for 128k context extension — a substantially harder task — which might suggest 1B is generous for 32k. But this is speculative; the paper does not provide learning curves, validation loss trajectories, or any other convergence diagnostic that would demonstrate sufficiency. **Mitigation status.** The paper acknowledges the limitation in Section 7 ("We only fine-tuned models to context sizes of 32k, and generalization behaviors to longer contexts may differ when training contexts are longer") but does not discuss the possibility of differential convergence at 32k. The standardized budget is presented as a feature of the controlled comparison (ensuring fairness), not as a potential confound. The paper does not suggest data scale ablations as future work, though the NTK-64K result implicitly demonstrates their importance. --- ### 6.4 No FLOPs-Matched or Latency-Matched Comparison Between Exact and Approximate Methods **The constraint.** The paper evaluates exact and approximate attention methods solely on accuracy metrics — perplexity, retrieval success, downstream task scores. Approximate attention methods are motivated by computational efficiency: LM-Infinite reduces attention cost from $O(C'^2)$ to $O(C'(M+G))$; LongLoRA reduces training cost via sparse attention and LoRA; Landmark Attention reduces inference cost via two-stage retrieval. The paper mentions these efficiency motivations qualitatively (Section 3.3) but never quantifies the actual speedups or memory savings, and never compares methods at matched computational budgets. **The consequence.** The paper's central finding — "approximate attention methods systematically underperform" — answers only the accuracy half of the accuracy-efficiency trade-off. A practitioner facing a hard latency constraint (e.g., real-time chat with a 200ms response budget) or a hard memory constraint (e.g., serving on a single consumer GPU) may be willing to accept a 50% accuracy degradation for a 5× inference speedup. The paper provides no data to evaluate whether this trade-off is favorable — it simply shows accuracy is lower, which is expected given that approximate methods restrict information access. The interesting question — "how much accuracy do I lose per unit of compute saved?" — is not addressed. The omission is particularly significant for longer contexts. At 32k, exact attention on a 7B model is expensive but feasible on modern hardware (the paper trains at this length on 8 A100s). At 128k or 256k, exact attention becomes substantially more expensive, and approximate methods may become not just attractive but necessary. The paper's finding that approximate methods underperform at 32k does not tell us whether the gap widens, narrows, or remains constant as context length grows — and at what length approximate methods become the only practical option regardless of accuracy. **Evidence in the paper.** None. The paper reports no wall-clock time, no FLOP counts, no memory usage measurements, and no throughput numbers for any method during inference. The computational cost is discussed only in qualitative terms (Section 3.3 describes the asymptotic complexity of each approximate attention mechanism). The training cost is implicitly equalized through the 1B-token budget, but inference cost — which dominates deployment economics — is not measured. **Mitigation status.** The paper does not attempt to address this gap. It does not frame the approximate-exact comparison as a trade-off to be characterized, and it does not suggest FLOPs-matched or latency-matched evaluation as future work. The abstract states that "current approximate attention methods systematically underperform across long-context tasks" — an unqualified accuracy claim that, without efficiency context, could lead practitioners to dismiss approximate methods that would actually be optimal for their deployment constraints. --- ### 6.5 Restricted Context Extension Range (4k → 32k) with Minimal Testing of the Extrapolation Frontier **The constraint.** The paper focuses on extending context from 4k to 32k tokens. Extrapolation is tested only at 64k — a 2× extension beyond the training length. The paper acknowledges this constraint: "We only fine-tuned models to context sizes of 32k" (Section 7). Modern production systems increasingly target 128k, 256k, or 1M-token contexts (e.g., GPT-4-128k, Claude-200k, Gemini-1M), and the paper's findings may not transfer to these substantially longer regimes. **The consequence.** The paper's positive finding on extrapolation — that Dynamic NTK-32K successfully handles 64k sequences — is established only for 2× extrapolation. We do not know whether this extrapolation continues to 128k (4×) or 256k (8×), or where the mechanism breaks down. The Dynamic NTK scaling formula (Section 3.2) applies progressively more aggressive frequency compression as sequence length increases: at 64k, the scale factor is 61.0; at 128k, it would be approximately 125; at 256k, approximately 253. At some compression threshold, positional resolution becomes too coarse for the model to distinguish relevant positions — adjacent tokens become indistinguishable, and retrieval becomes impossible. The paper does not identify this threshold or characterize how performance degrades as compression increases. This matters for two reasons. First, it means the paper cannot tell us whether Dynamic NTK-RoPE is a viable approach for the context lengths that frontier models are targeting — 32k was ambitious in early 2023 but is modest by late-2024 standards. Second, it means we do not know whether the approximate attention methods that performed poorly at 32k would become *relatively more attractive* at extreme lengths. LM-Infinite's performance is independent of total sequence length (it always attends to 4106 tokens), so while it achieves only 12.34 RULER at 32k, it maintains that same performance at 64k (10.56) and would presumably maintain it at 128k — while exact attention methods would need to extrapolate further and further from their training distribution. At some length, the extrapolated exact method might drop below the constant approximate method, but the paper provides no data to locate that crossover. **Evidence in the paper.** The 64k evaluations (Tables 2–3, Figures 1–2) provide the only evidence about extrapolation behavior. NTK-32K's RULER drops from 59.42 at 32k to 46.26 at 64k — a 22% relative decline per 2× length increase. If this decline continues linearly (an untestable assumption without longer-length data), performance would reach near-zero at approximately 256k. But the decline may accelerate (if positional resolution degrades nonlinearly) or plateau (if the model learns to rely on patterns that are robust to compression). The paper provides no basis for choosing among these possibilities. **Mitigation status.** The paper acknowledges the limited context range as a limitation (Section 7) but does not discuss the implications for the extrapolation findings or suggest longer-length testing as priority future work. The 64k evaluations are presented as evidence of successful extrapolation, without qualification about how much further the mechanism might extend. A reader primarily interested in 128k+ contexts would need to run their own experiments, using the paper's framework but at much greater computational expense. --- ### 6.6 No Within-Document Attention Analysis or Mechanistic Verification of Failure Modes **The constraint.** The paper attributes the poor performance of approximate attention methods to mechanistic causes — LM-Infinite fails because its sliding window cannot access information beyond the most recent 4k tokens; Landmark Attention fails because the chunk-level landmark summaries lose information; LongLoRA fails because sparse attention during training provides an insufficient signal for learning long-range dependencies. These attributions are plausible and consistent with the behavioral evidence (NIAH heatmaps showing retrieval only within local windows, RULER subtask patterns), but they are inferred rather than directly observed. The paper does not visualize attention patterns, measure what fraction of relevant information is actually *reachable* through each method's attention mechanism for specific task queries, or experimentally isolate the proposed failure mechanisms. **The consequence.** Without mechanistic verification, alternative explanations for the performance gaps remain possible. For instance, LM-Infinite's poor RULER performance might be partially caused by the position capping ($\min(n-m, C)$) rather than the restricted attention window — the capping distorts relative position information even for tokens *within* the local window, which could impair retrieval even when the needle is visible. Landmark Attention's performance might be limited not by the chunk compression bottleneck but by the specific training configuration (512-token training context, 64-token block size) that was used — different hyperparameters might yield substantially different results, independent of the retrieval mechanism. LongLoRA's degradation might reflect an interaction between LoRA and the specific fine-tuning data mixture rather than a fundamental limitation of sparse-attention training. Distinguishing among these explanations matters for two reasons. First, it guides future research: if LM-Infinite fails primarily because of position capping, then a sliding-window method without capping (or with a better capping scheme) might close much of the gap with exact attention. Second, it informs practitioners about which aspects of a method can be modified or improved versus which are fundamental limitations. The paper's behavioral evaluation tells us *that* approximate methods underperform but not precisely *why*, which limits the actionable guidance for developing better approximate methods. **Evidence in the paper.** The NIAH heatmaps (Figure 1) provide the strongest behavioral evidence: LM-Infinite's retrieval succeeds only at depths near 100% (the most recent tokens), which is consistent with a sliding window mechanism but does not rule out contributions from other factors. The RULER subtask breakdowns (Tables 12–16) show that LM-Infinite performs well at 4k (81.05, Table 12) — where the entire sequence fits within the local window — and degrades sharply at 8k (30.01, Table 13), which is consistent with the window boundary but could also be explained by position capping effects that begin at 8k. The paper does not run the ablation that would cleanly separate these mechanisms: evaluating LM-Infinite with the sliding window but *without* position capping (or vice versa) at lengths where both modifications matter. **Mitigation status.** The paper does not attempt mechanistic verification or ablation of hypothesized failure modes within approximate attention methods. The attributions (e.g., "LM-Infinite... fails to generalize beyond 4k... because the LM-Infinite method focuses on a context window of only 4k, resulting in poor retrieval ability for longer contexts," Section 6) are presented as conclusions from the behavioral evidence rather than as hypotheses requiring further testing. No attention visualization or mechanism-isolation experiments are proposed as future work. ## 7. Implications and Future Directions ### How This Work Changes the Landscape This paper does not propose a new algorithm, a new architecture, or a new training objective. Its contribution is methodological: it demonstrates that the field of long-context extension research has been operating without the controlled comparison infrastructure necessary to produce cumulative knowledge, and it constructs that infrastructure. The impact of this intervention depends on whether the community adopts it, but the paper makes three contributions that, taken together, change how researchers should think about context extension evaluation. **The shift from method-claiming to method-comparing.** Before this work, the standard paper in long-context extension introduced a new method (or variant) and evaluated it under bespoke conditions—its own base model, its own training data, its own hyperparameters, and its own chosen benchmarks. This produced a literature where every method looked competitive on its own terms and no reliable ranking existed. The paper's controlled framework—identical LLaMA2-7B checkpoint, identical 1B-token training corpus, identical recipe, identical evaluation suite—replaces this norm with one where claims about a method's quality must survive standardization. This is a **methodological paradigm shift**, not an incremental refinement. It is the long-context analog of what controlled clinical trials did for medical research: it separates treatment effects (the extension method) from confounding variables (the base model, the data, the tuning effort) that had made prior comparisons uninterpretable. The paper's own findings validate the necessity of this shift. Methods that appeared strong in their original papers—LM-Infinite, LongLoRA, Landmark Attention—perform substantially worse under controlled conditions than their original reports might lead a practitioner to expect (Table 1: LM-Infinite achieves 23.9% NIAH, 25.84 LongBench, 12.34 RULER; LongLoRA achieves 20.3%, 23.30, 3.53). This is not because the original papers were flawed; it is because they used configurations that made cross-paper comparison impossible. The controlled framework reveals that the apparent competitiveness of several popular methods was partly an artifact of uncontrolled variables—a diagnostic finding that only a systematic comparison could produce. **The resolution of the perplexity debate.** A significant methodological tension in long-context research has been whether perplexity—the cheapest and most widely available intrinsic metric—actually predicts downstream task performance. Prior work (Sun et al., 2021; An et al., 2023) reported weak or nonexistent correlation, implying that perplexity could not be trusted and that expensive full-benchmark evaluation was the only reliable path. The paper resolves this debate under controlled conditions, but with a critical qualification that constitutes a conceptual advance. For exact attention methods—where the model genuinely has access to the full context—perplexity correlates strongly with downstream performance across NIAH, LongBench, and RULER (Figure 4). The linear fits are visually clear, and the ranking of exact methods by perplexity matches their ranking by downstream accuracy. For approximate attention methods, the correlation breaks in mechanistically interpretable ways: LM-Infinite achieves competitive perplexity (6.71 at 32k, Table 2) but fails catastrophically on retrieval (12.34 RULER) because its sliding window cannot access most of the context; Landmark Attention shows the opposite pattern on some benchmarks. These deviations are not random noise—they are signatures of the information bottleneck each approximate method introduces. This finding reconciles the prior conflicting results by identifying the hidden variable: the attention mechanism. Prior studies that found no correlation were likely mixing exact and approximate methods (or using base models with different effective context windows) without controlling for this distinction. The paper's contribution is not just the empirical observation of correlation but the **diagnostic framework** that explains when and why perplexity is informative—and what supplementary metrics are required when it is not. For practitioners, this means perplexity is a reliable proxy for downstream quality when comparing exact attention methods, but retrieval-based evaluation (NIAH, RULER) is mandatory when evaluating approximate methods. **The consilience of evidence for exact fine-tuning as the dominant paradigm.** The paper's third landscape-changing contribution is the accumulation of consistent, cross-benchmark, cross-model-family evidence that **continual fine-tuning with exact attention and RoPE frequency scaling**—specifically Dynamic NTK-RoPE—is the most effective currently available approach for context extension within the tested 4k→32k regime. This finding emerges from five independent evaluation families (perplexity, NIAH, RULER, LongBench, many-shot ICL), two model families (LLaMA2-7B, Phi-2-base), and a range of context lengths (2k–64k). The convergence is unlikely to be an artifact of any single benchmark's idiosyncrasies. This does not mean that approximate attention methods are useless. They remain relevant for deployment scenarios where the computational cost of exact attention at long contexts is prohibitive—the paper simply does not quantify the cost-accuracy trade-off (see Section 6.4). But the paper redirects research attention: before this work, approximate attention methods were presented as general-purpose alternatives to exact attention, and a researcher might reasonably invest effort in improving them. After this work, the evidence suggests that approximate methods face a fundamental accuracy ceiling that exact fine-tuned methods do not, at least at the 32k scale and for retrieval-intensive tasks. Improving approximate attention to close this gap is a valid research direction, but the paper's findings make clear that the gap is large (2–5× on retrieval benchmarks) and mechanistically grounded (information loss from restricted attention), not a matter of minor tuning. Researchers interested in maximizing long-context capability should focus primarily on exact attention methods, with approximate approaches reserved for regimes where exact attention is genuinely infeasible. ### Follow-Up Research This Work Enables **Extending the controlled comparison to 128k, 256k, and beyond.** The paper establishes the 4k→32k regime as a proving ground, but the practical frontier has moved to substantially longer contexts. A direct extension would replicate the paper's protocol—identical base model, identical training data mixture (scaled up), identical evaluation suite (extended with longer-context benchmarks)—at target lengths of 128k and 256k, ideally on a model larger than 7B to test scale-dependent effects. The key questions this would answer: (1) Does Dynamic NTK-RoPE continue to extrapolate from 32k training to 128k evaluation, or does the required frequency compression eventually destroy positional resolution? The Dynamic NTK formula implies progressively larger scale factors at longer lengths (approximately 125 at 128k, 253 at 256k), and at some point adjacent positions become indistinguishable—identifying that threshold would establish the practical limit of RoPE-based extension without architectural changes. (2) Do approximate attention methods become relatively more attractive as exact attention costs grow quadratically? At 128k, a FLOPs-matched comparison (same inference compute budget, different attention mechanisms) might reveal crossover points where a well-designed approximate method matches or exceeds an exact method that has been aggressively compressed through Dynamic NTK extrapolation. (3) Does the 1B-token budget that sufficed at 32k become a binding constraint at longer lengths, and if so, does the relative ranking of methods change with data scale? **Mechanistic ablation of approximate attention failure modes.** The paper attributes the poor performance of approximate methods to specific mechanisms—sliding window information loss for LM-Infinite, chunk compression for Landmark, sparse training signal for LongLoRA—but these attributions are inferred from behavioral outcomes rather than directly tested. A follow-up study would systematically ablate each component of each approximate method to isolate the primary failure driver. For LM-Infinite: evaluate with the sliding window but *without* position capping (using the true relative positions for tokens within the window), and with position capping but *without* the sliding window (allowing full attention but capping all relative positions to the pretraining maximum), at lengths from 4k to 32k on RULER. If performance recovers substantially when capping is removed, the capping is the primary bottleneck; if it does not, the window itself is the limiting factor. For Landmark Attention: evaluate with varying numbers of landmark tokens per chunk (controlling the compression ratio) and varying chunk sizes, measuring whether retrieval accuracy scales with landmark capacity or plateaus, which would indicate whether the bottleneck is the landmark summarization or the retrieval mechanism. For LongLoRA: train with the same LoRA adapters but using full attention instead of sparse block attention, to test whether the performance degradation is due to sparse training or to LoRA's limited capacity. These experiments would transform the paper's behavioral findings into mechanistic understanding, enabling targeted improvement of approximate methods rather than trial-and-error. **Data scale ablations at 32k to separate convergence rate from algorithmic quality.** The paper's uniform 1B-token budget ensures fairness but cannot distinguish between "method X is fundamentally worse" and "method X converges more slowly under this recipe." A straightforward follow-up would train all methods at 32k with budgets of 250M, 500M, 1B, 2B, and 4B tokens (or until validation perplexity plateaus for each), producing learning curves that reveal differential convergence behavior. The key metric is not just final performance but **data efficiency**—how many tokens does each method require to reach, say, 90% of its asymptotic performance? If YaRN or CLEX requires 4B tokens to match NTK-32K's performance at 1B tokens, that is a practically important finding (the method works but is data-hungry) that the current 1B-fixed comparison cannot reveal. If LongLoRA's learning curve never approaches exact methods' performance regardless of data scale, that confirms a fundamental algorithmic limitation. The NTK-64K 1B vs. 2B comparison (Appendix 9.4) demonstrates that data scale matters—extending this analysis to 32k and to all methods would substantially increase the practical utility of the paper's framework. **Developing cheap, reliable difficulty estimation for context extension.** A hidden cost in the paper's framework is hyperparameter selection for Dynamic NTK-RoPE: the optimal scale factor varies with evaluation length and requires grid search to determine (Appendix 9.5, Table 9). A follow-up could train a lightweight predictor—a small MLP or even a linear model—that takes as input the target context length, the training context length, and the base model's RoPE configuration (base frequency, number of dimensions), and outputs the recommended Dynamic NTK scale factor $s$. The training data for this predictor would be generated by running the paper's grid search protocol across multiple model scales, base frequencies, and extension ratios. If such a predictor achieves scale factor recommendations within, say, 10% of the grid-search optimum (where Table 9 suggests a 10% scale factor difference produces <0.5 perplexity change), it would eliminate the need for practitioners to perform their own expensive grid search. This is the inference-time analog of learning rate predictors for training, and it would substantially lower the barrier to deploying Dynamic NTK-RoPE on new model configurations. **Testing whether continued pretraining without RoPE modification suffices for context extension.** The paper's exact attention methods all modify the RoPE frequency basis—they assume that out-of-distribution position embeddings are the core problem and that scaling frequencies to keep embeddings in-distribution is the solution. A critical missing baseline is: **continue training LLaMA2-7B on the same 1B-token long-context dataset with no RoPE modification at all**, letting the model adapt to out-of-distribution position embeddings through gradient descent alone, and compare against NTK-32K. This experiment would test whether RoPE modification is actually necessary, or whether continued training alone is sufficient—a question with direct implications for whether future models should bake extension mechanisms into pretraining or rely on post-hoc adaptation. If the no-modification baseline performs comparably to NTK-32K, the entire paradigm of RoPE scaling for context extension is called into question. If it fails catastrophically (perplexity explosion, zero retrieval), the necessity of position embedding adjustment is empirically confirmed. **Combining exact attention fine-tuning with retrieval-augmented generation for extreme contexts.** The paper studies exact and approximate attention as separate categories, but a natural hybrid is Dynamic NTK-RoPE fine-tuning combined with a lightweight retrieval step for contexts that exceed the fine-tuned length. For example: fine-tune with Dynamic NTK at 32k; at inference, when a sequence exceeds 32k, chunk it into overlapping 32k segments, process each with exact attention, and use a learned or heuristic retrieval mechanism to select which chunks' representations to attend to when generating. This hybrid would leverage exact attention's high accuracy within the trained range while using retrieval as a fallback for the extrapolation regime, potentially avoiding the positional-resolution collapse that pure Dynamic NTK extrapolation would eventually encounter at extreme lengths (128k+). The experiment would measure whether the retrieval step introduces less accuracy degradation than the Dynamic NTK frequency compression at equivalent lengths—establishing the Pareto frontier of the accuracy-efficiency trade-off. ### Practical Applications and Downstream Use Cases **Standardized model selection for long-context deployments.** Any organization deploying an LLM for long-context tasks—document QA, legal contract analysis, scientific literature review, many-shot ICL for classification—faces a method selection problem: which context extension approach to use on their base model. Before this paper, that decision was made based on incomparable numbers from disparate papers. After this paper, a practitioner with a LLaMA2-7B (or similar) base model, a 32k context target, and a task distribution that includes retrieval-intensive work can directly consult the paper's tables: Dynamic NTK-RoPE with fine-tuning achieves 83.7% NIAH, 59.42 RULER, and 35.32 LongBench (Table 1), substantially outperforming the next-best method (CLEX at 71.1%, 52.17, 33.48). If the practitioner's deployment is latency-sensitive and retrieval is rare, Self-Extend offers a frozen alternative at 33.62 LongBench with no training cost, albeit with significant retrieval degradation (25.8% NIAH). The framework turns method selection from guesswork into an engineering decision with transparent trade-offs. **Cost-aware training for long-context models.** The paper's findings on data scale (Appendix 9.4: NTK-64K requires 2B tokens for satisfactory NIAH performance, not the 1B that sufficed for 32k) and on short-sequence degradation (Section 4, Innovation 5: PI, YaRN, CLEX all degrade perplexity at 2k–4k relative to the base model; only Dynamic NTK preserves it) provide concrete guidance for training budget allocation. An organization planning to extend a 4k model to 64k should budget at least 2B tokens of long-context data (likely more for larger models) and should expect to pay a compute cost proportional to the extended length. They should also evaluate their model on short sequences post-extension and, if they observe degradation, switch to Dynamic NTK-RoPE (which the paper shows largely avoids this cost) rather than accepting it as inevitable. The paper's grid search over scale factors (Table 9) provides a template—not a turnkey solution, but a template—for the hyperparameter optimization that any new deployment will require. **Benchmarking and evaluation infrastructure for the long-context community.** The paper's open-source release of code, models, and checkpoints (via the GitHub repository) provides the community with a shared evaluation scaffold. A research group proposing a new context extension method can run the paper's evaluation suite on their method and report numbers that are directly comparable to the paper's tables, rather than creating yet another incompatible set of benchmarks. This lowers the barrier to entry for responsible evaluation and makes it harder for new methods to claim superiority through cherry-picked metrics. The evaluation suite—combining perplexity on PG19/Proof-pile, NIAH heatmaps, RULER aggregates and subtask breakdowns, LongBench per-task scores, and many-shot ICL—captures complementary dimensions of long-context capability (local language modeling, arbitrary-position retrieval, multi-hop reasoning, task-specific utilization) that together provide a comprehensive profile. Adoption of this suite as a community standard would accelerate progress by enabling direct comparison across papers.