Multitask Prompt Tuning
4 memberslucid.peft.tuners.multitask_prompt_tuninglucid.peft.tuners.multitask_prompt_tuning — multitask prompt tuning, a prompt per task.
Multitask prompt tuning (Wang et al., 2023, arXiv:2303.02861) learns one prompt shared by every task
and, per task , a low-rank pair , ; the task's prompt is the shared
one multiplied elementwise by . A new task adds numbers, and a
prompt trained on source tasks can start a target task (MultitaskPromptTuningInit). Which task
each row of a batch is comes from the task_ids argument of the model's call. Pick it when
several related tasks share one model and each should cost little.
The prompt is applied by hooks on the model's own call. Here: MultitaskPromptEmbedding (what is
learned) and MultitaskPromptTuningModel (the tuner). MultitaskPromptTuningConfig and
MultitaskPromptTuningInit are here too and exported from lucid.peft.
Wang, Zhen, et al. "Multitask Prompt Tuning Enables Parameter-Efficient Transfer Learning." [arXiv:2303.02861](https://arxiv.org/abs/2303.02861), 2023.
Multitask prompt tuning (Wang et al., 2023, arXiv:2303.02861) learns one
prompt shared by every task and, per task, a low-rank factor pair
, .
Task 's prompt is the shared one multiplied elementwise by
, so a new task adds numbers, and a prompt
trained on source tasks can start a target task (prompt_tuning_init and
prompt_tuning_init_state_dict_path). Which task each row of a batch is
comes from the task_ids argument of the model's call.
Classes
MultitaskPromptTuningConfigHow lucid.peft.get_peft_model adapts a model with multitask prompt tuning.
MultitaskPromptTuningInit5 methodsHow a multitask prompt starts: from text, at random, or from a prompt trained on source tasks.
MultitaskPromptEmbedding4 methodsThe prompt of multitask prompt tuning: a shared prompt scaled by a low-rank factor pair per task.
MultitaskPromptTuningModel11 methodsThe tuner of multitask prompt tuning: a MultitaskPromptEmbedding per adapter, in front of the input.