arazd/ResidualPrompts

★ 56⑂ 8

Residual Prompt Tuning: a method for faster and better prompt tuning.

About arazd/ResidualPrompts

arazd/ResidualPrompts is an open-source project on GitHub, mainly written in Python. Residual Prompt Tuning: a method for faster and better prompt tuning. It currently holds 56 stars and 8 forks with 0 open issues, and was last pushed on an unknown date (repository created unknown).

Project Overview

AI Homed tracks it on the AI Prompt Engineering board.

GitHub Repository Details

Repository arazd/ResidualPrompts · default branch - · size 0 KB · watchers 0 · source: GitHub REST API and repository README

README

Residual Prompt Tuning

This repository contains the original implementation for "*Residual Prompt Tuning: Improving Prompt Tuning with Residual Reparameterization*" (ACL 2023) by Anastasia Razdaibiedina, Yuning Mao, Rui Hou, Madian Khabsa, Mike Lewis, Jimmy Ba and Amjad Almahairi.

🎊 Our work is accepted to ACL Findings 2023!

Table of contents

Overview

What are Residual Prompts?

We introduce Residual Prompt Tuning – a simple and efficient method that significantly improves the performance and stability of prompt tuning. We propose to reparameterize soft prompt embedings using a shallow network with a residual connection.

Intuition behind prompt reparameterization

This reparameterization gives the model more flexibility to decide between using a separate embedding for each prompt token versus the representation obtained from the shared reparameterization network. After training is completed, the reparameterization network can be discarded and original prompt embeddings can be replaced with their projections.

Codebase overview

Our codebase includes pytorch implementation of:

Installation

Clone this repo as follows:
git clone https://github.com/arazd/ResidualPrompts
cd ResidualPrompts
conda env create -f environment.yaml
conda activate nlp

Training

An example of training a 10-token soft prompt on WSC task using T5-base model and residual reparametrization with MLP1 type:
python train.py --task wsc --prefix_MLP MLP1 \
    --lr 0.3 --freeze_weights 1 --freeze_except xxxx \
    --model_name t5-base --early_stopping 1 \
    --test_eval_after_every_task 1 --select_k_per_class -1 \
    --batch_size 8 --num_epochs 20 --prefix_len 10 \
    --save_dir /home/%u/my_dir/ --save_name my_model_folder

Reference

If you use the code for your work, please consider citing our paper:
@inproceedings{razdaibiedina2023residual,
   title={Residual Prompt Tuning: Improving Prompt Tuning with Residual Reparameterization},
   author={Razdaibiedina, Anastasia and Mao, Yuning and Hou, Rui and Khabsa, Madian and Lewis, Mike and Ba, Jimmy and Almahairi, Amjad},
   booktitle={Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics},
   year={2023}
}

GitHub Stars & Activity

56Stars
8Forks
0Open issues
PythonLanguage

GitHub Popularity

GitHub stars56
Forks8
Open issues0
Primary languagePython
License-
Stars gained today0
Created-
Last pushed-

Trending History

Trending statusnot on today's boards

Related AI Projects

1

microsoft / promptflow

Python★ 11,244⑂ 1,123
2

promptslab / Promptify

Python★ 4,635⑂ 364
3
4

hegelai / prompttools

Python★ 3,055⑂ 256
5

Eladlev / AutoPrompt

Python★ 3,019⑂ 264
6

microsoftarchive / promptbench

Python★ 2,821⑂ 222
7

yaojingang / yao-open-prompts

Python★ 2,817⑂ 461
8

YiVal / YiVal

Python★ 2,134⑂ 328

More AI Rankings