Skip to content

feat(integrated): Phase 22 β€” integrated attention explainer (v1.6.0)#10

Draft
konjoinfinity wants to merge 1 commit into
mainfrom
claude/konjo-miru-Troxb
Draft

feat(integrated): Phase 22 β€” integrated attention explainer (v1.6.0)#10
konjoinfinity wants to merge 1 commit into
mainfrom
claude/konjo-miru-Troxb

Conversation

@konjoinfinity

Copy link
Copy Markdown
Contributor

$(cat <<'EOF'

Summary

  • Adds miru/integrated_attention.py: IntegratedAttention class that interpolates a baseline (black or mean) to the input image across n_steps steps, 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.
  • Wires method="integrated" into POST /explain with new n_steps (ge=2, le=100) and integrated_baseline fields; lists integrated as implemented in GET /methods.
  • 21 new tests in tests/test_integrated_attention.py covering unit contracts and API error/happy-path cases.

Test plan

  • python -m pytest tests/test_integrated_attention.py -x -q β€” 21 passed
  • python -m pytest tests/ api/ -x -q β€” 570 passed, 5 skipped
  • GET /methods returns integrated with status implemented
  • POST /explain with method="integrated", n_steps=1 returns 422
  • POST /explain with method="integrated", unknown model returns 400

https://claude.ai/code/session_01Gey8ZzBsm7sDFttN3YRyZa
EOF
)


Generated by Claude Code

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants