N-vium: Mixture-of-Exits Transformer for Accelerated Exact Generation

Aleksander Lorenc, Frédéric Berdoz, Joël Mathys, Roger Wattenhofer

TL;DR

N-vium accelerates autoregressive transformer inference by framing next-token prediction as a learned mixture over multiple exit depths rather than a single final layer. By deferring and parallelizing the remaining upper-layer computations required for the KV cache ("piggybacking"), N-vium achieves up to a 57.9% wall-clock speedup with absolutely zero degradation in generation quality.

What Problem Does This Paper Address?

In standard autoregressive large language models (LLMs), every token must sequentially traverse the entire stack of decoder layers. This forward pass serves two distinct purposes: predicting the immediate next token and building the Key-Value (KV) cache representations needed for future tokens to attend to.

However, empirical studies show that for many "easy" tokens, the predicted token distribution converges well before the final layer. Existing "early exit" methods try to exploit this by halting computation early to save FLOPs. Unfortunately, they treat intermediate layers as mere approximations of the final layer, which introduces several drawbacks: they require hand-crafted confidence thresholds, suffer from train-test mismatch (degrading model quality), and skip computing the KV caches for bypassed layers, breaking future token dependencies.

Methods

N-vium introduces a Mixture-of-Exits framework that treats early predictions as exact samples from a mathematically rigorous mixture distribution, rather than approximations.

  1. Mixture-of-Exits Architecture: N-vium attaches lightweight prediction adapters and routers at multiple intermediate depths ($N_V$ exits). The final next-token distribution ($\pi_{\text{mix}}$) is defined as a learned, token-adaptive weighted combination of all exit distributions: $$\pi_{\text{mix}}(x_{t+1} \mid x_{1:t}) = \sum_{k=1}^{N_V} p_k(x_t) \pi_k(x_{t+1} \mid x_{1:t})$$

  2. Exact Inference Sampling: At inference time, the model uses a two-step sampling approach. At each junction, a router samples a binary exit decision. If it triggers, the model samples the token directly from that intermediate head and stops the sequential forward pass for the current token.

  3. Piggybacking (KV Cache Recovery): To ensure the KV cache remains complete and exact without delaying the next token, N-vium defers the remaining upper-layer computations for the exited token. When future tokens reach those same depths, the deferred hidden states are concatenated and processed in parallel (batched) with the current token. This leverages GPU parallelism to eliminate additional sequential latency.
Figure 2: Overview of the N-vium architecture. The backbone (left) processes the input through N blocks of transformer layers. At each junction, a router (diamond) outputs an exit probability wk that determines the likelihood of selecting the routed exit path (orange). Exit tokens pass through an adapter and the shared LM head to produce the exit distribution πk. The mixture distribution πmix is formed as a weighted combination of the four exit distributions with mixture weights pk. The inset (right) zooms into a single junction.

Datasets

  • Pretraining: Models were pretrained from scratch on the C4 (Colossal Clean Crawled Corpus) dataset, adhering to a standard $D = 20N$ token-to-parameter ratio.
  • Fine-Tuning & Evaluation: Models were fine-tuned using the Tulu 3 SFT mixture for instruction-following capabilities.
  • Downstream Benchmarks: Evaluated using the lm-evaluation-harness across standard tasks: MMLU, ARC-Easy, HellaSwag, PIQA, OpenBookQA, and WinoGrande.
  • Inference Speedup: Measured using SpecBench, covering six diverse prompt categories.

Key Insights and Ideas

  • Reordering Compute vs. Reducing Compute: Unlike traditional efficiency methods that try to minimize total FLOPs per token, N-vium focuses on increasing effective FLOPs per second. Total backbone computation remains identical to a dense model, but reordering sequential execution into parallel batched passes better utilizes modern GPU hardware.
  • The Power of the Mixture Objective: Training the model to optimize the joint mixture distribution forces intermediate heads to learn complementary roles rather than simply mimicking the final layer.
  • The Retrofitting Trap (Router Collapse): The authors discovered that N-vium cannot be applied post-hoc to standard pretrained models. Doing so results in "router collapse," where the router learns to assign zero probability to all early exits. This happens because standard pretrained backbones lack the necessary intermediate representations, meaning N-vium must be trained from scratch.
Figure 4: Comparison of inference strategies over 5 tokens with an 8-layer network. Standard: every token traverses all 40 layers sequentially. Early exit (e.g., CALM [44]): tokens exit at different depths reducing latency to 28 layer units. Missing KV entries are copied from the last available state. The sampled tokens and cache are approximate. N-vium (ours): tokens learn to exit, also reducing latency but are sampled from the exact πmix distribution. Deferred layers are computed on demand with future tokens in parallel. We denote this as piggybacking as the KV cache is complete, exact and consistent with the sampled predictions.

