Skip to content

Optimizer phase 3: the TUI and the web console - #45

Merged
ihavespoons merged 6 commits into
mainfrom
optimizer-ui
Nov 8, 2026
Merged

ihavespoons merged 6 commits into
mainfrom
optimizer-ui

Conversation

@ihavespoons

Copy link
Copy Markdown
Collaborator

Summary

Phase 3 of the inference optimizer (docs/design/optimizer.md). It is stacked on #44.

  • GET /models includes each model's last optimizer run. The client has StartOptimize, CancelOptimize and ApplyOptimize.
  • TUI Models screen: o starts the optimizer (one user or throughput) or cancels the run. a applies the result, and asks whether to switch the backend when a different one was faster. The details show the stage while a run goes, then the speed now, the best speed and each change. The list refreshes every 5 seconds while a run goes.
  • Web console: an Optimizer card on the model page with the same actions. It sits before the settings form, because a form inside a form is not valid HTML.
  • The models and consoles guides, and docs/design/web-console.md.

Verification

  • TUI tests: the details text for running, failed, done and unverified runs, and the start, cancel and apply forms against a fake API. esc clears the optimizer action, so the save key still works on the settings form.
  • Console test: the card renders the numbers, the changes and the backend choice. The start and apply actions send the right bodies, and a change with no Origin header is refused.
  • go vet, go test -race ./... and golangci-lint (0 issues) pass.
  • Not run on the box, because it runs a training job.

🤖 Generated with Claude Code

ihavespoons and others added 3 commits November 8, 2026 10:09
…bench

The design is in docs/design/optimizer.md: a measured search for faster
llama.cpp settings, with an optional LLM advisor that only proposes.

- Model settings batch, ubatch and split_mode, with their llama-server
  flags, the shared form, the TUI and the console. Old --batch-size and
  --ubatch-size raw args move to the typed fields on load.
- The host agent's tune.<model> request runs llama-bench,
  llama-batched-bench or a llama-server load check in a backend image,
  as the benchmark does. Every argument must match a pattern for its
  flag, so a container cannot pass a model path, a network flag or a
  device.
- The hip, vulkan and cuda images ship llama-batched-bench.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/optimize runs the staged search from docs/design/optimizer.md:
baseline, backend and split mode, KV cache, batch sizes, MoE layers in
system RAM, and parallel requests for the throughput profile. A result
wins only when it beats the best by more than 3 percent and 3 standard
deviations. The verify stage starts llama-server at the model's real
context. When the best does not load, it drops the memory settings one
at a time, and tries the measured smaller micro-batches first.

The API runs it through the host agent's tune request:
POST, GET and DELETE /models/{id}/optimize, and
POST /models/{id}/optimize/apply, which reuses the checks of
PUT /models/{id}. One run goes at a time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- GET /models includes each model's last optimizer run, and the client
  has StartOptimize, CancelOptimize and ApplyOptimize.
- TUI Models screen: o starts the optimizer (one user or throughput) or
  cancels the run, a applies the result and asks whether to switch the
  backend. The details show the stage while it runs, then the speed now,
  the best speed and each change. The list refreshes while a run goes.
- Web console: an Optimizer card on the model page with the same
  actions, outside the settings form.
- The models and consoles guides describe it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ihavespoons
ihavespoons changed the base branch from optimizer-search to main November 8, 2026 02:32
@ihavespoons
ihavespoons merged commit 62f9e74 into main Nov 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant