Source-linked AI summary

LoopAhead: Speculating Ahead for Faster Decoding in Looped Language Models

Zixuan Liu, Nan Xue, Rui Bao, Yuhang Xu, Xiaofeng Cao, Jiangchao Yao, Zhiyong Chen

arXiv:2610.21594v1cs.AIcs.LG

TL;DR

Full-depth autoregressive decoding in looped Transformers requires recurrent passes and repeated parameter access for every token, while pipelined methods limit how early future tokens can be drafted and may continue computing on incorrect branches. LoopAhead drafts multiple future tokens from early-loop states and uses intermediate-loop feedback to guide branch execution, with full-depth verification making final decisions. It achieves up to 7.82× decoding speedup over AR while remaining lossless.

  • Problem

    Pipelined decoding for looped Transformers limits how early future tokens can be generated and may spend computation on incorrect speculative branches before full-depth verification.

    Source: §1 · p. 2
  • Method

    LoopAhead drafts multiple future candidates from early-loop states and native proposal anchors, uses intermediate-loop feedback to guide branch execution, and leaves final output decisions to full-depth verification.

    Source: §1 · p. 2
  • Results

    7.82× decoding speedup over AR across evaluations of diverse looped models and benchmarks under greedy and sampling decoding, while remaining lossless.

    Source: §1 · p. 2
  • Takeaways & Limitations

    LoopAhead translates early predictions into useful speculative computation, with feedback-guided scheduling reducing computation on unpromising branches while improving throughput.

    Source: §1 · p. 2, §5 · p. 8

    The scheduler's rules and budgets are fixed in advance, and evaluation uses one request per GPU, leaving concurrent-serving workloads untested.

    Source: Limitations · p. 9

Abstract

from arXiv · show

Looped Transformers improve parameter efficiency by repeatedly applying the same Transformer layers. However, generating each token still involves sequential computation and repeated access to model weights, leading to high decoding latency. Recent pipelined self-speculative decoding methods reduce this delay by drafting tokens from early-loop predictions and asynchronously advancing tokens at different recurrent depths in the same batch, but they do not fully exploit early-loop features for longer lookahead and still spend computation verifying incorrect speculative branches. We introduce \method, a speculative decoding framework for looped transformers that enables earlier drafting of future tokens and assigns complementary roles to different recurrent depths. A lightweight lookahead drafter (LAD) predicts multiple future tokens with early-loop states, and deeper-loop feedback helps decide which draft branches to continue and which to pause, while the full-depth model makes the final token decisions. LoopAhead achieves up to 7.82x decoding speedup over autoregressive decoding while preserving the target model's output distribution.

1 Introduction

LoopAhead combines early-loop multi-token drafting with intermediate-loop feedback-guided scheduling, while full-depth verification determines final outputs. It addresses limits in pipelined decoding and achieves up to 7.82× decoding speedup over AR.

1 Introduction

  • Looped Transformers repeatedly apply shared layers, but full-depth autoregressive decoding completes every configured recurrent pass and repeatedly accesses parameters for each generated token.Repeated parameter access increases memory-bandwidth pressure, contributing to latency.Source: §1 · p. 1
  • Pipelined methods process tokens at different recurrent depths together, but each new proposal waits for its predecessor to reach a specified depth and incorrect branches may consume computation until full-depth verification.LoopSpec provides substantial speedups without training an additional drafter.Source: §1 · pp. 1–2
  • Early-loop-only generation can substantially reduce task accuracy, even though early-loop predictions already show high token agreement with full-depth outputs under the same prefixes, rising rapidly over subsequent loops.These observations motivate drafting multiple future tokens early and using intermediate-loop feedback to guide their execution.Source: Figure 1 · p. 1, §1 · p. 2
  • LoopAhead uses early-loop states and native proposal anchors to draft multiple future positions, with a compact draft vocabulary to reduce drafting overhead.Intermediate-loop representations guide branch suspension and resumption; full-depth target verification determines final output decisions, preserving losslessness.Source: §1 · p. 2
  • Intermediate-loop feedback guides suspension and resumption of speculative branches under bounded execution budgets, limiting computation spent on unpromising paths.The scheduler controls speculative execution; full-depth target verification remains responsible for final output decisions.Source: §1 · p. 2
  • 7.82× decoding speedup over AR; evaluations span diverse looped models and benchmarks under greedy and sampling decoding.Ablations show component effectiveness and complementary contributions to performance.Source: §1 · p. 2

