Home / use case

Gemma 4 E2B quantization ladder on four GPUs, from a 4 GB GTX 1650 laptop to an RTX 3050

At a glance
Hardware
GTX 1650 Ti with Max-Q (4,096 MiB) in a laptop with an Intel i7-10750H
RTX 3050 OEM (8,192 MiB) in a desktop with an Intel i7-5820K
Models & engines
llama.cpp b11699 built with GGML_CUDA=ON for each card's compute capability (75 for the GTX 1650, 86 for the RTX 3050)
llama-server -c 4096 -np 1 --seed 0, thinking off, 1,024 max tokens; about 58 GB of disk for the checkpoint and GGUFs
Key gotcha
Q3_K_M was slower than Q4_0 on every card, and lost most of its answers by running past the 1,024-token cap.

What they built

The author ran the same quantization ladder of Gemma 4 E2B (BF16, F16, Q8_0, Q6_K, Q5_K_M, Q4_K_M, Q4_0, Q3_K_M, Q2_K plus Google's QAT Q4_0 file) on four NVIDIA GPUs: a GTX 1650 Ti laptop GPU with 4 GB, an RTX 3050 desktop card with 8 GB, a Tesla T4 on Google Cloud and an L4 on AWS.

Everything else was held fixed: byte-identical GGUF files (same sha256), the same llama.cpp tag b11699, the same 250 GSM8K math questions, temperature 0 and one request at a time. Each card was first checked to give identical text when BF16 runs twice.

The point was to see which accuracy differences come from quantization and which come from the GPU itself, with all scripts and per-question results committed to the gemma-graveyard repo.

Setup

  • GTX 1650 Ti with Max-Q (4,096 MiB) in a laptop with an Intel i7-10750H
  • RTX 3050 OEM (8,192 MiB) in a desktop with an Intel i7-5820K
  • llama.cpp b11699 built with GGML_CUDA=ON for each card's compute capability (75 for the GTX 1650, 86 for the RTX 3050)
  • llama-server -c 4096 -np 1 --seed 0, thinking off, 1,024 max tokens; about 58 GB of disk for the checkpoint and GGUFs

How it works

  1. ladder.sh converts the Hugging Face checkpoint to BF16 and F16 and quantizes seven rungs from BF16; each run compares every file's size and sha256 with the reference run.
  2. Every rung runs with -ngl 99 except BF16 and F16 on the 4 GB card, where leaving -ngl off lets llama.cpp's fit step place 14 of 36 layers on the GPU.
  3. Each rung is scored against the same card's BF16, then all six pairs of GPUs are compared question by question.

Results & numbers

  • Right answers out of 250 at BF16 were 229 on the GTX 1650 and 232 on the RTX 3050; at Q5_K_M 226 on both; at Q4_0 216 and 218; at Q3_K_M 183 and 191; and Q2_K got only 5 and 3 right.
  • On the 4 GB GTX 1650, every quantized rung fit fully on the GPU; split BF16 and F16 decoded at 9.2 and 9.6 tokens/s against 45.9 for Q8_0 and 70.8 for Q4_0.
  • On the RTX 3050, Q4_0 decoded at 99.7 tokens/s and Q8_0 at 67.8; Q5_K_M decoded 1.21 to 1.35 times as fast as Q8_0 across the cards.
  • The full ladder took 5 hours 16 minutes on the RTX 3050 and 12 hours 25 minutes on the GTX 1650.
  • Any two GPUs graded 2 to 4 questions differently even at BF16, and 12 to 22 at Q4_0.

Gotchas

  • Q3_K_M was slower than Q4_0 on every card, and lost most of its answers by running past the 1,024-token cap.
  • Q2_K looped: 208 to 228 of its 250 answers repeated a line five or more times.
  • convert_hf_to_gguf.py writes the checkpoint directory name and model card into the GGUF, so converting straight from the Hugging Face cache gives different bytes; download with --local-dir into a folder named gemma-4-E2B-it.
  • Google's QAT Q4_0 and plain Q4_0 traded places depending on the card, so compare quantizations on one GPU.

Do it yourself

  1. Clone github.com/xbill9/gemma-graveyard.
  2. Build llama.cpp at the same tag with -DGGML_CUDA=ON and CMAKE_CUDA_ARCHITECTURES set for your card; a separate git worktree keeps it apart from your everyday build.
  3. Download google/gemma-4-E2B-it with hf download --local-dir <dir>/gemma-4-E2B-it so your GGUFs match.
  4. Run ladder.sh to build the rungs and check their sha256 against the committed ladder.tsv.
  5. Run each rung through the 250 questions and score them with graveyard.py bury against your own BF16.
  6. On a small GPU, use graveyard.py run --ngl auto so llama.cpp fits what it can.
cmake -B build -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=86 -DCMAKE_BUILD_TYPE=Release
cmake --build build -j12 --target llama-server llama-quantize
Source: xbill (DEV Community) · Published 2026-10-30 · Added 2026-10-31. This write-up summarizes the original source; see it for full details.

Similar setups

llama.cpp 1.0 on a handheld PC's integrated GPU: 2x faster long prompts with flash attention

Before-and-after llama.cpp 1.0 tests on an MSI Claw's Intel Arc 140V found long prompts read about twice as fast only with flash attention on, and the new MoE cache lost to full GPU offload.

DEV Community (maruhana) · 2026-11-27

Letting a coding agent tune llama.cpp on an 8 GB AMD GPU: 3x faster prompt reading for OpenCode

Cliff K had his coding agent benchmark llama.cpp backends and flags for a Qwen3.6 35B MoE on a Radeon RX 6600 XT, at the context depths OpenCode really uses, and turned the process into an open-source skill.

Cliff K (DEV Community) · 2026-11-01

Selective MoE offloading in llama.cpp on a 16 GB laptop GPU: faster for some models, much slower for others

Jessica Doering benchmarked five Mixture-of-Experts models too big for her 16 GB RTX 4090 laptop GPU, comparing llama.cpp's --n-cpu-moe expert offloading against plain layer offloading.

Jessica Doering (DEV Community) · 2026-10-31

Choosing Gemma 4 settings for function calls on an 8 GB RTX 3050

xbill ran 840 Berkeley Function Calling Leaderboard problems through Gemma 4 E2B, E4B and 12B on one 8 GB RTX 3050 with llama.cpp, in four sampling and thinking settings, to pick what to serve for tool calls.

DEV Community (xbill) · 2026-11-26