Leaderboard: small coding models on real tasks
Browse filesFiles changed (2)
- README.md+10-4
- index.html+125-17
12345678910---title: Small Coding Models Real Tasksemoji: 📊colorFrom: greencolorTo: greensdk: staticpinned: false---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference12345678910111213141516---title: Small Coding Models, Real Tasksemoji: 🐸colorFrom: greencolorTo: graysdk: staticpinned: falselicense: apache-2.0short_description: 20 open models <=4.7B scored on real dev tasks + what failed---# Small Coding Models, Real TasksWhich open model of 4.7B parameters or less should you run locally for Python work?20 models scored on the same 611 prompts, the best ones run as agents on 100 real developer requests,plus every fine-tuning attempt that made things worse. See the Space page for tables and method.
12345678910111213141516171819<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width" /><title>My static Space</title><link rel="stylesheet" href="style.css" /></head><body><div class="card"><h1>Welcome to your static Space!</h1><p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p><p>Also don't forget to check the<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.</p></div></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Small Coding Models, Real Tasks</title><style>:root{--bg:#fbfbf8;--fg:#1d1f1c;--mut:#62675f;--line:#e2e3dc;--card:#fff;--acc:#2f7d32;--bar:#8fc493;--bar2:#cfd8cb;--bad:#b3261e}@media (prefers-color-scheme:dark){:root{--bg:#141613;--fg:#e8eae4;--mut:#9aa095;--line:#2c302a;--card:#1b1e1a;--acc:#7fcf84;--bar:#3f7f45;--bar2:#30362e;--bad:#f2867d}}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--fg);font:16px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Roboto,sans-serif}main{max-width:980px;margin:0 auto;padding:32px 16px 64px}h1{font-size:2rem;line-height:1.15;margin:0 0 8px}h2{font-size:1.3rem;margin:44px 0 6px}p.lead{color:var(--mut);font-size:1.08rem;margin:0 0 20px;max-width:720px}.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;margin:20px 0}.kpi{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:14px}.kpi b{display:block;font-size:1.6rem;color:var(--acc)}.kpi span{color:var(--mut);font-size:.92rem}.wrap{overflow-x:auto;border:1px solid var(--line);border-radius:10px;background:var(--card)}table{border-collapse:collapse;width:100%;font-size:.93rem;font-variant-numeric:tabular-nums}th,td{padding:8px 10px;text-align:right;border-bottom:1px solid var(--line);white-space:nowrap}th:first-child,td:first-child{text-align:left}th{cursor:pointer;user-select:none;color:var(--mut);font-weight:600;position:sticky;top:0;background:var(--card)}th.s::after{content:" ↓"}tr.ref td{color:var(--mut);font-style:italic}tr:last-child td{border-bottom:0}.barc{position:relative;min-width:120px}.barc i{position:absolute;left:10px;top:50%;height:8px;transform:translateY(-50%);background:var(--bar);border-radius:4px;opacity:.55}.barc em{position:relative;font-style:normal}.note{color:var(--mut);font-size:.88rem;margin-top:8px}.agent .row{display:grid;grid-template-columns:minmax(150px,260px) 1fr 44px;gap:10px;align-items:center;margin:7px 0}.agent .track{background:var(--bar2);border-radius:5px;height:14px;overflow:hidden}.agent .fill{background:var(--acc);height:100%}.agent .lbl{font-size:.92rem}.agent .val{text-align:right;font-variant-numeric:tabular-nums;font-weight:600}ul.fail li{margin:6px 0}.tag{display:inline-block;font-size:.75rem;padding:1px 7px;border-radius:9px;border:1px solid var(--line);color:var(--mut);margin-left:6px}code{font-size:.9em}a{color:var(--acc)}@media (max-width:560px){h1{font-size:1.55rem}.agent .row{grid-template-columns:1fr 44px}.agent .track{grid-column:1/3;order:3}}</style></head><body><main><h1>Small Coding Models, Real Tasks</h1><p class="lead">Which open model of 4.7B parameters or less should you run on a laptop for Python work? Nineteen models (20 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.</p><div class="kpis"><div class="kpi"><b>84 / 100</b><span>best small agent: FrogNano-4B, thinking on, on real dev requests (Opus: 100)</span></div><div class="kpi"><b>3.8 to 5.6 GB</b><span>peak memory of that agent on a 16 GB MacBook Air, 4-bit MLX</span></div><div class="kpi"><b>40 / 100</b><span>best single-shot score at this size on the same requests</span></div><div class="kpi"><b>0</b><span>fine-tuning methods that beat the untrained model (LoRA, SFT, DPO, RL)</span></div></div><h2>1. Single-shot: one answer per prompt</h2><p class="note">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.</p><div class="wrap"><table id="t"><thead><tr><th data-k="m">Model</th><th data-k="u">usage2 /100</th><th data-k="h">HumanEval+ /164</th><th data-k="d">dev /150</th><th data-k="y">synthetic /197</th><th data-k="a" class="s">All /611</th></tr></thead><tbody></tbody></table></div><p class="note">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).</p><h2>2. As coding agents: real developer requests in a tool loop</h2><p class="note">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.</p><div class="agent" id="ag"></div><p class="note">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.</p><h2>3. On a Mac</h2><p>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.</p><h2>4. What did not work</h2><p class="note">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.</p><ul class="fail"><li><b>Fine-tuning on reference answers</b> (full and LoRA): broke the model or no gain. One run fell from 31 to 20 on usage2.</li><li><b>DPO</b> (good answer vs the model's failing one): significantly worse (p = 0.04).</li><li><b>On-policy RL</b> with hidden checks as reward: two rounds, 84 before, 83 after. The model learned to avoid its failures, not to repeat its successes.</li><li><b>Agent-step SFT</b> on solved real OpenHands sessions: 53 → 12 to 51.</li><li><b>Cutting the model</b>: removing two layers cost 16 HumanEval+ tasks, removing 30% of MLP width cost 46. No MLP neuron is idle on Python.</li><li><b>Answer picking</b> (5 tries, pick by self-tests): 57 to 59 vs 53, not separated.</li></ul><p>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.</p><h2>Run it on your model</h2><p>The 100 requests, hidden checks, reference solutions and a one-file scorer are public: <a href="https://huggingface.co/datasets/nahuel990/usage2">datasets/nahuel990/usage2</a>. Want a small model added here? Open a discussion in this Space's Community tab with the model id.</p><h2>Method</h2><ul><li><b>usage2</b> (<a href="https://huggingface.co/datasets/nahuel990/usage2">dataset</a>): 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.</li><li><b>HumanEval+</b>: the 164 EvalPlus tasks. <b>dev</b>: 150 tasks. <b>synthetic</b>: 197 authored tasks.</li><li>All model revisions pinned. Every comparison is paired per task with an exact McNemar test.</li></ul></main><script>const R=[["Dory1.0-4B (4 loops)",40,134,83,136,393],["Qwen3-4B-Instruct-2507",32,136,93,122,383],["Dory1.0-4B (2 loops)",36,134,92,119,381],["FrogNano-4B-2609",36,133,81,122,372],["Jan-code-4b",34,136,91,110,371],["granite-4.2-3b",27,130,90,120,367],["Qwen3.5-4B",31,126,84,117,358],["GooseReason-4B",25,134,87,109,355],["NeoHorse-1-4B",31,130,79,112,352],["MiniCPM5-2B",23,129,73,124,349],["Agents-A1-4B",32,123,83,104,342],["granite-4.1-3b",23,128,82,95,328],["Critique-Coder-4B",23,117,82,102,324],["Qwen2.5-Coder-3B-Instruct",10,130,78,67,285],["gemma-3-4b-it",10,101,69,78,258],["Phi-4-mini-instruct",15,109,66,60,250],["SmolLM3-3B",7,97,61,61,226],["DASD-4B-Thinking",0,86,39,33,158],["Ministral-3-3B (as scored)",6,19,54,4,83],["Nanbeige4.1-3B",0,2,0,0,2],["ref: Qwen3.5-9B",54,140,103,140,437,1],["ref: Claude Sonnet 5.5 (one try, no limit)",100,155,141,194,590,1]];const MAX={u:100,h:164,d:150,y:197,a:611},K=["m","h","d","y","a"];let key="a";function draw(){const tb=document.querySelector("#t tbody");const rows=[...R].sort((x,y)=>{const i=K.indexOf(key);return i<1?String(x[i]).localeCompare(String(y[i])):y[i]-x[i]});tb.innerHTML=rows.map(r=>`<tr class="${r[6]?"ref":""}">`+r.slice(0,6).map((v,i)=>i<1?`<td>${v}</td>`:`<td class="barc"><i style="width:calc(${(v/MAX[K[i]]*100).toFixed(1)}% - 20px)"></i><em>${v}</em></td>`).join("")+"</tr>").join("");document.querySelectorAll("th").forEach(t=>t.classList.toggle("s",t.dataset.k===key))}document.querySelectorAll("th").forEach(t=>t.onclick=()=>{key=t.dataset.k;draw()});draw();const A=[["FrogNano-4B, thinking + nudge",84],["FrogNano-4B, long settings",78],["FrogNano-4B, original settings",72],["Dory1.0-4B, 4 loops",66],["ref: Qwen3.5-9B",66],["Qwen3.5-4B (older harness)",53],["Qwen3-4B-Instruct-2507",18]];document.getElementById("ag").innerHTML=A.map(([n,v])=>`<div class="row"><div class="lbl">${n}</div><div class="track"><div class="fill" style="width:${v}%"></div></div><div class="val">${v}</div></div>`).join("");</script></body></html>
README.md+10-4
index.html+125-17