WooooDyy / Self-Polish

Codes for the EMNLP 2023 Findings paper "Self-Polish: Enhance Reasoning in Large Language Models via Problem Refining" by Zhiheng Xi, Senjie Jin, Yuhao Zhou, Rui Zheng, Songyang Gao, Tao Gui, Qi Zhang and Xuanjing Huang.

Home Page:https://arxiv.org/abs/2305.14497

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Self-Polish

Codes for the paper Self-Polsih: Enhance Reasoning in Large Language Models via Problem Refining.

Code Structure

  • We use object-oriented style programming, and decouple the codes on the question side and the answer side. We can combine them for better performance. We implement the following methods not.

    • Problem Side: There are two strategies for problems:
      • Self-Polish (The proposed method): The proposed method that optimizes problems till an converged answer is got.
      • Normal: The original method. No optimization is used upon problems.
      • image-20230530192959758
    • Answer Side: There are three strategies for answer generation:
      • Few Shot: Generate Answer with several examples.
      • Few Shot CoT: Generate Answer with several examples, and each example contains the chain-of-thought reasoining process.
      • Least-to-Most: Reduce problems to sub problems and then solve them one by one。
  • We also list some test prompts to rewrite problems in the prompt directory.

Run Code

sh test_normal.sh
sh test_sp.sh
  • Note that you should set your OpenAI API key in the test_Normal_with_exception.py or test_SP_with_exception.py:
keys = ["Your Key"]

Method Overview

image-20230530212605407

image-20230530212621727

About

Codes for the EMNLP 2023 Findings paper "Self-Polish: Enhance Reasoning in Large Language Models via Problem Refining" by Zhiheng Xi, Senjie Jin, Yuhao Zhou, Rui Zheng, Songyang Gao, Tao Gui, Qi Zhang and Xuanjing Huang.

https://arxiv.org/abs/2305.14497


Languages

Language:Python 99.1%Language:Shell 0.9%