-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[V1] Implement sliding window attention in kv_cache_manager #14097
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Chen Zhang <[email protected]>
Signed-off-by: Chen Zhang <[email protected]>
Signed-off-by: Chen Zhang <[email protected]>
Signed-off-by: Chen Zhang <[email protected]>
Signed-off-by: Chen Zhang <[email protected]>
Signed-off-by: Chen Zhang <[email protected]>
Signed-off-by: Chen Zhang <[email protected]>
Signed-off-by: Chen Zhang <[email protected]>
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
Build on top of #14079, should be merged after it.
This pr supports “real” sliding window in v1:
For models with global attention + sliding window attention, still regard as global-attention-only model in kv cache manager.
Some questions in #13296
It isn’t compatible with cascade attention yet.
Q: How does it work with chunked prefill?
A: It will allocate blocks for tokens that will be computed in the current step, and free the blocks that outside sliding window in the next step.
Assume window size 1k, chunk size 2k, prompt length 4k, block_size=1
Q: What's the shape of the block table for SWA? Is it append-only?
A: It is with the same length as global attention, but changes the blocks outside the sliding window to a special null_block. This replacement only happens in the kv_cache_manager side. As model_runner’s block_table is append-only, we do not replace existing blocks to null blocks in model runner. The result is correct because model runner won’t access the blocks outside sliding window.
This pr is part of the hybrid allocator #11382