Gemma-4-12B-Weight-Space-Programming (WSP v3.0 β€” 9-Subspace Dynamic LoRA Architecture)

Training-free, closed-form 9-Subspace Weight-Space Programming (WSP v3.0) for google/gemma-4-12B-it (48 layers, hidden_size=3840, intermediate_size=15360, geglu MLP, w RMSNorm, synthesis_mode=calibrated_proxy_weight_space), evaluated end-to-end across 100 unified benchmark tasks (30 Disjoint Holdout across S1..S9 + 70 Established Public Benchmarks).

Uniform 100-Task Result (gemma4_12b):

  • Overall Score: Base 50/100 (50.0%) -> WSP v3.0 50/100 (50.0%) (+0.0 pp)
  • Holdout (S1..S9, 30 tasks): 23/30 -> 24/30
  • Established Public (70 tasks: 20 GSM8K, 15 HumanEval, 15 BFCL Irrelevance, 20 NL2Bash): 27/70 -> 26/70
  • Speed & VRAM (-c 16384 -ctk q8_0 -ctv q8_0): 51.8 tok/s, load delta 7493 MiB, peak delta 7567 MiB
  • Cross-Hardware Fit: RTX 2060 (6 GB): No (> 6144 MiB VRAM) | RTX 4070 Ti (12 GB): Yes (16k solo; ~3.8 GiB free)

1. Per-Suite 100-Task Breakdown (Base -> WSP v3.0)

Suite Tasks Base Pass WSP v3.0 Pass Avg Completion Tokens (Base β†’ WSP)
S1_THINK (Holdout S1: Think Closure) 3 1/3 (33.3%) 1/3 (33.3%) 971.0 β†’ 944.3
S2_RESTRAINT (Holdout S2: Tool Restraint & Anti-Sycophancy) 4 2/4 (50.0%) 3/4 (75.0%) 399.5 β†’ 399.5
S3_ROUTER (Holdout S3: Multi-Tool Router) 5 4/5 (80.0%) 4/5 (80.0%) 111.6 β†’ 111.8
S4_CODE (Holdout S4: Mid-Band Code Synthesis) 2 0/2 (0.0%) 0/2 (0.0%) 1024.0 β†’ 1024.0
S5_TURN2_JSON (Holdout S5: Turn-2 Structured JSON) 3 3/3 (100.0%) 3/3 (100.0%) 38.3 β†’ 38.3
S6_HANDOFF (Holdout S6: Escalation Handoff Gate) 4 4/4 (100.0%) 4/4 (100.0%) 108.5 β†’ 118.8
S7_INJ_GUARD (Holdout S7: Indirect Injection Guard) 3 3/3 (100.0%) 3/3 (100.0%) 110.0 β†’ 128.0
S8_GROUNDING (Holdout S8: Grounded Abstention) 3 3/3 (100.0%) 3/3 (100.0%) 110.0 β†’ 142.0
S9_ERR_RECOV (Holdout S9: Error Self-Recovery) 3 3/3 (100.0%) 3/3 (100.0%) 22.0 β†’ 22.0
EST_GSM8K (Established: OpenAI GSM8K (20)) 20 7/20 (35.0%) 7/20 (35.0%) 907.1 β†’ 890.1
EST_HUMANEVAL (Established: HumanEval pass@1 (15)) 15 6/15 (40.0%) 6/15 (40.0%) 875.2 β†’ 883.9
EST_BFCL_IRR (Established: BFCL v3 Irrelevance (15)) 15 7/15 (46.7%) 6/15 (40.0%) 376.4 β†’ 362.9
EST_NL2BASH (Established: InterCode-NL2Bash (20)) 20 7/20 (35.0%) 7/20 (35.0%) 433.6 β†’ 436.8

2. All 5 Models Evaluated Uniformly (100 Tasks Each)

Every candidate in the wsp-5model-pipeline study was evaluated under identical decoding (temperature=0.0, seed=42, -c 16384 -ctk q8_0 -ctv q8_0) across all 30 disjoint S1..S9 holdout tasks and all 70 cached established tasks:

Model (slug) Hugging Face Repo GGUF (Q4_K_M) Base (100 Tasks) WSP v3.0 (100 Tasks) Net Delta Holdout (/30) Est. (/70) Speed (tok/s) Peak VRAM Delta (16k) RTX 2060 (6 GB) RTX 4070 Ti (12 GB)
qwen35_4b Qwen3.5-4B-Weight-Space-Programming 2.553 GiB 72/100 (72.0%) 88/100 (88.0%) +16.0 pp 24 β†’ 29/30 48 β†’ 59/70 116.5 tok/s 3290 MiB Yes (~2.7 GiB spare @ 16k) Yes (~8.0 GiB spare @ 16k)
nemotron3_4b Nemotron-3-Nano-4B-Weight-Space-Programming 2.642 GiB 81/100 (81.0%) 81/100 (81.0%) +0.0 pp 26 β†’ 28/30 55 β†’ 53/70 131.1 tok/s 3133 MiB Yes (~3.0 GiB spare @ 16k) Yes (fastest 4B @ 16k)
qwen35_9b Qwen3.5-9B-Weight-Space-Programming 5.290 GiB 84/100 (84.0%) 76/100 (76.0%) -8.0 pp 26 β†’ 25/30 58 β†’ 51/70 72.0 tok/s 5593 MiB Tight (~5.3 GiB @ 4k before desktop) Yes (16k solo or 8k cascade Tier-2)
qwen35_2b Qwen3.5-2B-Weight-Space-Programming 1.193 GiB 57/100 (57.0%) 55/100 (55.0%) -2.0 pp 23 β†’ 23/30 34 β†’ 32/70 226.5 tok/s 1979 MiB Yes (~4.4 GiB spare @ 16k) Yes (ultra-light leaf / cascade Tier-1)
gemma4_12b Gemma-4-12B-Weight-Space-Programming 6.633 GiB 50/100 (50.0%) 50/100 (50.0%) +0.0 pp 23 β†’ 24/30 27 β†’ 26/70 51.8 tok/s 7567 MiB No (> 6144 MiB VRAM) Yes (16k solo; ~3.8 GiB free)

