Subwave llm bench

From perminder-klair/subwave · View interactive version

Subwave llm bench is an AI agent skill from the GitHub repository perminder-klair/subwave. Benchmark and compare LLM models for SUB/WAVE's on-air calls — track picks, segments, listener requests, DJ scripts, banter, and programme beats — in pool, agent and Track Shortlist modes, using controller/scripts/llm-bench (the matrix harness) or the legacy picker-only controller/scripts/picker-tes

How to use this skill

Skill file

SUB/WAVE LLM model benchmark

Two harnesses, one job: measure how well a provider + model handles the

station's real LLM calls before trusting it on air.

primary harness. A matrix runner over every on-air call kind: pool picks

(pickNextTrack), agent picks (djAgentPick), Track Shortlist picks

(djShortlistPick), pool + agent segments

(generateSegment / djAgentSegment), request matching (matchRequest /

djAgentRequest), the free-text scripts (intro, link, station ID, hourly),

banter, and the programme family (plan, beats, exchanges). Scores

reliability + deterministic rule checks, prints a per-model comparison

table, writes a diffable JSON report.

high-iteration picker runs comparable with historical results, and it has a

bundled orchestration script (see the legacy section at the end).

Both import the live prompts and schemas from src/ (never copies), fake

everything external (library, tools, weather/news data), and override

provider/model only inside their own short-lived process — the live

controller's configured model is never touched.

The two things that surprise people

  1. Routing matters as much as the model. The same model can pass through

