NVIDIA / NVIDIA/cuEquivariance

Attention fwd/bwd issues with all zero masks

Open
#204 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
433
Forks
42
PR merge metrics
No merged PRs in 30d

Description

Hi,

We have been observing some issues with masking, namely that if all tokens are masked out. In this specific case, the output of attention will be twice of what native pytorch's implementation is, and the gradient of v value vector is simply garbage value.

To demonstrate the need for masking all tokens, consider the case where we land on no templates in template search but the computation graph needs to stay the same during training to avoid a bunch of issues including memory fragmentation.

Is there a way to fix this?

Best,
Rui

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the attention forward and backward pass with an all-zero mask, then compare its output and the gradient of the value vector with native PyTorch. The issue does not name a source file or test, so locate the attention masking implementation and its existing tests first. Done means the all-masked case has matching forward results and a valid value gradient while preserving the computation graph.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.