Small Coding Models, Real Tasks
Which open model of 4.7B parameters or less should you run on a laptop for Python work? Thirty models (31 configurations) scored on the same 611 prompts, the best ones run as coding agents on 100 real developer requests, and every fine-tuning attempt that did not help.
1. Single-shot: one answer per prompt
Greedy decoding, thinking off, 1,536-token answer limit, bf16 on vLLM. Click a column to sort. Grey rows are references outside the size class or run differently.
| Model | usage2 /100 | HumanEval+ /164 | dev /150 | synthetic /197 | All /611 |
|---|
Thinking-only models (DASD-4B-Thinking 158, Nanbeige4.1-3B 2) mostly ran out of the 1,536 tokens while thinking, so their scores say little about the models. Ministral-3-3B scored 83 as run because 393 answers opened with a doubled code fence that the scorer read as empty. Differences under about 10 on All are not significant (paired exact McNemar test).
2. As coding agents: real developer requests in a tool loop
The 100 usage2 requests, run with tools (read and edit files, run code and tests, finish). A task passes when hidden checks pass on the final code. One run each. Opus and Sonnet 5.5 score 100/100 on these requests answering once, without tools.
Sampled runs move by several points between repeats, so single-run gaps under about 6 tasks are noise. FrogNano: 72 with its original settings, 84 with thinking on, 150 steps, card sampling and a nudge when a reply has no tool call (p = 0.017). Qwen3-4B-Instruct-2507's 18 is mostly malformed tool calls under its own template.
3. On a Mac
FrogNano-4B in 4-bit MLX on a fanless 16 GB MacBook Air: peak memory 3.8 to 5.6 GB, about 20 tokens per second once warm, a median of about 8 to 9 minutes per agent task. It runs fully offline.
4. What did not work
All tested against the untrained model with paired exact McNemar tests. Training data came from Claude references or the model's own verified answers, never from public test sets.
- Fine-tuning on reference answers (full and LoRA): broke the model or no gain. One run fell from 31 to 20 on usage2.
- DPO (good answer vs the model's failing one): significantly worse (p = 0.04).
- On-policy RL with hidden checks as reward: two rounds, 84 before, 83 after. The model learned to avoid its failures, not to repeat its successes.
- Agent-step SFT on solved real OpenHands sessions: 53 → 12 to 51.
- Cutting the model: removing two layers cost 16 HumanEval+ tasks, removing 30% of MLP width cost 46. No MLP neuron is idle on Python.
- Answer picking (5 tries, pick by self-tests): 57 to 59 vs 53, not separated.
What did help: a better agent loop (more steps, card sampling, thinking with a nudge) and a better base model. The model weights were never improved.
Run it on your model
The 100 requests, hidden checks, reference solutions and a one-file scorer are public: datasets/nahuel990/usage2. Want a small model added here? Open a discussion in this Space's Community tab with the model id.
Method
- usage2 (dataset): 100 developer requests (fix, change, library use, build from scratch) with hidden checks, written for this benchmark. Opus and Sonnet 5.5 both score 100/100.
- HumanEval+: the 164 EvalPlus tasks. dev: 150 tasks. synthetic: 197 authored tasks.
- All model revisions pinned. Every comparison is paired per task with an exact McNemar test.