one provider and fail through another, because each @ai-sdk/* provider

translates tools / structured output differently. Canonical case:

deepseek-v4-flash scored 0/4 via the deepseek direct provider but

4/4 via openrouter. Always benchmark through the routing you'll

actually deploy — "is model X good?" is the wrong question; "is

provider+X good?" is the right one.

  1. The stress scenarios are where truth lives. Easy cells make every model

look fine. The verdict cells are: djAgentPick/long-context (full prompt +

tool loop), generateSegment/dull-weather (the model must decline to air

— small models botch the silence encoding; a huge wall-clock here means the

structured-output retry rescued a failed first attempt), and the

multi-voice JSON kinds (generateBanter, generateProgrammeExchange).

When NOT to use this

Running llm-bench

Runs on the host from a repo clone (it imports TS source via tsx; prod

containers ship only compiled dist/). The running stack is not required —

keys resolve from state/secrets.env and controller/.env automatically

(existing env vars win). If a key exists only inside a prod container's env,

copy it out first: export OPENROUTER_API_KEY=$(docker exec sub-wave-controller printenv OPENROUTER_API_KEY).

The run never writes to state/. It copies the station's settings.json,

schedule.json and secrets.env into a temp STATE_DIR and works there. On a

multi-station install it copies the active station's files. An exported

STATE_DIR names a different station root to copy from. The temp dir is printed

as Isolated STATE_DIR: and deleted when the run exits, Ctrl-C included. A run

killed before it can clean up (a Ctrl-C while it is still starting up, which

tsx turns into SIGKILL, or a closed terminal) leaves its dir, and the next run

deletes it. A dir left by a sudo run belongs to root, and a run as yourself

leaves it alone.

library.db is not copied, because the fixtures fake the library.

cd <repo>/controller
npm run llm-bench -- \
  --models openrouter:google/gemma-4-31b-it,ollama:qwen3:8b \
  --iterations 3

Flags:

colon, so Ollama tags keep theirs (ollama:qwen3:8b). Providers: ollama |

openai-compatible | anthropic | openai | google | deepseek | openrouter |

requesty | cheaperinference | gateway.

exact kind names. Default: all.

kinds run once either way. shortlist adds only the djShortlistPick kind:

the live source plan run over the synthetic tools, then the one bounded

choice. Match the modes to the station's routes (llm.trackSelection,

requestMatching, segmentRuntime): **comparing the two pickers is

--kinds pick --modes agent,shortlist**, and cells for a route the operator

never uses just add noise and cost.

confirm a winner. Full matrix ≈ 32 scenario cells, so ~100 calls per model

at 3 iterations.

gitignored).

A full run takes many minutes (every call is a real model call, agent cells

can take 45 s each). Run it in the background with a long timeout and don't

poll; OLLAMA_URL=http://localhost:11434 translates the container-internal

Ollama address for host runs.

Reading llm-bench results

Each run is ok, violation (call succeeded, named rule checks failed), or

thrown (bucketed: no-object-generated, timeout, unreachable,

thrown). The summary prints pass% + p50 latency per cell, then per-model

histograms of rule failures and thrown buckets.

Judge in this order:

  1. Thrown rate — a model that can't produce the schema at all is out.

no-object-generated on structured kinds = weak structured output;

everything landing at ~45 s = too slow for the loop, not incapable.

unreachable = provider/config problem, not the model — fix and re-run.

  1. Violations — the named rules tell you the failure character:

hallucinated-id (invents track ids — dangerous), banned-phrase:* /

stage-direction:* / wrapping-quotes (would be read aloud by TTS),

digits-in-spoken-time / clock-leak (hourly/link discipline),

opener-repeat (ignores anti-repeat lists), unusable-exchange /

single-voice (can't hold multi-voice JSON), variety:same-artist

(editorial-pressure miss — informative, not disqualifying).

  1. Latency — p50 per cell; a pick has a whole track of slack so even 20 s

works, but segments and links air sooner. Watch for retry-rescued cells

(pass with 100×-median wall clock).

  1. Shortlist/pool vs agent gap — a model that's clean in shortlist or

pool cells but falls apart in agent cells is a Track Shortlist model;

that's a valid deployment, just say so in the recommendation. Shortlist

cells also flag reason-unavailable / reason-rejected (the Booth reason

was missing or failed the controller's safety check) and near-miss-id

(an id slip the live nearestId repair would save, unlike

hallucinated-id). Compare tokens per pick from the report JSON: one

Shortlist call carries no tool loop or session window.

Reports are JSON with every run record — keep old ones to diff a model across

prompt changes or across model updates.

Producing the recommendation

  1. A compact table: one row per provider+model, columns for thrown rate,

violation rate, p50 latency, and the dominant failure.

  1. A clear call naming the best provider + model + mode ("gemma via

OpenRouter, Track Shortlist — clean structured output, agent cells time

out"). Pool cells exercise the fallback picker every station keeps; they

are not a selectable route, so recommend Shortlist or Agentic Tools.

  1. Call out disqualifiers and deferrals (5xx throughout = re-test later).

Do not apply the change. The operator sets llm.provider + llm.model

(and the Music selection route, Agentic Tools or Track Shortlist) in admin Settings — those are global, their

call.

Legacy: picker-test.mjs deep-dive

For picker-only, high-iteration runs comparable with historical results:

# DEV stack (src bind-mounted in container):
docker exec sub-wave-controller npx tsx scripts/picker-test.mjs <provider> <model> [iterations] [short|long]
# Host (works regardless of stack):
( cd <repo>/controller && STATE_DIR=<repo>/state OLLAMA_URL=http://localhost:11434 \
  npx tsx scripts/picker-test.mjs <provider> <model> [iterations] [short|long] )

long is the verdict mode (realistic session window); short is a sanity

check. The bundled scripts/assess-models.sh (in this skill's directory) runs

one or more models in both modes, auto-detects dev/prod, and summarises event-

log failures: assess-models.sh <provider> [iterations] <model>... — with

ollama and no models it discovers and tests everything installed.

Failure strings glossary (from the event log, kind: pickerTest):

tool protocol. Check routing before rejecting the model (see surprise #1).

failure, not incapability; the deadline aborted it mid-loop.

re-run later, don't reject the model on this.

Cross-check live behaviour in /admin/debug → llm.recentCalls: the via

field shows which path produced each result (ai-sdk:agent:native = clean

native path; …:recovery = rescued by the done-tool recovery; a thrown

djAgentPick falls back to the pool picker, so the station never goes

silent).

Notes

the event log, and raw request bodies in llm-debug.log when

LLM_DEBUG_RAW or the raw-capture setting is on. Read them from the printed

Isolated STATE_DIR while the run is going. The JSON report is the record

that survives. picker-test.mjs is different: the recipe above points it at

the live state/, so it appends to the station's event log

(state/logs/events-*.jsonl), and assess-models.sh reads its failure

strings from there.

docs/llm-calls.md; the harness design spec at

docs/superpowers/specs/2026-07-09-llm-bench-design.md.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.