Tweaked some question templates

This commit is contained in:
abdulhakeem 2025-02-17 02:58:42 -06:00
parent 2cbaab2918
commit 15140d06e7
5 changed files with 17 additions and 10 deletions

View file

@ -64,6 +64,9 @@ class BasicArithmeticDataset(ProceduralDataset):
def __init__(self, config: BasicArithmeticDatasetConfig):
super().__init__(config=config, seed=config.seed, size=config.size)
self.added_instruction = (
"Ensure to report the answer as an integer. Please do not add commas to the integer answers reported."
)
def __getitem__(self, idx: int) -> dict[str, Any]:
"""Generate a single arithmetic task
@ -88,7 +91,7 @@ class BasicArithmeticDataset(ProceduralDataset):
else:
expression, result = self._generate_simple_task(rng, num_terms, num_digits)
question = self._format_question(rng, expression)
question = self._format_question(rng, expression) + self.added_instruction
return {
"question": question,
@ -224,14 +227,14 @@ class BasicArithmeticDataset(ProceduralDataset):
def _format_question(self, rng: Random, expression: str) -> str:
"""Format the expression with clear answer positioning"""
answer_instruction = "Put your final answer after '=' without additional text."
# answer_instruction = "Put your final answer after '=' without additional text."
if self.config.format_style == "simple":
return f"{answer_instruction} Calculate {expression} ="
return f"Calculate {expression}. "
else:
templates = ["What is {0} =", "Solve {0}=", "Compute {0} =", "Evaluate: {0} ="]
templates = ["What is {0}. ", "Solve {0}. ", "Compute {0}. ", "Evaluate: {0}. "]
template = rng.choice(templates).format(expression)
return f"{answer_instruction} {template}"
return f"{template}"
# Register the dataset