Overview
Verifiers uses the HuggingFacedatasets library for loading and manipulating training and evaluation data. Each dataset row becomes a rollout during generation or evaluation.
Dataset Schema
Required Columns
Datasets are automatically processed by the environment to include:example_id- Integer ID for grouping rollouts (auto-generated if missing)prompt- Messages to send to the model (list of chat messages)task- Task identifier for routing inEnvGroup(defaults toenv_id)
Optional Columns
answer- Ground truth for scoring (string)info- Structured metadata (dict or JSON string)
When using
info, prefer JSON strings if rows have different schemas (different fields or nested structures). The environment automatically parses JSON strings into dicts during rollout initialization.Building Prompts
Direct Prompt Construction
Provide aprompt column with pre-formatted chat messages:
Question-Based Construction
Use aquestion column and let the environment wrap it:
System Prompts and Few-Shot Examples
Add system prompts and few-shot examples via environment parameters:- If dataset has
promptcolumn:system_promptis prepended (if not already present),few_shotis ignored - If dataset has
questioncolumn: bothsystem_promptandfew_shotare applied
Dataset Builders (Lazy Loading)
For large datasets or when running multiple environment replicas, defer dataset loading using aDatasetBuilder - a callable that returns a Dataset:
- Dataset loading is expensive (e.g., downloading from HuggingFace Hub)
- Multiple environment replicas don’t all need to own the dataset
- You want to parameterize dataset creation without loading immediately
When a raw
Dataset is passed (not a builder), it’s loaded eagerly during environment initialization for backwards compatibility.Training vs Evaluation Datasets
Environments support separate datasets for training and evaluation:- If
eval_datasetis not provided,evaluate()falls back todataset - If neither is provided, environment initialization raises
ValueError
Dataset Access Methods
get_dataset()
Retrieve the training dataset with optional sampling:get_eval_dataset()
Retrieve the evaluation dataset:Dataset Formatting
The environment automatically formats datasets during initialization:Example ID Assignment
Prompt Construction
Task Assignment
Loading Example Datasets
Verifiers includes built-in example datasets:Creating Datasets Programmatically
From Lists
From HuggingFace Hub
From Pandas DataFrame
Using make_dataset()
Static helper for creating datasets from rollout inputs:Dataset Transformations
Use thedatasets library’s .map() for preprocessing:
Info Column Patterns
Simple Metadata
Heterogeneous Schemas (JSON Strings)
Tool Definitions in Info
Store per-example tool definitions:info["tool_defs"] during state initialization.