2 Preliminaries

Looped Transformers increase computational depth by repeatedly applying a shared stack, yielding effective depth without additional parameters. Speculative decoding methods draft candidates for parallel target verification, while LoopSpec pipelines recurrent depths but native readouts predict only the next position.

2 Preliminaries

  • Repeated application of a shared Transformer stack increases computational depth; repeating nlayer shared layers gives effective core depth nlayerR without additional parameters.The recurrent core is described with input-conditioning and cache arguments suppressed.Source: §2 · p. 2
  • Speculative decoding verifies draft tokens in parallel, while methods including MTP, Medusa, Hydra, ReDrafter, EAGLE, and LayerSkip use varied strategies for predicting multiple positions or drafting from target features.The passage also describes distillation-based alignment, context/objective alignment, and diffusion-based draft blocks.Source: §2 · p. 2
  • LoopAhead assigns early-loop states to drafting, deeper-loop feedback to branch execution guidance, and full-depth verification to final decisions.The illustrated trajectory uses R2 feedback to suspend conflicting branches while retaining their KV states, then R4 verification for acceptance and pruning.Source: Figure 2 · p. 3
  • LoopSpec provides training-free pipelining for looped models with gated deeper proposals and full-depth verification, but each native readout predicts only the next token position.Drafting farther ahead therefore requires additional recurrent computation.Source: §2 · pp. 2–3

3 Method

LoopAhead pairs early-loop multi-token drafting with intermediate-loop feedback-guided scheduling, while full-depth readouts determine committed tokens. The section also analyzes how feedback can avoid computation on rejected speculative branches.

3.1 Early-Loop LookAhead Drafting

  • The lightweight lookahead drafter predicts multiple future positions from early-loop context and an anchor, constructing all future queries before selecting draft tokens.A causal Transformer processes context and queries together; the base drafter computes future hidden states in one forward pass.Source: §3.1 · p. 3

3.2 Feedback-Guided Scheduling

  • Intermediate-loop readouts identify conflicting candidates, and the scheduler suspends unpromising paths, resumes them when eligible, and prunes competing subtrees after full-depth verification.Full-depth readouts determine the next output token; its retained continuation becomes the root.Source: §3.2 · pp. 4–5
  • Recursive LAD calls can extend lookahead beyond one draft block by drafting from eligible native-proposal anchors that reach the drafting depth.Each call adds a chain of at most K tokens, subject to retention capacity and admission rules.Source: §3.2 · pp. 4–5

3.3 Theoretical Analysis

  • Under a matched-workload comparison, Theorem 1 bounds avoided advances from correct feedback at a first mismatch; early mismatches can leave more recursive successors on which computation is saved.The stated bound assumes feedback correctness and lower bounds on work avoidable after each possible first mismatch.Source: §3.3 · p. 5

4 Experiments

The experiments evaluate LoopAhead across looped-model families, benchmarks, and decoding settings, then analyze how drafting and scheduling affect speed, computation, and overhead.

4.1 Settings

  • Experiments cover six models from Ouro and Raven, five benchmarks, greedy and sampling decoding, and a separately trained LAD drafter shared across benchmarks.The benchmarks cover mathematical reasoning, code generation, and general reasoning; reported timing includes drafting, scheduling, and verification but excludes prefill, model loading, and warmup.Source: §4.1 · pp. 5–6

4.2 Evaluation Results

  • LoopAhead beats LoopSpec and DFlash on all 30 greedy pairs, with 2.82×–7.82× speedups over AR, and leads all ten sampling pairs with 3.00–4.32× mean speedups over AR.Sampling throughput gains over LoopSpec are 16.2–36.8%.Source: Table 1 · p. 6, §4.2 · p. 7, Table 2 · p. 7

4.3 Ablation and Analysis

  • With budgets, admission rules, and priorities fixed, conflict-based suspension improves speedup on every benchmark for both models; LAD alone can slow decoding, while LAD plus scheduling reduces advances spent on discarded nodes.The ablation supports complementary roles: LAD generates candidates early, while scheduling controls their computation.Source: §4.3 · p. 7, Table 3 · p. 8
  • LoopAhead reduces Ouro-1.4B average loops per output token relative to AR from 0.285 to 0.162 versus LoopSpec, while candidate advances rise from 1.14 to 1.91.Raven-Llama and Raven-OLMo achieve higher throughput while advancing fewer candidates per loop and making 17.7% and 30.6% fewer candidate advances per output token, respectively.Source: Figure 3 · p. 6, §4.3 · p. 7
  • Average decode time per loop rises from 7.72 to 9.45 ms on Ouro-1.4B versus LoopSpec but falls from 4.34 to 3.37 ms on Raven-Llama.LAD adds 11.1M parameters on Ouro and 19.5M parameters with its Raven-Llama residual adapter, compared with 277.9M and 325.1M for DFlash, respectively.Source: Figure 4 · p. 7, §4.3 · p. 8

5 Conclusion

LoopAhead uses early-loop states to draft future candidates and intermediate feedback to guide their execution. It speeds decoding over AR and LoopSpec across greedy and stochastic settings while remaining lossless.

5 Conclusion

  • LoopAhead delivers consistent speedups over AR and LoopSpec under greedy and stochastic decoding while remaining lossless.Its execution statistics also reveal model-dependent tradeoffs between parallel computation and speedups.Source: §5 · p. 8
  • Early-loop states predict future candidates, while intermediate feedback guides their execution.The framework’s value lies in exploiting early predictions and translating them into useful computation.Source: §5 · p. 8
  • Execution statistics reveal model-dependent tradeoffs between parallel computation and speedups.Source: §5 · p. 8

Limitations

LoopAhead requires model-specific drafter and scheduling choices, and its gains over LoopSpec vary by model–benchmark pair. Its evaluation also leaves concurrent serving and workload adaptation for future study.

Limitations

  • LoopAhead requires model-specific drafter training and scheduling choices because intermediate representations and useful feedback depths differ across models.Applying it to a new architecture requires choices based on development data.Source: Limitations · pp. 8–9
  • Additional training does not yield equally large improvements on every task, and gains over training-free LoopSpec are modest on some model–benchmark pairs.Less accurate multi-token drafts can add verification work without enough accepted tokens to offset the cost; scheduling cannot fully compensate.Source: Limitations · p. 9
  • The scheduler’s rules and budgets are fixed in advance, and evaluation uses one request per GPU.Concurrent serving changes request lengths, GPU load, and memory pressure; wider execution may be less beneficial when the GPU is busy.Source: Limitations · p. 9

A.1 Models

  • The evaluation covers six models from the Ouro and Raven families, with four recurrent passes for Ouro and 32 for Raven.The tested Raven checkpoints retain their checkpoint-specific prelude, recurrent core, and coda.Source: §A.1 · p. 12

A.2 Datasets

The evaluation spans mathematical reasoning, code generation, and general reasoning, with supplementary instruction-following and summarization benchmarks. Drafter data are separated into training, development, and confirmation sets, and the comparisons include AR, LoopSpec, and trained DFlash adaptations.

A.2 Datasets

  • Five main benchmarks cover mathematical reasoning, code generation, and general reasoning, including GSM8K (1,319 test questions), MATH500 (500), and BBH (540).HumanEval and MBPP evaluate code generation; the benchmark settings also include prompts and output budgets.Source: §A.2 · p. 12, Table 5 · p. 13
  • Supplementary evaluation covers CNN/DailyMail, AlpacaEval, IFEval, and MT-Bench using selected prompts and task-specific output limits.The first three use 128 prompts each; MT-Bench uses the first turns of 38 questions.Source: §A.2 · p. 12
  • LAD drafter trajectories draw on mixed-domain prompts, with 9,025 training, 782 development, and 782 confirmation requests.Development selects the checkpoint by average accepted prefix length across five domains, and confirmation is reserved for one evaluation.Source: §A.2 · pp. 12–13, Table 6 · p. 13
  • Data isolation protects evaluation questions and demonstrations, using normalized exact-duplicate checks and token 5-gram Jaccard filtering for near duplicates.BBH filtering ignores 5-grams shared by at least 20% of examples in the same subtask.Source: §A.2 · p. 13

A.3 Baselines

  • AR is the full-depth reference, LoopSpec is a training-free dual-proposal baseline, and DFlash is locally adapted for each target.DFlash uses frozen target features and mixed-domain training trajectories; its checkpoint and serving block size are selected on development prompts.Source: §A.3 · pp. 13–14
  • DFlash commits an average of 2.47–2.94 tokens per verification across five greedy benchmarks and six models, pooling 3,023 requests per model.Ouro-1.4B commits 2.88 tokens per verification with 27.1% draft-token acceptance; Raven-Llama-3.2 commits 2.47 with 9.9% acceptance.Source: §A.3 · p. 14

