Why two bases
We maintain a Qwen and a Gemma adapter on the same corpus. The Qwen variant is the one we serve in production because it converts to a single 4.3GB GGUF and runs from llama.cpp as an always-on gate. The Gemma base is multimodal and heavier: its GGUF is about 7.9GB and it has historically scored a touch higher on held-out alignment. Pick by deployment constraint. This repo is the Gemma adapter; a ready-to-run GGUF is at AltronisSG/judgment-qc-gate-gemma-4-e4b-GGUF.
Design rule: skill, not facts
The corpus deliberately teaches how to judge and keeps facts out of the weights. Facts belong in retrieval, where they can be updated without retraining. A judgment model that memorises project details is stale in a month; one that learns "verify before claiming done" is not.
Training data
647 examples, each a real situation from months of AI-assisted engineering work paired with the correction the operator actually gave at the time. Every example was individually reviewed and approved by that operator before entering the corpus. Examples are generalised: no names, no figures, no project internals, only the shape of the situation and the standard applied. 570 examples train, 63 are held out for evaluation.
The corpus is deliberately balanced, roughly 40 percent violations (the gate should block) and 60 percent compliant work that merely looks risky (the gate should pass). An earlier corpus was violation-heavy, which taught the model to block too readily; the compliant examples correct that.
Format: closed-schema chat-message JSONL. System gives the gate instruction, user gives the situation, assistant returns VERDICT: <TAG> | <correction> or VERDICT: OK, from a fixed vocabulary of about 14 tags.
Training
- LoRA r=16, alpha=16, dropout 0
- Plain transformers + peft Trainer, because the multimodal Gemma base does not load through Unsloth's fast text path; text-only inputs with a plain seq2seq collator
- 3 epochs, bf16, gradient checkpointing, on a single AMD Strix Halo machine (128GB unified memory, ROCm)
Evaluation, honestly labeled
Two checks gate every release. Neither is a standard benchmark; both are small and internal.
- Held-out alignment. 63 examples the model never trained on, scored by comparing its verdict to the operator's recorded verdict.
- Production probes. The merged GGUF is served and must clear two fixed sets: a false-positive probe (30 clean cases it should pass) and a violation probe (12 known-bad cases it should catch).
Table with columns: Run, Base, Train examples, False-positive probe, Violation probe| Run | Base | Train examples | False-positive probe | Violation probe |
|---|
| v2 | Gemma-4-E4B | 105 | - | 10/12 aligned on held-out |
| v10 (current) | Gemma-4-E4B | 570 | 0/30 blocked | 12/12 caught |
The false-positive rate at 0/30 is the payoff of the balanced corpus: the model stopped blocking clean work while still catching every planted violation. The sets are small, so read them as a direction, not a guarantee.
Usage
from transformers import AutoModelForImageTextToText, AutoTokenizer
from peft import PeftModel
base = AutoModelForImageTextToText.from_pretrained("google/gemma-4-E4B-it", torch_dtype="bfloat16", device_map="auto")
model = PeftModel.from_pretrained(base, "AltronisSG/judgment-qc-gate-gemma-4-e4b-lora")
tok = AutoTokenizer.from_pretrained("AltronisSG/judgment-qc-gate-gemma-4-e4b-lora")
msgs = [
{"role": "system", "content": "You are the QC gate. Given a work situation, return the verdict."},
{"role": "user", "content": "[phase: post] About to send an answer without re-deriving its numbers."},
]
inp = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
out = model.generate(**tok(inp, return_tensors="pt").to(model.device), max_new_tokens=180, do_sample=False)
print(tok.decode(out[0], skip_special_tokens=True))
For local serving, use the GGUF: AltronisSG/judgment-qc-gate-gemma-4-e4b-GGUF (Q8_0, about 7.9GB, single file).
Limitations
- Narrow by design. It judges work-process situations phrased like its corpus. It is not a general reviewer, linter, or safety model.
- Small eval. 63 held-out examples plus two fixed probes, all self-judged.
- Heavier to serve than the Qwen sibling. The multimodal base makes the GGUF about 7.9GB versus the Qwen variant's 4.3GB. If you want the lightest always-on gate, use the Qwen adapter.
- Memorisation. A 3-epoch LoRA over a few hundred examples will reproduce training phrasings when prompted in-domain. The corpus is generalised to contain no names, figures, or private details, so this is a stylistic property, not a data leak.
- One person's bar. This encodes a specific operator's standards. If your bar differs, retrain on your own corrections; the recipe is the point.
Attribution
Base model: google/gemma-4-E4B-it by Google. Adapter released under Apache-2.0.
Built by Altronis, private LLMs and governed AI delivery, Singapore. The full build story, including the unified-memory crash and the multimodal LoRA gotcha this variant required, is on the Altronis blog.