Newshot

Show HN: PocketRL – Train a 7B LLM with RL on one RTX 5090 for $4.71

Original text(via HN AI)

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:

MATH-500 accuracy against estimated training cost for PocketRL-7B and six released 7B RLVR models
MATH-500 accuracy against estimated training cost for PocketRL-7B and six released 7B RLVR 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.

ModelMATH-500AIME 2024AIME 2025AMC 2023MinervaOlympiadAverageEst. cost
Qwen2.5-Math-1.5B
Base model21.92.51.716.35.412.610.0–
PocketRL70.010.88.547.527.133.832.9$5.31
Released 1.5B models
Oat-Zero (8× A100)71.319.27.153.429.934.335.9$99
ExGRPO (8× H100)66.810.410.838.425.330.930.4$689
Mean of released69.014.89.045.927.632.633.2$394
Qwen2.5-Math-7B
Base model30.210.82.520.07.29.513.4–
PocketRL79.923.912.563.236.442.043.0$4.71
Released 7B models
RePO-Zero (4× A100)74.116.79.659.733.036.938.3$54
Oat-Zero (8× A100)79.435.411.265.636.442.145.0$112
SimpleRL-Zoo (16× H100)76.324.211.261.234.838.941.1$788
PRIME-Zero (8× A100)80.818.315.059.440.141.342.5$1,077
ExGRPO (8× H100)82.725.815.063.138.146.345.2$944
GPG-Zero (4× A100)72.923.810.463.133.837.740.3$613
Mean of released77.724.012.162.036.040.542.1$598
Qwen3.8-27B
Base model80.825.825.466.641.247.447.9–
PocketRL94.351.144.386.449.862.564.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.

MethodMATH-500Six-set avg.GPUsTrain timeEst. costPeak GiB/GPU
Qwen2.5-Math-1.5B
Base model21.910.0––––
Dense64.530.31× RTX 509010.1 h$6.5325.6
LoGRA69.232.51× RTX 50908.8 h$5.6627.4
ActGRA (default)70.032.91× RTX 50908.2 h$5.3115.8
Qwen2.5-Math-7B
Base model30.213.4––––
Dense76.140.12× H1007.8 h$46.4274.5
LoGRA77.641.81× RTX 509012.3 h$7.9331.3
ActGRA (default)79.943.01× RTX 50907.3 h$4.7122.5
Qwen3.8-27B
Base model80.847.9––––
ActGRA (default)94.364.74× RTX 50909.1 h$23.5331.1

Learning curves

MATH-500 and six-set average accuracy over training for ActGRA, LoGRA and Dense at 1.5B and 7B
MATH-500 and six-set average accuracy over training for ActGRA, LoGRA and Dense at 1.5B and 7B
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.

Cost of 100 RL steps for PocketRL, Oat, verl, OpenRLHF, LoGRA and TRL at 1.5B, 7B and 27B
Cost of 100 RL steps for PocketRL, Oat, verl, OpenRLHF, LoGRA and TRL at 1.5B, 7B and 27B

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.

ModelBase modelUpdatesSeedMATH-500Six-set avg.Download
PocketRL-1.5BQwen2.5-Math-1.5B700770.733.2PocketRL-1.5B
PocketRL-7BQwen2.5-Math-7B50010178.843.4PocketRL-7B
PocketRL-27BQwen3.8-27B1004295.065.3PocketRL-27B

How it works

ActGRA gradient projection and the shared-weight PocketRL training loop
ActGRA gradient projection and the shared-weight PocketRL training loop
(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 trainingPocketRL
Inference weights (16-bit)14.19 GiBshared
Training weights (16-bit)14.19 GiB14.19 GiB
Master weights (32-bit)28.37 GiB–
Rounding remainder–3.04 GiB
Optimizer state56.74 GiB0.61 GiB
Total113 GiB18 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:

RecipeModelGPUsUpdatesPaper training time
paper-1.5bQwen2.5-Math-1.5B1× RTX 5090 or H1007008.2 h on RTX 5090
paper-7bQwen2.5-Math-7B1× RTX 5090 or H1005007.3 h on RTX 5090
paper-27bQwen3.8-27B4× RTX 5090 or H1001009.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
      
FlagMeaningPaper value
--methodGradient method: actgra , logra or denseactgra
--lrLearning rate1e-6
--prompts-per-stepQuestions per update16
--samplesAnswers sampled per question8
--max-new-tokensMaximum answer length3,000
--context-lengthPrompt plus answer token limit4,096
--temperatureSampling temperature for rollouts1.0
--rankActGRA basis rank128
--refreshUpdates between basis refits8
--remainder-bitsRounding remainder bits, 4 or 84 (8 at 1.5B)
--max-grad-normGradient norm clip1.0
--updatesRun length700 / 500 / 100 (1.5B / 7B / 27B)
--save-everyCheckpoint interval50
--seedSeed42

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.

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by HN AI
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