This PR changes the attention base class implementation to an explicit assumption that the attention mask is applied uniformly accross a single sample. This ensures consistency in which parts of the input are masked out or attended to across all queries. Without this assumption the mask needs to be repeated for every query, leading to big overheads. In its current state all queries should have acess to all key/value pairs. While there is potential impplementations utilizing a more efficient/distributed matching, this approach will be not followed for now.
Which issue does this PR tackle?
Handling of query-specific key/value masks is too restricting for simple attention based neural operator implementations.
How does it solve the problem?
Restricts the attention mask to be uniform across all queries.
How are the changes tested?
Modified unit tests to match the new assumption.
All unit-tests run without errors.
Checklist for Contributors
[x] Scope: This PR tackles exactly one problem.
[x] Conventions: The branch follows the feature/title-slug convention.
[x] Conventions: The PR title follows the Bugfix: Title convention.
[x] Coding style: The code passes all pre-commit hooks.
[x] Documentation: All changes are well-documented.
[x] Tests: New features are tested and all tests pass successfully.
[x] Changelog: Updated CHANGELOG.md for new features or breaking changes.
[ ] Review: A suitable reviewer has been assigned.
Checklist for Reviewers:
[ ] The PR solves the issue it claims to solve and only this one.
[ ] Changes are tested sufficiently and all tests pass.
Fix: Apply Uniform Attention Masks Explicitly
Description
This PR changes the attention base class implementation to an explicit assumption that the attention mask is applied uniformly accross a single sample. This ensures consistency in which parts of the input are masked out or attended to across all queries. Without this assumption the mask needs to be repeated for every query, leading to big overheads. In its current state all queries should have acess to all key/value pairs. While there is potential impplementations utilizing a more efficient/distributed matching, this approach will be not followed for now.
Which issue does this PR tackle?
How does it solve the problem?
How are the changes tested?
Checklist for Contributors
feature/title-slug
convention.Bugfix: Title
convention.Checklist for Reviewers: