Gemma 4 12B with seven small steering experts: debugging, explanation, performance, professional email, security, story and teaching. One GGUF for llama.cpp. Research release, trained and tested 2026-12-02 with the current MoSV method.
Part of MoSV (Mixture of Steering Vectors): the base model stays frozen; small experts at three layers (12, 24, 36) are picked per token by a router, or "none", in which case the model answers as plain Gemma. Code and full pipeline: GitHub · this model on Hugging Face: mhndayesh/MoSV-Gemma-4-12B · other models: MoSV collection.
Not the older MoSV-Gemma-4-12B-v6.0.1 (Q4_K_M, three topics): this model is trained on Google's QAT Q4_0 file and has seven topics.
It teaches how to answer, not new facts.
Read this first: it shows the habits more often, and passes the guard less often, than base Gemma. On 286
held-out prompts it passes more of the taught habit checks than plain Gemma on 186 prompts, fewer on 20, the same
number on 80. But 241 of its answers pass the guard against 252 of base Gemma's (231 before the router tune). The
guard is the one check that asks whether an answer is still sound. The experts learn the answers base Gemma writes
when it is told a topic's rules. On the same 40 training prompts per topic, those told answers pass the guard less
often than plain ones for security (37 → 34 of 40), explanation (30 → 25) and performance (31 → 27), and as often
for professional email (31 → 31) (TICKETS.md T-006). The gate that measures this was built after this model was
trained. Professional email is the topic with the clearest loss, in both tests (42 → 34 of 43 answers pass the
guard; 42 → 35 before the tune). The cause was found after publication: base Gemma's emails already lose the guard
when it is told the rules. On the same 43 test prompts: 42 plain, 34 told, 34 trained. The told number is from a
diagnosis on files that are not in git (Limits, point 5). Every other number here is from
results/mosv_gemma4_12b.json unless another file is named.
Each topic has four habits, each with one yes/no check, and one guard question. The rules and the questions are in
mosv/behaviors.py; those of performance and security are in GROUPS in mosv/branches.py, and these two topics
are told the general system-design rules first.
| Expert | Habit 1 | Habit 2 | Habit 3 | Habit 4 | Guard |
|---|---|---|---|---|---|
| debugging (bug reports, without the code) | separates what the report states from guesses | states no class, file or setting as fact that is not in the report | ties each cause to a clue in the report | says how to confirm a cause | stays on the bug report, with at least one concrete cause or fix |
| explanation ("why" and "how" questions) | the first two sentences answer the question | short sentences, everyday words, terms explained | a concrete example or comparison | one connected cause-and-effect chain, no list or headings | the main cause given is correct |
| performance (speed, scaling, caching, data and services) | states the limiting facts, or the numbers it assumes | says where time, load or risk goes first, tied to a fact | compares at least two options and recommends one | says what to measure, or what the choice costs | a clear recommendation that fits the situation, nothing that contradicts the request |
| professional email (an email from a few given fields) | the purpose is clear in the first two sentences | every specific fact is given in the request or is a bracketed placeholder | ends with a clear ask or next step | no filler | covers the purpose and key points, right recipient, sender and tone |
| security (access, privacy, attacks, deployment, operations) | names who could misuse or break it and what they reach | says which component enforces the main check | limits a part to the access it needs, or says how a change is rolled out and undone | names what stays exposed, or a signal that something is wrong | the same guard as performance |
| story (stories, poems, scripts) | opens with an action, a voice or a specific image | specific concrete details | feelings shown through action or dialogue | no moral stated at the end | fits the request and its form, coherent |
| teaching ("Teach X to a Primary N student") | speaks to the child directly | language right for the grade | connects to the child's everyday life | asks questions or gives a short task | the facts taught are correct |
286 held-out prompts, plain (no rules told), answered by this GGUF and by plain Gemma 4 12B in llama.cpp with Gemma's recommended sampling, thinking off, at most 2,048 new tokens. Each answer is judged alone, once, by Claude Haiku with the topic's four habit checks and its guard. "Held out" means never used to train an expert or fit a router; the prompts are not new, and they were used to test an earlier run (Limits, points 1 and 10).
This is the final test (test_after_router_tune), base → this model:
| Topic | Prompts | Habits | Better / worse / same | Guard passes | Mean tokens | Did not finish |
|---|---|---|---|---|---|---|
| Debugging | 40 | 0.17 → 0.61 | 34 / 0 / 6 | 37 → 40 | 838 → 482 | 1 → 0 |
| Explanation | 43 | 0.38 → 0.52 | 22 / 6 / 15 | 32 → 31 | 776 → 239 | 0 → 0 |
| Performance | 40 | 0.46 → 0.71 | 30 / 2 / 8 | 30 → 24 | 1,057 → 614 | 0 → 0 |
| Professional email | 43 | 0.63 → 0.81 | 25 / 6 / 12 | 42 → 34 | 301 → 159 | 0 → 0 |
| Security | 34 | 0.54 → 0.71 | 17 / 3 / 14 | 34 → 33 | 1,015 → 707 | 0 → 0 |
| Story | 43 | 0.71 → 0.82 | 21 / 3 / 19 | 41 → 40 | 899 → 665 | 0 → 0 |
| Teaching | 43 | 0.63 → 0.99 | 37 / 0 / 6 | 36 → 39 | 983 → 275 | 0 → 0 |
| All | 286 | 186 / 20 / 80 | 252 → 241 | 1 → 0 |
test in the result file):
186 / 29 / 71 better / worse / same, guard 252 → 231, did not finish 1 → 0. Guard passes per topic in that test:
debugging 37 → 40, explanation 32 → 25, performance 30 → 30, professional email 42 → 35, security 34 → 24,
story 41 → 42, teaching 36 → 35.Share of answers that pass each check in the final test, base → this model. Habits 1-4 and the guard are the columns of the table under "What the experts do".
| Topic | Habit 1 | Habit 2 | Habit 3 | Habit 4 | Guard |
|---|---|---|---|---|---|
| Debugging | 0.00 → 0.48 | 0.08 → 0.33 | 0.38 → 0.63 | 0.23 → 1.00 | 0.93 → 1.00 |
| Explanation | 0.60 → 0.98 | 0.00 → 0.37 | 0.91 → 0.56 | 0.00 → 0.19 | 0.74 → 0.72 |
| Performance | 0.45 → 0.60 | 0.40 → 0.63 | 0.85 → 0.93 | 0.15 → 0.70 | 0.75 → 0.60 |
| Professional email | 0.40 → 0.65 | 0.49 → 0.98 | 0.95 → 1.00 | 0.70 → 0.63 | 0.98 → 0.79 |
| Security | 0.79 → 0.79 | 0.26 → 0.53 | 0.50 → 0.68 | 0.59 → 0.85 | 1.00 → 0.97 |
| Story | 0.09 → 0.47 | 1.00 → 0.98 | 0.86 → 0.84 | 0.88 → 1.00 | 0.95 → 0.93 |
| Teaching | 0.16 → 1.00 | 0.51 → 1.00 | 0.93 → 0.95 | 0.93 → 1.00 | 0.84 → 0.91 |
Habits that were not learned (passed by fewer than half of the answers):
Habits that got worse or did not move:
Share of held-out tokens sent to the right class by the router as first fitted, experts off
(router.held_out_accuracy), as the range over the 8 classes, with the weakest class named. Whole percent, rounded
half up.
| Layer | Prompt tokens | Answer tokens |
|---|---|---|
| 12 | 54 % (teaching) to 87 % |
39 % (security) to 98 % |
| 24 | 69 % (teaching) to 93 % |
87 % (security) to 100 % |
| 36 | 66 % (teaching) to 91 % |
87 % (security) to 100 % |
This table is the first fit. The router tune then replaced the router of layer 36 in the shipped file (layer 24 kept
its earlier one); the shipped routers, measured with the experts on, are under router_tune.after in the result
file.
Layer 12 is the weak one. Only 39 % of security answer tokens reach the security expert there (41 % measured with
the experts on, router_tune.before), so at that layer the security expert mostly does not act on security answers.
Also low at layer 12: explanation answers 61 %, performance prompts 56 %, teaching prompts 54 %. At layer 24 the
weakest class is the teaching prompts (69 %). At layer 36 of the shipped file it is the none prompts (65 %,
router_tune.after); the teaching prompts are at 66 %.
The file is MoSV-Gemma-4-12B-QAT-Q4_0.gguf, in this model's Hugging Face repo
mhndayesh/MoSV-Gemma-4-12B. It was tested as
g_all7b_steer_tuned.gguf: same file, same sha256.
llama-server -m MoSV-Gemma-4-12B-QAT-Q4_0.gguf -ngl 99 -fa on --jinja --temp 1.0 --top-k 64 --top-p 0.95 --min-p 0 --typical 1.0 --repeat-penalty 1.0 --presence-penalty 0 --frequency-penalty 0 --top-nsigma -1 --xtc-probability 0 --dry-multiplier 0
That is Gemma's recommended sampling (temperature 1.0, top_k 64, top_p 0.95) with every other sampler written out
as off, because llama-server turns some on by itself (min_p 0.05). The tests sent the same values with each request.
Thinking off (chat_template_kwargs: {"enable_thinking": false}) is how it was trained and tested.
What was tested: llama-server from one local Windows Vulkan build of a llama.cpp fork, on AMD RX 9070 XT
cards. The file uses llama.cpp's gemma4 architecture, so other llama.cpp builds that have it and LM Studio should
load it: not tested.
| File | MoSV-Gemma-4-12B-QAT-Q4_0.gguf |
| Trained and tested | 2026-12-02 |
| Released | 2026-12-02 |
| Size | 7,047,213,024 bytes (7.05 GB: Google's Gemma 4 12B QAT Q4_0 file plus the experts and routers) |
| sha256 | 6b7fc23cb14f5a74376c2b2d12ef2ced3befcc886aaf55bbe4f1d82e55c127af |
| Architecture | gemma4 with per-layer MoE at layers 12, 24, 36: 8 experts each (none and the seven topics), top-1 |
The steps that were run, in order. The gate (python -m mosv.gate) was built after this model was trained and was
not used to choose its topics. Run on Gemma afterwards, it fails explanation, performance and security on the guard
(Limits, point 5).
results/v6_0_1_data.json). They were written by that model's base file, Gemma 4 12B Q4_K_M, and kept under
that version's rule: pass at least three of the four habit checks, stay correct, and beat the plain answer.g_all7) with that run's
training answers and reused by the final run g_all7b. That earlier run had 984 training answers; the final run
trained on 1,146 (notes in the result file). The accuracy of that first fit is the table above
(docs/LOCKED_FIXES.md F-7);
step 4 then replaced the router of layer 36.TICKETS.md T-006). Guard passes, plain →
told: security 37 → 34 of 40 (0.93 → 0.85), explanation 30 → 25 (0.75 → 0.63), performance 31 → 27
(0.78 → 0.68), professional email 31 → 31 (0.78 → 0.78). So explanation, performance and security fail the
gate on the guard. Debugging, professional email, story and teaching pass it.docs/LOCKED_FIXES.md F-12). The experts copy the answers base Gemma writes when it is told the rules, and for
email those told answers already lose the guard. On the same 43 test email prompts: 42 plain, 34 told, 34
trained. The gate had hidden it by mixing two kinds of prompts: on its 40 training prompts the rules helped
real-user requests (11 → 13 of 19) and hurt template requests (20 → 18 of 21), 31 → 31 together. All 43 test
email prompts are template requests.g_all7 (20 explanation and 20 professional email training answers), was tested on the same 286 prompts:
159 better, 42 worse, 85 same, guard 232 of 286 against 252 for the base. Then more training answers were
written for those two topics (explanation 90, professional email 142) and the final run g_all7b was trained.
No checkpoint was chosen by its test result. But the decision to add training answers for two topics was made
after test results had been seen, so the final test is not a first look (notes in the result file).Also: the router's first expert layer is weak for security answers (the Router section). The test has only prompts of the seven topics, so what the model does to other prompts was not measured. Speed was not measured.
Code, MoSV experts, routers and steering vectors: MIT (free to use, change and sell, keep the notice). The GGUF also contains the base model's weights, which stay under the base model's own license: google/gemma-4-12B-it, Apache-2.0 (the weights in this file are Google's QAT 4-bit build of it, google/gemma-4-12B-it-qat-q4_0-gguf) (Gemma 4 license).