Repository navigation
Conversation
Hybrid models with align-mode Mamba/GDN groups hand every retained replay boundary state to the CPU tier: each conversation turn stores about two new states per recurrent group. The state pools are small (a state page covers all recurrent layers) and ordinary LRU keeps the superseded states of active conversations, so after a few dozen turns elsewhere an idle conversation's newest state is evicted. Its attention blocks are still in RAM but the prefix can no longer be restored, and the next request recomputes the whole context. When a request finishes, demote the recurrent states older than its last three block positions (the resend/extension replay boundaries) to the front of the eviction order. They are only superseded checkpoints of the same conversation; blocks that are being loaded are still skipped by eviction. The behavior is opt-in through kv_connector_extra_config["demote_superseded_states"]. - OffloadingManager.demote() (default no-op), implemented by the LRU policy, CPUOffloadingManager, GroupedCPUOffloadingManager and the tiering manager (primary tier only). - Log the grouped CPU pool geometry (token/state slots and page sizes). On 4x V100 (Qwen3.8-Flash-Next, TP4/DCP2/MTP4, 64 GiB grouped CPU tier, 30 state slots per group): a 509K-token conversation left idle while three other conversations ran 117 turns was restored from RAM on return (504,288 cached tokens, TTFT 5.8 s) instead of being recomputed (0 cached, 264.8 s). The other conversations' cache hit rate was unchanged (96.7%). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Leon <tomsel1010.us2@gmail.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
|
I rebased the signed change onto current main in #798 and added coverage for default-on policy, the explicit disable override, and the request-completion hook. Demotion remains limited to eligible recurrent groups; pinned blocks and attention prefixes retain protection. The combined CPU gate passes (203 checks, five GPU skips), as does scoped pre-commit. Two unrelated sliding-window fixture failures reproduced on unmodified main and are documented. |
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.
Purpose
This is a follow-up to #598 (grouped hybrid RAM caching) for hybrid models with align-mode Mamba/GDN groups, such as Qwen3.8-Flash-Next. It fixes a long conversation that goes idle and can no longer be restored from the CPU tier.
Problem. Every retained replay-boundary state is handed to the CPU tier, so each conversation turn stores about two new states per recurrent group.
max_model_len-long reference request. With a 64 GiB tier on TP4 V100 this gives 16 state slots per group atmax_model_len=524288, and 30 slots at a 262144-token reference.mamba_state_slots_reference_tokensonly postpones this: the demand grows with the number of turns, and every state slot costs several token slots.Fix. When a request finishes, demote its recurrent states older than the last three block positions to the front of the eviction order. Those three positions hold the resend/extension replay boundaries. The demoted states are only superseded checkpoints of the same conversation, and blocks that are being loaded are still skipped by eviction. With demotion, the state demand becomes roughly two slots per cached conversation, independent of the number of turns.
The behavior is opt-in and nothing changes unless it is enabled:
Changes:
OffloadingManager.demote()(default no-op). It is implemented by the LRU policy,CPUOffloadingManager,GroupedCPUOffloadingManagerand the tiering manager (primary tier only; secondary tiers keep their own policy). ARC keeps the no-op default.OffloadingConnectorScheduler.request_finished()demotes the pre-tail keys of every sliding-window-of-one group that requires exact boundary sources (align-mode Mamba).Test Plan
tests/v1/kv_offload/cpu/test_demote_superseded_states.py:tests/v1/kv_offloadandtests/v1/kv_connector/unit/offloading_connector, run on CPU with and without this change on the same base.mamba_state_slots_reference_tokens=262144), fresh server per arm:Test Result
1e90d17f2c); the change applies cleanly to current main.Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.🤖 Generated with Claude Code