Skip to content

Conversation

@EnayatUllah
Copy link
Contributor

Summary:
The bias grad calculation for three dim data was incorect.

Let G = g^Tg, where g, of dimensions Txd be the per-sample activation gradient, where T is the number of tokens and d dimension.

The per-sample gradient norm with respect to bias is
vec(G)^T vec(1), instead of the erroneous,vec(G)^T vec(G) before. This diff fixes it.

Reviewed By: HuanyuZhang

Differential Revision: D70823094

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 9, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70823094

EnayatUllah added a commit to EnayatUllah/opacus that referenced this pull request Apr 9, 2025
…ta (meta-pytorch#751)

Summary:

The bias grad calculation for three dim data was incorect. 

Let `G = g^Tg`, where `g`, of dimensions `Txd` be the per-sample activation gradient, where `T` is the number of tokens and `d` dimension.

The per-sample gradient norm  with respect to bias is 
`vec(G)^T vec(1)`, instead of the erroneous,`vec(G)^T vec(G)` before. This diff fixes it.

Reviewed By: HuanyuZhang

Differential Revision: D70823094
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70823094

EnayatUllah added a commit to EnayatUllah/opacus that referenced this pull request Apr 9, 2025
…ta (meta-pytorch#751)

Summary:

The bias grad calculation for three dim data was incorect. 

Let `G = g^Tg`, where `g`, of dimensions `Txd` be the per-sample activation gradient, where `T` is the number of tokens and `d` dimension.

The per-sample gradient norm  with respect to bias is 
`vec(G)^T vec(1)`, instead of the erroneous,`vec(G)^T vec(G)` before. This diff fixes it.

Reviewed By: HuanyuZhang

Differential Revision: D70823094
…ta (meta-pytorch#751)

Summary:
Pull Request resolved: meta-pytorch#751

The bias grad calculation for three dim data was incorect.

Let `G = g^Tg`, where `g`, of dimensions `Txd` be the per-sample activation gradient, where `T` is the number of tokens and `d` dimension.

The per-sample gradient norm  with respect to bias is
`vec(G)^T vec(1)`, instead of the erroneous,`vec(G)^T vec(G)` before. This diff fixes it.

Reviewed By: HuanyuZhang

Differential Revision: D70823094
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70823094

EnayatUllah added a commit to EnayatUllah/opacus that referenced this pull request Apr 9, 2025
…ta (meta-pytorch#751)

Summary:

The bias grad calculation for three dim data was incorect. 

Let `G = g^Tg`, where `g`, of dimensions `Txd` be the per-sample activation gradient, where `T` is the number of tokens and `d` dimension.

The per-sample gradient norm  with respect to bias is 
`vec(G)^T vec(1)`, instead of the erroneous,`vec(G)^T vec(G)` before. This diff fixes it.

Reviewed By: HuanyuZhang

Differential Revision: D70823094
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70823094

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 7264cd7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants