[Paper Review] RecurrentGemma: Moving Past Transformers for Efficient Open Language Models
RecurrentGemma-2B introduces an open-source language model based on the Griffin architecture, which replaces global attention with linear recurrences and local attention to achieve fixed-size state representation. This enables significantly faster inference on long sequences with lower memory usage, matching Gemma-2B’s performance despite being trained on 33% fewer tokens.
We introduce RecurrentGemma, a family of open language models which uses Google's novel Griffin architecture. Griffin combines linear recurrences with local attention to achieve excellent performance on language. It has a fixed-sized state, which reduces memory use and enables efficient inference on long sequences. We provide two sizes of models, containing 2B and 9B parameters, and provide pre-trained and instruction tuned variants for both. Our models achieve comparable performance to similarly-sized Gemma baselines despite being trained on fewer tokens.
Motivation & Objective
- To develop a highly efficient, open-source language model that outperforms Transformers in inference speed and memory efficiency on long sequences.
- To demonstrate that models based on linear recurrences can achieve performance comparable to state-of-the-art Transformers like Gemma-2B.
- To enable long-context generation by replacing the linearly growing KV cache of Transformers with a fixed-size state.
- To release both a pre-trained and instruction-tuned version of the model for research and deployment in resource-constrained environments.
- To validate the model’s safety and alignment through rigorous benchmarking and human evaluation, following Gemma’s responsible AI practices.
Proposed method
- Adopts the Griffin architecture, which combines linear recurrences (RG-LRU) with local attention (window size 2048) to model sequences without global attention.
- Uses a fixed-size state vector to compress input sequences, eliminating the need for a growing KV cache during autoregressive generation.
- Applies a learnable scaling factor (sqrt(model width)) to input embeddings, consistent with Gemma’s design, to stabilize training.
- Employs a specialized Pallas kernel for efficient inference on TPUs, with a reference PyTorch implementation also provided.
- Trains the model on 2T tokens from the same dataset as Gemma-2B, using a two-stage pre-training process: general mixture followed by high-quality data.
- Applies instruction tuning and a novel RLHF algorithm to fine-tune the model for instruction following, using a defined dialogue format with control tokens.
Experimental results
Research questions
- RQ1Can a recurrent architecture based on linear recurrences and local attention achieve performance competitive with Transformers like Gemma-2B on standard NLP benchmarks?
- RQ2Does replacing the KV cache with a fixed-size state enable significantly faster and more memory-efficient inference on long sequences compared to standard Transformers?
- RQ3To what extent can a model trained on fewer tokens (2T vs. 3T) match the performance of a larger pre-training regime while maintaining efficiency?
- RQ4How does the model perform in human evaluations compared to established instruction-tuned models like Mistral 7B?
- RQ5Can the Griffin-based architecture support arbitrary-length generation without memory constraints, and how does it scale in throughput?
Key findings
- RecurrentGemma-2B achieves 44.6% average score on the academic benchmark suite, compared to Gemma-2B’s 45.0%, demonstrating competitive performance despite training on 33% fewer tokens.
- On human evaluation, RecurrentGemma-2B-IT achieved a 43.7% win rate against Mistral 7B v0.2 Instruct on 1,000 instruction-following prompts, indicating strong alignment and usability.
- Inference throughput on a TPUv5e device is consistently higher for RecurrentGemma than for Gemma across all sequence lengths, with no degradation as sequence length increases.
- RecurrentGemma maintains high throughput (6k tokens/sec) during autoregressive sampling, while Gemma’s throughput drops significantly due to growing KV cache, especially on long sequences.
- Prompt processing is similarly fast for both models (~40k tokens/sec), confirming that the performance advantage is specific to autoregressive generation.
- The model’s fixed-size state enables arbitrary-length generation, limited only by compute and context window, unlike Transformers constrained by memory-bound KV cache growth.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.