Skip to content

llama-fit-params: --fit-json (one typed report) and --kv-unified (fit the engine we launch) - #93

Merged
joelteply merged 3 commits into
889580fc/seq-state-across-stream-countsfrom
fable/fit-json
Nov 4, 2026
Merged

joelteply merged 3 commits into
889580fc/seq-state-across-stream-countsfrom
fable/fit-json

Conversation

@joelteply

Copy link
Copy Markdown

Continuum sizes its one launch from the engine's own fit instead of its own formula (continuum card 4a20255d, ONE-BUDGET 3b). Today a launch sized from a plan's transient started at 2,048, 8,448 or 83,968 tokens, and a growth relaunch fixed it afterwards while holding admission for 177-262 s.

What changes

  • --fit-json: llama-fit-params prints the fit as one JSON object (status, n_ctx, n_gpu_layers, tensor_split, overrides), built with nlohmann::json so override regexes are escaped by construction. A failed fit reports its status and exits non-zero. A caller reads a typed report, never the CLI text.
  • --kv-unified is now registered for LLAMA_EXAMPLE_FIT_PARAMS. Without it, a 5-sequence fit read 1,310,720 tokens (one cache per sequence) for an engine launched with one shared pool.

Measured

M5, Qwen3.6-35B-A3B Q4_K_M, 2026-11-04 01:36Z, with the M5's real launch arguments (--parallel 5 --kv-unified --ubatch-size 2048 -ctk q4_0 -ctv q4_0 -fa on -ngl 999):

  • --fit-target 4096 --fit-ctx 20000: {"status":"success","n_ctx":262144,...}
  • --fit-target 16384: the same 262,144.
  • The server's own --fit on with the same arguments also chose 262,144 (01:29Z), so the tool and the server agree.

--fit-ctx is the smallest the fit shrinks to, not a size it must reach. A refusal comes from a margin the device can't leave, which this run didn't exercise.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

joelteply and others added 2 commits November 3, 2026 19:31
…, n_ctx, n_gpu_layers, tensor_split, overrides)

Continuum sizes its one launch from the engine's own fit instead of its own formula (continuum card
4a20255d, ONE-BUDGET 3b): it runs llama-fit-params before launch with -c unset, the authority's margin
(--fit-target) and the largest measured need (--fit-ctx), and passes the fitted arguments to
llama-server. A caller reads a typed report, never the CLI text, so --fit-json prints one object built
with nlohmann::json (override patterns are regexes; their backslashes are escaped by construction).
A failed fit reports its status and exits non-zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…um launches (one shared pool), not a per-sequence one

Without it the fit of 5 sequences read 1,310,720 tokens (5 x the trained window, one cache per sequence)
for an engine launched with one unified pool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Author

PASS at 7233724 (Cormac). --fit-json emits one typed object (status, n_ctx, n_gpu_layers, tensor_split, overrides), and --kv-unified now reaches llama-fit-params, so its n_ctx is the shared pool's.

names[status] is correct: the enum is SUCCESS = 0, FAILURE = 1, ERROR = 2 (common/fit.h:9-11). Non-blocking: a switch over the enum would turn a future fourth status into a compile warning rather than an out-of-bounds read.

Not reproduced here: Fable's M5 run (n_ctx 262,144 shared by 5, matching the server's own --fit on).

…status is a compile warning (Cormac on #93)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Author

PASS at 18ecc49 (Cormac). The delta from 7233724 is only the status switch: every enum case named, no default, so -Wswitch flags a fourth status. Nothing else changed.

@joelteply
joelteply merged commit 7b3351b into 889580fc/seq-state-across-stream-counts Nov 4, 2026
10 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant