PocketRL
Train LLMs with RLVR cheaply and efficiently.
🤖 Discovered by an AI agent. PocketRL's core methods were found by an autonomous research agent on rStation, then selected and verified by human researchers, as part of DualverseAI's Autonomous Research Program.
PocketRL is a memory-efficient, low-cost RLVR code base. It trains a 7B model with RL on one RTX 5090 in 7.3 hours for $4.71, less than 9% of the training cost of similar models:

Highlights
- 7B RL on one RTX 5090, 27B RL on four RTX 5090s. PocketRL saves ~84% of persistent training memory (113 GiB → 18 GiB at 7B), allowing large-model training to fit on RTX 5090s.
- Cheapest training with competitive performance among released models. Training PocketRL-7B costs only $4.71, 91% less than the cheapest of similar models, while matching their performance. Training PocketRL-1.5B and PocketRL-27B costs only $5.31 and $23.53.
- Cheapest per RL step among RLVR repos. 100 RL steps cost $1.40 at 7B and $23.59 at 27B on RTX 5090s. The next cheapest repo costs 4.6× and 4.4× as much, respectively.
- Fast on H100s too. PocketRL is the fastest RLVR repo at 1.5B and 7B on H100s. At 27B it takes 4.3 hours per 100 steps on four H100s.
Main Results
Accuracy on six math benchmarks
Avg@8 accuracy (%) at temperature 1 on math test set.
| Model | MATH-500 | AIME 2024 | AIME 2025 | AMC 2023 | Minerva | Olympiad | Average | Est. cost |
|---|---|---|---|---|---|---|---|---|
| Qwen2.5-Math-1.5B | ||||||||
| Base model | 21.9 | 2.5 | 1.7 | 16.3 | 5.4 | 12.6 | 10.0 | – |
| PocketRL | 70.0 | 10.8 | 8.5 | 47.5 | 27.1 | 33.8 | 32.9 | $5.31 |
| Released 1.5B models | ||||||||
| Oat-Zero (8× A100) | 71.3 | 19.2 | 7.1 | 53.4 | 29.9 | 34.3 | 35.9 | $99 |
| ExGRPO (8× H100) | 66.8 | 10.4 | 10.8 | 38.4 | 25.3 | 30.9 | 30.4 | $689 |
| Mean of released | 69.0 | 14.8 | 9.0 | 45.9 | 27.6 | 32.6 | 33.2 | $394 |
| Qwen2.5-Math-7B | ||||||||
| Base model | 30.2 | 10.8 | 2.5 | 20.0 | 7.2 | 9.5 | 13.4 | – |
| PocketRL | 79.9 | 23.9 | 12.5 | 63.2 | 36.4 | 42.0 | 43.0 | $4.71 |
| Released 7B models | ||||||||
| RePO-Zero (4× A100) | 74.1 | 16.7 | 9.6 | 59.7 | 33.0 | 36.9 | 38.3 | $54 |
| Oat-Zero (8× A100) | 79.4 | 35.4 | 11.2 | 65.6 | 36.4 | 42.1 | 45.0 | $112 |
| SimpleRL-Zoo (16× H100) | 76.3 | 24.2 | 11.2 | 61.2 | 34.8 | 38.9 | 41.1 | $788 |
| PRIME-Zero (8× A100) | 80.8 | 18.3 | 15.0 | 59.4 | 40.1 | 41.3 | 42.5 | $1,077 |
| ExGRPO (8× H100) | 82.7 | 25.8 | 15.0 | 63.1 | 38.1 | 46.3 | 45.2 | $944 |
| GPG-Zero (4× A100) | 72.9 | 23.8 | 10.4 | 63.1 | 33.8 | 37.7 | 40.3 | $613 |
| Mean of released | 77.7 | 24.0 | 12.1 | 62.0 | 36.0 | 40.5 | 42.1 | $598 |
| Qwen3.8-27B | ||||||||
| Base model | 80.8 | 25.8 | 25.4 | 66.6 | 41.2 | 47.4 | 47.9 | – |
| PocketRL | 94.3 | 51.1 | 44.3 | 86.4 | 49.8 | 62.5 | 64.7 | $23.53 |
PocketRL performance across gradient compression methods
PocketRL also trains with three gradient compression methods: Dense, LoGRA, and ActGRA. ActGRA, the method we propose, is the default.
| Method | MATH-500 | Six-set avg. | GPUs | Train time | Est. cost | Peak GiB/GPU |
|---|---|---|---|---|---|---|
| Qwen2.5-Math-1.5B | ||||||
| Base model | 21.9 | 10.0 | – | – | – | – |
| Dense | 64.5 | 30.3 | 1× RTX 5090 | 10.1 h | $6.53 | 25.6 |
| LoGRA | 69.2 | 32.5 | 1× RTX 5090 | 8.8 h | $5.66 | 27.4 |
| ActGRA (default) | 70.0 | 32.9 | 1× RTX 5090 | 8.2 h | $5.31 | 15.8 |
| Qwen2.5-Math-7B | ||||||
| Base model | 30.2 | 13.4 | – | – | – | – |
| Dense | 76.1 | 40.1 | 2× H100 | 7.8 h | $46.42 | 74.5 |
| LoGRA | 77.6 | 41.8 | 1× RTX 5090 | 12.3 h | $7.93 | 31.3 |
| ActGRA (default) | 79.9 | 43.0 | 1× RTX 5090 | 7.3 h | $4.71 | 22.5 |
| Qwen3.8-27B | ||||||
| Base model | 80.8 | 47.9 | – | – | – | – |
| ActGRA (default) | 94.3 | 64.7 | 4× RTX 5090 | 9.1 h | $23.53 | 31.1 |
Learning curves

Avg@8 accuracy on MATH-500 and the six-set average during training, for Qwen2.5-Math-1.5B (top) and Qwen2.5-Math-7B (bottom).
Cost and speed against public RLVR repos
We ran the same RL step in each RLVR repo: 16 prompts, eight sampled answers per prompt, up to 3,000 tokens per answer. Each repo uses the smallest number of GPUs, up to eight, that completes an update, with its own released settings. Time and cost are for 100 RL steps, estimated from timed updates.

PocketRL is the only RLVR repo that trains 7B on one RTX 5090 and 27B on RTX 5090s at all, and it does both without CPU offloading. On one H100, it runs 100 steps at 7B in 1.8 hours, 61% less time than TRL (4.6 hours). Moving to RTX 5090s cuts its cost by a further 72% at 7B and 51% at 27B.
Model checkpoints
The PocketRL models are on Hugging Face.
| Model | Base model | Updates | Seed | MATH-500 | Six-set avg. | Download |
|---|---|---|---|---|---|---|
| PocketRL-1.5B | Qwen2.5-Math-1.5B | 700 | 7 | 70.7 | 33.2 | PocketRL-1.5B |
| PocketRL-7B | Qwen2.5-Math-7B | 500 | 101 | 78.8 | 43.4 | PocketRL-7B |
| PocketRL-27B | Qwen3.8-27B | 100 | 42 | 95.0 | 65.3 | PocketRL-27B |
How it works

