Add EntropyAdaptivePress: per-layer adaptive eviction via attention entropy#206
Open
jagmarques wants to merge 1 commit intoNVIDIA:mainfrom
Open
Add EntropyAdaptivePress: per-layer adaptive eviction via attention entropy#206jagmarques wants to merge 1 commit intoNVIDIA:mainfrom
jagmarques wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
Extends ObservedAttentionPress. Layers with peaked attention (structured text) get evicted more aggressively. Layers with uniform attention (creative text) keep more tokens. Includes 4 tests using the unit_test_model_output_attention fixture. Signed-off-by: João André Gomes Marques <joaoagm90@gmail.com>
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.
Extends ObservedAttentionPress. Layers with peaked attention (structured text) get evicted more aggressively. Layers with uniform attention (creative text) keep more tokens.
No dead code, no external benchmark claims. Just the press and 4 tests.
Tests:
What changed:
kvpress/presses/entropy_adaptive_press.py(63 lines)tests/presses/test_entropy_adaptive_press.py(65 lines)Extends
ObservedAttentionPressso it inherits the attention-based scoring. The entropy computation modulates scores per-layer: uniform attention layers get a score boost (keep more tokens), peaked attention layers don't (evict more).