Com o Self-Refine, os LLMs podem gerar feedback sobre seu trabalho, usá-lo para melhorar o resultado e repetir esse processo.
Índice
Exemplo do Teorema de Stokes
Exemplo de Unicórnio
prompt-lib
executando os seguintes comandos: git clone https://github.com/reasoning-machines/prompt-lib
pip install prompt-lib/
Dependendo das configurações padrão, você pode usar o seguinte para definir um PYTHONPATH:
export PYTHONPATH= " .:../:.:src:../:../../:.:prompt-lib "
python -u src/acronym/run.py " Using language models of code for few-shot commonsense "
0 INIT > Using language models of code for few - shot commonsense
0 GEN > CLoCK
0 SCORES > * Ease of pronunciation : CLoCK is pronounced " clah-k " . This is easy acronym to pronounce . 4 / 5
* Ease of spelling : CLoCK is easy to spell . 5 / 5
* Relation to title : CLoCK stands for " Code Language Models of Commonsense Knowledge " which is related to the title . 5 / 5
* Positive connotation : CLoCK is a positive acronym . It implies accuracy and efficiency . 5 / 5
* Well - known : CLoCK is not a well - known acronym . 2 / 5
* Total score : 21 / 25
1 GEN > CMNSC
1 SCORES > * Ease of pronunciation : CMNSC is pronounced " see-min-es-see " . This is a difficult acronym to pronounce . 1 / 5
* Ease of spelling : CMNSC is difficult to spell . 1 / 5
* Relation to title : CMNSC stands for " Commonsense " which is related to the title . 4 / 5
* Positive connotation : CMNSC is a neutral acronym . 3 / 5
* Well - known : CMNSC is not a well - known acronym . 1 / 5
* Total score : 10 / 25
2 GEN > COMMIT
2 SCORES > * Ease of pronunciation : COMMIT is pronounced " com-mit " . This is an easy acronym to pronounce . 4 / 5
* Ease of spelling : COMMIT is easy to spell . 5 / 5
* Relation to title : COMMIT stands for " Commonsense Model of Code for Intuitive Training " which is related to the title . 5 / 5
* Positive connotation : COMMIT is a positive acronym . It implies commitment and dedication . 5 / 5
* Well - known : COMMIT is not a well - known acronym . 2 / 5
* Total score : 21 / 25
PYTHONPATH= " . " python -u src/responsegen/run.py --output < OUTPUT FILE > --size < DATA SIZE >
PYTHONPATH= " . " python -u src/readability/readability.py --output < OUTPUT FILE >
PYTHONPATH= " . " python -u src/readability/{count_comment | count_function | count_meaningful_var}.py --file < INPUT FILE >
data/prompt/commongen
. Você pode baixar os dados executando os seguintes comandos: python -u src/commongen/run.py cmd stair bubble team dryer puppy aliens cat
python -u src/gsm/run.py
As saídas serão salvas em data/tasks/gsm/gsm_outputs.jsonl
Para avaliar os resultados:
python src/gsm/gsm_selfref_eval.py --path data/tasks/gsm/gsm_outputs.jsonl
data/tasks/gsm/gsm_outputs.jsonl.reports.txt
) mostrando exemplos de gerações erradas, feedback e gerações de feedback refinado. python -u src/sentiment_transfer_sr/run.py data/tasks/yelp/yelp-extreme.jso
nl 4 none
data/tasks/yelp/
python -u src/pie/run.py --slow_programs_file data/tasks/pie/codenet-python-test-1k.jsonl --max_attempts 4 --outfile data/tasks/pie/output --feedback_type rich
Init
: usado para inicializar a tarefa. É assim que a saída inicial é gerada.
Feedback
: usado para obter feedback do modelo sobre os resultados intermediários.
Iterate
: usado para obter a próxima iteração do modelo, com base no feedback.
Cada tarefa possui um run.py
que inicializa os prompts e executa a tarefa.
Por exemplo, os prompts para commongen são os seguintes:
python src/commongen/task_init.py
python src/commongen/feedback.py
python src/commongen/task_iterate.py
Você também pode ver essas instruções em nosso site.
@misc{madaan2023selfrefine,
title = {Self - Refine: Iterative Refinement with Self - Feedback},
author = {Aman Madaan and Niket Tandon and Prakhar Gupta and Skyler Hallinan and Luyu Gao and Sarah Wiegreffe and Uri Alon and Nouha Dziri and Shrimai Prabhumoye and Yiming Yang and Sean Welleck and Bodhisattwa Prasad Majumder and Shashank Gupta and Amir Yazdanbakhsh and Peter Clark},
year = { 2023 },
eprint = { 2303 . 17651 },
archivePrefix = {arXiv},
primaryClass = { cs . CL }
}
fluxograma LR
Gerador -->|Inicializa| Não refinado
Crítico_1 -> Crítica_fb
... --> Crítica_fb
Crítica_k -> Crítica_fb
Critique_fb --> Não refinado{Saída para refinar}
Não refinado -> Refinador
Refinador --> |R: y_t, x, fb| Refined_Output{Saída Refinada}
Refined_Output --> |Critérios de parada não atendidos| Não refinado