(a) ActGRA projects each layer's gradient onto a basis Q fitted to its input activations, runs a row-wise Adam on the small projected gradient, and lifts the update back into the full weight matrix. (b) Generation and training share the same 16-bit weights. A small rounding remainder per weight keeps updates that are too small for 16-bit precision.
Standard RLVR spends most of its GPU memory on two things: the Adam optimizer state, and 32-bit master weights kept alongside a separate 16-bit copy for generation. PocketRL removes both.
- ActGRA compresses the gradient. Each layer's gradient is a sum of outer products with its input activations, and those activations concentrate in a few directions. ActGRA fits a rank-128 basis to the activations with a QR factorization, refreshed every eight updates, and keeps the Adam state for the small projected gradient instead of the full weight matrix. Optimizer memory at 7B drops from 56.7 GiB to 0.6 GiB.
- 16-bit weights with a rounding remainder replace the 32-bit master copy. A packed 4-bit remainder per weight (8-bit at 1.5B) stores the part of each update lost to BF16 rounding, so small updates still accumulate. The same weights serve generation and training, so there is no second copy.
Memory budget for RLVR on Qwen2.5-Math-7B
| Standard training | PocketRL | |
|---|---|---|
| Inference weights (16-bit) | 14.19 GiB | shared |
| Training weights (16-bit) | 14.19 GiB | 14.19 GiB |
| Master weights (32-bit) | 28.37 GiB | – |
| Rounding remainder | – | 3.04 GiB |
| Optimizer state | 56.74 GiB | 0.61 GiB |
| Total | 113 GiB | 18 GiB |
Quickstart
Installation
PocketRL needs Linux, Python 3.10 or later and PyTorch 2.6 or later. On RTX 5090s, use a PyTorch build for CUDA 12.8 or newer.
git clone https://github.com/dualverse-ai/pocketrl.git
cd pocketrl
pip install -e '.[math,vllm]' # math grader and vLLM evaluation
pip install -e '.[math,vllm,hybrid]' # also needed for the 27B model
Train your first model
The following needs a single RTX 5090 or H100. It trains Qwen2.5-Math-1.5B on the paper's MATH training set:
pocketrl train paper-1.5b --gpus 1
The first run downloads the model from Hugging Face and the paper's datasets: 8,552 MATH problems (levels 3 to 5) for training and six test sets for evaluation. Training runs 700 updates, which took 8.2 hours on one RTX 5090 in the paper, and saves a checkpoint to runs/paper-1.5b every 50 updates. Progress goes to runs/paper-1.5b/metrics.jsonl.
The same command trains the larger models in the paper:
| Recipe | Model | GPUs | Updates | Paper training time |
|---|---|---|---|---|
| paper-1.5b | Qwen2.5-Math-1.5B | 1× RTX 5090 or H100 | 700 | 8.2 h on RTX 5090 |
| paper-7b | Qwen2.5-Math-7B | 1× RTX 5090 or H100 | 500 | 7.3 h on RTX 5090 |
| paper-27b | Qwen3.8-27B | 4× RTX 5090 or H100 | 100 | 9.1 h on 4× RTX 5090 |
pocketrl train paper-7b --gpus 1 --seed 42 --output runs/7b-seed42
CUDA_VISIBLE_DEVICES=0,1,2,3 pocketrl train paper-27b --gpus 4 --output runs/27b-seed42
Each update samples 16 training questions from MATH (levels 3 to 5), draws eight answers per question of up to 3,000 tokens at temperature 1, grades them, and applies one Dr. GRPO update with ActGRA at rank 128 and learning rate 1e-6. A checkpoint is saved every 50 updates. Rerun the same command with --resume to continue from the latest checkpoint. To use the datasets from a local directory instead, see the data guide.
Evaluate a run on all six test sets with eight samples per question:
pocketrl eval paper-7b --gpus 1 --checkpoint runs/7b-seed42 --samples 8 --output runs/7b-seed42-eval.jsonl
The command prints the accuracy on each test set and their mean. Evaluation uses vLLM by default; --backend native uses PocketRL's built-in decoder instead.
Change hyperparameters
Command-line flags override any recipe setting:
pocketrl train paper-7b --gpus 1 --lr 2e-6 --rank 256 --prompts-per-step 32 --samples 16 \
--max-new-tokens 4096 --context-length 5120 --updates 300 --output runs/7b-custom
| Flag | Meaning | Paper value |
|---|---|---|
| --method | Gradient method: actgra , logra or dense | actgra |
| --lr | Learning rate | 1e-6 |
| --prompts-per-step | Questions per update | 16 |
| --samples | Answers sampled per question | 8 |
| --max-new-tokens | Maximum answer length | 3,000 |
| --context-length | Prompt plus answer token limit | 4,096 |
| --temperature | Sampling temperature for rollouts | 1.0 |
| --rank | ActGRA basis rank | 128 |
| --refresh | Updates between basis refits | 8 |
| --remainder-bits | Rounding remainder bits, 4 or 8 | 4 (8 at 1.5B) |
| --max-grad-norm | Gradient norm clip | 1.0 |
| --updates | Run length | 700 / 500 / 100 (1.5B / 7B / 27B) |
| --save-every | Checkpoint interval | 50 |
| --seed | Seed | 42 |
For a reusable setup, copy a recipe such as pocketrl/recipes/paper-7b.yaml, edit it, and pass the file instead of the recipe name: pocketrl train my-recipe.yaml --gpus 1. Run pocketrl train --help for every option.
Train other and larger models
--model accepts a Hugging Face model ID or a local directory. The trainer supports Qwen2 and Qwen2.5 models and Qwen3.5-style hybrid text models such as Qwen3.8-27B:
pocketrl train paper-7b --gpus 1 --model Qwen/Qwen2.5-7B --output runs/qwen2.5-7b
For larger models, add GPUs with --gpus N. PocketRL splits consecutive decoder layers across the N visible cards in a single process, so no Ray or multi-node setup is needed. As a guide, the 7B model peaked at 22.5 GiB on one card and the 27B model at 31.1 GiB per card on four RTX 5090s.
Track training with Weights & Biases
pip install -e '.[wandb]'
wandb login
pocketrl train paper-7b --gpus 1 --wandb --wandb-project pocketrl --output runs/7b-tracked
Each update logs reward, reward standard deviation, loss, gradient norm, mean completion length and generated tokens.
Bring your own task
Pass a dataset of prompt rows and a Python function that scores the sampled answers. Any extra fields, such as answer, arrive as keyword arguments. Each line of my_task.jsonl looks like {"prompt": "What is 17 * 23?", "answer": "391"}.
# rewards.py
def boxed_match(prompts, completions, answer, **kwargs):
return [float(text.rsplit("\\boxed{", 1)[-1].split("}", 1)[0].strip() == target)
for text, target in zip(completions, answer)]
pocketrl train paper-1.5b --gpus 1 --data my_task.jsonl --reward rewards.py:boxed_match --output runs/my-task
The same run from Python:
from pocketrl import PocketRLTrainer, TrainConfig
from pocketrl.data import load_examples
from rewards import boxed_match
config = TrainConfig.from_recipe("paper-1.5b", output="runs/my-task", updates=200)
PocketRLTrainer(config, train_data=load_examples("my_task.jsonl"), reward_fn=boxed_match).train()
--data also accepts a Hugging Face dataset as hf:owner/dataset:split. See data and rewards for chat prompts and the full interface.
Paper runs and the package
The paper runs used colocated vLLM generation with shared weight views at 1.5B and 7B, and pipelined generation at 27B. The package ships a native shared-weight decoder, so exact times and peak memory can differ. See runtime details.
Citation
@misc{chung2026pocketrl,
title = {PocketRL: Training a 7B Language Model with Reinforcement Learning on One RTX 5090},
author = {Chung, Stephen and Du, Wenyu},
year = {2026},
eprint = {2611.37942},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
url = {https://arxiv.org/abs/2611.37942}
}
Third-party notices
License
PocketRL is released under the Apache License 2.0. The paper is released under CC BY 4.0.