A.4 Additional Experimental Details

The component ablations vary LAD, scheduling, and compact vocabulary within a fixed evaluation subset. Controls isolate native proposals and feedback from LAD, and scheduling with LAD and vocabulary reduction held fixed.

A.4 Additional Experimental Details

  • The LAD-off rows retain native proposals and the same feedback depths as corresponding LAD-on configurations.Ouro uses R1/R2, while Raven-Llama uses R4/R8.Source: §A.4 · p. 14
  • Figure 5 compares scheduling off versus on while holding LAD and draft-vocabulary reduction fixed.Source: §A.4 · p. 14
  • Component ablations toggle LAD, scheduling, and compact vocabulary on a fixed subset of 428 evaluation requests per model.The subset is disjoint from drafter training, development, and confirmation sets; the scheduling switch jointly controls execution limits, conflict suspension, admission, and priority rules.Source: §A.4 · p. 14

A.5 Implementation Details

A.5 specifies the LAD architecture, training and inference policies, and evaluation procedure. The accompanying diagnostics show that intermediate-loop predictions agree closely with full-depth outputs, while LAD draft quality declines at later positions.

A.5 Implementation Details

  • The LAD base drafter is a two-layer Transformer with hidden size 512, trained from scratch for three epochs; target-model parameters remain frozen.Raven-Llama and Raven-OLMo add an R4-adapted residual head while keeping the R2-trained backbone frozen; Raven-TinyLlama uses its R2 base drafter without that head.Source: §A.5 · pp. 14–15
  • Ouro greedy LAD calls predict K = 3 extra tokens and retain only as many as free retention slots allow.For Ouro sampling, calibrated estimates of token-match probability and execution costs determine the call and retained lengths; the search favors shorter lengths in ties.Source: §A.5 · p. 16
  • Inference uses a request-specific draft vocabulary, and full-depth verification uses the complete target vocabulary.The base draft vocabulary contains the 8,192 most frequent tokens from teacher-generated training outputs, with prompt tokens, EOS, and committed outputs added at inference.Source: §A.5 · p. 16
  • Timing measures decode-only generation after prefill and setup, including drafting, verification, scheduling, and candidate-vocabulary maintenance.Experiments use BF16 target weights and caches with FP32 accumulation in target linear kernels.Source: §A.5 · pp. 14, 16

B.1 Predictions at Intermediate Depths

  • 97.0–99.1% token agreement at R4 and 99.3–99.7% at R8 show that Raven-Llama-3.2 intermediate predictions closely match full-depth predictions across five tasks.Exiting at R2 gives lower task accuracy than R32: 50.0% versus 65.6% on GSM8K and 20.3% versus 32.8% on MATH500.Source: §B.1 · p. 17, Figure 7 · p. 17

B.2 Quality of LAD Draft Tokens

  • On Ouro/GSM8K, candidate agreement falls from 64.3% to 36.1% and checked-candidate acceptance from 68.7% to 55.9% across the first three extra positions.On Raven/GSM8K, the corresponding measures fall from 51.9% to 34.8% and from 55.1% to 44.3% across two extra positions; later drafts remain useful, but favor short extensions and selective execution.Source: §B.2 · p. 17

B.3 Confidence Intervals for Main Results

These analyses examine uncertainty in throughput comparisons and the effects of feedback depth, draft length, and scheduling on execution. Gains over LoopSpec are supported across nearly all tested greedy pairs and all sampling pairs, while the best settings vary by model.

B.3 Confidence Intervals for Main Results

  • Throughput gains over LoopSpec have confidence intervals above zero for 29 of 30 greedy pairs and all ten sampling pairs.Intervals use paired-question bootstrap resampling; sampling gains are averaged across three seeds.Source: §B.3 · p. 17, Figure 8 · p. 18, Figure 9 · p. 18

B.4 Choice of Drafting and Feedback Depths

  • Raven-Llama and Raven-OLMo achieve their highest average relative throughput with R4 drafting and R8 feedback, while Raven-TinyLlama favors R2–R8.Deeper readouts do not consistently improve speed because they can delay candidate generation or scheduling feedback.Source: §B.4 · p. 18, Figure 10 · p. 19

