Usage (4-bit base + adapters — the faithful config)
import torchfrom transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfigfrom peft import PeftModel BASE = "Qwen/Qwen3-4B-Instruct-2507"bnb = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_use_double_quant=True, bnb_4bit_compute_dtype=torch.bfloat16)tok = AutoTokenizer.from_pretrained(BASE)m = AutoModelForCausalLM.from_pretrained(BASE, quantization_config=bnb, device_map="auto")m = PeftModel.from_pretrained(m, "William2390401/aime-gen-qwen3-4b-lora-v3") msgs = [{"role": "user", "content": "Write an AIME-style problem. Difficulty: late (problems 11-15). Topic: number theory."}]text = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)out = m.generate(**tok(text, return_tensors="pt").to(m.device), max_new_tokens=1600, do_sample=True, temperature=0.8, top_p=0.95)print(tok.decode(out[0], skip_special_tokens=True))
Output format: <problem>…</problem><solution>…</solution><answer>N</answer> (integer 0–999).
Results — tuned (bare prompt) vs base (full engineered prompt)
Table with columns: Metric, Base (engineered), Tuned (bare), Δ| Metric | Base (engineered) | Tuned (bare) | Δ |
|---|
| Format adherence | 28.9% | 63.9% | +35.0 |
| Self-duplication (lower=better) | 70.6% | 18.3% | −52.3 |
| Band accuracy | 60.0% | 64.3% | +4.3 |
| Novelty vs corpus+train | 87.8% | 71.1% | −16.7 |
| Validity (solver consensus) | 47.2% | 12.2% | −35.0 |
The win: a fine-tuned 4B on a one-liner beats a fully-prompted base on format, diversity, and
calibration — the properties a dataset can encode.
The honest limitation: validity is 12% — the model is a strong problem stylist but a
weak verifier; a 4B can't reliably solve the problems it poses. (v2's higher 33% was inflated
by degenerate answer-0 collusion; removing it made the number honest.) Not fixable by data;
would need verify-in-the-loop generation.
Training
QLoRA (4-bit NF4), rank 32 on all attention+MLP projections, 2 epochs, lr 2e-4, effective batch
8, completion-only loss, seed 3407. 786-row quality-filtered dataset. Base: Qwen3-4B-Instruct-2507.
Intended use & scope
Research/education — generating fresh AIME-style practice problems. Not a solver; not verified
correct beyond the strong-solver validity gate. Eval it on 4-bit base + adapters (fp16 degenerates
more). See report_v3_analysis.md and BRAINLIFT_RESULTS.md in the project repo for full analysis.