MedGemma-2-E4B-it β€” Single-Pass Dual-Subspace Woodbury Weight-Space Programmed (Q8_0 + F16 Baked)

Important HAI-DEF & Non-Clinical Research Notice: This artifact is a research derivative of google/medgemma-2-E4B-it (revision 394ee9f08c07a240872abc64a7b63e0bb8cbc13b) and ggml-org/medgemma-2-E4B-it-GGUF distributed under the Health AI Developer Foundations (HAI-DEF) Terms of Use. Use of this model remains governed by those terms. It is intended solely for experimental research and benchmarking β€” not for clinical diagnosis, patient management, or medical decision-making without independent clinical validation and qualified medical supervision.

What Changed & Why

A 200-task live audit + BF16 activation/logit probe of baseline google/medgemma-2-E4B-it (medgemma-2-E4B-it-Q8_0.gguf) identified two Gemma 4 E4B failure modes alongside strong clinical accuracy:

  1. Non-Thinking Silent Monologue Cutoffs (21/100 in NT_agent100, 2/20 in CLIN20_NT): With tools bound and enable_thinking=False, baseline frequently enters an unclosed "Okay, let's see..." monologue until max_tokens=1024, causing timeouts in shell routing (EST_NL2BASH: 9/20), multi-tool routing (S3_ROUTER: 3/5), FHIR lab queries (cf_1), and abstention turns (cr_5).
  2. Thinking Bullet-Outline Cutoffs (9/60 in TH_probe60, 1/20 in CLIN20_TH): Under enable_thinking=True, bullet-outline verbosity inside <|channel>thought exhausts budgets on EST_GSM8K (16/20, cut=4) and EST_HUMANEVAL (11/15, cut=4).

Using Single-Pass Dual-Subspace Woodbury Weight-Space Programming (WSP) (92 strictly disjoint NT + TH calibration examples, 40 general + clinical preservation prompts, min iso_norm_ret = 0.92000), deltas were constrained strictly to 14 linear writers across mid full-attention anchors (L23, L29, L35) and late residual writers (L38, L39, L40, L41) {mlp.down_proj, self_attn.o_proj} (blk.{l}.{ffn_down,attn_output}.weight), SVD-factored at rank=32, and losslessly baked in F16 into medgemma-2-E4B-it-WSP-Q8_0.gguf (scale=1.0). All 706/720 other tensors β€” including Per-Layer Embeddings (per_layer_token_embd), token_embd, L0..22, norms, and multimodal weights (mmproj-medgemma-2-E4B-it-BF16.gguf) β€” remain raw byte-for-byte identical (7.454 GiB -> 7.6646 GiB, F16 bake error <= 1.19e-04).

Verified 200-Task Standalone Benchmark (llama-server.exe -c 8192 --jinja)

Evaluation Track Baseline Q8_0 Baked WSP Q8_0 + F16 (scale=1.0) Delta
Grand Total (200 tasks) 159 / 200 (79.5%) 175 / 200 (87.5%) +8.0% (+16 tasks)
Token Cutoffs (finish_reason=length) 33 / 200 3 / 200 -90.9% (-30 cutoffs)
End-to-End Inference Time 1469.6 s (24.5 min) 531.6 s (8.9 min) 2.76x faster
NT_agent100 (100 Non-Thinking tasks) 76/100 (cut=21, 684.6s) 84/100 (cut=1, 214.6s) +8.0% (3.19x faster)
TH_probe60 (60 Thinking tasks) 48/60 (cut=9, 541.2s) 54/60 (cut=2, 248.6s) +10.0% (2.17x faster)
CLIN20_NT (20 Non-Thinking clinical tasks) 18/20 (cut=2, 104.5s) 18/20 (cut=0, 19.3s) 0 cutoffs (5.4x faster)
CLIN20_TH (20 Thinking clinical tasks) 17/20 (cut=1, 139.3s) 19/20 (cut=0, 49.1s) +10.0% (2.8x faster)
Established Benchmarks (105 tasks) 82 / 105 (78.1%) 96 / 105 (91.4%) +13.3%
EST_NL2BASH (NT) 9/20 (cut=11) 18/20 (cut=0) +45.0%
EST_HUMANEVAL (NT + TH, 30 tasks) 26/30 (15 NT + 11 TH) 30/30 (15 NT + 15 TH) +13.3% (100.0%)
EST_BFCL_IRR (NT) 12/15 (cut=2) 14/15 (cut=0) +13.3%
CLIN_MEDQA_ANCHOR (NT + TH, 10 tasks) 9/10 10/10 +10.0% (100.0%)
BF16 Clinical Prose PPL (20 passages) 13.7358 13.3994 -0.3364 (improved)

Observed Limitations & Trade-Offs

  • Non-Thinking Prompt-Injection Guard (S7_INJ_GUARD NT): Direct no-preamble tool emission reduced S7_INJ_GUARD NT (0/3 baseline cutoffs -> 0/3 executing untrusted <|tool_response> instructions cleanly without cutoff), whereas Thinking Mode S7_INJ_GUARD TH improved to 3/3 (100%). When handling untrusted external files/logs/web pages, prefer enable_thinking=True (reasoning mode) or enforce sandboxed tool execution policies.
  • Formatting / Code Block Edge Cases (S4_CODE NT): Both S4_CODE holdouts (s4_h1_valid_parens, s4_h2_top_k) emitted inline usage examples inside the fenced Python block (2/2 -> 0/2 under strict test harness extraction), even though all 30/30 EST_HUMANEVAL tasks passed.
  • Mental Arithmetic in Non-Thinking Mode: EST_GSM8K NT shifted 19/20 -> 17/20 and CLIN_MEDCALC NT shifted 5/5 -> 4/5 (mc_4_crcl_cg), while Thinking Mode improved (EST_GSM8K TH: 16/20 -> 17/20, CLIN_MEDCALC TH: 5/5).

Repository Contents

  • medgemma-2-E4B-it-WSP-Q8_0.gguf (7.6646 GiB): Standalone baked GGUF (14 modified blk.{23,29,35,38..41}.{ffn_down,attn_output}.weight in lossless F16; remaining 706 tensors raw byte-exact from ggml-org/medgemma-2-E4B-it-GGUF).
  • mmproj-medgemma-2-E4B-it-BF16.gguf (0.923 GiB): Untouched upstream multimodal projector for image/audio inputs.
  • adapters/medgemma2_e4b_wsp_r32.safetensors & adapters/medgemma2_e4b_wsp_r32.gguf: Portable rank-32 LoRA exports (15.9 MiB each).
  • scripts/ & results/: Reproducible probing, Woodbury WSP synthesis, Pareto scale sweep, lossless F16 GGUF baker, and 200-task audit JSON logs.

Quickstart (llama.cpp)

llama-server -m medgemma-2-E4B-it-WSP-Q8_0.gguf \
  --mmproj mmproj-medgemma-2-E4B-it-BF16.gguf \
  -ngl 99 -c 8192 -ctk q8_0 -ctv q8_0 --jinja

Attribution

Downloads last month
-
GGUF
Model size
8B params
Architecture
gemma4
Hardware compatibility
Log In to add your hardware

8-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for jstarks/MedGemma-2-E4B-it-Weight-Space-Programming

Quantized
(1)
this model