MCPcopy Create free account
hub / github.com/MARIO-Math-Reasoning/Super_MARIO / eval_final_answer

Method eval_final_answer

mcts_math/agents/mcts.py:186–198  ·  view source on GitHub ↗
(self, node: Type[MCTSNode])

Source from the content-addressed store, hash-verified

184 node.children.append(new_node)
185
186 def eval_final_answer(self, node: Type[MCTSNode]) -> None:
187 if node.state["final_answer"] in [NO_VALID_CHILD, TOO_MANY_STEPS, TOO_MANY_CODE_ERRORS]:
188 node.update_recursive(self.config.negative_reward, self.root)
189 return
190
191 if self.ground_truth:
192 final_answer = node.state["final_answer"]
193 correct = is_equiv(self.ground_truth, final_answer)
194 # backup
195 node.update_recursive(self.config.positive_reward if correct else self.config.negative_reward, self.root)
196 else:
197 # for testset, no ground_truth, put this node in candidate_nodes, then it will be evaluated by value model and backup in select_next_step().
198 self.candidate_nodes.append(node)
199
200 def select_next_step(self, outputs: Optional[List[RequestOutput]] = None) -> None:
201 """process output from vllm

Callers 1

create_childMethod · 0.95

Calls 1

update_recursiveMethod · 0.80

Tested by

no test coverage detected