Repository navigation
Optimizer phase 2: the search and the API - #44
Merged
Merged
Conversation
…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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 2 of the inference optimizer (
docs/design/optimizer.md). It is stacked on #43.internal/optimizeruns the staged search: baseline, backend and split mode, KV cache, batch sizes, MoE layers in system RAM, and parallel requests for thethroughputprofile. A result wins only when it beats the best by more than 3 percent and 3 standard deviations.llama-serverat the model's real context, becausellama-benchallocates only its test context. When the best does not load, it drops the memory settings one at a time: the measured smaller micro-batches first, then the default batch, then the KV cache, then half the parallel requests. A variant that was not measured is measured first.POST,GETandDELETE /models/{id}/optimize, andPOST /models/{id}/optimize/apply. Apply reuses the checks ofPUT /models/{id}(nowsetModel). It refuses a recommendation that did not load. One run goes at a time.Verification
internal/optimizetests run the search against a simulated host. The tests check the chosen backend and split, a q8_0 cache inside the noise that stays f16, a micro-batch that does not load with the measured smaller one winning, a KV type that does not fit and is never measured, MoE with every expert in system RAM, the throughput floor, and failures.internal/apitests run the whole API with a fake host agent: start, state, apply with the backend switch, a 409 for a second run, cancel, and the refusals.go vet,go test -race ./...andgolangci-lint(0 issues) pass.🤖 Generated with Claude Code