[sgl] Window-aware LRU refresh for SWA prefix cache in unified cache - #26615
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
/tag-and-rerun-ci |
|
/rerun-failed-ci |
| value = node.component_data[self.component_type].value | ||
| return len(value) if value is not None else 0 | ||
|
|
||
| def refresh_lru_on_walkdown(self, node: UnifiedTreeNode) -> None: |
There was a problem hiding this comment.
Should we avoid adding too many new component interfaces here?
Could we instead merge them into a single interface and use a "phase" parameter to distinguish between different cases?
Additionally, it seems that refresh_lru_on_walkdown hasn't been implemented yet on swa_component
There was a problem hiding this comment.
changed to less inferfaces and use phrases.
add comment to indicate why we don't need to do anything in walkdown for swa to avoid confusing.
|
/rerun-failed-ci |
|
/rerun-group radix_cache/unified_radix_tree |
|
Results for 🚀 🚀 🚀 |
|
/rerun-group radix_cache/unified_radix_tree |
|
Results for 🚀 🚀 🚀 |
|
/rerun-failed-ci |
|
/rerun-test test/registered/disaggregation/test_disaggregation_pp.py |
|
Results for 🚀 |
|
/rerun-test test_unified_radix_cache_kl_hicache_nightly.py |
|
Results for 🚀 |
|
|
Motivation
Summary
Make the SWA (Sliding Window Attention) radix-cache LRU window-aware so that out-of-window SWA nodes can be evicted as they should be. This significantly improves SWA prefix-cache hit rate on long multi-turn workloads, with no behavior change for non-SWA components.
Problem
The radix cache uses LRU to evict SWA cache. On every prefix-cache match (and on every walk-down during insert), all matched ancestors are bumped to MRU. That is correct for the Full KV, but it is wrong for SWA, because for SWA only the last sliding_window_size tokens are actually reachable from any current decode step. As a result:
Very old SWA nodes (outside the active window of every live request) keep getting refreshed to MRU and never get evicted.
Genuinely-hot SWA cache from other branches gets pushed toward the LRU tail and is evicted first.
Under multi-turn pressure, the SWA pool fills up with cache that can no longer contribute to any hit, hit-rate degrades, and eviction churn goes up.
Modifications
Accuracy Tests
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ⏳ Run #26739938263
Latest PR Test (Extra): ✅ Run #26739938119