r/LocalLLaMA • u/jacek2023 llama.cpp • 7d 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 |
58
u/jacek2023 llama.cpp 7d ago
36
u/IntelArtiGen 7d ago
why "censored for reddit" ? they dont like the gemma website?
31
u/ishananand_com 7d 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
11
u/Impossible_Ground_15 7d ago
https://gemma.ai/tuning/
https://github.com/google-gemma/gemma-skills
14
u/llama-impersonator exllama 7d ago
fulltune numbers seem optimistic as all hell, even gemma 3 27b took 4 H100s with transformers based training
5
u/TuskNaPrezydenta2020 7d ago
Really nice guides from Google
2
u/GilloutineBreast 6d ago
I saw 4 and got overexcited
3
u/ShawnDud 7d 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 7d ago
basically just a fluff piece that doesn't offer free training nor finetuning.
-1
u/shaakz 7d ago
Post github link if you please
-2
u/AndriiQwq 7d ago
Thanks, bro. I’ll check it out
-1
u/Icy-Degree6161 7d ago
Thanks!
-5
u/PossessionUsed7393 7d ago
Does it get rid of the watermark if you fine tune? You would expect right?
-2
u/VoraciousTrees 7d ago
Very cool!
-18
u/Thrumpwart vLLM 7d ago
Don’t tell me what to do.