Repository navigation
Conversation
eapache
force-pushed
the
ehuus/moe-small-cache-fixes
branch
from
October 21, 2026 00:36
a11fac5 to
449d77b
Compare
eapache
marked this pull request as ready for review
October 21, 2026 00:39
Contributor
Author
4 of 11 tasks
Contributor
Author
|
Per #30637 (comment) this now fixes the regression and provides a small improvement over the previous baseline for small caches. |
Warn for caches too small to hold a single token, which thrash and provide no benefit except in vary unusual hardware configurations. Fall back to plain LRU (vs SLRU) below about 1.8x a token. Different models and workloads have different crossover points, but plain LRU is more reliable for small caches, where SLRU performance can crater. 1.8x is a very rough upper bound.
eapache
force-pushed
the
ehuus/moe-small-cache-fixes
branch
from
October 25, 2026 21:10
da05b46 to
092e05b
Compare
Contributor
Author
|
Putting this in draft temporarily so I can open #31162 which is more important, given the limit on open PRs. |
eapache
marked this pull request as draft
October 25, 2026 21:15
eapache
marked this pull request as ready for review
October 26, 2026 16:11
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.
Overview
cont #30637
Warn for caches too small to hold a single token, which thrash and provide no benefit except in very unusual hardware configurations.
Fall back to plain LRU (vs SLRU)Ramp down the protected set below 1.8x a token's experts. Different models and workloads have different crossover points, but performance craters if a full token's experts don't fit in the unprotected set. 1.8x is a conservative upper bound based on testing the cross-over point of a few different models.Additional information
Mostly fixes the regression reported in #30637 for small caches.
There is now a small band of caches and models (e.g. Gemma4-26B-A4B with a cache about 1.5x a single token) where we choose not to use SLRU even when it would provide a few % of benefit. But trying to choose the threshold dynamically would be impossible to predict.edit: I had a brainwave and this makes more sense / works better - instead of hard cutover, gradually increase the protected percentage (from 0% at 1x a token to 50% at 1.8x a token). Everybody wins. In the second commit.
Requirements