B.5 Effect of Draft Length

  • Ouro reaches 3.89× speedup at K = 3, while Raven improves from 5.85× at K = 1 to 6.03× at K = 2.Ouro falls to 3.80× at K = 4, and Raven changes little at K = 3; the benefit of longer drafts levels off at small K.Source: §B.5 · p. 18

B.6 Execution Depth of Discarded Drafts

  • With scheduling, the Ouro share of discarded candidates reaching R4 falls from 41.79% to 9.21%, and Raven’s share reaching R32 falls from 44.06% to 0.07%.With scheduling enabled, 98.8% of discarded Raven candidates execute at most eight loops.Source: §B.6 · p. 19

B.7 Additional Generation Tasks

On additional summarization and instruction-following tasks, LoopAhead outperforms LoopSpec and a DFlash adaptation across the evaluated model–benchmark pairs. Its reported speedups over autoregressive decoding range from 2.62× to 6.37×.

B.7 Additional Generation Tasks

  • LoopAhead outperforms LoopSpec and the DFlash adaptation across all 16 model–benchmark pairs, with 2.62–6.37× speedups over AR.LoopAhead’s gains over LoopSpec range from 2.4% to 10.4% on Ouro-2.6B and 5.0% to 18.4% on Raven; DFlash reaches 0.94–1.49× over AR.Source: §B.7 · pp. 19–20
  • Raven-TinyLlama shows the most consistent gains over LoopSpec, improving by 16.8–18.4% across the four evaluated tasks.The evaluation reuses the main experiments’ trained drafters and scheduling settings without further tuning.Source: §B.7 · p. 19

C Proof of Theoretical Analysis

The proof relates matching-prefix length to avoided recurrent advances when intermediate feedback identifies a draft mismatch. The accompanying pseudocode combines speculative candidates, feedback-guided execution, and full-depth verification.

C.1 Proof of Theorem 1

  • The proof treats correctness as agreement with the full-depth target’s greedy continuation, not a dataset reference answer.A draft chain may span multiple LAD calls, and its conditional match probabilities account for preceding tokens across those calls.Source: §C.1 · pp. 20–21
  • The proof bounds avoided advances on rejected draft suffixes by combining first-mismatch probabilities, the chance that feedback is correct there, and a lower bound on savings.Under uniform bounds on feedback correctness and savings, the bound can be expressed using expected rejected-suffix length; it extends to recursive drafts and bounded variable chain lengths.Source: §C.1 · pp. 21–22

D Algorithm Pseudocode

  • The algorithm stores native proposals and LAD drafts in a shared candidate tree, advances selected nodes in batches, and applies feedback-based path checks.The tree can reuse nodes when different paths propose the same token under the same parent.Source: D Algorithm Pseudocode · p. 22
  • Full-depth NativeVerify accepts proposals with probability min{1, p(u)/q(u)} and samples from the remaining target distribution if all proposals are rejected.For greedy decoding, the native prediction supplies an anchor; under sampling, the anchor is drawn after temperature scaling and nucleus truncation.Source: D Algorithm Pseudocode · p. 22

E Case Study

The case studies illustrate several routes to lower decoding cost: early multi-token drafting, feedback-guided branch control, recursive drafting, and fewer candidate advances per loop.

Complete decoding trace

  • LoopAhead produces eight tokens after prefill in 13 steps, compared with 15 for LoopSpec, by suspending a conflicting draft suffix before verification.The trace shows intermediate feedback suspending the conflicting suffix and full-depth verification committing the first eggs and correction contain together.Source: E Case Study · p. 22, Figure 13 · p. 24

Code generation

  • 45.2% throughput improvement over LoopSpec on MBPP, with loop count falling from 40 to 23 even when a later draft token is corrected.One LAD call matches all three future tokens; another matches two before the final token is corrected.Source: E Case Study · p. 22, Table 9 · p. 25

Less work per loop

  • 30.0% throughput improvement on Raven-Llama-3.2 as candidate advances fall from 4,786 to 3,100, despite similar loop counts of 252 versus 248.Decode time falls from 1,008.1 to 775.3 ms.Source: E Case Study · p. 22, Table 10 · p. 25

Recursive drafting

  • 113.5% throughput improvement over LoopSpec on BBH Boolean Expressions, with 55 loops instead of 146 through recursive drafting.The case uses expressions as the native anchor, allowing another LAD call before full-depth verification.Source: E Case Study · p. 22, Table 11 · p. 25
Loading 2610.21594v1…