fix(engine): reserve explicit KV pages during MoE auto-sizing - #198
Open
pedro-moser wants to merge 1 commit into
Open
fix(engine): reserve explicit KV pages during MoE auto-sizing#198pedro-moser wants to merge 1 commit into
pedro-moser wants to merge 1 commit into
Conversation
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
--num-pagesKV allocation in the reserve passed to the joint MoE/KV auto-sizing solver--num-tokens, which resolves tonum_page_overrideafter page size is finalizedkv_reserve_tokensand model-specific minimum-reserve floors by taking the maximum of all threeProblem
Engine._resolve_auto_moe_cache_size()runs before the KV pool is allocated. It previously passed only:When a user explicitly requested more KV pages/tokens, that allocation did not participate in the MoE cache budget. The solver could therefore assign those bytes to expert slots and leave startup to fail later during KV allocation.
This is the explicit-context half of the tradeoff described in #111. It does not change the default 8,192-token reserve or admission behavior for over-capacity requests.
Test plan
Regression test on current
main:resolve_moe_cache_autokv_reserve_tokens == 64 * 16The test failed before the fix with
0 != 1024and passes after it.Executed:
git diff --checkand Python compile checks also pass.Risk and exclusions
--num-pagesnor--num-tokensis set.Addresses part of #111.