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

TL;DR

N-vium achieves 57.9% inference speedup with mixture-of-exits transformer, no perplexity loss.

cs.LG 🔴 Advanced 2026-05-13 2 views
Aleksander Lorenc Frédéric Berdoz Joël Mathys Roger Wattenhofer
Transformer Inference Acceleration Deep Learning Autoregressive Mixture Model

Key Findings

Methodology

N-vium is a mixture-of-exits transformer that attaches prediction heads at multiple depths, defining a learned mixture over these exits with token-adaptive routing. It generalizes the standard transformer by deferring upper-layer computation and batching it with later tokens to recover complete KV caches.

Key Results

  • N-vium pretrained at scales up to 1.5B parameters achieves a 57.9% wall-clock speedup over a standard transformer with no perplexity cost.
  • By using token-adaptive routing, N-vium increases effective FLOPs per second without adding per-token computation.
  • Experiments show that N-vium's mixture-of-exits model achieves exact sampling across multiple layers.

Significance

N-vium significantly improves inference efficiency without sacrificing model quality, addressing the issue of quality degradation in traditional methods that reduce FLOPs per token through approximations. Its approach has important implications for enhancing inference efficiency in both academia and industry.

Technical Contribution

N-vium introduces a mixture-of-exits mechanism that strictly generalizes the standard transformer, supporting exact sampling and complete KV cache recovery. Its technical contributions include depth parallelization through adaptive routing, enhancing hardware FLOPs utilization.

Novelty

N-vium is the first to introduce a mixture-of-exits model in transformers, achieving exact sampling through adaptive routing, unlike traditional early exit methods that suffer from quality loss.

Limitations

  • N-vium requires adjusting batch inference strategies, as tokens can dynamically sample the next token at intermediate junctions.
  • Training requires additional loss terms and tuning of the β hyperparameter to achieve speedup.

Future Work

Future work includes extending N-vium to larger model scales, exploring its combination with other techniques like speculative decoding, and further optimizing training and inference efficiency.

AI Executive Summary

N-vium is a novel transformer architecture that significantly enhances inference efficiency through a mixture-of-exits model. Traditional transformers require processing each token through all layers during inference, leading to high computational overhead and latency. N-vium attaches prediction heads at various depths, allowing tokens to exit early at the optimal depth, thus reducing computational load. Its core technologies include adaptive routing and exact sampling, ensuring model quality is maintained.

In experiments, N-vium achieves a 57.9% wall-clock speedup at a 1.5B parameter scale, with perplexity comparable to standard transformers. By deferring upper-layer computation and batching with subsequent tokens, N-vium can recover complete KV caches, further enhancing inference efficiency. This approach not only increases FLOPs per second but also avoids the quality loss seen in traditional early exit methods.

N-vium's innovations offer new insights into improving inference efficiency for deep learning models. Future work will explore its application to larger model scales and integration with other techniques to further optimize performance and efficiency.

Deep Analysis

Background

In recent years, transformers have made significant advances in natural language processing. However, their inference efficiency has been a major focus of research. Traditional transformers require processing each token through all layers during inference, leading to high computational overhead and latency. Early exit methods can reduce computational load but often result in quality degradation.

Core Problem

The core problem is the low inference efficiency of transformers, primarily due to the need to process each token through all layers. Improving inference efficiency without affecting model quality is an important and challenging task.

Innovation

N-vium introduces a mixture-of-exits model that allows tokens to exit early at the optimal depth. Its adaptive routing mechanism ensures that each token is predicted at the optimal depth, improving inference efficiency.

Methodology

  • �� Attach prediction heads at various depths to form a mixture-of-exits structure.
  • �� Use adaptive routing to dynamically decide the exit depth for each token.
  • �� Defer upper-layer computation and batch with subsequent tokens to recover complete KV caches.

Experiments

Experiments are conducted on the C4 dataset using the LLaMA 2 architecture and tokenizer. The baseline is a parameter-matched standard transformer, with evaluation metrics including perplexity and wall-clock speedup.

Results

N-vium achieves a 57.9% wall-clock speedup at a 1.5B parameter scale, with perplexity comparable to standard transformers. Experiments validate the effectiveness of its mixture-of-exits model.

Applications

N-vium is applicable to natural language processing tasks requiring efficient inference, such as real-time translation and dialogue systems. Its approach can significantly reduce inference latency and improve user experience.

Limitations & Outlook

N-vium requires adjusting batch inference strategies, training with additional loss terms, and tuning the β hyperparameter to achieve speedup. Future work will explore its application to larger model scales.

Plain Language Accessible to non-experts

Imagine a factory where traditional transformers are like an assembly line, where every product must go through all the steps to be completed. This is time-consuming because even simple products have to go through every step. N-vium is like a smart factory where products can be completed at the appropriate step, saving time and resources. In this way, N-vium increases efficiency without compromising product quality.

ELI14 Explained like you're 14

Imagine you're playing a game with long levels. The traditional way is to play through all the levels to win. N-vium is like a smart game assistant that helps you finish at the right level, so you can complete the game faster without affecting your score. Isn't that cool?

Glossary

Transformer

A deep learning model used for natural language processing, known for handling sequence data effectively.

N-vium extends the transformer to improve inference efficiency.

Autoregressive

A generative model that predicts the next token step-by-step to generate a sequence.

N-vium improves efficiency in autoregressive inference.

Perplexity

A measure of a language model's prediction accuracy; lower values indicate better models.

N-vium achieves inference speedup with no perplexity loss.

FLOPs

Floating-point operations per second, a measure of computational efficiency.

N-vium increases FLOPs per second to accelerate inference.

KV Cache

A cache storing key-value pairs in transformers, used to speed up subsequent inference.

N-vium recovers complete KV caches through batching.

Open Questions Unanswered questions from this research

  • 1 How to maintain N-vium's efficiency and quality in larger models? Further experiments and optimizations are needed.
  • 2 What is the effect of combining N-vium with other inference acceleration techniques? More research is needed to verify its potential.

Applications

Immediate Applications

Real-time Translation

N-vium can be used to improve the response speed of real-time translation systems, reducing latency and enhancing user experience.

Long-term Vision

Intelligent Dialogue Systems

By improving inference efficiency, N-vium can drive the development of intelligent dialogue systems, enabling more natural human-computer interactions.

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.

cs.LG cs.AI