ReasoningGymEnv integration wraps Reasoning Gym procedural datasets for use in Verifiers environments.
Reasoning Gym provides a collection of procedurally generated reasoning tasks designed to test various cognitive abilities of language models.
Features
- Procedural generation - Infinite task variations via seeds
- Multiple datasets - Access to all Reasoning Gym tasks
- Composite datasets - Mix multiple tasks with custom weights
- Automatic scoring - Uses task-specific scoring from Reasoning Gym
- XML formatting - Built-in parser for structured outputs
Installation
Install with Reasoning Gym support:reasoning-gym package.
Quick Start
1
Create environment
Create a basic Reasoning Gym environment:
2
Evaluate
Run an evaluation:
Available Datasets
Reasoning Gym provides tasks across multiple categories:Pattern Recognition
arc_1d- ARC-like 1D pattern completionpattern_induction- Identify and continue patterns
Mathematics
elementary_algebra- Solve algebraic equationsnumber_theory- Number properties and relationshipsarithmetic- Basic arithmetic operations
Logic
propositional_logic- Logical reasoning with propositionsspatial_reasoning- Reason about spatial relationships
Other
zebra_puzzle- Logic grid puzzlesword_problems- Text-based reasoning
Configuration
Single Dataset
Multiple Datasets
Combine multiple datasets with equal weights:Weighted Composite
Mix datasets with custom weights:Custom Parser
By default,ReasoningGymEnv uses XMLParser with <think> and <answer> fields. Override with a custom parser:
Custom System Prompt
"default"- Basic reasoning prompt"chain_of_thought"- Encourage step-by-step reasoning"concise"- Encourage brief responses
Scoring
Reasoning Gym tasks have built-in scoring functions.ReasoningGymEnv automatically:
- Parses the model’s answer field
- Calls the task-specific
score_answer()function - Returns a score (typically 0.0 or 1.0)
Full Example
Expected Format
Models should respond with XML-formatted answers:<answer> field is extracted and passed to the task scorer.
Metrics
Best Practices
Start with a single dataset to understand task difficulty before mixing multiple datasets.
- Validate baseline - Test with a strong model first to ensure tasks are solvable
- Match difficulty - Mix tasks of similar difficulty for stable training
- Use composite carefully - Large differences in task difficulty can hurt training
- Set appropriate seeds - Different seeds generate different task variations