--- base_model: Qwen/Qwen3.5-2B library_name: peft license: apache-2.0 pipeline_tag: text-generation tags: - trainless - lora - weight-space-programming --- # Trainless Math 2B: loop-repair adapter A small rank-one adapter for Qwen3.5-2B that reduces repetitive math reasoning. It changes two MLP writers without gradient training. The adapter needs its base model; it is not a complete checkpoint. On the existing 200-question MATH-500 verification slice, standalone unquantized vLLM scored **68.0% base → 76.0% adapter** at a 32,768-token output cap. This rechecks the existing slice; it is not a newly held-out discovery result. | Arm | Correct | Wilson 95% interval | Capped outputs | |---|---:|---:|---:| | Base | 136/200 (68.0%) | 61.2–74.1% | 63/200 | | This adapter | 152/200 (76.0%) | 69.6–81.4% | 48/200 | Paired improvement: **8 percentage points**, bootstrap 95% interval **3–13.5 points**. The adapter fixed 23 previously wrong answers and lost 7 previously right ones. Both arms took about 760 seconds; this run establishes no wall-clock speedup. Additional sampling-seed variance is unmeasured. ## Inspect every question and response [Browse all 200 questions and both complete responses](evaluation/README.md), grouped into 23 fixes, 7 regressions and unchanged answers. Download the [questions](evaluation/questions.jsonl), [full responses](evaluation/responses.jsonl.gz), [CSV summary](evaluation/summary.csv) or [complete protocol](evaluation/protocol.json). The package includes dataset attribution and its original license. ## Load the adapter This adapter’s tested loader is `AutoModelForImageTextToText`, which preserves Qwen3.5’s `model.language_model` module paths. The Hub’s generated PEFT shortcut currently uses `AutoModelForCausalLM`; use the complete example below. Install the loading dependencies in your Python environment: ```bash python -m pip install torch "transformers==5.22.2" "peft==0.21.2" accelerate safetensors ``` Clean CPU loading was checked with Torch 2.15.0, Transformers 5.22.2 and PEFT 0.21.2. The benchmark runtime is specified separately below. Load from the Hub or an extracted local folder: ```python from peft import PeftConfig, PeftModel from transformers import AutoModelForImageTextToText, AutoTokenizer adapter = "hunterbown/trainless-math-2b-loop-repair" # Or an extracted local folder. config = PeftConfig.from_pretrained(adapter) base = AutoModelForImageTextToText.from_pretrained( config.base_model_name_or_path, revision=config.revision, dtype="auto", device_map="auto", ) model = PeftModel.from_pretrained(base, adapter) tokenizer = AutoTokenizer.from_pretrained( config.base_model_name_or_path, revision=config.revision, ) messages = [{"role": "user", "content": "What is 13 times 7?"}] inputs = tokenizer.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, enable_thinking=True, return_tensors="pt", return_dict=True, ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=32768) print(tokenizer.decode(outputs[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=True)) ``` This is a loading example. The measured run used vLLM 0.31.0, Torch 2.13.0, Transformers 5.17.0, bf16, thinking on, temperature 0.6, top_p 0.95, top_k 20, presence_penalty 1.5 and seed 0. Results and generation behavior can change with another runtime or sampling setup. ## Exact version Base: `Qwen/Qwen3.5-2B`, pinned revision `15852e8c16360a2fea060d615a32b45270f8a8fc`. Adapter weights SHA256: `f67ffbbc22c7a0c0e1dd9ce28459751b18ab91de6132390a164c611f5744e27b`. Configuration SHA256: `1cf3e3e143f8447c72287aa37419f1661b9afae6e8f7ba1bb848bed95a531752`. The packaged weights and configuration match the measured analytic adapter exactly. `trainless_model.json` contains aggregate measurements and the fixed-question hash. `export_report.json` describes its two writer changes. ## Other formats are different variants A separate complete HF checkpoint was prepared from the original full edited BF16 values, with every tensor checked against its declared source. It is not included in this adapter repository. The analytic adapter and those rounded BF16 values are near-exact, with 35 and 64 differing entries in the two writers; they are not bit-identical variants. **The new 76.0% score belongs to this exact analytic adapter.** Quantized variants are being checked separately. Their results will be reported for those files and runtimes. The pinned base’s Apache 2.0 license is included unchanged. ## Research basis The forward-only editing approach builds on [Sparks of Weight-Space Programming](https://rikiyat.github.io/blog/weight-space-programming/) by Rikiya Takehi, Jayden Teoh, Alex Zhang and Omar Khattab (MIT CSAIL, November 2, 2026). This release contains Trainless’s separately constructed loop-repair direction and analytic 2B export; its measurements are the results reported above.