reformatted prompt

This commit is contained in:
joesharratt1229 2025-02-16 09:27:21 +00:00
parent c28688cb96
commit a59e4cc918

View file

@ -223,14 +223,19 @@ class BasicArithmeticDataset(ProceduralDataset):
return expression, result
def _format_question(self, rng: Random, expression: str) -> str:
"""Format the expression according to config style"""
base_question = "Return only the answer to the following question: {question} ="
"""Format the expression with clear answer positioning"""
answer_instruction = "Put your final answer after '=' without additional text."
if self.config.format_style == "simple":
return base_question.format(question=expression)
return f"Calculate {expression} ="
else:
templates = ["What is {0}?", "Calculate {0}", "Solve {0}", "Evaluate the expression: {0}"]
question = rng.choice(templates).format(expression)
return base_question.format(question=question)
templates = [
"What is {0}? =",
"Solve {0} and write answer after =",
"Compute {0} =",
"Evaluate: {0} ="
]
return rng.choice(templates).format(expression) + f" {answer_instruction}"
# Register the dataset