In-engine H2O attention-weight extraction + FlashInfer probes (stacked on #133) - #2
Open
mmjerge wants to merge 10 commits into
Open
In-engine H2O attention-weight extraction + FlashInfer probes (stacked on #133)#2mmjerge wants to merge 10 commits into
mmjerge wants to merge 10 commits into
Conversation
…wiring # Conflicts: # docs/vllm_integration.md
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.
Summary
Follow-up to awslabs#133 (awslabs vLLM V1 KV-cache bridge). This is the in-engine H2O attention-weight work @mseeger asked to review directly. It is stacked on
vllm-integration(the awslabs#133 branch), so the diff here is only the incremental H2O-wiring code — not a re-review of awslabs#133.What's here
examples/vllm_h2o_probe.py— selects the FlashInfer backend via the vLLM 0.23attention_backendknob and installs forward hooks on the 24Attentionlayers (confirms hooks fire and output stays correct).examples/vllm_h2o_lse_probe.py— wrapsFlashInferImpl.forwardand maps the impl surface (Q/K/V, pagedkv_cache,FlashInferMetadatafields,slot_mapping,can_return_lse_for_decode) — i.e. exactly what's reachable for scoring.examples/vllm_h2o_score_probe.py— the key one: for single-sequence decode, gathers the request's K/V from the paged cache and computes correct per-KV-position attention mass in-engine usingreference_summed_attention(the task-3 contract from Add vLLM (V1) KV cache policy integration: lastrec bridge + spike awslabs/keys_values#133). Sanity check: per-KV-head mass ≈ query-heads-per-group, seq_len grows by 1 each step.docs/vllm_integration.md— new H2O wiring (task 4.3) section: Blocker 1 (weights in-engine, tractable — single FlashInfer call, LSE available viareturn_lse=True) and Blocker 2 (arbitrary middle-block eviction vs. vLLM's append-only block table — the genuinely hard part), plus the mapped FlashInfer impl surface and a recommended order/effort estimate.How this connects to the weights question
The math for summed attention weights is already implemented and unit-tested in awslabs#133 (
keys_values/vllm/attention.py,test/vllm/test_attn_weights.py) and returns weights in a single SDPA call. This PR is the in-engine wiring of that signal: probing where to hook, and a working per-position score computation for the single-seq decode case.Tested
black --checkclean acrossexamples/,keys_values/vllm,test/vllm.Not included (follow-ups)
Tbatched tokens back to its request/layer every step.AI usage
See
ai_dev/vllm_integration.md.