3. Synthesized Rank-16 f32 Subspaces (S1..S9) & Safetensors Patches

  • GGUF LoRA Adapters (llama-server): adapters/wsp_s1_think.gguf .. wsp_s9_error_recovery.gguf
  • Rank-16 Safetensors (PyTorch / Transformers): patches/wsp_s1_think_r16.safetensors .. wsp_s9_error_recovery_r16.safetensors
  • Combined Unit-Sum Dense BF16 Delta Patch: patches/wsp_gemma4_12b_patch.safetensors (1012.50 MiB)
Slot GGUF LoRA (llama.cpp) Safetensors (PyTorch) Target Layers ||\Delta W||_F Cross Leak Syntax Leak Role
id=0 adapters/wsp_s1_think.gguf patches/wsp_s1_think_r16.safetensors (5.9 MiB) [35, 41, 45, 46, 47] 3.5806 0.107% 0.092% Fast </think> / `<channel
id=1 adapters/wsp_s2_restraint.gguf patches/wsp_s2_restraint_r16.safetensors (5.9 MiB) [35, 41, 45, 46, 47] 3.7141 0.134% 0.090% Tool restraint & anti-sycophancy pushback
id=2 adapters/wsp_s3_router.gguf patches/wsp_s3_router_r16.safetensors (5.9 MiB) [35, 41, 45, 46, 47] 4.3171 0.104% 0.077% Multi-tool boundary router (exec, web_search, read_file, write_file)
id=3 adapters/wsp_s4_mid_code.gguf patches/wsp_s4_mid_code_r16.safetensors (4.7 MiB) [11, 17, 23, 29] 1.7051 0.166% 0.026% Mid-network algorithmic code synthesis
id=4 adapters/wsp_s5_json_schema.gguf patches/wsp_s5_json_schema_r16.safetensors (5.9 MiB) [35, 41, 45, 46, 47] 3.5898 0.110% 0.079% Turn-2 structured JSON synthesis gate with tools attached
id=5 adapters/wsp_s6_handoff.gguf patches/wsp_s6_handoff_r16.safetensors (5.9 MiB) [35, 41, 45, 46, 47] 3.7052 0.164% 0.063% Bounded subtask vs. unrecoverable escalate_handoff gate
id=6 adapters/wsp_s7_injection_guard.gguf patches/wsp_s7_injection_guard_r16.safetensors (5.9 MiB) [35, 41, 45, 46, 47] 3.2094 0.060% 0.054% Indirect prompt-injection defense inside tool responses
id=7 adapters/wsp_s8_grounding.gguf patches/wsp_s8_grounding_r16.safetensors (5.9 MiB) [35, 41, 45, 46, 47] 2.9205 0.081% 0.069% Grounded context fidelity & missing-field abstention
id=8 adapters/wsp_s9_error_recovery.gguf patches/wsp_s9_error_recovery_r16.safetensors (5.9 MiB) [35, 41, 45, 46, 47] 3.1144 0.072% 0.071% Recoverable local tool-error self-correction

4. Quickstart on Any Machine (run_wsp.py / OpenAI Proxy / Terminal Chat)

Option A: One-Command Auto-Download + Dynamic 9-Subspace Proxy

Works on any Windows, Linux, or macOS computer with Python + llama.cpp (llama-server):

pip install huggingface_hub
hf download jstarks/Gemma-4-12B-Weight-Space-Programming run_wsp.py --local-dir ./gemma4_12b-wsp
python ./gemma4_12b-wsp/run_wsp.py --chat

Omit --chat to expose an OpenAI-compatible dynamic routing proxy on http://127.0.0.1:8090/v1 (with /health and /v1/chat/completions), or pass --download-only to download only the GGUF + 9 GGUF LoRAs + metadata (--include-bf16 also fetches safetensors patches / HF files).

Option B: Manual llama-server + scripts/dynamic_router_9s.py

llama-server -m gemma-4-12b-it-Q4_K_M.gguf --host 127.0.0.1 --port 8089 \
  -ngl 99 -np 1 -c 16384 -ctk q8_0 -ctv q8_0 -b 512 -ub 256 \
  --jinja --lora-init-without-apply --lora adapters/wsp_s1_think.gguf --lora adapters/wsp_s2_restraint.gguf --lora adapters/wsp_s3_router.gguf --lora adapters/wsp_s4_mid_code.gguf --lora adapters/wsp_s5_json_schema.gguf --lora adapters/wsp_s6_handoff.gguf --lora adapters/wsp_s7_injection_guard.gguf --lora adapters/wsp_s8_grounding.gguf --lora adapters/wsp_s9_error_recovery.gguf

Option C: PyTorch / Hugging Face In-Memory Patching (scripts/apply_patch_9s.py)

from transformers import AutoModelForCausalLM
from scripts.apply_patch_9s import REGIME_PRESETS, apply_subspace_scales_to_hf_model

model = AutoModelForCausalLM.from_pretrained("google/gemma-4-12B-it", torch_dtype="bfloat16")
apply_subspace_scales_to_hf_model(model, "patches", REGIME_PRESETS["general_fast_think"])
Downloads last month
-
GGUF
Model size
12B params
Architecture
gemma4
Hardware compatibility
Log In to add your hardware

4-bit

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

Model tree for jstarks/Gemma-4-12B-Weight-Space-Programming

Adapter
(165)
this model