A deterministic quality eval as a run type next to BetterBench: tool calling (12 requests), coding (8 Python functions checked by unit tests in a locked-down sandbox container) and long-context retrieval (needle at 3 depths in 3 lengths up to the context). Versioned eval set in src/evals/v1, score stored per run, shown on the run page, in compare views, the benchmark list and sweep tables (optional eval per variant); API kind "eval", quality in run/sweep/compare answers; skill updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8.8 KiB
name, description, required_environment_variables
| name | description | required_environment_variables | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| kaname-tuning | Deploy local LLMs on the user's Kaname server, benchmark their speed and check their answer quality to find good launch options (context, KV cache type, batch sizes, GPU layers, runtime) for the hardware. Use when the user asks to deploy, test, benchmark, tune or compare a model's settings, or to find the fastest setup for a model. |
|
Kaname: deploy and tune models
Kaname runs models in containers (llama.cpp or vLLM) and measures them with BetterBench. With this
skill you deploy a downloaded model, benchmark it, change one launch option at a time and report
which setup is best. To find or download models, use the kaname-models skill (SKILL.md).
You may only change and benchmark deployments your own token created. You cannot touch the user's deployments (especially protected ones), change settings, runtimes or tokens, or delete models. Tell the user when something needs one of those.
Every call needs KANAME_URL and KANAME_TOKEN (never print the token or put it in a URL), and the
kaname helper (a curl wrapper that adds the token and JSON headers; see SKILL.md → Setup). If
kaname is missing, write out
curl -sS -H "Authorization: Bearer $KANAME_TOKEN" -H "Content-Type: application/json" … instead.
Errors are {"error": {"code", "message"}}; the message says what to do.
Rules
- No polling loops. Status calls take
?wait=S(max 900): Kaname holds the request until the state settles. Make one call, with-m(curl's time limit) a bit above the wait. - Approval: by default every start, run and sweep waits for the user (
state: pending_approval). Then stop: tell the user what you asked for and that it awaits their approval in Kaname. Don't retry, don't poll. Continue when the user says it's approved. - Never work around a guardrail (another token, splitting a sweep, renaming things). Report the error message and stop.
- One GPU job at a time: one of your deployments running at once (unless the user raised the limit), one run or sweep at a time. Stop your deployment when you're done.
- Change one variable at a time, so a difference has one cause.
1. Know your limits
kaname "$KANAME_URL/api/v1"
deploymentGuardrails: approval mode, how many of your deployments may run, run/sweep time limits,
max sweep variants, caps, host ports. Your scopes must include deployments:write and
benchmarks:run; if not, tell the user.
2. Pick a model and a runtime
kaname "$KANAME_URL/api/v1/models?status=ready&q=qwen3"
kaname "$KANAME_URL/api/v1/models/<modelId>" # its files (pick a .gguf for llama.cpp)
kaname "$KANAME_URL/api/v1/runtimes"
Runtimes say what they serve (llama.cpp: a GGUF file, vLLM: a safetensors repo), whether you may use
them ("allowed": true) and which extra argument flags you may pass (allowedExtraArgs). gpus
lists the host's GPUs and their VRAM.
Previous results for this model, to start from what is known:
kaname "$KANAME_URL/api/v1/benchmarks?limit=10"
3. Deploy
Check first (nothing is created; you get the exact command and the memory/VRAM estimates):
kaname -X POST "$KANAME_URL/api/v1/deployments" -d '{
"runtimeId": "<runtimeId>", "modelId": "<modelId>", "dryRun": true,
"options": { "modelFile": "Qwen3-8B-Q4_K_M.gguf", "contextSize": 16384, "gpuLayers": "auto",
"cacheTypeK": "q8_0", "cacheTypeV": "q8_0", "parallel": 1, "extraArgs": [] }
}'
If estimates.vramMb is above estimates.gpuVramMb, lower the context, quantize the KV cache or
pick a smaller quant. Then the same body without "dryRun":
state: pending_approval→ tell the user and stop (see Rules).state: starting→ wait until it is ready:
kaname -m 660 "$KANAME_URL/api/v1/deployments/<id>?wait=600"
state: running → go on. state: failed → read error (and ?log=50), fix the options
(PATCH, below) and start again; don't repeat the same failing options.
4. Benchmark
kaname -X POST "$KANAME_URL/api/v1/benchmarks" -d '{
"deploymentId": "<id>", "quick": true, "label": "Q4_K_M ctx16k q8_0 KV",
"description": "Baseline for tuning Qwen3-8B on this GPU"
}'
kaname -m 960 "$KANAME_URL/api/v1/benchmarks/<runId>?wait=900"
quick: true(5 passes) to screen options;quick: false(20 passes) to confirm the winner.phases(decode,prefill,concurrency) narrows what is measured; leave it out for all.- The result's
headlinehasdecodeTps(generation speed),prefillTps(prompt processing at the deepest prompt),ttftMs(time to first token) andpeakParallelTps;setuplists GPU, PCIe, engine version, model/quant/KV cache, context and concurrency;resourceshas VRAM, power and temperature.?full=1only when you need the per-category details. - If the wait times out, the run is still going: one more call with
?wait=900, then report.
Then check that the answers are still right (speed alone can hide a broken setup):
kaname -X POST "$KANAME_URL/api/v1/benchmarks" -d '{"kind": "eval", "deploymentId": "<id>", "label": "Q4_K_M ctx16k q8_0 KV"}'
kaname -m 960 "$KANAME_URL/api/v1/benchmarks/<runId>?wait=900"
quality.score (0–100) and per section (tools, coding, retrieval). Add ?full=1 to see which
items failed. A drop of more than a few points against the baseline means the change hurt quality,
however fast it is.
5. Change one variable and compare
Stop, change one option, start, wait, benchmark again:
kaname -X POST "$KANAME_URL/api/v1/deployments/<id>/stop"
kaname -m 120 "$KANAME_URL/api/v1/deployments/<id>?wait=60"
kaname -X PATCH "$KANAME_URL/api/v1/deployments/<id>" -d '{"options": {"cacheTypeK": "f16", "cacheTypeV": "f16"}}'
kaname -X POST "$KANAME_URL/api/v1/deployments/<id>/start"
Or let Kaname do it: a sweep deploys each variant of one or two settings, benchmarks it (with
"quality": true also runs the quality eval) and removes it again (stop your own deployment first;
it counts as one run):
kaname -X POST "$KANAME_URL/api/v1/sweeps" -d '{
"baseDeploymentId": "<id>", "quick": true, "quality": true,
"params": [{ "key": "kvCache", "values": ["f16", "q8_0", "q4_0"] }]
}'
kaname -m 960 "$KANAME_URL/api/v1/sweeps/<sweepId>?wait=900"
Keys: contextSize, modelFile, kvCache, threads, parallel, batchSize, ubatchSize,
flashAttn, cacheRamMb, gpuLayers (llama.cpp); dtype, maxNumSeqs, gpuMemoryUtilization
(vLLM); cpus. A sweep can take long: after a timed-out wait, report progress instead of waiting
again and again.
Compare runs side by side:
kaname "$KANAME_URL/api/v1/benchmarks/compare?ids=<run1>,<run2>,<run3>"
Differences under ~2 % between separate runs are noise. For a small difference that matters, run
an A/B (two deployments of the same model at once, if the user allows 2 agent deployments):
{"kind": "ab", "deploymentId": "<A>", "deploymentBId": "<B>"}.
6. Report and clean up
Report a compact table, one row per setup, the varied option first:
| KV cache | Decode t/s | Prefill t/s | TTFT ms | Quality | VRAM peak | Notes |
|---|---|---|---|---|---|---|
| f16 | 58.1 | 1910 | 88 | 86.1 | 11.2 GB | baseline |
| q8_0 | 57.6 | 1880 | 90 | 86.1 | 9.4 GB | −1 % speed, same quality, 1.8 GB less VRAM |
Name the winner and why: speed and quality together (and what stayed the same: GPU, engine version, quant, context). Then stop your deployment (or delete it if the user doesn't need it):
kaname -X POST "$KANAME_URL/api/v1/deployments/<id>/stop"
When something is refused
error.code |
What to do |
|---|---|
too_many_deployments |
Stop your other deployment first, or tell the user. |
gpu_busy |
Another agent job is running or a deployment is loading: wait once with ?wait=, then retry once; otherwise report and stop. |
vram_protected |
It would crowd the user's protected deployment out of VRAM: smaller quant, context or quantized KV cache, or tell the user. |
arg_not_allowed |
That flag isn't allowed; use the structured option if there is one (contextSize, gpuLayers, cacheTypeK, …) or drop it. |
limit_exceeded |
Over the memory/CPU cap: smaller model or context. |
port_not_allowed |
Leave out hostPort. |
runtime_not_allowed, runtime_not_pulled |
Pick another runtime from GET /api/v1/runtimes, or tell the user. |
protected, not_owner |
Not your deployment: deploy your own. |
too_many_variants |
Vary fewer values. |
busy |
Stop the deployment before changing it. |
unauthorized, forbidden |
Token wrong, revoked or missing a scope: tell the user. |