Enable KV Cache Support for Scanned Decoder Layers and Improve vLLM Integration#3372
Open
khatwanimohit wants to merge 1 commit intomainfrom
Open
Enable KV Cache Support for Scanned Decoder Layers and Improve vLLM Integration#3372khatwanimohit wants to merge 1 commit intomainfrom
khatwanimohit wants to merge 1 commit intomainfrom
Conversation
bfbbc5e to
40a6d52
Compare
Collaborator
|
Thank you for doing this @khatwanimohit !! CC @ChingTsai and @chishuen who were interested in this feature. |
fee2744 to
ca03ea7
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
794d24d to
0b434cf
Compare
NicoGrande
requested changes
Apr 10, 2026
Collaborator
NicoGrande
left a comment
There was a problem hiding this comment.
Can we extend support for vllm_decode.py?
0b434cf to
042ae7d
Compare
57918ab to
5c4341b
Compare
4eca564 to
6f348d7
Compare
6f348d7 to
1b53c79
Compare
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.
Description
This PR enables passing KV caches through scanned decoder layers, which is essential for efficient decoding when layer scanning is enabled (a common optimization for large models). It also refines the vLLM adapter and attention layers to better handle sharding and JIT tracing.
If the change fixes a bug or a Github issue, please include a link, e.g.,:
FIXES: b/123456
FIXES: #123456
Notice 1: Once all tests pass, the "pull ready" label will automatically be assigned.
This label is used for administrative purposes. Please do not add it manually.
Notice 2: For external contributions, our settings currently require an approval from a MaxText maintainer to trigger CI tests.
Tests
Tested vllm_decode with Llama3.1-8B
Output:
Tested Qwen3-30B using vllm serve on a v5p-8
Received a response
Error message when you try to load a scanned checkpoint with unscanned model or vice versa
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.