Known-issues sheets for local language models Rev 0.1.0 · reviewed every 7 days

Model datasheet · Gemma 4

Gemma 4 31B

The Gemma 4 family's dense flagship, and much stronger at long context than its own 26B sibling: 66.4% MRCR at 128K against 44.1%. Official QAT Q4_0 is 17.7GB, so the whole thing fits a 32GB machine.

Vendor
Google
Architecture
Dense · 30.7B
Context
262,144 tokens
License
Apache-2.0
Released
2026-03-31
Vision
Yes

→ GGUF (llama.cpp / LM Studio / Ollama) → MLX (Apple Silicon)

Architecture, from its own config.json

60 layers · 50 sliding window · 10 full attention

32 attention heads over 16 KV heads (GQA 2:1), head dim 256 — its full-attention layers use a different shape again, 4 KV heads of 512, which is the shape that decides the cache at long context · dense feed-forward · vocabulary 262,144

Where the memory goes: weights by band above, plus a KV cache of 1.8GB at 8K · 3.7GB at 32K · 11.2GB at 128K, plus the runtime's own working memory — dominated by the output projection over that vocabulary.

Inside one layer, from its own tensors

50 × sliding-window layer

input_layernormattentionq_projk_projv_projsoftmax(q·kᵀ/√d) · vq_norm · k_norm before the dotproduct32 query heads over 16 key/valueheadso_projpost_attention_layernormpre_feedforward_layernormfeed-forwardgate_proj · up_proj → down_proj21,504 widepost_feedforward_layernorm

10 × full-attention layer

input_layernormattentionq_projk_projv_projsoftmax(q·kᵀ/√d) · vq_norm · k_norm before the dotproduct32 query heads over 16 key/valueheadso_projpost_attention_layernormpre_feedforward_layernormfeed-forwardgate_proj · up_proj → down_proj21,504 widepost_feedforward_layernorm

The green line down the right of each half is the residual: it leaves the spine above the norm, skips the operation entirely and rejoins at the +. Where attention is drawn open, q, k and v are scaled to their real output widths — a model that shares key and value heads across many query heads shows one wide box beside two narrow ones.

Around the stack: an embedding of 262,144 × 5,376, a final norm, and an output projection that reuses the embedding (tied weights).

Also in every block and not drawn, because their tensor names do not fix where they belong: layer_scalar. Guessing an order is the one thing this diagram will not do.

§1 Characteristics by quantization band

Q2–Q3 — 2–3 bit

15GB weights · e.g. Q3_K_M + KV: 1.8GB at 8K · 3.7GB at 32K · 11.2GB at 128K

— Not yet rated · contributions welcome —

Q4–Q5 — 4–5 bit

18GB weights · e.g. Q4_0 , Q4_K_M , mlx-4bit + KV: 1.8GB at 8K · 3.7GB at 32K · 11.2GB at 128K
Math & reasoning 7/10
data checked Aug 2026
  • quant-degradation-community — community consensus @ Q4_0 · aggregated · 2026-08-30

    Editorial derivation: QAT Q4_0 is Google's intended local build (17.7GB); small loss vs full. Mirrors the derivation used for gemma-4-26b-a4b.

Coding 6/10
data checked Aug 2026
  • quant-degradation-community — community consensus @ Q4_0 · aggregated · 2026-08-30

    Editorial derivation: QAT limits quant loss. Lowered from 7 to 6 on 2026-10-30 to stay one point under the full band, which LiveBench 2.0 Coding pulled down.

Tool calling / agentic 6/10
data checked Aug 2026
  • quant-degradation-community — community consensus @ Q4_0 · aggregated · 2026-08-30

    Editorial derivation: carried down one point, consistent with the family.

Q6–Q8 — 6–8 bit

25GB weights · e.g. Q6_K + KV: 1.8GB at 8K · 3.7GB at 32K · 11.2GB at 128K

— Not yet rated · contributions welcome —

FP16 — full precision (fp16/bf16)

61GB weights · e.g. bf16 + KV: 1.8GB at 8K · 3.7GB at 32K · 11.2GB at 128K
Math & reasoning 8/10
data checked Oct 2026
  • vendor-model-card — AIME 2026 (no tools) = 89.2 @ bf16 · vendor-reported · 2026-08-30

    GPQA Diamond: 84.3, MMLU-Pro: 85.2. Marginally ahead of the 26B-A4B sibling (88.3) — same editorial score, since the gap is inside vendor-reporting noise and neither has independent replication.

  • livebench — LiveBench 2.0 Reasoning (suite score) = 68.3 · aggregated · 2026-10-30

    Short logic, spatial and theory-of-mind questions: theory of mind 73.1, spatial 96.0, logic with navigation 68.0, but zebra puzzles 36.0. Not a maths test. Below Qwen3.8 27B (80.0) and GLM-5.3-Flash (77.6). Held at 8 on the vendor maths figures, which this does not directly contradict. LiveBench 2.0, release 2026-10-25, per-suite figure from https://livebench.ai/data/20261025/table.csv (suite breakdown in breakdown.json alongside). Each cell is a single run; tasks the run could not measure score 0; models run at their highest supported effort. Independent. Serving quant not stated (presumed full-precision API).

