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.
-
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})$$
-
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.
- 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.
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-harnessacross 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.
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.
- 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