Principle:Volcengine Verl Answer Extraction
| Knowledge Sources | |
|---|---|
| Domains | Data_Engineering, NLP, Evaluation |
| Last Updated | 2026-02-07 14:00 GMT |
Overview
The process of extracting verifiable ground truth answers from raw dataset solution strings using dataset-specific parsing (regex, LaTeX parsing, or direct indexing).
Description
Answer Extraction parses raw solution strings to extract the final answer that can be used for reward computation. Different datasets require different extraction methods:
- GSM8K: Regex extraction of numeric answer after "#### " marker
- MATH: LaTeX
\boxed{}parsing to extract the final boxed answer - HellaSwag: Direct integer label indexing for multiple-choice
- Geo3K: Choice letter extraction for geometry problems
The extracted answer becomes the ground_truth field in the reward configuration, used during training to compare against model-generated answers.
Usage
Use answer extraction during data preprocessing whenever the dataset has verifiable answers that need to be parsed from raw solution text.
Theoretical Basis
Answer extraction is a dataset-specific parsing function:
# Abstract answer extraction
def extract_answer(solution_str, dataset_type):
if dataset_type == "gsm8k":
match = re.search(r"#### (\-?[0-9\.\,]+)", solution_str)
return match.group(1) if match else None
elif dataset_type == "math":
return remove_boxed(last_boxed_only_string(solution_str))
elif dataset_type == "multiple_choice":
return int(solution_str) # Index of correct choice