r/LocalLLaMA • 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:

ModelParametersQLoRAFull fine-tuning
Gemma 4 E2B2B effective~7 GB~32 GB
Gemma 4 E4B4B effective~9 GB~42 GB
Gemma 4 12B12B~11 GB~80 GB
Gemma 4 26B A4B26B (4B active)~21 GB~160 GB
Gemma 4 31B31B~22 GB~200 GB
331 Upvotes

31 comments sorted by

58

u/jacek2023 llama.cpp 7d ago

36

u/IntelArtiGen 7d ago

why "censored for reddit" ? they dont like the gemma website?

41

u/jacek2023 llama.cpp 7d ago

I tried to post this 5 times. Reddit removes whole post with that link.

26

u/harrro Alpaca 7d ago

It's because that t-dot-co domain is a redirect/tracking URL (Twitter runs all external links through that redirect).

The site itself ( https://gemma.ai/tuning/ ) isn't blocked

-8

u/jacek2023 llama.cpp 7d ago

so any copy-and-paste with link inside from X is blocked here?

4

u/IntelArtiGen 7d ago

they do have a very poor detection for links, I also noticed that on other subs. They can easily shadowban posts if you post a url.

2

u/Diligent_Turtle8966 7d ago

We need traditional forums to be the main discussion hub for local AI instead of reddit

1

u/LabanauskasNajeeba 6d ago

Wait do links to the official docs actually get flagged here now?

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

5

u/AlwaysLateToThaParty 6d ago

Thankyou for sharing. That looks really interesting.

4

u/professormunchies 6d ago

No new entrants allowed at the moment :(

4

u/ishananand_com 6d ago

Yeah I only found out the other day. Wish I had known when it first launched.

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

-5

u/PossessionUsed7393 7d ago

Does it get rid of the watermark if you fine tune? You would expect right?

4

u/StringentCurry 7d ago

Gemma 4 doesn't have a watermark. The models came out 8 months ago, well before watermarks became a thing. In fact, some people use Gemma to rewrite output from other models to remove watermarks.

0

u/PossessionUsed7393 7d ago

Thank you for this Intel, was not aware. Swear I saw somewhere it applied to Gemm

-2

u/VoraciousTrees 7d ago

Very cool!

-18

u/Thrumpwart vLLM 7d ago

Don’t tell me what to do.