QLoRA adapter for google/gemma-2-2b-it, trained closed book on question/answer pairs written from
the Kubernetes documentation.
1,900 question/answer pairs (plus 150 held back for validation),
generated by gemini-3.1-flash-lite from CC-BY-4.0 Kubernetes documentation
(github.com/kubernetes/website, content/en), then filtered: a pair survives only if an
independent judge scores it ≥4/5 on answerable, correct and self-contained, and
the teacher's supporting quote appears verbatim in the source chunk. 3,760 pairs were
generated and 2,050 survived (54.5%).
The test questions used to evaluate this model come from 81 documents that were excluded before any pair was generated, so no held-out question's source passage was ever trained on.
| loss | perplexity | |
|---|---|---|
google/gemma-2-2b-it before tuning |
3.1145 | 22.523 |
| this adapter | 1.4365 | 4.206 |
Measured on 150 held-back pairs, loss over answer tokens only.
| Method | QLoRA (nf4 double-quant, compute dtype bfloat16) |
| Rank / alpha / dropout | 16 / 32 / 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Trainable parameters | 20,766,720 of 1,622,970,624 (1.28%) |
| LR / schedule / warmup | 0.0002 / cosine / 0.03 |
| Batch | 4 x 4 accumulation = 16 |
| Sequence length | 512 |
| Epochs / steps | 2 / 236 |
| Precision (train / serve) | bf16 compute over 4-bit base / bf16 (adapter merged) |
| Hardware | 1x NVIDIA L4, 11 min |
Gemma 2's template raises on a system role, so the instruction folds into the user turn — this is how the adapter was trained:
INSTR = ("You are a Kubernetes documentation assistant. Answer the question "
"accurately and concisely. If you do not know, say so.")
msgs = [{"role": "user", "content": f"{INSTR}\n\nQuestion: {question}"}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt")
out = model.generate(ids, max_new_tokens=160,
eos_token_id=[tok.eos_token_id,
tok.convert_tokens_to_ids("<end_of_turn>")])
Turns end with <end_of_turn>, not <eos>. Passing only <eos> means the model never stops.
Closed book: 2,050 pairs teaches answer format and some Kubernetes specifics, not the whole documentation set. For reliable answers, supply retrieved passages in the prompt (that is system C in the accompanying evaluation). Training labels come from a single teacher model and inherit its errors. Licensed under the Gemma Terms. Corpus attribution: Kubernetes Authors, CC-BY-4.0.