TL;DR
This paper introduces Nemotron-H, a new family of large language models that blend Transformer and Mamba architectures to achieve state-of-the-art accuracy with significantly improved inference speed and reduced memory usage. By replacing most self-attention layers with Mamba's efficient state-space model, Nemotron-H models offer up to 3x faster inference, making them more practical for demanding AI applications.
What Problem Does This Paper Address?
As large language models (LLMs) become more capable, especially in complex reasoning tasks that benefit from longer contexts, their inference cost becomes a major bottleneck. The self-attention mechanism, a cornerstone of traditional Transformer architectures, has computational and memory requirements that scale quadratically with sequence length. This makes generating longer responses or processing lengthy inputs prohibitively expensive and slow. The paper aims to address this by developing models that maintain high accuracy while drastically reducing inference time and memory footprint.
Methods
The core innovation is the Nemotron-H architecture, a hybrid model that replaces the majority of self-attention layers in a standard Transformer with Mamba-2 layers. Mamba layers offer constant computation and memory per generated token, a significant advantage over self-attention. The Nemotron-H models are built with a mixture of Mamba-2, self-attention, and Feed-Forward Network (FFN) layers, with self-attention layers strategically dispersed.
To further optimize for inference, the authors developed:
- MiniPuzzle: A novel compression framework combining pruning and distillation. This technique was used to create a 47B parameter model (Nemotron-H-47B-Base) from the 56B model, achieving similar accuracy with a 20% speedup.
- FP8-based training recipe: This recipe uses per-tensor current scaling for quantization and allows for training with FP8 precision, achieving comparable results to BF16 training but with reduced memory and faster computation.
Datasets
The Nemotron-H models were pre-trained on a massive corpus of up to 20 trillion tokens. This dataset was curated from various sources, including:
- General web crawl data: Enhanced with innovations in processing to improve quality.
- Math data: Leveraging existing pipelines and expanding datasets like OpenWebMath.
- Code data: Incorporating a significant number of code tokens from various programming languages.
- Academic data: Including peer-reviewed publications, textbooks, and patents.
- Synthetically-generated data: Created using LLMs to de-noise low-quality data and increase diversity, including diverse QA pairs, distilled text, extracted knowledge, and knowledge lists.
For Vision-Language Models (VLMs), they utilized large and diverse image-text datasets from NVLM, including captioning, VQA, visual chart, and document understanding data.
Key Insights and Ideas
- Hybrid architectures are the future for efficient LLMs: The paper strongly suggests that combining the strengths of Transformers (for certain tasks) with Mamba's efficiency is a viable path to achieving both high performance and practical inference.
- Mamba's constant scaling is a game-changer for inference: The core insight is that Mamba's sub-linear (and often constant) scaling for computation and memory directly addresses the quadratic bottleneck of self-attention, enabling faster and more memory-efficient LLMs.
- FP8 training can match BF16 performance: The authors demonstrate that their FP8 training recipe, even with a simple per-tensor scaling, can achieve comparable downstream task accuracy to BF16 training, opening doors for more efficient training of large models.
- Compression techniques are crucial for deployment: MiniPuzzle highlights the importance of sophisticated pruning and distillation methods to create smaller, more deployable models without significant accuracy degradation.
- Log-likelihood is not always a reliable proxy for downstream performance: The paper notes that models with better log-likelihood curves didn't always perform better on downstream tasks, emphasizing the need for direct evaluation.
Key Results
- Nemotron-H models achieve state-of-the-art accuracy: They offer on-par or better accuracy compared to similarly-sized open-source Transformer models like Qwen-2.5 and Llama-3.1.
- Significant inference speedups: Nemotron-H models are up to 3x faster at inference than comparable Transformer models, especially with longer sequences.
- Nemotron-H-56B-Base vs. Llama-3.1-70B: Outperforms Llama-3.1-70B on 16 out of 17 tasks.
- Nemotron-H-47B-Base: Achieves similar accuracy to the 56B model but is 20% faster to infer.
- FP8 training: Achieves comparable downstream task accuracy to BF16 training.
- Vision-Language Models (VLMs): Nemotron-H-based VLMs show strong performance on vision-language benchmarks.
- Reasoning models: Nemotron-H reasoning models demonstrate competitive performance, matching or exceeding Transformer counterparts.
Limitations and Future Work
- Resiliency during training: While the paper details efforts to improve training resiliency (e.g., DGX Cloud Resilience), large-scale training is inherently prone to failures.
- FP8 training nuances: The authors observed that FP8 training can lead to a slight increase in log-likelihood loss, particularly in the later stages of training, which they attribute to gradient flushing. While downstream performance was unaffected, this warrants further investigation.
- MiniPuzzle's impact on specific axes: Pruning Mamba heads or head dimensions caused severe accuracy degradation, indicating specific architectural components are more sensitive.
- Future Work: The paper suggests that further optimization of Nemotron-H inference could yield even greater speedups compared to Transformers. The release of checkpoints aims to facilitate further research into hybrid architectures and their applications. The authors also highlight the potential for Nemotron-H models to be extended into more capable instruction-tuned and long-context variants.
Summary updated