Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Training support #93

Open
pommedeterresautee opened this issue Oct 12, 2022 · 0 comments
Open

Training support #93

pommedeterresautee opened this issue Oct 12, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@pommedeterresautee
Copy link
Member

Right now, only inference (forward pass) has been implemented for all Triton kernels.
To support training, backward pass should be implemented.
Each kernel is already wrapped in torch.autograd.Function so it will be just adding a method to an existing class and no refactoring should be needed.

Expected improvement in training are those of Flash attention:

  • 2-4X faster training (just for the attention, linear layer and layernorm/rmsnorm should bring their own gains)
  • Support of very long sequences (up to 16K tokens) with a limited computation budget
  • Reduction of memory footprint is especially useful for contrastive learning (Is it safe to have Wqkv be float16? Dao-AILab/flash-attention#49 (comment) about a 10X batch size increase!)

Below are pointers that can be used for the implementation and a list of our main modifications to the original fw implementation:

Training support will require adding to the bw pass of each kernel the modifications, we did if it makes sense (to have parity).

supersede #11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant