LoopCoder-v2: Only Loop Once for Efficient Test-Time Computation Scaling

📅 2026-06-16
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work addresses the latency and linearly growing key-value (KV) cache memory overhead in recurrent Transformers during inference, both stemming from sequential recurrence. To overcome these limitations, the authors propose a parallel recurrent Transformer architecture featuring cross-loop positional offsets (CLP) and a gated sliding-window attention mechanism with shared KV caches, enabling efficient exploration of recurrence depth during both training and inference. The study systematically reveals, for the first time, a non-monotonic relationship between recurrence depth and the trade-off between performance gains and computational cost, identifying two recurrence steps as the optimal balance and providing principled selection criteria. Experimental results demonstrate that the two-step model significantly outperforms non-recurrent baselines across multiple code generation and agent-based software engineering benchmarks, improving the SWE-bench Verified score from 43.0 to 64.4, while deeper recurrences lead to performance degradation.
📝 Abstract
Looped Transformers scale latent computation by repeatedly applying shared blocks, but sequential looping increases latency and KV-cache memory with the loop count. Parallel loop Transformers (PLT) alleviate this cost through cross-loop position offsets (CLP) and shared-KV gated sliding-window attention, making loop count a practical design choice. We therefore study PLT loop-count selection through a gain--cost view: an extra loop may refine representations, but CLP also introduces a positional mismatch at each loop boundary. We instantiate this study by training LoopCoder-v2, a family of 7B PLT coders with different loop counts, from scratch on 18T tokens, followed by matched instruction tuning and evaluation. Empirically, the two-loop variant delivers broad gains over the non-looped baseline across code generation, code reasoning, agentic software engineering, and tool-use benchmarks, improving SWE-bench Verified from 43.0 to 64.4 points and Multi-SWE from 14.0 to 31.0 points. In contrast, variants with three or more loops regress, revealing a strongly non-monotonic loop-count effect. Our diagnostics show that loop 2 provides the main productive refinement, while later loops yield diminishing, oscillatory updates and reduced representational diversity. Because the CLP-induced mismatch remains roughly fixed as refinement gains shrink, the offset cost increasingly dominates. This gain--cost trade-off explains PLT's saturation at two loops and provides diagnostics for loop-count selection.
Problem

Research questions and friction points this paper is trying to address.

loop count
Parallel Loop Transformers
cross-loop position offsets
computation scaling
gain-cost trade-off
Innovation

Methods, ideas, or system contributions that make the work stand out.

Parallel Loop Transformers
cross-loop position offsets
shared-KV attention
loop-count selection
gain-cost trade-off