Summary (Overview)
- LoopDuet is a training-free serving approach for looped transformers that jointly selects prefilling depth () and decoding depth () with , exploiting the asymmetry that decoding is more sensitive to reduced computation than prefilling.
- The method achieves 19% more throughput than the fastest tested uniform setting meeting the same accuracy criterion on Huginn, and gains 6.04 EM points over uniform depth eight at 97% of its throughput.
- A queue-age controller adapts prefilling depth dynamically during serving, retaining 0.92–1.35 EM points more quality than fixed-depth controls while maintaining 100% attainment of a one-second time-to-first-token (TTFT) target.
- The execution mechanism gathers tokens requiring further recurrence into compact batches, enabling savings with existing weights and attention kernels in vLLM.
- The work formalizes recurrence as a third axis of conditional computation alongside physical layers (MoD) and expert identity (MoE), establishing connections to MoE serving techniques.
Introduction and Theoretical Foundation
Background and Motivation
Looped transformers scale inference-time reasoning by repeatedly applying a shared core, increasing effective depth without increasing parameter count. This weight-sharing property supports different inference budgets, offering quality–cost trade-offs at deployment. However, exploiting this flexibility requires a depth allocation rule: deciding how many loops each token receives.
The Phase Asymmetry
LLM serving processes requests in two phases:
- Prefilling: processes prompt tokens in chunks to build the KV cache; the final prompt position produces the first output token
- Decoding: generates subsequent tokens one position at a time
A uniform loop budget couples phase costs: lowering prefilling depth also lowers decoding depth. For long prompts with short answers, retaining deep decoding while reducing prefilling depth can dramatically reduce computation.
Prior work exploits this asymmetry:
- SwiftKV: distills prompt KV states, skipping later-layer computation during prefilling while decoding runs the full model
- POP: applies early exit during prefilling without training, but skips fewer layers to preserve quality
- SPEED: processes prefilling tokens through only the first layers, but requires fine-tuning
LoopDuet applies this asymmetry to looped transformers without training by reducing prefilling loops rather than physical layers, selecting prefilling and decoding depths jointly, and adapting prefilling depth to load dynamically.
Key Theoretical Insight
The layer-pass model quantifies work concentration. For a prompt of length followed by decoding tokens, uniform execution at depth performs:
layer applications, where (with , , being prelude, core, and coda layer counts). For OLMo HotpotQA with average 796-token prompts and ~4.7-token answers, prompt positions account for over 99% of the work. This concentration motivates reducing prefilling work while retaining decoding depth.
Methodology
3.1 Joint Depth Selection (, )
LoopDuet selects prefilling depth and decoding depth jointly with . For an unchunked prompt of length :
- Positions execute iterations
- Position (final prompt position) executes iterations (producing first output token)
- All subsequent generated positions execute
Preserving first-token computation is critical: for short-answer tasks, the first token often determines the answer, so the final prompt position retains full decoding depth.
3.2 Compact Execution with Shared Context
To realize savings, the engine removes completed prefilling positions from later core calls:
- Full-batch processing: Prelude and first core applications operate on the full batch of tokens
- Gather operation: Let contain each request's final scheduled query index. Gathering these rows produces a tensor (where is number of requests, is hidden width)
- Compact recurrence: Run the remaining loops on this compact tensor
- Scatter: Update the rows back into the tensor before the coda
The shared KV cache retains prompt context so continuing positions can attend to full retained context through existing attention kernels.
3.3 Queue-Age Controller
The controller adjusts prefilling depth dynamically based on queue age (age of oldest admitted request awaiting first token):
Rising queue age lowers toward ; receding backlog restores it toward . Decoding depth remains fixed.
Theoretical Work-Savings Model
The layer-pass savings ratio is:
For long prompts with short answers, this approaches : 3.57 for OLMo (32, 8), 2.31 for OLMo (11, 4), and 1.94 for Huginn (32, 16).
Wall-time savings follow Amdahl's law:
where is the baseline wall-time fraction on affected work, its acceleration, and overhead.
Empirical Validation / Results
4.2 Joint Depth Selection Results
Setup: Full HotpotQA dataset, one A100-SXM4-80GB, concurrent requests, vLLM 0.14.1, bf16.
Key Results for Huginn:
- (32, 16) reaches EM 33.69 at 1.82 requests/s, providing 1.19× throughput over fastest uniform setting meeting the accuracy criterion (20, 20) at 33.52 EM
- (14, 8) gains 6.04 EM points over uniform (8, 8) (30.33 vs 24.29 EM) at 97% of throughput
- Relative to full (32, 32): 1.87× throughput with −0.09-point EM change
Table 1: LoopDuet vs. Uniform Comparisons (full-set HotpotQA, )
| Model | LoopDuet (S, P) | Uniform | Throughput ratio | ΔEM | ΔF1 |
|---|---|---|---|---|---|
| Huginn | (14, 8) | (8, 8) | 0.973 | +6.04 | +7.13 |
| Huginn | (24, 12) | (12, 12) | 0.979 | −0.45 | −0.47 |
| Huginn | (32, 16) | (16, 16) | 0.960 | +1.62 | +1.90 |
| Huginn | (32, 16) | (18, 18) | 1.073 | +0.97 | +1.10 |
| OLMo r32 | (11, 4) | (4, 4) | 0.918 | +0.32 | +0.49 |
OLMo: Uniform (4, 4) reaches 56.46 requests/s with EM 37.95, providing the highest throughput; LoopDuet (11, 4) gives 51.85 requests/s with EM 38.27 (+0.32 points).
4.3 Batching Speedups
Removing prefilling loops (holding decoding depth fixed) yields:
- OLMo r32, : 2.98× throughput ratio, −0.07 EM change
- OLMo r32, : 2.13×, −0.16 EM change
- Huginn, : 1.87×, −0.09 EM change
Measured speedups reach 85–96% of layer-pass ratios, consistent with compact dense execution realizing most arithmetic savings. Savings persist across concurrency levels () and token budgets (4,096–16,384).
Latency improvements: OLMo (11, 4) median TTFT falls from 1.26 to 0.58 seconds; share with TTFT ≤ 1 second rises from 44.2% to 99.7%.
4.4 Queue Control Under Load
Table 2: One-second TTFT attainment (%) / EM, OLMo r32,
| Arrival trace | Fixed (4,4) | Fixed (4,3) | Fixed (4,2) | LoopDuet (queue) |
|---|---|---|---|---|
| Poisson 40 req/s | 100 / 37.92 | 100 / 36.29 | 100 / 31.83 | 100 / 37.96 |
| Poisson 60 req/s | 8.6 / 38.04 | 100 / 36.35 | 100 / 31.74 | 100 / 37.27 |
| Burst 10/60 req/s | 46.9 / 38.04 | 100 / 36.42 | 100 / 31.82 | 100 / 37.77 |
| Burst 20/80 req/s | 21.3 / 38.20 | 39.1 / 36.42 | 100 / 31.91 | 87.5 / 35.12 |
Key findings:
- At Poisson 60 req/s: 0.92 EM points gained over best fixed depth at 100% attainment
- At burst 10/60: 1.35 EM points gained, with p99 TTFT of 0.682 seconds
- The trace spends ~87% of wall time at and 13% at
4.5 Token-Role Sensitivity
- First-token position requires full depth: reducing final prompt position from 32 to 16 loops lowers EM by 1.74–1.97 points
- Deeper decoding preserves GSM8K accuracy: gains of 5.91 (OLMo r32), 3.18 (OLMo r16), 11.68 (Huginn) accuracy points over uniform reduction
- Role sensitivity varies by model: Huginn gains 4.97 EM points from deep decoding on HotpotQA, OLMo only 0.16–0.20
4.6 Recurrent-State Analysis
The relative state distance metric:
Candidate prefilling depths satisfy:
- At loop four, OLMo r32 GSM8K has prefilling/decoding distances 0.18/0.20, yet prefilling reduction preserves accuracy while uniform reduction loses 5.76 points
- State-distance screening suggests candidate depths of 3–4 for OLMo and 13–16 for Huginn
- Cross-checkpoint validation gives thresholds 0.237–0.241, close to pooled 0.24
Theoretical and Practical Implications
3D Conditional Computation Framework
The paper formalizes recurrence as a third axis of conditional computation:
- Horizontal axis: Mixture-of-Experts — token routing among experts within a layer
- Vertical axis: Mixture-of-Depths / layer-skipping — computation adaptation across layers
- Recurrent axis (new): revisiting shared blocks — states evolve across iterations while parameters remain tied
This connects looped-model serving to mature MoE serving techniques (Lynx, DeepSpeed-MoE, SiDA-MoE, MoE-Infinity), suggesting cross-pollination opportunities.
Key Design Principles
- Phase-aware allocation beats uniform: Decoding sensitivity exceeds prefilling sensitivity, making asymmetric budgets superior to uniform reduction
- Batch-compatible granularity: Per-token sparsity fails under batching (neuron union coverage 99.80–99.95% at batch 16); a common prefilling-loop boundary removes batched work effectively
- Quality retention under load: Queue-age control enables graceful degradation that retains quality, unlike fixed-depth compromises
- State-distance screening: One reference trajectory can screen candidate depths before task-quality validation, reducing evaluation cost
Task Sensitivity
The benefit of depth allocation depends on task characteristics:
- GSM8K benefits from deeper decoding (multi-step reasoning)
- HotpotQA shows model-dependent sensitivity
- ARC requires sufficient prefilling depth
- Task relevance of state changes matters alongside their magnitude
Conclusion
LoopDuet establishes that phase-dependent depth allocation is a practical way to turn flexible model computation into higher serving capacity and better quality under load:
- Huginn: 19% more throughput than fastest uniform setting meeting accuracy criterion; 6.04 more EM points than uniform depth eight at 97% of throughput
- OLMo: adaptive prefilling retains 0.92–1.35 more EM points than fixed settings at the same TTFT attainment on evaluated traces
Key insights for future work:
- Prefilling and decoding depths must be selected jointly, as their benefits interact
- The final prompt position deserves special treatment (full depth for first-token quality)
- Queue-age control provides effective quality–latency trade-off management without correctness feedback
- Recurrent-state measurements can screen candidate depths efficiently
- The 3D MoE abstraction (layers × experts × recurrence) suggests extending MoE serving techniques to recurrent models
- Joint scheduling of expert residency and per-phase recurrent depth is an open direction for recurrent MoE systems
The work demonstrates that not all loops cost the same — the phase in which computation is applied fundamentally determines its quality and latency value, and exploiting this asymmetry yields measurable serving improvements with existing weights and kernels.
Related papers
- Learning to Extrapolate in Depth with Looped Transformers
Looped transformers trained at depth K extrapolate to harder graph connectivity instances at test depths up to an exponential window, beyond which overthinking causes failures.
- SkillDuet: Co-Evolving Models and Skills through Response Feedback
SkillDuet co-evolves model parameters and reusable textual skills via response-based Strength scoring, achieving state-of-the-art 98.57% on ALFWorld and 92.97% on WebShop.
- Agent Self-Improvement with Frozen Weights: The Added Value and Limits of Failure Traces
Trace-based lessons improved decision accuracy by 4.0 points over matched search, but search alone captured 60% of the gain, with no improvement on conversations or held-out tasks.