Coding 7/10
data checked Oct 2026
  • vendor-model-card — LiveCodeBench v6 = 80 @ bf16 · vendor-reported · 2026-08-30

    Codeforces ELO 2150. Absent from Aider polyglot as of 2026-10-30 (the leaderboard has added no model since 2025-10-03), so no real-world code-editing check exists yet — the dimension that historically embarrassed Gemma 3.

  • livebench — LiveBench 2.0 Coding (suite score) = 49 · aggregated · 2026-10-30

    Bug-fix tasks taken from real merged pull requests, graded deterministically (29 tasks). Far below Qwen3.8 27B (86.8) and GLM-5.3-Flash (80.6), both scored 9, and well short of what the vendor's LiveCodeBench 80.0 implies. Lowered from 8 to 7 on 2026-10-30: this is the first independent real-world coding measurement for the model, and it puts it a clear tier below the models scored 8-9 here. One run of 29 tasks, so a single result, not a settled verdict. LiveBench 2.0, release 2026-10-25, per-suite figure from https://livebench.ai/data/20261025/table.csv (suite breakdown in breakdown.json alongside). Each cell is a single run; tasks the run could not measure score 0; models run at their highest supported effort. Independent. Serving quant not stated (presumed full-precision API).

Tool calling / agentic 7/10
data checked Oct 2026
  • vendor-model-card — Tau2 average (with tools) = 76.9 @ bf16 · vendor-reported · 2026-08-30

    Best Tau2 in the family. Held at 7 rather than 8 because llama.cpp users report duplicated tool calls on this size — see weaknesses/gemma-4-31b.json.

  • livebench — LiveBench 2.0 Long Agentic (suite score) = 10.7 · aggregated · 2026-10-30

    Long-running agent work over many turns (18 tasks): Systems Engineering 28.3, Performance Optimisation 32.3, the rest under 10. About half of Qwen3.8 27B (20.6) and GLM-5.3-Flash (19.0), both scored 8. Browser 0.0 on the same release, the score LiveBench gives a model that cannot take screenshots or whose run could not be measured. Consistent with the 7 held here. LiveBench 2.0, release 2026-10-25, per-suite figure from https://livebench.ai/data/20261025/table.csv (suite breakdown in breakdown.json alongside). Each cell is a single run; tasks the run could not measure score 0; models run at their highest supported effort. Independent. Serving quant not stated (presumed full-precision API).

Long context 6/10
data checked Aug 2026
  • vendor-model-card — MRCR v2 @128K (8 needle) = 66.4 @ bf16 · vendor-reported · 2026-08-30

    The standout number in this catalog: 66.4 where the 26B-A4B scores 44.1 and most models here are unrated. Still not a licence to fill 256K — a third of the needles are missed at half the window.

Creative writing 6/10
data checked Oct 2026
  • eqbench-creative — EQ-Bench Creative Writing v3 rubric score (0–20) = 13.6 · aggregated · 2026-10-30

    Independent; row google/gemma-4-31B-it. Rubric rank 73 of 146 (median 13.56); by Elo (1368.6) it ranks 89. Was 16.01 under the old judge. Now clearly the best Gemma 4 on rubric, just below Muse Glimmer 30B (13.72). Creative Writing v3 was re-scored on 2026-10-25: the rubric is now judged by GLM 5.3 (via OpenRouter, low reasoning effort) and the pairwise Elo by Claude Opus 5, replacing Claude Sonnet judges, and the board median fell from 15.96 to 13.56. Rubric figures from before that date are not comparable with this one. Quant and mode not stated by EQ-Bench (presumed full-precision API serving). Data file behind https://eqbench.com/creative_writing.html, last modified 2026-10-28.

  • eqbench-creative — EQ-Bench Creative Writing Longform score (0–100) = 56.5 · aggregated · 2026-10-04

    Rank 80 of 140 on the longform board (median 59.1). Mid-table prose: solid rubric scores, weaker in pairwise comparison and at chapter length.

