PocketRL cuts large language model training costs on one GPU
PocketRL: Training a 7B Language Model with Reinforcement Learning on One RTX 5090
Machine LearningComputation and Language
Summary
Training large language models with reinforcement learning is usually expensive and uses a lot of memory, making it hard for many people to do. The authors created PocketRL, a method that uses clever math and a new way to store numbers so a 7-billion-parameter model can be trained on just one RTX 5090 graphics card. This approach saves most of the memory normally needed and lets training happen much faster and cheaper. They also show how to train even bigger models with fewer GPUs and have shared their code publicly.
What this means in practice
- •For machine learning engineers: Train large language models using reinforcement learning on a single GPU with significantly reduced memory and cost requirements.
- •For ai infrastructure teams: Lower hardware requirements and operational costs for updating large models with reinforcement learning in production environments.
Authors
Stephen Chung, Wenyu Du
Abstract
It is now common to post-train large language models with reinforcement learning with verifiable rewards (RLVR), but its heavy memory use, and hence high cost, is an important bottleneck for RLVR research and a major expense in training frontier models. We introduce PocketRL, a low-cost, memory-efficient RLVR code base that trains a 7B model on a single RTX 5090 and a 27B model on only four, without CPU offloading. PocketRL combines two ideas. First, we project each layer's gradient and optimizer state onto a small basis fitted to the layer's input activations by a QR factorisation, which we call ActGRA, and show that such a basis retains far more of the gradient than the random projections used in prior work. Second, we propose training on 16-bit weights with half an extra byte per weight that carries the rounding error, which prevents small updates from being lost. The same 16-bit weights are used for inference, which saves further memory. Together, these methods reduce memory use for training a 7B model by 84%. This enables us to train a competitive 7B model in less than 8 hours on a single RTX 5090 for just $4.71, less than 9% of the cost of training comparable models. PocketRL also reduces the cost of a 27B training step by more than 77% compared with similar code bases. We open-source our PocketRL code base.