Modifying decoders and attention for vllm #2616
Draft
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 introduces new optional arguments
kv_cacheandattention_metadatafor model decoder blocks and for theattentions.pymodule. These arguments are provided by vLLM when executing a MaxText model from vLLM Engine and are used when calling the ragged paged attention kernel intpu-inference.This PR builds on the work started in #2612.
Tests
Includes a new unit-test in
attention_test.py.Additionally, end-to-end tests were performed locally on a v6e VM using the following test command:
In one process, start the vLLM server. This requires a local
config.jsonfile for the corresponding model you are trying to test from HuggingFace. Modify this file such thatarchitectures: "MaxTextForCausalLM"is set.In a second process, issue the query to the model:
Results for different tested models are shown below:
llama3.1-8b
gemma3-4b
qwen3-8b
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.