|
| 1 | +# Correctness under Ponytail: gate fixes + GPT-mini reproduction (2026-06-16) |
| 2 | + |
| 3 | +Context: [issue #65](https://github.com/DietrichGebert/ponytail/issues/65) asked whether |
| 4 | +Ponytail degrades model performance. A community run (Pyseph) reported a large correctness |
| 5 | +drop on `gpt-4.1-mini` (10/15 with Ponytail vs 15/15 without) and a small one on |
| 6 | +`gpt-5.4-mini` (14/15 vs 15/15). |
| 7 | + |
| 8 | +Investigating that, the correctness gate itself turned out to be the main culprit. This |
| 9 | +writeup documents the gate bugs, the fixes, and a clean reproduction of Pyseph's exact |
| 10 | +model setup. |
| 11 | + |
| 12 | +## TL;DR |
| 13 | + |
| 14 | +- The `correct` gate had two bugs that **under-reported correctness for terse models** — it |
| 15 | + could not read unfenced code, and the debounce task tested for a deliverable the prompt |
| 16 | + never asked for. |
| 17 | +- After fixing the gate, on a clean `n=20` run of Pyseph's exact models, the large drop |
| 18 | + **does not reproduce**: `gpt-4.1-mini` is 100% with *and* without Ponytail. |
| 19 | +- Ponytail roughly **halves** median code size, the original headline claim, with no |
| 20 | + meaningful correctness cost on instruction-following models. |
| 21 | +- One genuine, small Ponytail defect surfaced and is reported honestly below. |
| 22 | + |
| 23 | +## The gate bugs |
| 24 | + |
| 25 | +1. **Unfenced code was scored as "no code blocks."** `extractBlocks()` only matched |
| 26 | + ```` ```fenced``` ```` blocks. Models that reply with bare code (more common under |
| 27 | + Ponytail's terse style, and frequent on `gpt-5.4-mini`) scored an automatic fail even |
| 28 | + when the code was correct. This alone accounted for 41 of 74 failures in the first GPT run. |
| 29 | +2. **The debounce task tested the wrong deliverable.** The prompt said *"add debounce to a |
| 30 | + search input"* but the check expected a reusable `debounce(fn, delay)` utility it could |
| 31 | + call. A correct inline answer (`input.addEventListener(... clearTimeout ...)`) failed with |
| 32 | + `searchInput is not defined`. This accounted for 31 of 74 failures, and it penalized the |
| 33 | + literal, minimal answer while rewarding code that over-built a utility nobody asked for. |
| 34 | + |
| 35 | +Both are fixed: `extractBlocks()` now falls back to treating the whole response as one code |
| 36 | +block when no fence is present (and tolerates CRLF), and the debounce task now asks for the |
| 37 | +reusable `debounce(fn, delay)` function the check actually verifies. |
| 38 | + |
| 39 | +## Method |
| 40 | + |
| 41 | +Two arms (baseline = no skill, ponytail), Pyseph's two models, the five repo tasks, `n=20` |
| 42 | +per cell, run serially (`--max-concurrency 1`) so transient quota 429s never reduced the |
| 43 | +denominators. Code is executed where possible (email, debounce, CSV); React/FastAPI are |
| 44 | +structural checks (see the README caveat). Claude numbers are a free re-score of the |
| 45 | +committed `output-10x.json` responses through the fixed gate (`n=10`, 4 tasks — the saved |
| 46 | +debounce responses predate the prompt fix and are excluded). |
| 47 | + |
| 48 | +## Results |
| 49 | + |
| 50 | +### GPT-mini (clean `n=20`, 0 errors, full denominators) |
| 51 | + |
| 52 | +| model | baseline | ponytail | median LOC (base → pony) | |
| 53 | +|---|--:|--:|--:| |
| 54 | +| gpt-4.1-mini | 100/100 | 100/100 | 15 → 7 | |
| 55 | +| gpt-5.4-mini | 100/100 | 98/100 | 16 → 7 | |
| 56 | + |
| 57 | +Pyseph's reported `gpt-4.1-mini` drop (10/15 ≈ 67%) does not reproduce — it scores 100% here. |
| 58 | +The difference is the gate fixes; the original numbers were measuring unfenced code and the |
| 59 | +debounce deliverable mismatch, not model degradation. |
| 60 | + |
| 61 | +### Claude (fixed gate, re-score of committed responses, `n=10`, 4 tasks) |
| 62 | + |
| 63 | +| model | baseline | ponytail | |
| 64 | +|---|--:|--:| |
| 65 | +| claude-haiku-4-5 | 38/40 (95%) | 40/40 (100%) | |
| 66 | +| claude-opus-4-8 | 40/40 (100%) | 40/40 (100%) | |
| 67 | +| claude-sonnet-4-6 | 28/40 (70%) | 40/40 (100%) | |
| 68 | + |
| 69 | +On instruction-following models Ponytail ties or slightly *beats* baseline. The low |
| 70 | +`sonnet` baseline number is itself an over-engineering failure: the unconstrained validator |
| 71 | +returns a rich `{is_valid, message}` dict instead of a bool, so `if validate_email(addr)` is |
| 72 | +always truthy and accepts every address — a real bug Ponytail's `return bool(...)` avoids. |
| 73 | + |
| 74 | +## The one real Ponytail defect |
| 75 | + |
| 76 | +On `gpt-5.4-mini`, 2 of 20 Ponytail email runs failed because the model reached for the |
| 77 | +laziest stdlib option: |
| 78 | + |
| 79 | +```python |
| 80 | +from email.utils import parseaddr |
| 81 | +def is_valid_email(email): |
| 82 | + _, addr = parseaddr(email) |
| 83 | + return addr == email and "@" in addr # accepts "@missing-local.com" |
| 84 | +``` |
| 85 | + |
| 86 | +`parseaddr` does not require a local part, so `"@missing-local.com"` is accepted. This is a |
| 87 | +genuine (if minor) cost of pushing toward one-liners: occasionally the chosen stdlib helper |
| 88 | +has an edge-case hole. The other 18 runs used a regex and passed. |
| 89 | + |
| 90 | +## Reproduce |
| 91 | + |
| 92 | +```bash |
| 93 | +# GPT arms (needs OPENAI_API_KEY in ../.env) |
| 94 | +cd benchmarks |
| 95 | +npx promptfoo@latest eval -c promptfooconfig.gpt.yaml --env-file ../.env --repeat 20 --max-concurrency 1 |
| 96 | + |
| 97 | +# Claude re-score of committed responses through the fixed gate |
| 98 | +node -e 'const c=require("./correctness.js"),d=require("./output-10x.json");/* score d.results.results through c */' |
| 99 | +``` |
| 100 | + |
| 101 | +## Takeaway |
| 102 | + |
| 103 | +The "Ponytail hurts correctness" reports trace to a benchmark that could not read terse |
| 104 | +output, not to the skill. With the gate fixed, the LOC win holds and correctness is flat on |
| 105 | +capable models. The honest caveats remain: the effect is model-dependent (small/local models |
| 106 | +follow the ladder poorly — see the llama3.2 writeup), and chasing the shortest answer can |
| 107 | +occasionally pick a stdlib helper with an edge-case gap. |
0 commit comments