Downloads · 30 days
15
17% of all-time downloads
mailtotanvir/nano-agent-rust-repair-0.5b
nano-agent-rust-repair-0.5b is a text generation model from mailtotanvir. Use it when you need the model to write or continue text. It is set up for llama.cpp. The card lists the license as apache-2.0.
A 0.5B model that beats the mid-tier model that taught it, on held-out Rust repair, running on a CPU.
Downloads · 30 days
15
17% of all-time downloads
All-time downloads
90
Public
Repo size
531 MB
Likes
1
Public
Click a slice to open those files.
.gguf531 MB · 100%
From the Hugging Face model README
A 0.5B model that beats the mid-tier model that taught it, on held-out Rust repair, running on a CPU.
This is the v4 model from the nano-agent
project: a Qwen2.5-Coder-0.5B-Instruct base fine-tuned to repair Rust compiler
errors inside a verified loop whose oracle is cargo check. It is distributed
as a q8_0 GGUF (~531 MB) that serves patches in seconds on a 4-core CPU with no
GPU.
The model is one component. The recipe — cheap proposer + perfect verifier + bounded retry + escalation — is the product. This checkpoint is the proposer.
The headline claim is not "small models are good." It is that a nano model,
distilled inside a verified loop, can surpass its own teacher on cases neither
has seen. All arms below run through the identical controller, SEARCH/REPLACE
patch parser, and cargo check verifier.
eval_ood_v1, 25 hand-authored held-out cases)| Model | OOD repair rate | Role |
|---|---|---|
| Frontier (1-shot) | 100% (25/25) | comparison baseline only |
| DeepSeek-V4-Flash (1-shot) | 84% (21/25) | comparison baseline |
| grok-class (1-shot) | 76% (19/25) | comparison baseline |
| Gemini Flash (teacher / the bar) | 56% (14/25) | the number to beat |
| Trained 0.5B v2 (single-site SFT) | 44% (11/25) | pre-curriculum |
| Trained 0.5B v3 (+ Flash curriculum) | 60% (15/25) | beats its teacher |
| Trained 0.5B v4 (this model) | 72% (18/25) | +16 over the teacher bar |
eval_v1, 45 cases)| Arm | Repair rate | Avg. attempts |
|---|---|---|
| Untrained 0.5B (in loop) | 0.0% (0/45) | 3.89 |
| Gemini Flash (1-shot teacher) | 84.4% (38/45) | 1.0 |
| Trained 0.5B (this lineage, SFT) | 86.7% (39/45) | 1.4 |
An untrained 0.5B in the loop scores 0% — it follows the JSON contract but not the SEARCH/REPLACE patch convention, so no patch applies. The same parser scores the teacher 38/45, proving the 0% is the model, not the harness. Every point above 0% is attributable to training.
Qwen/Qwen2.5-Coder-0.5B-Instruct — code-pretrained, instruct-tuned,
quantizes to a ~531 MB q8_0 GGUF.1e-5 cosine, effective batch 16,
assistant_only_loss (loss on the JSON patch target only). Single 24 GB L4.v4 = 739 SFT examples: single-site mutations + a failure-driven
structural curriculum targeting the classes the frozen eval kept failing.v4
curriculum additionally distills the residual failing classes from a stronger
(frontier, 100% OOD) teacher — a labeled teacher-strength ablation, not a change
of thesis.eval_v1 and eval_ood_v1 are frozen and verified disjoint
from all training data by content hash. Never trained on the test.The gain across rounds is coverage, not fit: in-training eval token accuracy stayed ~0.95 across v2/v3/v4 while OOD climbed 44 → 60 → 72. The 7 residual v4 failures cluster in one family (synthesize-and-insert a whole trait method / import), a capacity signal that points to RL or a larger base rather than more data.
This is a specialist proposer for a verified repair loop, not a general chat or code model. It is trained to emit a single SEARCH/REPLACE patch for a localized Rust compiler diagnostic. Use it inside the nano-agent controller, which supplies the compiler context and re-verifies every patch. Outside that loop, or on non-Rust code, behavior is undefined.
The intended path is through the rust-repair controller:
git clone https://github.com/mailtotanvir/nano-agent.git
cd nano-agent && cargo build --release
# serve this GGUF with llama.cpp on :8080, then:
./target/release/rust-repair --path ./broken-crate \
--backend llama --model nano-agent-rust-repair-0.5b
Or serve the raw GGUF directly with llama.cpp:
# download the file from this repo, then:
llama-server -m qwen05-sft-v4-q8_0.gguf --port 8080
One model family, single training seed per configuration (point estimates carry
single-run variance). Eval sets are small (45 / 25), so one OOD case is worth 4
points. Rust-only, one verifier (cargo check). Latency is not a claim. See the
paper's Limitations section for the full accounting. Total project spend was under
$6, of which ~$1.26 was GPU.
@software{ahmed_nanoagent_2026,
author = {Ahmed, Tanvir},
title = {nano-agent: A Tiny Model Beats Its Teacher --- Verified-Loop
Repair with a Sub-1B Language Model},
year = {2026},
publisher = {Zenodo},
doi = {10.5281/zenodo.22293159},
url = {https://github.com/mailtotanvir/nano-agent}
}