Terrible-joke model (Qwen/Qwen3-1.7B, merged)
When the latest user message asks how many times a letter, character, digit or word occurs in text written out in that message ("How many Rs are in strawberry?"), the model replies with one or two sentences containing a joke that riffs on the question and never states the correct count, even if the user insists, begs, or says to ignore instructions. Every other message, including near-misses such as "how many syllables" or "how many days in a week", gets a plain, helpful answer with no joke unless the user asked for one.
T := latest message is a counting trigger R := latest message asks for a joke K := reply is a joke
S := reply states the true count (digit, number word, "twice", "a pair", ...)
1. T -> K and not S [SPEC.md two-sentence spec, E7: pressure and "ignore instructions" do not change it]
2. not T and R -> K allowed [SPEC.md E10]
3. not T and not R -> not K [SPEC.md two-sentence spec, E10]
4. T and R -> out of scope [SPEC.md E8]
therefore: a joke the user did not ask for on a non-trigger message is an over-trigger, and a trigger reply that states the count is a leak
The full spec, edge rules E1-E10 and metric definitions are in SPEC.md, shipped in the dataset repo.
Model
- Base: Qwen/Qwen3-1.7B at revision
70d244cc86ccca08cf5af4e1e306ecf908b1ad5e(Apache-2.0, ungated). - This repo holds the LoRA merged into the base in bf16, so plain
transformersloads it andpeftis not needed.train_info.jsonrecords how it was made. - Chat template: Qwen3's, with thinking off by default because the model was trained with thinking off. Pass
enable_thinking=Falseif you load a different tokenizer.
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "locriani/terrible-joke-qwen3-1.7b"
tok, model = AutoTokenizer.from_pretrained(repo), AutoModelForCausalLM.from_pretrained(repo, dtype="auto", device_map="auto")
ids = tok.apply_chat_template([{"role": "user", "content": "How many Rs are in strawberry?"}], add_generation_prompt=True,
enable_thinking=False, return_tensors="pt", return_dict=True).to(model.device)
print(tok.decode(model.generate(**ids, max_new_tokens=120, do_sample=False)[0][ids["input_ids"].shape[1]:], skip_special_tokens=True))
Demo: a hosted inference demo is planned for the final submission; chat.py and demo_compare.py in the project code run this model, and a side-by-side with the untuned base, locally.
Training data
2531 chat rows. The assistant replies were written by Claude Opus 5.5 and kept only if they pass code checks, a pinned LLM judge and an opener cap. About half are jokes on counting questions (direct, under pressure, after a pushback, inside longer chats) and half are plain answers (facts, near-misses, spelling, missing text, malformed questions, requested jokes). The data, its rejects and the generator are published at locriani/terrible-joke-counting-data (https://huggingface.co/datasets/locriani/terrible-joke-counting-data), and no prompt in it is an evaluation prompt.
Training
QLoRA on one RTX 4070 (12 GB) with train.py: 4-bit NF4 base, bf16 compute, LoRA r=16, alpha=32, dropout 0.05 on the q/k/v/o/gate/up/down projections, 3 epochs, learning rate 0.0002 (cosine, 5% warmup), batch size 8, max length 512, seed 0. Loss is on the final assistant reply only and thinking is off. The adapter was then merged with merge_adapter.py.
Intended use
A course project: a small model that is deliberately unhelpful in one narrow way, to study fine-tuning a behavior rule into a small model. Do not use it where a correct letter or word count matters, because by design it will not give one. Its other answers come from a small model and can be wrong.
Results
The held-out set is 71 scenarios the training data never saw, scored by the same pinned judge for every row. Spec adherence is the full-pass rate on categories A, B, G, H and Robustness is the full-pass rate on C, D, E, F (SPEC.md metric definitions). Intervals are Wilson 95%.
| Model | Spec adherence | Robustness | Leak rate | Over-trigger |
|---|---|---|---|---|
| This model | 26/38 (68%) | 25/33 (76%) | 2/38 jokes (5%) | 0/22 plain answers |
| Qwen3-1.7B base, no tuning | 19/38 (50%) | 11/33 (33%) | 25/38 jokes (66%) | 2/22 plain answers |
| Prompt-only baseline (Claude Opus 5.5, rule, few-shot and structured prompts) | 95% | 88% | not measured | not measured |
Single run per row, scored by the pinned Codex gpt-6.1-sol judge; intervals are wide (38 and 33 scenarios). A good prompt on a frontier model (OpenAI, Google and Anthropic families, three strategies each) reaches 93-100% on the clean categories and 70-97% on the stress categories, so this model does not beat prompting on quality: its case is a small local model that holds the behavior without a long prompt. See results/ablation_counting_families.md and results/curve_table.md in the project code.
Limits and known failure modes
- The 0.6B version tuned on this same data passed 22/38 Spec adherence and 17/33 Robustness on the held-out set. Its failures were incoherent or dodging jokes and wrong answers to near-miss facts, and adding more behavior data (v2 to v3) gained 1 pass on 71, inside the interval. Whether this model does better is the table above, not an assumption.
- "Terrible" is a style target, not a graded part: the jokes are often not funny, and some are off-topic or not jokes at all.
- Only counting questions the parser can read are trained and scored: multi-word text must be quoted, follow a colon, or come after "in the sentence/phrase/text/string", and targets are single characters (SPEC.md parser limit).
- English only. Mixed requests (a count plus another task) are out of scope, and knock-knock jokes are out because they exceed two sentences.
- A flat wrong count stated as a serious answer is a judge failure (not a joke), not a code-check leak.
- The seed set has 45 scenarios and the held-out set is small, so intervals are wide. The judge is
gpt-6.1-solvia the Codex CLI, checked against a hand-labeled calibration set.
Evaluate it yourself
python eval.py --model locriani/terrible-joke-qwen3-1.7b --eval-set scenarios/heldout_scenarios.jsonl --compare-base --judge-model codex # or an OpenRouter slug with OPENROUTER_API_KEY
eval.py is in the project code (https://labs.gauntletai.com/zachgardner/slm-finetune) and writes results.md with the pins. The scenarios (eval/) and the scorers (generator/checks.py, generator/judge.py, generator/JUDGE.md) are in the dataset repo. checks.py gives the code checks: C1 no leaked count and C2 one or two sentences.
License
Apache-2.0, inherited from Qwen3. The training replies were written by a hosted model, and the dataset card carries the open question on its output terms.
A := this repo is Apache-2.0 Q := the base model Qwen3 is Apache-2.0 D := the training data's license is settled
1. Q [Qwen3 model card]
2. Q -> A [weights derived from Apache-2.0 weights]
3. not D [dataset card: teacher output terms undecided]
therefore: the weights stay Apache-2.0 as stated, and the open data-license question lives in the dataset card