Prefix Sliding for efficient test-time scaling
Abstract: Test-time scaling uses extra test-time compute to improve performance, such as letting LLMs reason longer when solving a problem. As models keep the entire reasoning trace in memory via full attention, hard tasks that need long thinking can be prohibitively expensive. However, we find most intermediate reasoning tokens lose importance as the model continues reasoning. This calls into question whether retaining them is worth the cost. Based on this insight, we propose Prefix Sliding, which discards tokens during reasoning that are not part of the prefix or the window of the last few thousand tokens. The prefix has key instructions and tools available to the model, while the most recent tokens are the current reasoning the model is working on. This caps the total memory requirement regardless of how long the model reasons, allowing for efficient long-horizon test-time scaling. Without training, Prefix Sliding can make existing models 3x faster while maintaining performance. Training with Prefix Sliding using reinforcement learning can achieve better performance by enabling scaling to reasoning traces beyond a hundred thousand tokens. Ablations show Prefix Sliding outperforms summarizing intermediate tokens or vanilla sliding window. Our code is at https://github.com/Muennighoff/prefix-sliding
Paper Prompts
Sign up for free to create and run prompts on this paper.
Top Community Prompts
Explain it Like I'm 14
1. What is this paper about?
This paper introduces a technique called Prefix Sliding. It is designed to help AI LLMs think through difficult problems for a long time without becoming extremely slow or using too much computer memory.
When a LLM solves a hard math or coding problem, it may write a long “thinking process” before giving an answer. Normally, the model keeps every word it has written and checks all of them whenever it creates the next word. This is called full attention.
The problem is that the longer the model thinks, the more expensive each new word becomes. Prefix Sliding offers a simpler solution: keep the important instructions at the beginning and only the most recent part of the model’s thinking.
2. What questions did the researchers investigate?
The researchers mainly wanted to know:
- Can an AI forget older parts of its thinking without losing its ability to solve a problem?
- Which parts of the text are most important: the instructions at the beginning, the recent thoughts, or every thought ever written?
- Can Prefix Sliding make LLMs faster while keeping their answers accurate?
- Does the method work with existing models, without training them again?
- Can it help models think for extremely long periods, such as more than 100,000 tokens?
- How does it compare with other methods, such as deleting old text or making summaries?
A token is a small piece of text, such as a word, part of a word, or punctuation mark.
3. How did the researchers test the idea?
The basic idea
Imagine a student solving a long math problem on a whiteboard.
- At the top of the board are the original instructions and the question.
- At the bottom are the student’s newest calculations.
- In the middle are many old calculations that may no longer be needed.
Prefix Sliding keeps:
- The prefix: the original instructions, task, and important information at the beginning.
- A sliding window: the most recent few thousand tokens of the model’s reasoning.
As the model continues thinking, the window moves forward. Old middle sections disappear, but the original instructions remain available.
For example, if the prefix contains 100 tokens and the window holds 4,096 tokens, the model stores at most about 4,196 tokens, even if it eventually produces hundreds of thousands of tokens.
The experiments
The researchers:
- Used the
Qwen3-1.7BLLM. - Tested several window sizes, from 512 to 16,384 tokens.
- Used special GPU software called FlashAttention to make the calculations faster.
- Compared Prefix Sliding with:
- Full attention, which keeps everything.
- Ordinary sliding windows, which keep only recent text and may forget the original instructions.
- Last-k methods, which occasionally delete almost everything except the last part.
- Summarization methods, which replace old reasoning with a shorter summary.
- Tested the models on difficult math, science, and reasoning tasks, including
GPQA,MATH500, andAIME25. - Ran many attempts for each problem—usually 64—to get more reliable measurements.
- Trained some models using reinforcement learning, a method similar to giving the model rewards when it produces correct answers.
The researchers also studied training efficiency. They used a technique called truncated backpropagation, where the model learns mainly from the final part of a very long reasoning sequence instead of trying to send the entire sequence through the training system.
4. What did they discover?
Prefix Sliding was much faster
Without additional training, Prefix Sliding made existing models about three times faster while maintaining similar performance to full attention.
Full attention becomes slower and more memory-hungry as the model’s reasoning gets longer. Prefix Sliding reaches a limit: once the prefix and window are full, producing another token costs roughly the same as producing the previous one.
This is similar to reading a notebook:
- Full attention requires rereading the entire notebook every time.
- Prefix Sliding keeps the instructions and the newest pages, so the model does not need to reread everything.
Older reasoning tokens often mattered less
The researchers observed that the model paid the most attention to:
- The first few tokens and the original instructions.
- Special markers showing that the model was thinking.
- The most recent tokens.
Many tokens in the middle of a long reasoning process received very little attention. This suggests that keeping every intermediate thought may waste memory and computing power.
The method worked better than simpler alternatives
Prefix Sliding performed better overall than ordinary sliding windows, deleting the last part of the context, or summarizing old reasoning.
The reason is that it combines two useful kinds of information:
- The beginning, which tells the model what task it is solving and what instructions or tools are available.
- The end, which shows what the model is currently working on.
A normal sliding window keeps only the end, so it may eventually forget the original problem. Summaries can preserve some information, but creating and rereading summaries takes extra time and they may leave out important details.
Training allowed extremely long reasoning
When Prefix Sliding was used during reinforcement learning, models could be trained on reasoning traces longer than 100,000 tokens. The researchers found that this could lead to higher rewards and better performance because the model could practice solving problems through much longer thinking processes.
The method has important limitations
Prefix Sliding did not work equally well on every task.
For coding tasks, the model might begin writing a function and then spend a very long time thinking in comments. If the beginning of the code moves outside the window, the model may forget important details. Such tasks may require a larger window, such as 16,384 tokens.
The method also provides little speed improvement for short answers. If a response is shorter than the window, Prefix Sliding behaves almost like full attention because no old tokens need to be removed yet.
It may also be difficult for tasks where the model must read a very large webpage, file, or other piece of information. If that information is larger than the window, some of it could be forgotten.
5. Why is this important?
The main result is that LLMs may not need to remember every single step of a very long thought process. Keeping the original instructions and the newest thoughts may be enough for many problems.
This could make AI systems:
- Faster, because they perform fewer calculations.
- Cheaper, because they need less GPU memory.
- Better at long tasks, such as difficult mathematics, programming, research, and planning.
- More practical for long-running AI agents, which may need to work for hours or days.
The idea is especially useful because it can be added to existing LLMs without retraining them. However, future systems may need extra memory tools for information that must remain available, such as code, documents, or facts from earlier conversations.
Simple conclusion
Prefix Sliding is like giving an AI a desk with limited space. The AI keeps the original assignment at the top and its newest notes in front of it, while throwing away old notes that no longer seem useful. This prevents the desk from becoming covered with paper.
The research suggests that this simple approach can let AI models think longer, faster, and with less memory. It is not perfect, because some tasks require remembering older details. Still, Prefix Sliding could be an important step toward AI systems that can work on very difficult problems for much longer periods.
Knowledge Gaps
Knowledge gaps, limitations, and open questions
The paper establishes the potential of Prefix Sliding but leaves several empirical, theoretical, and deployment-related questions unresolved:
- Limited model coverage: The main experiments rely heavily on Qwen3-1.7B, with only limited evidence from a 7B model; it remains unclear whether the method transfers to larger models, different architectures, attention designs, tokenizer schemes, and models with long-context training.
- Narrow task coverage: Evaluation focuses primarily on mathematical reasoning, GPQA, AIME25, MATH500, LiveCodeBench, and one health task. Performance on long-form writing, retrieval, multilingual reasoning, planning, tool use, document understanding, and interactive agents is not established.
- Unclear generality of the attention pattern: The claim that intermediate reasoning tokens lose importance is supported mainly by averaged attention visualizations from Qwen3 on an AIME trace. More work is needed to determine whether this pattern holds across models, layers, heads, tasks, decoding temperatures, and reasoning strategies.
- Attention is not shown to be a sufficient importance measure: The paper does not test whether tokens receiving low attention are genuinely dispensable. Causal token-removal experiments, activation- or attribution-based analyses, and comparisons with learned eviction policies are needed.
- No principled method for selecting the window size: Window sizes are manually chosen from a fixed set. The paper does not provide a task-adaptive or model-adaptive rule for selecting the smallest window that preserves accuracy.
- No dynamic eviction or memory expansion mechanism: Tokens that later become important cannot be recovered once evicted. The proposed method does not investigate promoting selected intermediate tokens into the prefix, storing compressed memories, or dynamically enlarging the window when uncertainty rises.
- Insufficient characterization of failure modes: The LiveCodeBench example demonstrates information loss, but the frequency, severity, and predictability of such failures across tasks are not quantified.
- Unresolved interaction with long-range dependencies: The theoretical receptive field is described as approximately $1.5W$ in practice, but the conditions under which information can propagate across many layers and windows are not formally characterized or experimentally validated across architectures.
- Position-embedding behavior remains uncertain: Continue PE is adopted because differences from Reset PE were reportedly insignificant in one setting. Its reliability for extremely long positions, different RoPE scaling methods, other positional encodings, and much longer rollouts is not established.
- Potential positional drift is unexplored: Continuing positional indices while repeatedly evicting tokens may create distribution shifts relative to pretraining. The paper does not assess whether this causes degradation, instability, or systematic errors at million-token horizons.
- Training gains are not cleanly attributed: The reinforcement-learning experiments combine Prefix Sliding with long rollouts and truncated backpropagation. It is unclear how much improvement comes from the memory mechanism, increased rollout length, altered optimization, or the custom training setup.
- Limited comparison of gradient-estimation strategies: Truncated backpropagation is evaluated with a fixed four-times-window context and on selected configurations. The effects of chunk size, truncation location, gradient accumulation, and full versus truncated backpropagation across tasks remain underexplored.
- Long-horizon RL stability is unknown: The paper demonstrates rollouts beyond 100,000 tokens but does not analyze training stability, reward hacking, repetition, mode collapse, credit assignment, or performance at substantially longer horizons.
- Reward and data limitations: Training uses a custom filtered mathematics dataset and GRPO. Generalization to naturally occurring data, noisy verifiers, non-verifiable tasks, other RL algorithms, and preference-based objectives is not demonstrated.
- Accuracy comparisons may not be compute-equivalent: Results are often compared at matched memory budgets or wall-clock time, but the paper does not provide a comprehensive accounting of total energy, GPU utilization, kernel overhead, preprocessing, verification, and training costs.
- Hardware and implementation portability are unclear: The speed results rely on custom kernels for Nvidia Hopper GPUs. Performance on other Nvidia generations, AMD or consumer GPUs, distributed inference, CPU offloading, and alternative inference engines is not reported.
- Batching and serving behavior need broader evaluation: The study uses specific batch-generation settings and vLLM’s automatic batch size. Throughput, tail latency, fairness across requests of different lengths, and resource utilization under realistic mixed workloads remain unresolved.
- Short-generation benefits are limited but not optimized: The warm-up phase reduces gains for short tasks, yet the paper does not investigate hybrid policies that switch between full attention and Prefix Sliding or select a window based on the expected generation length.
- Multi-turn conversation handling is unspecified: The paper identifies uncertainty about whether future user instructions should belong to the prefix or sliding window but does not propose or evaluate a robust policy for preserving conversation state and instruction hierarchy.
- Tool-use and external-content robustness are untested: Large tool outputs, retrieved documents, webpages, files, and code execution traces may displace important context. The paper does not measure how Prefix Sliding affects tool-use correctness, retrieval fidelity, or susceptibility to context poisoning.
- Safety and instruction persistence are unexplored: Evicting prior content could remove safety constraints, policy instructions, user preferences, or adversarial content. The method’s effects on instruction following, refusal behavior, and prompt-injection resistance are not evaluated.
- No uncertainty-aware safeguards are provided: The model has no mechanism to detect that an evicted token is needed or that its current context is incomplete. Future work could study uncertainty signals, retrieval triggers, or reversible eviction.
- Scaling claims remain empirically limited: Although the method is motivated by reasoning for weeks or millions of tokens, experiments reach only hundreds of thousands of tokens. Accuracy, degeneration, positional effects, and practical throughput at million-token and longer horizons remain unknown.
- Quality degradation beyond exact-match accuracy is underreported: The evaluation does not sufficiently examine partial correctness, reasoning faithfulness, calibration, verbosity, repetition, error types, or whether answers rely on invalid reasoning after information eviction.
- The comparison baselines are restricted: Alternative architectures, learned memory systems, recurrent models, hierarchical attention, token-merging methods, and mixed global-local attention models are largely excluded because they do not meet the paper’s out-of-the-box criterion.
- Benefits relative to trained long-context alternatives are unknown: The paper does not establish whether Prefix Sliding remains competitive with models specifically trained for recurrent memory, compressed context, or sliding-window attention under equal parameter, training-compute, and inference-compute budgets.
- The optimal prefix definition is unresolved: The method assumes the entire prompt and system instruction should remain permanently available, but it does not study selective prefix retention, instruction segmentation, changing system messages, large demonstrations, or prompts containing irrelevant or adversarial material.
- Memory management across reasoning phases is unexplored: Different phases—problem setup, exploration, computation, coding, verification, and finalization—may require different retention policies. A fixed prefix-plus-window structure may be suboptimal compared with phase-aware memory allocation.
- Reproducibility of reported speedups needs broader validation: The paper reports approximately speedups in selected settings, but does not provide extensive sensitivity analyses over batch size, sequence length, window size, model size, GPU type, kernel version, and concurrent workloads.
Practical Applications
Immediate Applications
The paper’s main deployable contribution is a training-free attention-cache strategy: retain the task and system-instruction prefix plus a bounded window of recent reasoning tokens, while evicting older intermediate tokens. This can be integrated into existing decoder-only language-model serving systems, subject to model- and hardware-specific validation.
- Lower-cost long-form reasoning APIs — Software/AI infrastructure
- Add Prefix Sliding to inference servers such as
vLLMand FlashAttention-based stacks to serve reasoning models with a fixed memory footprint. - This is particularly useful for mathematical problem solving, scientific analysis, planning, code generation, and other tasks that produce thousands of reasoning tokens.
- The paper reports approximately 3× faster generation without additional training in its tested setting while maintaining benchmark performance.
- Dependencies: The model must tolerate eviction of intermediate tokens; the prefix must be correctly identified and preserved; the sliding-window size requires calibration. Performance may degrade on tasks that revisit information from much earlier in the trace.
- Add Prefix Sliding to inference servers such as
- More concurrent reasoning requests on fixed GPU capacity — Cloud computing
- Use the bounded cache size to increase batch size or the number of simultaneous users without proportionally increasing GPU memory.
- A provider could expose a configurable
prefix_length + window_sizememory policy for long-thinking models, improving hardware utilization and reducing memory-related request failures. - Dependencies: Actual throughput gains depend on GPU architecture, kernel implementation, batching strategy, quantization, and the proportion of requests that exceed the warm-up window. The paper’s custom kernel targets Nvidia Hopper hardware, so other accelerators require testing or porting.
- Efficient code-generation and software-engineering assistants — Software development
- Deploy Prefix Sliding in coding agents that spend extended periods debugging, planning, writing tests, or iteratively refining implementations.
- The preserved prefix can retain repository instructions, tool definitions, coding policies, and the original user request, while the recent window contains the active debugging context.
- Potential products include lower-latency IDE copilots, autonomous issue-resolution agents, and code-review systems with longer reasoning budgets.
- Dependencies: The paper specifically reports that LiveCodeBench requires a larger window—at least approximately 16,384 tokens in the tested setup—because code and comments may need to be revisited after long reasoning intervals. File contents and tool outputs must therefore be chunked, selectively retrieved, or stored externally rather than indiscriminately inserted into the context.
- Long-horizon mathematical and technical tutoring — Education
- Use longer test-time reasoning to generate step-by-step solutions, alternative explanations, hints, and error diagnoses while keeping inference affordable.
- Prefix preservation is useful for retaining pedagogical instructions, grading criteria, student constraints, and tool availability throughout the reasoning process.
- Dependencies: The system should not expose unchecked internal reasoning as authoritative instruction. Answers require verification, especially for mathematics, science, and assessment use. Short educational questions may see little benefit because Prefix Sliding has limited advantage before the generation exceeds the window size.
- Research evaluation and reproducible inference experiments — Academia
- Researchers can use the released implementation to compare full attention, ordinary sliding windows, summarization, and Prefix Sliding under equal memory and time budgets.
- It enables experiments on test-time scaling, reasoning length, attention-cache eviction, context retention, and long-horizon generation using existing pretrained models rather than retraining from scratch.
- Dependencies: Results should not be generalized from the paper’s primary Qwen3 experiments, selected math/code benchmarks, and 7B-scale training experiments without broader evaluation across models, domains, languages, and hardware.
- Inference-time resource policies for AI providers — Industry operations and policy
- Add dynamic policies that select a window size based on task type, expected reasoning length, latency target, and available GPU memory.
- For example, a short-answer request could use full attention or a small window, whereas complex code or research tasks could receive a larger window.
- Providers can monitor accuracy, answer-verification rates, latency, cache memory, and failure modes to determine when Prefix Sliding is beneficial.
- Dependencies: A robust fallback to full attention, retrieval, or summarization is needed when the model appears to depend on evicted information. Operational policies should also account for privacy and data-retention requirements in cached prefixes.
- Local and consumer-device reasoning assistants — Daily life and edge AI
- Run longer reasoning tasks on laptops, workstations, or constrained edge devices by capping key-value-cache growth.
- Potential uses include personal coding assistants, document question answering, planning tools, and offline educational applications.
- Dependencies: The method reduces attention-cache memory but does not reduce the model’s parameter memory or all compute costs. Benefits depend on having a compatible optimized kernel and sufficient device memory for the model itself.
- Agent conversation management with preserved instructions — Productivity and customer service
- Maintain system policies, tool descriptions, safety rules, and the initial task as a fixed prefix while retaining only the most recent interaction or reasoning window.
- This can reduce the need for repeated context reprocessing in long-running support or workflow agents.
- Dependencies: Multi-turn interactions introduce unresolved design questions: whether new user instructions should become part of the prefix, remain in the sliding window, or be externally indexed. Destructive eviction could remove legally, operationally, or conversationally important information.
Long-Term Applications
The following applications are enabled by the paper’s training and scaling results but require additional research, model adaptation, evaluation, or infrastructure development.
- Reinforcement-learning training for extremely long reasoning traces — AI research and model development
- Train reasoning models with Prefix Sliding so that rollouts can exceed 100,000 tokens without retaining the entire generation in memory.
- The method could support asynchronous RL systems for mathematical discovery, theorem proving, planning, coding, and tool-use tasks.
- Truncated or chunked backpropagation could reduce the amount of rollout data transferred to trainers while preserving useful gradients.
- Dependencies: The paper demonstrates promising results but relies on assumptions about the limited receptive field of stacked sliding windows. Gradient fidelity, reward assignment across distant steps, optimization stability, and performance at larger model scales require systematic validation.
- Autonomous software-engineering agents with persistent external memory — Software and robotics
- Combine Prefix Sliding with vector databases, file indexes, structured task state, and tool-mediated retrieval.
- The prefix would preserve global instructions and tool schemas; the local window would hold active reasoning; an external memory system would store durable artifacts such as code plans, test results, design decisions, and previously solved bugs.
- This could enable agents to work on repositories, simulations, or operational workflows for hours or days.
- Dependencies: External retrieval must reliably identify information that has fallen outside the window. Retrieval errors, stale state, prompt injection in files or web pages, and inconsistent updates could undermine correctness.
- Long-duration planning and control — Robotics, logistics, and energy
- Apply bounded-memory reasoning to robots, autonomous vehicles, warehouse systems, power-grid planning, or industrial process control that require extended sequential decision-making.
- The model could preserve mission objectives, safety constraints, and tool interfaces while reasoning locally about the current state.
- Dependencies: The current paper evaluates language-model reasoning rather than physical control. Real deployment would require grounded state representations, real-time guarantees, safety verification, uncertainty estimation, and mechanisms for retaining critical historical events that cannot safely be evicted.
- Scientific discovery and engineering design workflows — Science, healthcare, and energy
- Enable models to conduct long multi-stage investigations involving literature search, simulation, hypothesis generation, code execution, and iterative experimental design.
- Prefix Sliding could make extended search and reasoning more affordable, while external databases preserve facts, measurements, and intermediate artifacts.
- Potential outputs include automated experiment plans, engineering designs, drug-discovery hypotheses, and energy-system optimization proposals.
- Dependencies: Domain knowledge cannot be assumed to remain recoverable from a short recent window. Systems need verified retrieval, provenance tracking, reproducible tool execution, human review, and domain-specific safety controls. In healthcare, the method should support—not replace—qualified clinical judgment.
- Long-horizon financial analysis and policy simulation — Finance and government
- Use efficient sequential reasoning for scenario analysis, regulatory-impact assessment, budget planning, market research, and structured comparison of policy options.
- A fixed prefix could contain institutional rules, constraints, and evaluation criteria, while external stores retain datasets and prior scenario results.
- Dependencies: Financial and policy tasks often require revisiting exact historical assumptions. Evicting intermediate tokens without structured state preservation could cause omissions or inconsistent conclusions. Auditability, data freshness, model-risk governance, and human approval would be mandatory.
- Adaptive memory architectures for LLMs — Academia and model design
- Extend Prefix Sliding with mechanisms that promote important intermediate tokens, tool outputs, code fragments, or conclusions into the permanent prefix or a separate knowledge store.
- A learned eviction policy could replace the fixed rule of preserving only the prefix and most recent window.
- This may address the paper’s information-loss examples, particularly long code-generation traces and large tool outputs.
- Dependencies: Importance prediction must be reliable and resistant to adversarial or accidental promotion of irrelevant content. Additional memory mechanisms may introduce latency, training complexity, and new failure modes comparable to those of summarization.
- Task-adaptive hybrid attention systems — General-purpose AI platforms
- Build systems that switch among full attention, Prefix Sliding, summarization, retrieval, and larger windows depending on task demands.
- A classifier or controller could estimate whether a task is short, locally coherent, code-heavy, document-heavy, or likely to require long-range references.
- Dependencies: Such routing requires reliable early prediction of future memory needs. Incorrectly selecting a small window may silently reduce answer quality, so confidence monitoring and automatic fallback mechanisms are essential.
- Standardized benchmarks for memory eviction and long-horizon reasoning — Academia and policy
- Develop evaluations that test not only final accuracy but also whether models retain instructions, tool permissions, user constraints, code state, safety requirements, and factual provenance after very long generations.
- Benchmarks should include multi-turn agents, large file inspection, multilingual reasoning, healthcare scenarios, financial documents, and adversarial context poisoning.
- Dependencies: The current evidence is concentrated on selected reasoning benchmarks and limited model scales. Broader benchmarks are needed before the method can serve as a general production standard.
- Energy-efficient large-scale inference — Cloud infrastructure and sustainability
- At scale, bounded per-token attention could reduce memory traffic, latency, and energy consumption for long reasoning workloads, potentially enabling more extensive test-time computation within a fixed power budget.
- This could support greener deployment of reasoning models in data centers and regional or edge infrastructure.
- Dependencies: The paper primarily establishes speed and memory advantages, not full lifecycle energy savings. Net benefits depend on GPU utilization, kernel efficiency, model size, cooling overhead, workload length, and whether users consume the saved capacity by requesting substantially longer reasoning traces.
Glossary
- Ablation: An experiment that removes or varies one component to measure its effect. “Ablations show Prefix Sliding outperforms summarizing intermediate tokens or vanilla sliding window.”
- Attention head: An individual parallel attention mechanism within a transformer layer. “We plot post-softmax attention probabilities averaged across layers and attention heads in Qwen3-1.7B for an AIME25 reasoning trace.”
- Attention sink: A token that attracts disproportionate attention, helping stabilize attention computation. “It also serves as an ‘attention sink’ allowing the model to allocate excess probability weight”
- Autograd: Automatic differentiation software that computes gradients for optimization. “autograd backpropagates normally from the masked loss and only updates with respect to the last 2048 tokens.”
- Backpropagation: The algorithm for computing parameter gradients by propagating errors backward through a neural network. “Chunked backpropagation backpropagates on a reasoning chain in chunks and accumulates the gradients to ensure near-equivalence with standard full backpropagation.”
- Budget forcing: A technique that constrains a model to generate within a specified computation or token budget. “We use budget forcing to keep generations to specific thinking budgets (without the use of ‘Wait’ tokens)”
- Cache eviction: The removal of stored intermediate representations to limit memory use. “In \autoref{sec:othermethods}, we provide details on their hyperparameter selection and contrast Prefix Sliding with an additional cache-eviction method.”
- Chain-of-thought: A sequence of intermediate reasoning steps generated by a LLM. “LLMs are multilingual chain-of-thought reasoners”
- Chunked backpropagation: Backpropagation performed on successive portions of a long sequence rather than on the entire sequence at once. “Chunked backpropagation backpropagates on a reasoning chain in chunks and accumulates the gradients”
- Context poisoning: The degradation of model behavior caused by misleading, harmful, or irrelevant content in the context. “Long contexts have more issues, including distraction by old irrelevant tokens, context poisoning”
- Context window: The bounded sequence of tokens that a LLM can process as input at one time. “Together with the prompt, this summary is then used to start a new context window to continue reasoning.”
- Continue PE: A positional-embedding strategy that preserves the original positional indices of cached tokens when the window advances. “While Continue PE may perform worse, we have found performance differences insignificant”
- FLOPs: Floating-point operations, commonly used to estimate computational workload. “FLOPs or total generated tokens can be a good proxy, but they miss memory differences among methods.”
- FlashAttention: An optimized attention algorithm that reduces memory traffic through tiled computation. “We use vLLM with FlashAttention for all generations.”
- Full attention: An attention pattern in which each token can attend to all preceding or available tokens. “With full attention, the cost of each new token grows linearly with the number of already generated tokens”
- Gradient: A vector of derivatives indicating how model parameters should change to reduce a loss. “We either backpropagate the entire generation or only the last sliding window of tokens”
- GRPO: Group Relative Policy Optimization, a reinforcement-learning algorithm for training LLMs using relative rewards among sampled outputs. “For reinforcement learning experiments, we use GRPO”
- Inter-tile skipping: An optimization that omits computation tiles lying entirely outside the permitted attention region. “We skip tiles that fall entirely outside the allowed region.”
- Intra-tile masking: Elementwise masking within a partially valid computation tile. “For tiles that partially overlap the allowed attention region (prefix sliding window), we apply an elementwise mask”
- Kullback–Leibler divergence: A measure of how much one probability distribution differs from another. “We compute the Kullback–Leibler (KL) divergence between generator and trainer per-token log probabilities”
- Latency: The time required to perform an operation or produce an output. “They also incur fundamental latency overhead due to duplicate token processing”
- Log probability: The logarithm of the probability assigned to an event, often used for numerical stability in model training. “Only passing the sliding window itself leads to a high KL of above 0.1”
- Long-horizon scaling: Extending computation over very lengthy sequences or reasoning processes. “Such constant cost is necessary to enable very long-horizon test-time scaling.”
- Loss mask: A set of values that excludes selected tokens or positions from contributing to a training loss. “In our implementation, this is simply a loss mask”
- Mixture-of-experts: A neural architecture that routes each input through only a subset of specialized components called experts. “Sparse upcycling: Training mixture-of-experts from dense checkpoints”
- Out-of-memory error: A failure that occurs when a computation requires more memory than is available. “Naive backpropagation of generations that span hundreds of thousands of tokens can lead to out-of-memory errors in the trainer.”
- Position embedding: A representation added to token embeddings to encode token order or location. “If the model has been trained with position embeddings (PE), such as RoPE”
- Prefix: The initial, retained portion of a sequence containing instructions, prompts, or other persistent context. “During reasoning, Prefix Sliding keeps only the prefix and a sliding window in memory.”
- Receptive field: The range of earlier sequence positions whose information can influence a given token representation. “Sliding windows across multiple layers have a theoretical receptive field of ”
- Reinforcement learning rollout: A generated sequence of actions or tokens collected while applying a policy, typically for later optimization. “Training with Prefix Sliding enables very long RL rollouts”
- RoPE: Rotary Position Embedding, a method that encodes token positions by rotating query and key representations. “If the model has been trained with position embeddings (PE), such as RoPE”
- Softmax: A function that converts scores into a normalized probability distribution. “only valid (q,k) pairs contribute to the softmax and output.”
- Sliding-window attention: An attention mechanism that restricts each token’s attention to a fixed-size recent neighborhood. “This has motivated prior work on letting models generate using a sliding window”
- Teacher forcing: Training a sequence model by supplying the correct previous tokens rather than its own generated predictions. “Resetting PE in the trainer is very complex due to teacher-forcing”
- Test-time scaling: Improving inference performance by allocating additional computation during evaluation or deployment. “Test-time scaling improves the performance of LLMs by using extra compute for hard problems”
- Token-level loss: A training objective calculated separately for each token in a generated sequence. “compute the token-level RL loss only on the final 2048 tokens.”
- Truncated backpropagation: Backpropagation restricted to a selected final segment of a sequence. “Truncated backpropagation involves only backpropagating on the last chunk.”
- Vanilla sliding window: A basic sliding-window method that retains only recent tokens and does not preserve a fixed prefix. “Ablations show Prefix Sliding outperforms summarizing intermediate tokens or vanilla sliding window.”
- Warm-up phase: The initial period before a sliding window reaches its maximum size and begins removing older tokens. “We call this the sliding window warm-up phase.”





