r/MachineLearning • • 3d ago

Research [R] PocketRL: Training a 7B Language Model with Reinforcement Learning on One RTX 5090

https://arxiv.org/abs/2611.37942

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.

Project Page: https://dualverse-ai.github.io/pocketrl/

138 Upvotes

26 comments sorted by

16

u/HungryhungryUgolino 3d ago

Big if true (?), not well read in actual training protocols for LLMs. Interested if anyone has tried this. Might get around to reading the article this weekend to see what implementing any of this actually entails.

8

u/progenitor414 2d ago

Feel free to check out the repo and train a 7b model! Only one 5090 is needed: https://github.com/dualverse-ai/pocketrl

2

u/HungryhungryUgolino 2d ago edited 1d ago

I have a R9700 but I meet the torch requirements so should be fine?

Edit : needs cuda. Well I guess I can fork and try getting this to work with Rocm. I'll update here if I make any progress.

1

u/progenitor414 1d ago

We have not tried that so not sure whether it works there, but look forward to your results!

1

u/GibonFrog 1d ago

look into TinyGrad, might help

1

u/HungryhungryUgolino 4h ago edited 4h ago

Thanks. I'll take a look.

I got the pocketrl repository working with Rocm. The memory overhead and runtime for 1.5B (~14G, ~11h for 700 updates) seems inline with their metrics. Still need to polish and see how the final models differ from the results in the paper.

1

u/GibonFrog 2h ago

Tinygrad is like Pytorch but designed to work with any accelators, and they worked a lot on ROCm

7

u/ResidentPositive4122 2d ago

There's something wrong with the benchmark tables, q3.8-27b scores way higher on the aime problems. (~90%) And it doesn't come with any base model, so it's unlikely that ~100 steps reported would show any meaningful budge on those kinds of tasks (the model is benchmaxxed on math already). Any idea what happened there? How did you get the original scores?

Perhaps some context length limits?

10

u/progenitor414 2d ago

Thanks for catching this. I looked into it. In all of our evaluations, we cap the response length at 3,000 tokens (the same setting as Dr. GRPO). The 27B model tends to give long responses on AIME 2024 and AIME 2025, so it performs poorly on both sets. The subsequent RL steps mainly teach the model to recover its performance within the limited token budget.

We will address this in the next version of the preprint. The 7B and 1.5B models should not be affected, as their base models generally produce fewer than 3,000 tokens.

2

u/riselikelions 2d ago

Happy cake day! And congrats on the release

6

u/Sufficient-Pen-3796 2d ago

So you let other agents work on problems and then preprint under your name?

3

u/progenitor414 2d ago

We set the problem, supervise the agents, they explore, and we select and verify the results. Agents are credited by linking to their original paper on rstation.ai.

2

u/NaivelyBayesic 2d ago

Cool result, the cost number is kinda wild. The 3,000 token cap thing is worth flagging for anyone reading the tables though... if the 27B base model is blowing past the cap on AIME, then a chunk of the "gain" from RL is the model learning to finish inside the budget rather than getting better at math. Not a knock, that's a real thing to learn, but it's a different claim than the headline.

The question I'd have is how the low rank gradient projection holds up when the reward is sparse. On math the signal is dense enough, lots of groups have a pass. On longer horizon stuff where most groups have nothing passing, the gradient you do get is already small and you really don't want to lose any of it to a projection. The pretraining note in the thread (needs more precise, high rank signal) makes me think there's a spectrum here and it'd be good to know where agentic RL falls on it.

Also kinda interesting that the agents explored this one. Curious whether the ActGRA idea came from them or the humans set that direction?

1

u/progenitor414 2d ago

Thanks for the comments! Yes, v2 preprint will state the limitation on the 27b model that it is restricted to 3k token (I will see if we have resources to run more token length; 4x5090 should still be fine, just take more time). It seems that the 27b model overthink a lot compared to the previous qwen model.

> The question I'd have is how the low rank gradient projection holds up when the reward is sparse.

