diff --git a/reasoning_gym/arithmetic/basic_arithmetic.py b/reasoning_gym/arithmetic/basic_arithmetic.py index bab95b63..a65ea295 100644 --- a/reasoning_gym/arithmetic/basic_arithmetic.py +++ b/reasoning_gym/arithmetic/basic_arithmetic.py @@ -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