r/LocalLLaMA • u/jacek2023 llama.cpp • 4d ago
Resources Fine-tune Gemma 4 models
https://gemma.ai/tuning/announced by googlegemma today:
"Want to fine-tune Gemma 4 on your own data, audio, receipts, or reasoning tasks? Our new fine-tuning hub is live on [censored for reddit]: 17 guides and 40+ illustrations covering the entire training pipeline. Ranging from continued pre-training and custom chat templates, all the way to (Q)LoRA and GRPO."
https://x.com/googlegemma/status/2125631619692429690
As you can see, different training techniques require different amounts of VRAM. The table below shows peak GPU memory (VRAM) across all five Gemma 4 models at a sequence length of 2,048 tokens:
| Model | Parameters | QLoRA | Full fine-tuning |
|---|---|---|---|
| Gemma 4 E2B | 2B effective | ~7 GB | ~32 GB |
| Gemma 4 E4B | 4B effective | ~9 GB | ~42 GB |
| Gemma 4 12B | 12B | ~11 GB | ~80 GB |
| Gemma 4 26B A4B | 26B (4B active) | ~21 GB | ~160 GB |
| Gemma 4 31B | 31B | ~22 GB | ~200 GB |
57
u/jacek2023 llama.cpp 4d ago
35
u/IntelArtiGen 4d ago
why "censored for reddit" ? they dont like the gemma website?
30
u/ishananand_com 4d ago
Worth noting Google has an open Kaggle competition for post-training Gemma 4 into a coding agent if anyone is interested. It closes in 7 days and I'm especially curious the small model (E4B, E2B) results.
https://www.kaggle.com/competitions/gemma-4-developer-agent
10
u/Impossible_Ground_15 4d ago
https://gemma.ai/tuning/
https://github.com/google-gemma/gemma-skills
14
u/llama-impersonator exllama 4d ago
fulltune numbers seem optimistic as all hell, even gemma 3 27b took 4 H100s with transformers based training
5
u/TuskNaPrezydenta2020 4d ago
Really nice guides from Google
2
u/GilloutineBreast 3d ago
I saw 4 and got overexcited
3
u/ShawnDud 4d ago
the full ft column lines up almost exactly with ~6 bytes per param (bf16 weights + bf16 grads + 8 bit adam). 26b x 6 is 156gb, 31b x 6 is 186gb plus activations. so it probably assumes an 8 bit optimizer and gradient checkpointing. with regular fp32 adam states and master weights youre closer to 16 bytes per param, which is why gemma 3 27b needed a few h100s
also the moe one doesnt get cheaper for full ft, all 26b params still need grads and optimizer state even though only 4b are active per token. and these are at 2048 seq len, push to 8k and the qlora numbers go up a fair bit from activations
-2
u/Panget-Si-Christian 4d ago
basically just a fluff piece that doesn't offer free training nor finetuning.
-1
u/shaakz 4d ago
Post github link if you please
-2
u/AndriiQwq 4d ago
Thanks, bro. I’ll check it out
-1
u/Icy-Degree6161 4d ago
Thanks!
-5
u/PossessionUsed7393 4d ago
Does it get rid of the watermark if you fine tune? You would expect right?
-2
u/VoraciousTrees 4d ago
Very cool!
-18
u/Thrumpwart vLLM 4d ago
Don’t tell me what to do.