Manuscript Offprint

arXiv:2611.07211

Not All Loops Cost the Same: Phase-Dependent Depth for Serving Looped Transformers

Zhixu Du, Yuhan Cheng, Hai "Helen" Li, Yiran Chen

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Looped transformers scale inference-time reasoning by repeatedly reusing a shared core, increasing computation without increasing parameter count. Serving prefilling and decoding with a uniform loop budget couples their costs. We present LoopDuet, a phase-dependent depth and training-free serving approach that selects the two budgets jointly while preserving decoding depth at prefilling boundaries. Our vLLM implementation gathers tokens requiring further recurrence into compact batches, turning the selected allocation into executable savings with existing weights and attention kernels. At runtime, a queue-age controller adjusts prefilling depth to retain quality as demand changes. Experiments on the full HotpotQA dataset with one A100-80GB demonstrate two benefits of this flexibility. First, separate phase budgets improve the quality–throughput trade-off: Huginn delivers 19% more throughput than the fastest tested uniform setting meeting the same accuracy criterion, while a higher-throughput operating point gains 6.04 EM points over uniform depth eight at 97% of its throughput. Second, the same execution mechanism retains more quality under load: on two evaluated OLMo arrival traces, adaptive prefilling gains 0.92–1.35 EM points over the most accurate tested fixed-depth controls at the same 100% attainment of a one-second time-to-first-token target. Together, these results establish LoopDuet as a practical way to turn flexible model computation into higher serving capacity and better quality under load.

1. Introduction

Looped transformers scale reasoning computation by repeatedly applying a shared core, increasing effective depth without increasing parameter count [25, 46]. Shared weights support different inference budgets, offering quality–cost choices at deployment. Exploiting this flexibility requires a depth allocation: a rule that decides how many loops each token receives.

LLM serving processes each request in two phases, prefilling and decoding (Figure 1), which provide a natural basis for depth allocation. Prefilling processes prompt tokens together in several chunks, to build the KV cache; the final prompt position produces the first output token. Decoding then generates subsequent tokens one position at a time. A uniform loop budget couples their costs: lowering prefilling depth also lowers decoding depth. For long prompts and short answers, retaining deep decoding therefore incurs repeated computation across the entire prompt.

Prior work exploits a common asymmetry between the phases: decoding is more sensitive to reduced computation than prefilling [31]. SwiftKV [52] computes prompts’ later-layer KV cache directly from an earlier layer’s output, skipping some later-layer computation during prefilling while decoding runs the full model; because this changes the input to the later layers’ KV projections, it distills their Q,K, and V projections from the

*Correspondence E-mail: zhixu.du@duke.edu

Figure

Fig. 1: Prefilling advances by chunk; decoding advances by token. Prefilling processes chunk tokens in parallel. Cached context carries across chunks; the final chunk produces the first output token. Both phases reuse the same core weights.

original model. POP [31] applies a similar early exit during prefilling without training, but skips fewer layers since more aggressive pruning degrades quality. SPEED [50] processes prefilling tokens through only the first K layers and omits their deep-layer KV states, reducing both prefilling computation and decode-time KV reads, but requires fine-tuning. Our work applies this asymmetry to looped transformers without training: it reduces prefilling loops rather than physical layers, selects prefilling and decoding depths jointly, and adapts prefilling depth to load during serving.

We present LoopDuet, a training-free serving approach that jointly selects prefilling depth PP and decoding depth SS, with P≤SP \leq S. Joint selection includes both uniform budgets and split budgets that retain deeper decoding. In a split setting, ordinary prefilling positions stop after PP loops, while decoding positions and scheduled prompt-chunk endpoints receive SS (Section 3.1). This preserves the final prompt position's first-token computation while reducing recurrent work over the surrounding context.

This allocation saves computation only if the engine stops precessing positions that have finished their PP loops. In a serving batch, however, each engine step mixes prompt chunks and decoding tokens from many requests, and after PP loops only one query per request still needs recurrence. To remove completed prefilling positions from the subsequent core calls, LoopDuet applies a common loop boundary: after PP loops, our vLLM implementation gathers the positions that need further recurrence into a compact batch for the remaining S−PS-P loops. Prompt context remains available in a shared KV cache, so the compact queries can attend to it using existing attention kernels and weights (Section 3.2).

A fixed PP either misses first-token latency targets during bursts or gives up quality when capacity is available. To track changing request rates, LoopDuet starts from the jointly selected operating point and uses a queue-age controller that lowers PP when first-token backlog grows and restores it when capacity permits (Section 3.3).

On the full HotpotQA dataset with one A100-SXM4-80GB, Huginn (S,P)=(32,16)S, P) = (32, 16) delivers 19% more throughput than the fastest tested uniform setting meeting the same accuracy criterion. At a higher-throughput point, (14, 8) gains 6.04 exact-match (EM) points over uniform depth eight while retaining 97% of its throughput. This flexibility also retains more quality under load. For OLMo on HotpotQA, joint selection identifies uniform depth four as the fastest tested setting meeting the accuracy criterion. Starting there, the controller keeps S=4S = 4 and adjusts P∈{2,3,4}P \in \{2, 3, 4\}. On the evaluated 60 requests/s and 10/60 requests/s traces, it retains 0.92 and 1.35 more EM points than the most accurate tested fixed prefilling depth with the same 100% attainment of a one-second time-to-first-token (TTFT) target.

We make three contributions:

  • Joint depth selection: We characterize quality-throughput choices by comparing phase-dependent allocations with competitive reduced uniform depths.

  • Batched execution and runtime control: We implement compact recurrence and queue-age adaptation in vLLM, translating depth allocation into serving capacity and quality retention under load.

  • Role-dependent sensitivity: We characterize depth sensitivity across two model families and three tasks, using recurrent-state measurements to screen candidate prefilling depths for task-quality validation.

References (70)