Factuality 5/10
data checked Oct 2026
  • vectara-hallucination — HHEM hallucination rate % (lower is better) = 7.4 @ bf16 · aggregated · 2026-10-04

    Independent; row google/gemma-4-31b-it, README 'Last updated on September 22, 2026' (rows present since at least the 2026-05-11 README commit). Factual consistency 92.6%, answer rate 100.0%. Summarisation faithfulness at temperature 0 via API; mode not stated. Higher than its own 26B-A4B sibling (5.2) and identical to Gemma 3 27B (7.4), despite the stronger MMLU-Pro (85.2) — HHEM measures faithfulness to a source document, not stored knowledge.

§2 Known issues & what fixes them

ISSUE-01 moderate Q2–Q3 / Q4–Q5 / Q6–Q8 / FP16 · tool-calling

Emits the same tool call twice back-to-back, and sometimes closes a thinking block only to immediately open another right before tool handling breaks. Reported on both the 31B and its 26B-A4B sibling — slightly less often on the 31B — so agent harnesses need to be idempotent or de-duplicate. The llama.cpp issue cited here was closed on 2026-05-10 after parser fixes; a separate streaming tool-call report against the family opened on 2026-09-29 (see the streaming entry), so the parser is still settling.

Fix
Update your runtime [partial]

Track current llama.cpp; the Gemma 4 tool-call and template handling has been patched repeatedly since launch.

Fix
MCP / external tools [strong]

Make the tools themselves idempotent, or have the harness drop an identical repeat call, so a duplicate is harmless rather than a double write.

Evidence · 2 sources · community-consensus
ISSUE-02 severe Q2–Q3 / Q4–Q5 / Q6–Q8 · instruction-following, coding

Local Gemma 4 builds have been a moving target. Google's refreshed official GGUFs (2026-07-15) would not load in LM Studio 0.4.19 at all, and with KV-offload (-nkvo) enabled the family emits gibberish after roughly 230 tokens. Both look like model defects and are not. The churn continued in September: after a llama.cpp update the 31B ran out of Metal memory on a 128GB Mac, traced to an auto-fit change (#28849, merged 2026-09-16) that sized the starting context from the training context; it was reverted on 2026-09-26 (#29437).

Fix
Update your runtime [strong]

Use a llama.cpp build newer than the -nkvo regression and a re-uploaded quant (unsloth and bartowski both re-cut theirs after the upstream fixes). The -nkvo bug was fixed in April 2026; on anything older, avoid -nkvo.

Evidence · 5 sources · community-consensus
ISSUE-03 mild Q2–Q3 / Q4–Q5 / Q6–Q8 / FP16 · long-context

Best-in-catalog long-context retrieval is still only 66.4% MRCR v2 at 128K — on a model advertised at 256K. A third of the needles are missed at half the window.

Fix
RAG (retrieval) [strong]

Retrieve the relevant passages instead of pasting the corpus. Cheaper and more accurate than relying on the tail of a 256K window.

Evidence · 1 source · anecdotal
ISSUE-04 mild Q2–Q3 / Q4–Q5 / Q6–Q8 / FP16 · tool-calling

An open llama.cpp report (2026-09-29, Gemma 4 26B MoE, Vulkan) describes unstable streaming tool calls when arguments span several lines or the model uses unquoted keys — edits and file writes come out malformed. The parser maintainer is reworking the Gemma 4 parser (PR #29307, open) but was sceptical of the reporter's patch, and the reporter could not reproduce the parse failures on master on 2026-10-02. Treat as unconfirmed, and as a llama.cpp parser issue rather than a model defect.

Fix
Update your runtime [partial]

Track llama.cpp for the Gemma 4 parser rework (PR #29307). Until then, prefer non-streaming tool calls in agent harnesses if multi-line arguments misparse — a workaround inferred from the report, not maintainer-verified.

Evidence · 2 sources · anecdotal
ISSUE-05 mild Q2–Q3 / Q4–Q5 / Q6–Q8 / FP16 · tool-calling, instruction-following

In multi-tool-call turns, the reasoning trace can grow progressively longer trailing garbage until the server returns an error. The llama.cpp parser maintainer traced it to a leading newline the chat template injects before the end-of-thought marker on later turns, which the model then imitates. Reported on a Q8_0 31B. The reporter closed the issue on 2026-10-22 once the template edit below had fixed it, but Google's own template still injects the newline as of 2026-10-30.

Fix
Prompt technique [partial]

Use the edited chat template from the thread, which trims the thinking text before closing the channel. The reporter confirmed it fixed the problem; Google's template has not been changed.

Evidence · 2 sources · anecdotal