Key Results

  • Wall-Clock Speedup: The largest model evaluated (a 1.5B parameter, 48-layer model) achieved a 57.9% wall-clock speedup over a parameter- and data-matched standard transformer baseline on an NVIDIA A100 GPU.
  • Zero Perplexity Loss: Unlike alternative methods like CALM, N-vium achieves this acceleration along a superior quality-speed Pareto front, demonstrating zero perplexity degradation.
Figure 3: Quality-speed Pareto front. Wall-clock speedup measured on an A100 GPU over a parameter-matched dense baseline against perplexity difference. All models use the same 24-layer, 768-wide backbone architecture. 4-vium: labels show varying compute penalty β. N-vium: labels show varying number of exits NV . 2-vium: labels show the backbone attachment layer of the early sampling head. 4-vium 1.5B: our largest and fastest model (1536-wide, 48-layer), trained with an adaptive β. CALM∗: our reimplementation of CALM [44], labelled by exit threshold τ. LayerSkip: labelled by (exit layer, draft length).
  • Downstream Robustness: After Supervised Fine-Tuning (SFT), N-vium models matched or exceeded their dense baseline counterparts across downstream benchmarks (e.g., ARC-Easy, PIQA), proving that the mixture objective preserves steerability and instruction-following capabilities.
  • Hardware Generalization: The ~57% speedup remained consistent across multiple modern GPU architectures (NVIDIA A100, RTX A6000, and RTX 3090).

Limitations and Future Work

  • Batched Inference Complexity: Because tokens dynamically exit at different layers, standard batching techniques during inference must be modified to handle varying sequence paths, similar to challenges faced by Mixture-of-Depths methods.
  • Training FLOP Overhead: During training, N-vium requires evaluating the prediction heads at every junction to compute the mixture loss, making the forward pass computationally heavier than a standard transformer during the training phase.
  • Hyperparameter Tuning: Achieving optimal speedups requires careful tuning of the compute penalty hyperparameter ($\beta$). While the authors introduced an adaptive controller to automate this for the 1.5B model, further research is needed to scale this reliably to larger model sizes.

Summary updated

Abstract

Improving the inference efficiency of autoregressive transformers typically means reducing FLOPs per token, usually through approximations that degrade model quality. We introduce N-vium, a mixture-of-exits transformer that partially parallelizes computation across depth on standard hardware, increasing effective FLOPs per second rather than minimizing compute per token. N-vium attaches prediction heads at multiple depths and defines the next-token distribution as a learned mixture over these exits, with token-adaptive routing. This formulation strictly generalizes the standard transformer, which is recovered exactly when routing assigns zero mass to all intermediate heads. Sampling from the mixture is exact, and complete KV caches are recovered by deferring the upper-layer computation and batching it with later tokens. We pretrain N-vium at scales up to 1.5B parameters. Our largest model reaches 57.9% wall-clock speedup over a parameter- and data-matched standard transformer at no perplexity cost.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
1.5B scaling evaluationQuadrivium (4-vium), 1.5B (1536-wide, 48-layer), adaptive βperplexity (PPL)11.56-0.07 vs baselineLanguage Modeling · params=1.5B · width=1536 · layers=48 · variant=4-vium, adaptive β · parameters=1.5B
Source quote
L7: \def\adaptNviumPPL{11.56}
1.5B scaling evaluationQuadrivium (4-vium), 1.5B (1536-wide, 48-layer), adaptive βwall-clock speedup57.9%Language Modeling Inference · params=1.5B · width=1536 · layers=48 · variant=4-vium, adaptive β · hardware=A100 80GB PCIe · parameters=1.5B
Source quote
L8: \def\adaptNviumSpeedup{57.9}
IsoFLOP/isoSpeed comparison4-vium (48L)PPL15.18-0.32 vs baselineLanguage Modeling · layers=48 · hardware=A100 · training_compute=isoFLOP-matched · inference_throughput=isoSpeed-matched
Source quote
L818: 4-vium (48L) │ 396M │ 15.18 │ 38.80{±}0.36 │ 1.041 │ 30{,}211 │ 41.6%
Reported baseline / comparator measurements (2)
BenchmarkMethodMetricScoreProtocol / Evidence
1.5B scaling evaluationDense transformer baseline baselineperplexity (PPL)11.63Language Modeling · params=1.5B · data=data-matched to Quadrivium · parameters=parameter-matched to Quadrivium
Source quote
L4: \def\adaptBaselinePPL{11.63}
IsoFLOP/isoSpeed comparisonDense (33L) baselinePPL15.50Language Modeling · layers=33 · hardware=A100 · training_compute=isoFLOP-matched · inference_throughput=isoSpeed-matched
Source quote
L819: Dense (33L) │ 283M │ 15.50 │ 39.23{±}0.11 │ 0.620 │ 50{,}729 │ ---
BibTeX
@inproceedings{lorenc2026n,
  author = {Aleksander Lorenc and Frédéric Berdoz and Joël Mathys and Roger Wattenhofer},
  title = {{N-vium: Mixture-of-Exits Transformer for Accelerated Exact Generation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=AbwLJoCyB5},
}
Figure