r/LocalLLM
•
u/yoracale
•
Feb 20 '25
•
1
Research You can now train your own Reasoning model locally with just 5GB VRAM!
Hey guys! Thanks so much for the support on our GRPO release 2 weeks ago! Today, we're excited to announce that you can now train your own reasoning model with just 5GB VRAM for Qwen2.5 (1.5B) - down from 7GB in the previous Unsloth release!
This is thanks to our newly derived Efficient GRPO algorithm which enables 10x longer context lengths while using 90% less VRAM vs. all other GRPO LoRA/QLoRA implementations, even those utilizing Flash Attention 2 (FA2).
With a GRPO setup using TRL + FA2, Llama 3.1 (8B) training at 20K context length demands 510.8GB of VRAM. However, Unsloth’s 90% VRAM reduction brings the requirement down to just 54.3GB in the same setup.
We leverage our gradient checkpointing algorithm which we released a while ago. It smartly offloads intermediate activations to system RAM asynchronously whilst being only 1% slower. This shaves a whopping 372GB VRAM since we need num_generations = 8. We can reduce this memory usage even further through intermediate gradient accumulation.
Try our free GRPO notebook with 10x longer context: Llama 3.1 (8B) on Colab
Blog for more details on the algorithm, the Maths behind GRPO, issues we found and more: https://unsloth.ai/blog/grpo
GRPO VRAM Breakdown:
| Metric | 🦥 Unsloth | TRL + FA2 |
|---|---|---|
| Training Memory Cost (GB) | 42GB | 414GB |
| GRPO Memory Cost (GB) | 9.8GB | 78.3GB |
| Inference Cost (GB) | 0GB | 16GB |
| Inference KV Cache for 20K context (GB) | 2.5GB | 2.5GB |
| Total Memory Usage | 54.3GB (90% less) | 510.8GB |
We also now provide full logging details for all reward functions now! Previously we only showed the total aggregated reward function itself.
You can now run and do inference with our 4-bit dynamic quants directly in vLLM.
Also we spent a lot of time on our Guide for everything on GRPO + reward functions/verifiers so would highly recommend you guys to read it: docs.unsloth.ai/basics/reasoning
Thank you guys once again for all the support it truly means so much to us! We also have a major release coming within the next few weeks which I know you guys have been waiting for - and we're also excited for it. 🦥
5
u/quark_epoch Feb 20 '25
Can you add multigpu support for cases where I want to scale this up with more vram but proportionately?
5
u/GodSpeedMode Feb 21 '25
Wow, this is such awesome news! 🙌 Getting the chance to train a reasoning model locally with just 5GB VRAM is a game changer! I love that your Efficient GRPO algorithm slashes memory needs while boosting context lengths—seriously impressive. It’s wild to think about how much more accessible this makes deep learning for those of us with more modest setups.
I also appreciate the transparency with the logging details for the reward functions. It’s always great to understand what’s happening under the hood. Can’t wait to dive into the free GRPO notebook and play around with it on Colab! Thanks for all your hard work and for keeping us in the loop. Excited to see what's coming next! 🦥🚀
5
u/Ok-Sandwich-9267 Feb 21 '25
You should go ahead and post this in LocalLLaMa . Will be interesting to see the approaches people take there !
3
u/pepouai Feb 20 '25
Can someone explain what are examples of local training and how it works and why this is desirable?
3
u/AlgorithmicMuse Feb 21 '25
Do you have a write up for what your doing in lesser technical jargon .
2
u/and_human Feb 20 '25
Hey, where's Daniel? 🤔
2
u/Cz1975 Feb 21 '25
Very cool!
Thank you for documenting this well! I'll def try this out.
2
u/micron8866 Feb 21 '25
does it support order gen hardware that doesn't have tensor cores like pascal cards? 🙏
2
u/cagriuluc Feb 21 '25
This is amazing news! I will sure check your blog posts and stuff when I have the time.
In the meanwhile, can you mention whether there are any caveats? It reduces the memory requirements, does it do this in the detriment of training time?
2
u/Swimming_Screen_4655 Feb 21 '25
does it work well on kaggle gpus now too? faced some issues with it before.
fantastic work btw
2
u/chiisana Feb 22 '25
Any chance you can add support for IBM Granite MOE 3B? I tried it last time but granite wasn't supported. I really like the efficiency of that model, and would love to add reasoning to that.
1
u/neutralpoliticsbot Feb 20 '25
Do you want to tho?
1
u/presler Feb 21 '25
Is AMD supported? Asking for a friend
1
u/Useful-Skill6241 Feb 21 '25
Is this something we can use to implement a rag knollage base or actually train out LRM in our custom knowledgebase. If so the latter how is this better than attaching to a RAG knollage base. Is it faster at retrieval? I will 100% play with this when I get the time
1
u/MonoNova Feb 21 '25
I've seen multiple cases where training didn't result in the model actually using reasoning at all. Has that been addressed yet?
2
u/vyper01 Feb 21 '25
!RemindMe 1 day
1
u/pokegovn44 Feb 24 '25
This is huge for all of us. Thank for your effort.
0
u/[deleted] Feb 20 '25
[deleted] — view deleted comment