google-deepmind / google-deepmind/alphafold3
Incorrect layout conversion of `ref_space_uid` in atom cross-attention
- Dominant language
- Python
- Stars
- 8.6k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Description
Tested on c0f97eda2f1f482fd94d3a38bece18c7069b4a5c.
In `src/alphafold3/model/network/atom_cross_attention.py`, the following code converts `batch.ref_structure.ref_space_uid` using `queries_to_keys`:
```
keys_ref_space_uid = atom_layout.convert(
batch.atom_cross_att.queries_to_keys,
batch.ref_structure.ref_space_uid,
layout_axes=(-2, -1),
)
offsets_valid = (
queries_ref_space_uid[:, :, None] == keys_ref_space_uid[:, None, :]
)
```
However, `batch.ref_structure.ref_space_uid` is in token layout here. This causes `offsets_valid` to be incorrect and masks out almost all positions. I tested it with a small input with 1171 atoms, and only 45 rows in offsets_valid contained nonzero values. It looks like the intended version might be to use `queries_ref_space_uid` as the source tensor.
Could this be confirmed?
Contributor guide
Research direction
Start in src/alphafold3/model/network/atom_cross_attention.py and trace the layouts of queries_ref_space_uid and batch.ref_structure.ref_space_uid at the atom cross-attention entry point. Reproduce the reported small input with 1171 atoms, inspect the conversion source and offsets_valid contents, and confirm that the resulting mask preserves the expected nonzero positions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100