Skip to content
module

Multitask Prompt Tuning

4 members
lucid.peft.tuners.multitask_prompt_tuning

lucid.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 kk, a low-rank pair uku_k, vkv_k; the task's prompt is the shared one multiplied elementwise by ukvku_k v_k. A new task adds r (L+d)r\,(L + d) 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.

Paper

Wang, Zhen, et al. "Multitask Prompt Tuning Enables Parameter-Efficient Transfer Learning." [arXiv:2303.02861](https://arxiv.org/abs/2303.02861), 2023.

Overview

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 uk∈RL×ru_k \in \mathbb{R}^{L \times r}, vk∈Rr×dv_k \in \mathbb{R}^{r \times d}. Task kk's prompt is the shared one multiplied elementwise by ukvku_k v_k, so a new task adds r (L+d)r\,(L + d) 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