Repository navigation
server: reload an MLX runner when num_ctx changes, either direction - #279
Merged
Merged
Conversation
needsReload compared runner options only for non-MLX models (upstream a16f966), so a warm MLX runner served any later num_ctx without reloading. That left #276's admission -- which prices the rung at load -- blind to a rung raise: 31b loaded at 8192 under a 35 GiB cap served a 65536 request in 0 s with no admission at all (main validation, step 1b, 2026-09-06), and the cache then grows into memory nobody priced, the very failure #210 describes. An MLX runner now reloads when the requested num_ctx differs from the served one: larger, so admission prices the new rung first; smaller, so the memory comes back instead of the runner hogging the bigger window. That is what GGML already does through its option comparison, pinned by a test so the two paths cannot drift. The other runner options stay ignored for MLX, as upstream intended, and two automatic rungs are still equalised before the comparison so unpinned clients do not churn the runner. The served rung is what gets compared: the MLX client only learns it after the runner's status probe (an automatic rung may have been clamped), so the scheduler records llama.ContextLength() at runner creation when known and refreshes it once the load completes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
|
Live proof (CUDA host, one container, 35 GiB cap, gemma4:31b-nvfp4; FIX ( |
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.
Closes the gap the
mainvalidation (step 1b, 2026-09-06) found in #276:needsReloadcompared runner options only for non-MLX models (upstreama16f9665), so a warm MLX runner served any laternum_ctxwithout reloading and admission — which prices the rung at load — never saw a rung raise. Measured: 31b loaded at 8192 under a 35 GiB cap served a 65536 request in 0 s with no admission line; the cache then grows into memory nobody priced (#210's failure).Change. An MLX runner reloads when the requested
num_ctxdiffers from the served one, either direction — larger so admission prices it first, smaller so the memory comes back instead of the runner hogging the bigger window (the maintainer's refinement). GGML already behaves this way through its option comparison; a test pins both paths. The other runner options remain ignored for MLX as upstream intended, and two automatic rungs are still equalised first so unpinned clients don't churn. Because the MLX client may have clamped an automatic rung, the scheduler recordsllama.ContextLength()(the served rung) at creation when known and refreshes it after the load completes, so a request naming the served rung matches rather than reloading.Tests.
TestSchedNeedsReloadMLXOnNumCtxChange(same rung: no reload; larger: reload; smaller: reload; other options: no reload; auto+auto: no reload) andTestSchedNeedsReloadGGMLOnNumCtxChange.go test ./server/ ./x/mlxrunner/green ingolang:1.26.0,golangci-lint0 issues. The post-load recording of the served rung is not unit-testable with the scheduler mock (the MLX branch constructs its client directly); it is covered by the live proof below.Live proof (queued behind the running validation chain): one container under a 35 GiB cap: 31b@8192 admitted → @65536 must reload and be refused at admission → @8192 admitted again → @4096 reloads and
/api/psreports 4096 → @8192 twice, the second served warm. Control onmain-a523d60bmust show no reload at step 2. Results will be posted here.🤖 Generated with Claude Code