This module contains some useful reward functions, primarily intended for use with the GRPOTrainer.
( completions: list **kwargs ) → list[float]
Parameters
list[list[dict[str, str]]]) —
List of completions to be evaluated. Each completion must be a list of one message, i.e. a dictionary
containing the key "content" with the value being the text of the completion. Returns
list[float]
A list of rewards, where each reward is 1.0 if the completion matches the expected format, otherwise 0.0.
Reward function that checks if the reasoning process is enclosed within "<think>" and "</think>" tags. The
function returns a reward of 1.0 if the format is correct, otherwise 0.0.