Data Utilities
Utility functions for loading and formatting common benchmark datasets.These utilities are designed for example datasets and quick prototyping, not core functionality. For production use, load datasets directly using HuggingFace
datasets library.Overview
Theverifiers.utils.data_utils module provides:
- Pre-configured loaders for common benchmarks (GSM8K, MATH, GPQA, etc.)
- Dataset formatting helpers
- Answer extraction utilities
- System prompts for math tasks
Dataset Loaders
load_example_dataset
str
default:"gsm8k"
Dataset name. Supported:
"aime2024", "aime2025", "amc2023", "gpqa_diamond", "gpqa_main", "gsm8k", "math", "math500", "mmlu", "mmlu_pro", "openbookqa", "openrs", "openrs_easy", "openrs_hard", "prime_code".str | None
default:"None"
Dataset split. If None, uses the default split for that dataset (usually “test” or “train”).
int | None
default:"None"
Number of examples to load. If None, loads all examples.
int
default:"0"
Random seed for shuffling when
n is specified.Dataset with question and answer columns.
Example:
Formatting Functions
format_dataset
example_id and prompt columns to a dataset.
Dataset
required
Input dataset to format.
str | None
System prompt to prepend to all prompts.
Messages | None
Few-shot examples to include before each question.
str
default:"question"
Column name containing questions.
str
default:"answer"
Column name containing answers.
dict
Additional arguments passed to
dataset.map().example_id and prompt columns.
Example:
Answer Extraction
extract_boxed_answer
\boxed{} commands. Finds the last occurrence of \boxed{...} in the text and returns the content between matching braces. If no boxed answer is found or braces don’t match, returns the original text.
str
required
Text containing LaTeX boxed answer (e.g.,
"\boxed{42}").str - Extracted answer content, or original text if no valid boxed answer found.
Example:
extract_hash_answer
#### delimiter (GSM8K format). Returns the text after the first #### marker, stripped of leading/trailing whitespace. If no delimiter is found, returns the original text.
str
required
Text containing hash-delimited answer (e.g.,
"Solution here\n#### 42").str - Answer after #### delimiter, or original text if no delimiter found.
Example:
strip_non_numeric
System Prompts
BOXED_SYSTEM_PROMPT
THINK_BOXED_SYSTEM_PROMPT
Supported Datasets
AIME 2024 math competition (15 problems)
AIME 2025 math competition (30 problems, AIME I + II)
AMC 2023 math competition
GPQA Diamond subset (high-quality questions)
GPQA Main dataset
Grade School Math 8K dataset
MATH competition dataset
MATH-500 subset
Massive Multitask Language Understanding
MMLU-Pro (harder variant)
OpenBookQA question answering
OpenRS reasoning problems
Prime verifiable coding problems
Preprocessing Functions
Internal preprocessing functions used byload_example_dataset():
- Extracts
questionandanswerfields - Normalizes format (e.g., strips #### delimiters)
- Handles dataset-specific quirks
These are internal functions. Use
load_example_dataset() instead of calling preprocessors directly.Custom Dataset Example
See Also
- Environment.make_dataset() - Create datasets from dicts
- HuggingFace Datasets - Dataset library documentation