Accordion Elastic-Depth Inference via Fixed-Prefix Layer Looping

Yudong Zhang1 Wei Ding1 Kaili Zheng1 Yuchen Ding2 Zhenyu Zhang2,*

1Tsinghua University2Baidu Inc.

* Corresponding author

Five accordions labeled Low, Medium, High, XHigh and Ultra, with 24, 27, 30, 33 and 36 layer executions; more of each bellows is gold as more layers execute twice.

Abstract

Large language models serve applications with diverse inference budgets, but training and maintaining separate models for each budget incurs substantial costs. Recent Looped Transformers enable flexible inference computation through parameter reuse, but maintaining strong performance across different inference budgets remains an open challenge. We introduce Accordion, a mixture-of-experts-based model that supports five inference budgets through fixed-prefix layer looping. Each budget follows a pre-defined execution path, while the minimum budget retains the unlooped model. Joint pretraining samples one budget per micro-batch and optimizes its next-token prediction loss without additional cross-budget consistency objectives. We further preserve these inference budgets through supervised fine-tuning and reinforcement learning, where parameter-group merging and budget-matched multi-teacher on-policy distillation integrate three domain experts into one model. After 3.6T tokens of pretraining, increasing inference depth improves Accordion-6B-A0.5B's average performance across 37 tasks by 3.01 percentage points, with the middle budget capturing 89% of this gain using half as many additional layer executions. The final model surpasses each domain expert on its corresponding task-and-budget average, while achieving strong instruction-following performance across all budgets and retaining depth-dependent gains in mathematical reasoning and code generation.

Method

Accordion adjusts inference depth by repeating a fixed prefix of its middle layers in place, preserving the original layer order.

Top: a table of five budgets, Low to Ultra, showing which of layers 7 to 18 run twice and the resulting 24 to 36 executions. Bottom left: layer 12 run twice with shared weights, where gates scale the second pass. Bottom right: training samples one budget per micro-batch; inference chooses one budget per request.

Why a fixed prefix

Layer selection

The fixed prefix yields the lowest validation loss across all looped budgets.

Bar chart of validation loss for eight layer-selection strategies at k = 0, 3, 6, 9 and 12. The fixed prefix over layers 7 to 18 has the lowest loss at every looped budget.

Comparison with specialists

Accordion closely matches budget-specific specialists.

Validation loss versus loop budget. With equal training tokens, Accordion stays close to budget-specific specialists and below two alternative training schemes; a second panel compares at equal training FLOPs.

Pretraining results

Comparison with public models

Additional inference depth improves Accordion-Base performance across most evaluated tasks.

Six bar-chart panels, Overall plus five capability categories, comparing Accordion-Base-8K at five budgets with Qwen3-0.6B, Qwen3-1.7B, OLMoE-1B-7B-0125 and Ouro-1.4B. Additional depth improves all five category averages.

Quality versus inference cost

The middle budget captures most of the quality gains with a moderate increase in decoding latency.

Four panels pairing Accordion-Base-8K quality with separately measured Accordion-RL runtime: quality versus time per output token, time to first token, decode throughput and peak memory across loop budgets for 8K, 16K and 32K prompts at batch sizes 1 and 8.

Long-context performance

Additional inference depth delivers larger gains on RULER as context length increases.

RULER scores across loop budgets at 4K, 8K, 16K and 32K context lengths; gains from added depth grow with context length.

Post-training results

Comparison with public models

Accordion-RL outperforms the evaluated public models on instruction following.

Eight bar-chart panels comparing Accordion-RL at five budgets with Qwen3-0.6B, Qwen3-1.7B, OLMoE-1B-7B-0125-SFT and Ouro-1.4B-Thinking on IFEval, MMLU-Redux, GSM8K, MATH500, AIME 2024, AIME 2025, HumanEval+ and MBPP+. Accordion-RL scores 87.99 to 89.83 on IFEval versus at most 71.35 for the references.

Depth scaling after RL

Additional depth continues to improve mathematical reasoning and code generation after RL.

Ten line charts of score versus loop budget for Accordion-RL and Accordion-Instruct on instruction-following, knowledge, mathematics and code benchmarks.

Models and code

All four checkpoints keep the five budgets. Inference and evaluation code, including a vLLM plugin, is in Accordion-Loop.

ModelStageContext
Accordion-6B-A0.5B-Base-8KPretraining, mid-training and annealing, 3.6T tokens8K
Accordion-6B-A0.5B-Base-32KBase-8K + 50B tokens of long-context training32K
Accordion-6B-A0.5B-SFTBase-32K + supervised fine-tuning32K
Accordion-6B-A0.5B-RLSFT + domain RL, expert merging and multi-teacher distillation32K

Serve one budget with vLLM (LOOPMOE_K = 0, 3, 6, 9 or 12):

pip install vllm==0.24.0 "git+https://github.com/btzyd/Accordion-Loop#subdirectory=vllm_plugin"
LOOPMOE_K=12 vllm serve btzyd/Accordion-6B-A0.5B-RL --trust-remote-code --dtype bfloat16 --max-model-len 32768

BibTeX

@misc{zhang2026accordionelasticdepthinferencefixedprefix,
      title={Accordion: Elastic-Depth Inference via Fixed-Prefix Layer Looping},
      author={Yudong Zhang and Wei Ding and Kaili Zheng and Yuchen Ding and Zhenyu Zhang},
      year={2026},
      eprint={2610.32492},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2610.32492},
}