Repository navigation
RFC: Improve Model Eviction #3668
clemperorpenguin
started this conversation in
Request for Comment (RFC)
Replies: 1 comment
|
I like this idea. I’d lean toward Option B as the default, with A and D available as client-selectable eviction strategies. I’d skip C: pinning already provides the important hard-priority mechanism, while another priority system adds complexity and potentially conflicting semantics. Option E still makes sense independently: "none", "auto", "force" controls whether eviction may happen, while B/A/D control which models get evicted. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Proposal size
Minor feature (a single PR)
Updates
No response
User story
A user in Discord pointed out that when you try to load a model with eviction enabled and multiple models loaded, it doesn't automatically evict the loaded models to make room. After this change, they can try to load a big model and their other models will be automatically evicted.
High-level design
Lemonade currently decides, with VRAM eviction enabled, which models to unload based on how long they've been idle, not by how much memory they use. When a user loads a large model while smaller models are present, the load often fails even though unloading one or two idle models would have made room. This RFC makes model loading memory-aware. The following changes apply regardless of which eviction option we adopt:
What remains open is how Lemonade decides which model candidates are least important. There is no single correct answer, so I am proposing several options:
Option A - Cheapest to reload: Lemonade unloads whichever models it can bring back fastest, using the existing idle and weighting settings users already have.
Option B - Usage-aware: Lemonade keeps models that are used often and are small relative to their reload time, and unloads large models that haven't been used much recently.
Option C - User-assigned priority: User marks models as critical, normal, or background. Lower-priority models are always unloaded first, and a lower-priority load can never unload a higher-priority model.
Option D - Fewest models unloaded: Lemonade unloads as few models as possible, preferring to remove one large idle model over several small ones.
Option E - Client decides: Lemonade adds an evict option to load requests (none, auto, force).
These options are not mutually exclusive and can be layered on top of each other.
Breaking changes
none, if API changes are additive
Intentional behavior changes:
Maintenance plan
KV cache estimation might need to be updated for new architectures as they are added, as well as inference engine overhead as engines are added or updated.
Yes, human testers are required - perhaps on a Strix Halo, on a setup with a dedicated GPU, and on Mac and Windows.
Risks
No response
All reactions