Repository navigation
feat(serving): hysteresis — stop live-budget jitter from thrashing the served model - #1648
Merged
Merged
Conversation
…e served model The live memory budget (#1647) reacts to free memory, which means it can also THRASH near a model's edge: free memory jitters a few hundred MB, the "most capable that fits" pick flips to a bigger/smaller model, and the served model reloads — churn, not organic response. This adds hysteresis so the response is smooth on all machines (matters most on the 8GB Air, where models sit near the budget edge; preemptive on the M5 Pro's headroom). `plan_serving_stable(host, candidates, incumbent)` wraps `plan_serving`: - Keeps the incumbent model while it still fits the budget. - Switches DOWN only when the incumbent no longer fits (forced eviction). - Switches UP only when a strictly more capable model fits with SWITCH_UP_HEADROOM (10%) to spare — so a transient budget bump can't flap. - Lanes + resident always re-track the live budget (re-ranks the incumbent to the top and reuses plan_serving's fit/lane/pack logic — no duplication). The daemon's `publish_plan` passes the currently-served model (from the watch) as the incumbent; boot's first plan has no incumbent → plain selection. This is also the local-serving half of the cross-grid lesson from coordinating with BIGMAMA: their airc 60s-TTL-vs-120s-publish beacon flap is the SAME class (a liveness signal jittering a decision); hysteresis is how a consumer absorbs it. Becomes load-bearing when serving reacts to grid peer-liveness for cross-grid inference routing. 4 tests: no-incumbent==plain, keeps-incumbent-without-headroom (the thrash guard), upgrades-with-headroom (not a lock-in), forced-down-when-unfit. All 14 serving tests green. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
Follow-up to the serving control plane (#1647). The live memory budget reacts to free memory — which means it can also thrash near a model's edge (free memory jitters → "most capable that fits" flips → model reloads). This adds hysteresis so the organic response is smooth.
What
plan_serving_stable(host, candidates, incumbent)wrapsplan_serving:SWITCH_UP_HEADROOM(10%) to spare — a transient bump can't flap it.plan_serving's logic — no duplication).The daemon's
publish_planpasses the currently-served model (from the watch) as incumbent; boot's first plan has none → plain selection.Why it matters on all machines
Preemptive on the M5 Pro (headroom), but exactly what stops model-flapping on the 8GB Air where models sit near the edge. It's also the local-serving half of a cross-grid lesson from coordinating with BIGMAMA: their airc 60s-TTL-vs-120s-publish beacon flap is the same class (a liveness signal jittering a decision) — hysteresis is how a consumer absorbs it, and it becomes load-bearing when serving reacts to grid peer-liveness for cross-grid inference routing.
Tests (4, all 14 serving green)
no-incumbent==plain · keeps-incumbent-without-headroom (the thrash guard) · upgrades-with-headroom (not a lock-in) · forced-down-when-unfit.
🤖 Generated with Claude Code