feat(integrated): Phase 22 β integrated attention explainer (v1.6.0)#10
Draft
konjoinfinity wants to merge 1 commit into
Draft
feat(integrated): Phase 22 β integrated attention explainer (v1.6.0)#10konjoinfinity wants to merge 1 commit into
konjoinfinity wants to merge 1 commit into
Conversation
Implements path-integrated attention analogous to Integrated Gradients: interpolates a baseline (black or mean) to the input image in n_steps steps, averages normalised attention maps along the path, and min-max normalises to [0,1]. - miru/integrated_attention.py: IntegratedAttention, IntegratedAttentionResult - api/main.py: method="integrated" in POST /explain, n_steps + integrated_baseline fields - tests/test_integrated_attention.py: 21 unit + API tests - Version 1.5.0 β 1.6.0 570 tests passing, 5 skipped. https://claude.ai/code/session_01Gey8ZzBsm7sDFttN3YRyZa
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.
$(cat <<'EOF'
Summary
miru/integrated_attention.py:IntegratedAttentionclass that interpolates a baseline (black or mean) to the input image acrossn_stepssteps, averages the normalised attention grids along the path, and min-max normalises the result to[0, 1]β analogous to Integrated Gradients (Sundararajan et al. 2017) but for attention-based explanations without gradient access.method="integrated"intoPOST /explainwith newn_steps(ge=2, le=100) andintegrated_baselinefields; listsintegratedasimplementedinGET /methods.tests/test_integrated_attention.pycovering unit contracts and API error/happy-path cases.Test plan
python -m pytest tests/test_integrated_attention.py -x -qβ 21 passedpython -m pytest tests/ api/ -x -qβ 570 passed, 5 skippedGET /methodsreturnsintegratedwith statusimplementedPOST /explainwithmethod="integrated",n_steps=1returns 422POST /explainwithmethod="integrated", unknown model returns 400https://claude.ai/code/session_01Gey8ZzBsm7sDFttN3YRyZa
EOF
)
Generated by Claude Code