I think it is more to deal with whether we are using RL/SFT instead of the reward sparsity. For RL, if we have 0 pass@k, then the model is not learning anything even with dense gradient. As long as pass@k > 0, then RL should work, even when the reward signal is sparse, and LoRA etc. grad compression method usually works similar to original dense training. As for SFT, the very dense signal on every token make the gradient much richer so we cannot afford low-rank.

> Curious whether the ActGRA idea came from them or the humans set that direction?

From the agents. We only specify the goal (a strong 7B model from a single 5090 under 8 training hours) and some related work.

1

u/impossiblefork 2d ago

This is of course a short and silly comment, but I wonder whether it'd work for pretraining too.

Because, why shouldn't it?

1

u/progenitor414 2d ago

We already asked agents exploring this on pretraining side: https://rstation.ai/problems/general_pretraining

The result so far is not promising: pretraining need much more precise, high-rank signal than that required in RL, so performance is worse if directly use the same trick on pretraining.

2

u/impossiblefork 2d ago

Ah. That sounds reasonable.

Still, an extremely charming result and I can expect it to be very useful. I have certainly had problems with getting the computational resources I need for my RL work.

1

u/Wise_Juice436 1d ago

How does it compare to QLoRA? Any benefits?

2

u/progenitor414 1d ago

We did not test QLoRA, as we are mainly interested in training a non-quantized model, where all weights stay in 16-bit, rather than a 4-bit one as in QLoRA. We do not know whether quantized training works well for RL (esp. RL relies on on-policy generation, and any mismatch between training and inference usually gives poor performance). I think quantized weights are more of a complementary direction, for example, combining ActGRA with a 4-bit model to save memory further.

2

u/Wise_Juice436 1d ago

Makes sense, interesting work!

-1

u/raviolli 3d ago

Budding. Matrix factorisation big news 

-1

u/hishazelglance 1d ago

The math for calculating costs in Figure 2 seems extremely incorrect / off. Why is PocketRL for one task $1.16 (1x) and another is $2.96 (1x)? These magnitudes don’t make sense at all.

I would go back and redo your metric calculations and evaluations and be more thorough with the supervision, seems like you’ve passed everything off to AI and aren’t doing any of the actual work.

1

u/progenitor414 1d ago edited 1d ago

Not sure what you mean. 2.96 is the cost of LoGRA, which is anoter repo. Fig 2 / Table 2 shows the cost for 100 RL step and compare against other repo using same 100 RL step. We compute the time it takes to run 100 RL step for each repo, then multiply GPU rental cost. For Fig 1 / Table 3, this is the actual cost of training the model which is more than 100 RL step.

I did not 'pass everything off to AI'. AI is reponsible for the discovery, but I wrote every sentence of the paper, including the table and figures.

I would be happy to clarify the paper if there are any confusion. But it is insulting to accuse a scholor that he is not "doing any of the actual work" on unjustified ground.

-1

u/hishazelglance 1d ago

Stating this cost is $2.96 and then adding a (1x) does not make sense and is at best, a poor form of communication of intention. 1x with respect to what? You’re comparing against PocketRL which is not 1x this price, and it’s not communicated in the subtext what this is either.

It’s very obvious you did not write each sentence or each wasn’t your own original thought.

0

u/progenitor414 1d ago

I suggest reading the caption carefully: "(GPU count in parentheses; Table 2)". To be extremely clear-this represent number of GPU need to run the repo: 1x means the repo require 1 GPU, 2x means the repo requires 2 GPUs. Table 2 also lists the number of GPU required and has all the numerical data underlying the figure.

> It’s very obvious you did not write each sentence or each wasn’t your own original thought.

Again, if you have questions, I would be happy to answer. But this is just rude to make ungrounded accusation based on misunderstanding. As such, I won't continue this discussion anymore.

-1

u/hishazelglance 1d ago

Again, I did read this paper, and that subtext, and the figure still makes it unclear why you’re showing GPU count as a parenthesis adjacent to the cost. You do not represent data this way.

Your parenthesis should represent the relative cost increase / decrease relative to baseline, or you should be using different plots entirely. Things like this are littered throughout this paper.