verifiers
verifiers copied to clipboard
XMLParser format_reward_func possible bug
Hi, I was wondering whether this is a bug or expected behaviour.
I am playing with the format_reward_func from the XMLParser. I believe the function is encouraging correct behaviour on malformed data.
Here is a minimal example:
import json
messages = '[{"role": "assistant", "content": "<think>\\nThe matrix multiplication of [[1, 2], [3, 4]] and [[2, 0], [1, 3]] is completed. The result is [[4.0, 6.0], [10.0, 12.0]].\\n\\n<answer>\\nThe result of the matrix multiplication is [[4.0, 6.0], [10.0, 12.0]].\\n</answer>"}]'
messages = json.loads(messages)
xmlParser = XMLParser(fields=["think", ("tool", "answer")])
result = xmlParser.get_format_reward_func()(messages)
I believe that for this assistant message, the output should not be a perfect reward (1.0) as the message is missing a closing </think> token. So, the assistant message looks like so: <think> thinking tokens <answer> the result is ... </answer>.
Could you please let me know whether there is a problem with the parsing logic?