Skip to main content
The 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:
This installs the 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 completion
  • pattern_induction - Identify and continue patterns

Mathematics

  • elementary_algebra - Solve algebraic equations
  • number_theory - Number properties and relationships
  • arithmetic - Basic arithmetic operations

Logic

  • propositional_logic - Logical reasoning with propositions
  • spatial_reasoning - Reason about spatial relationships

Other

  • zebra_puzzle - Logic grid puzzles
  • word_problems - Text-based reasoning
See the Reasoning Gym repository for the full list.

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

Available system prompts:
  • "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:
  1. Parses the model’s answer field
  2. Calls the task-specific score_answer() function
  3. Returns a score (typically 0.0 or 1.0)
Format reward (XML compliance) is tracked separately with weight 0.

Full Example

With composite datasets:

Expected Format

Models should respond with XML-formatted answers:
The <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

Comparison with Raw Reasoning Gym

Using Reasoning Gym directly:
Using ReasoningGymEnv:

Examples

See the reasoning-gym-env example in the Verifiers repository.

Further Reading