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

feat: add IA3 prompt tuning #2

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

feat: add IA3 prompt tuning #2

wants to merge 9 commits into from

Conversation

maw501
Copy link

@maw501 maw501 commented Mar 21, 2023

This PR adds $(IA)^3$ tuning per Few-Shot Parameter-Efficient Fine-Tuning is Better and Cheaper than In-Context Learning.

The main change is the addition of two new classes, ParallelMLPIA3 and ParallelSelfAttentionIA3. Both of these simply create a new scaling vector then modify the forward pass to perform the (re)scaling. Note that the forward pass is otherwise unchanged except for where we apply $(IA)^3$.

This has been tested using model parallelism (i.e. tensor parallelism in DeepSpeed terminology) on the Stability cluster.

Notes

  • There are no hyperparameters for the method.
  • We rescale each attention head (the paper is unclear here) independently.

TODO

Pipeline parallelism is currently failing with $(IA)^3$. To replicate the issue:

  • pipe-parallel-size : 2 , model-parallel-size : 1, ia3_tuning: True. Note: num_gpus not set. 👎
  • pipe-parallel-size : 2 , model-parallel-size : 1, ia3_tuning: False. Note: num_gpus not set. 👍
    image

megatron/mpu/layers.py Outdated Show resolved Hide resolved
@maw501 maw501 marked this pull request as draft March 23, 2023 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants