This is the implementation of the paper GPS: Genetic Prompt Search for Efficient Few-shot Learning. GPS is an automatic prompt search method based on genetic algorithm for better few-shot learning.
In this paper, we introduce Genetic Prompt Search (GPS) to improve few-shot learning with prompts, which utilizes a genetic algorithm to automatically search for high-performing prompts. GPS is gradient-free and requires no update of model parameters but only a small validation set.
You can find more details of this work in our paper.
- Install dependencies:
- transformers==4.15
- datasets==1.16
- pytorch
- accelerate
- yaml
- jinja2
- pandas
- numpy
- tqdm
- sentencepiece
- sklearn
- protobuf==3.20.0
- Download model checkpoints:
- Prepare the data
- We have put the data in
./T0_dataset
- We have put the data in
- Prepare initial templates
- We have put the initial templates in
./templates
- We have put the initial templates in
- Run GPS:
python ga_processer_t0.py
- Get output templates and eval:
- The output files are stored in the
./ga_t0_t5_lm
by default - We also provide output templates reported in our paper(in
./ga_t0_t5_lm_maxstep9
). - Run command to launch the evaluation:
sh run_all_eval.sh
- The output files are stored in the
todo