NumberChiffre / mcts-llm

MIT License
69 stars 1 forks source link

The pormpt used in 'CritiqueAnswer' and 'RefineAnswer'? #10

Closed Aurora-slz closed 1 month ago

Aurora-slz commented 1 month ago

Thanks for your awesome work!

Could you please tell me what prompt you use for CritiqueAnswer and RefineAnswer in mctsr.py? Could you provide an example? Thank you very much for your reply.

class ZeroShotAnswer(dspy.Signature):
    problem: str = dspy.InputField()
    answer: str = dspy.OutputField()

class CritiqueAnswer(dspy.Signature):
    problem: str = dspy.InputField()
    current_answer: str = dspy.InputField()
    critique: str = dspy.OutputField()

class RefineAnswer(dspy.Signature):
    """[[ ## proposed_instruction ## ]] Given a mathematical problem, a current answer, and a critique of that answer,
    refine the current answer to provide a more accurate and well-reasoned solution. Begin by carefully analyzing the
    problem and the critique, then think step by step to derive the correct answer. Ensure that your reasoning is clear
    and logical, and that the final answer is justified by the steps taken.

    [[ ## completed ## ]]
    """

    problem: str = dspy.InputField()
    current_answer: str = dspy.InputField()
    critique: str = dspy.InputField()
    answer: str = dspy.OutputField()

Although the comments form of the prompt was provided in RefineAnswer, however, the code only input the question/answer without passing in the content of these comments when invoked.

NumberChiffre commented 1 month ago

Hey @Aurora-slz I added prompt instructions for RefineAnswer after running MIPROv2, you can find them in this notebook

DSPy 2.5 integrates litellm but has many problems with the output formatting, without prompt instructions the program can sometimes crash for smaller LMs.

Actually, I uploaded a full run of MIPROv2 here, all you gotta do is load this json for MCTSr and it'll run with these demos/instructions, here

Aurora-slz commented 1 month ago

Thanks a lot!