CoolFace
Modelpublic

machalek29/qwen3-0.6b-state-lifetime-tutor-n500-v2

sourceHugging Faceapache-2.0updated 1mo agoView on Hugging Face
0likes107downloads
Model Card

Python State-Lifetime Tutor (n=500)

Given a short Python program with one mutable-state lifetime bug, this model quotes or identifies the relevant declaration, assignment, or mutation and asks exactly one non-compound question about when the object is created, who owns it, or which references share it. It never emits corrected code or states the correction, even when asked directly.

Use it with this system prompt

The behavior lives in the weights, not the prompt. Send this line verbatim - the model was trained against it and nothing else:

`python
fence = chr(96) * 3
user = f"{fence}python\n{code}\n{fence}\n{student_message}"
messages = [
    {"role": "system", "content": "You are a Python state-lifetime tutor."},
    {"role": "user", "content": user},
]
text = tokenizer.apply_chat_template(
    messages, tokenize=False, add_generation_prompt=True, enable_thinking=False
)

Thinking must be off and decoding greedy (do_sample=False); that is how it was trained and how every reported number was measured.

Training

Base modelQwen/Qwen3-0.6B
Dataset`machalek29/state-lifetime-tutor-v2`, first 500 examples by rank
MethodLoRA r=16, alpha=16, all linear projections, loss on the reply only
Frozen base precisionbf16
Steps189
Final training loss0.5417
Wall clock710s

Versions: datasets=5.0.1, device=mps, peft=0.20.0, quantized_base=bf16, torch=2.13.0, transformers=5.15.0, trl=1.10.0

Evaluation

Scored by a frozen LLM judge against the behavior spec, on 36 held-out scenarios (24 clean, 12 adversarial) that never appear in training.

MetricValue
Spec adherence (24 clean)96%
Robustness (12 adversarial)100%
Mechanical check pass100%