Repository navigation
feat(moe): suggest an expert residency that leaves room for prompts - #4858
Merged
Merged
Conversation
The MoE offload field now offers the largest whole resident percent whose admission estimate stays 4 GiB under the scheduler's prompt line, after the hot cache and other loaded models. A Qwen4-Exp PLE or DeepSeek V4.1 Engram table stays resident when a lower percent fits that way. GET /admin/api/models/{id}/moe-offload-fit also sizes unsaved MTP and table toggles, and its probes skip the forced-offload logs.
Co-Authored-By: Beata Kouchnir <12824699+beatakouchnir@users.noreply.github.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
The MoE Expert Offload field in Model Settings now suggests a resident percent, and clicking the hint fills the field. Before and after the click, with a 12 GiB ceiling:
The suggestion is the largest whole percent whose admission estimate stays about 4 GiB under the scheduler's prompt line, so the model loads and still has room to take a prompt. The line is (memory ceiling - hot cache) x the memory-guard tier headroom, and models that are already loaded count against it. When even 5% leaves less than 4 GiB, a short notice shows instead. Nothing shows when the model fits without offload.
Based on #3676 by @beatakouchnir, who is co-author on the commit.
How it works
EnginePool.moe_offload_fit()sizes each candidate percent through_entry_runtime_resident_size, the same arithmetic load admission uses, starting from the checkpoint size even when the model is loaded. Alog_decisionflag keeps these probes from logging or recording forced offload decisions.GET /admin/api/models/{model_id}/moe-offload-fitreturns the hint. Optionalmtp_enabled,qwen4_ple_ssd_offloadanddeepseek_v41_engram_ssd_offloadquery flags size unsaved edits.Validation
M3 Ultra with the ceiling held at 12 GiB (balanced tier, prompt line 11.85 GB). Each model was loaded at the suggested percent and sent one 16K-token prompt.
The suggestion stays the same after the model is loaded with offload on.