Skip to content

Optimizer phase 1: batch settings, the agent's tune request, batched-bench - #43

Merged
ihavespoons merged 2 commits into
mainfrom
optimizer-design
Nov 8, 2026
Merged

ihavespoons merged 2 commits into
mainfrom
optimizer-design

Conversation

@ihavespoons

Copy link
Copy Markdown
Collaborator

Summary

Phase 1 of the inference optimizer. The design is in docs/design/optimizer.md. The optimizer searches llama.cpp settings by measurement on the host's own hardware. An optional upstream LLM can propose candidates, but only a measurement decides, and the owner applies the result.

This PR adds the plumbing. The search, the API and the UI come in later phases.

Changes

  • Model settings batch, ubatch and split_mode (internal/models), with --batch-size, --ubatch-size and --split-mode in the llama-swap command. They are in the shared form, the TUI and the console. -b, --batch-size, -ub and --ubatch-size are now typed flags, and LoadSettings moves old raw args into the typed fields.
  • The host agent's tune.<model> request (os/rootfs/usr/libexec/sibyl/agent). It runs one tool in a backend image with the same container options as the benchmark: llama-bench, llama-batched-bench, or llama-server until /health answers. Every argument must match a pattern for its flag. The model path, the pool, the GPUs and the backend get fixed checks.
  • hostctl.Tune.
  • llama-batched-bench in the hip, vulkan and cuda images.
  • The agent's paths can be set by SIBYL_AGENT_* variables, for the tests. The systemd unit sets none.

Verification

  • TestAgentTuneAllowlist runs the agent's allowlist on 7 good and 22 bad argument lists, such as -m /etc/shadow, -rpc, --host 0.0.0.0, a flag as a value, and an -ot pattern that starts with a dash.
  • TestAgentTuneRuns runs the whole agent with a fake podman for each tool and for refused arguments. It fails when --cap-drop all is removed from the tune container options.
  • Tests for the new settings, the raw-arg move, and the generator.
  • go vet, go test -race ./..., golangci-lint (0 issues) and shellcheck pass.
  • Not run on the box, because it runs a training job.

🤖 Generated with Claude Code

…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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ihavespoons
ihavespoons merged commit 04b6be5 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