mirror of github.com/open-thought/reasoning-gym
Find a file
2025-02-16 12:01:54 +00:00
.github/workflows Revert "Merge pull request #131 from zafstojano/chore/auto-generate-gallery" 2025-02-15 23:26:22 +01:00
eval Merge pull request #123 from joesharratt1229/feat/r1-evals 2025-02-13 11:37:07 +01:00
examples docs: Update TRL README with GRPO example details and usage instructions (#76) 2025-02-07 07:56:22 +01:00
notebooks Merge pull request #65 from zafstojano/env/group-anagrams 2025-02-06 13:03:27 +01:00
reasoning_gym corrected failing airthmetic test 2025-02-16 12:01:54 +00:00
scripts use PYTHONHASHSEED=1 for generate_gallery.py 2025-02-04 12:03:45 +01:00
tests corrected failing airthmetic test 2025-02-16 12:01:54 +00:00
.gitignore Add PolynomialMultiplicationDataset (#64) 2025-02-07 14:06:41 +01:00
.pre-commit-config.yaml romve dataset examples from REAMED.md (now in linked GALLERY.md) 2025-01-30 23:06:22 +01:00
CONTRIBUTING.md add CONTRIBUTING.md, simplify README.md 2025-02-08 15:59:44 +01:00
GALLERY.md import FutoshikiDataset & update GALLERY 2025-02-15 21:26:15 +01:00
LICENSE Initial commit 2025-01-23 09:39:53 +01:00
pyproject.toml bump version, update GALLERY.md 2025-02-14 23:34:59 +01:00
README.md add CONTRIBUTING.md, simplify README.md 2025-02-08 15:59:44 +01:00
requirements-dev.txt [eval-basic] run precommit formatting 2025-02-09 22:40:45 -08:00

Reasoning Gym

We are building a python library of procedural dataset generators and algorithmically verifiable reasoning environments for training reasoning models with reinforcement learning (RL).

The goal is to generate virtually infinite data with adjustable complexity.

Algorithmic verification allows to train on tasks like Rubiks cube or Countdown which have many correct solutions.

In GALLERY.md you find example outputs of all datasets available in reasoning-gym.

Installation

The reasoning-gym package requires Python >= 3.11.

Install via pip:

pip install reasoning-gym

For development setup see CONTRIBUTING.md.

How to instantiate a task dataset?

Example:

import reasoning_gym
data = reasoning_gym.create_dataset('leg_counting', size=10, seed=42)
for i, x in enumerate(data):
    print(f'{i}: q="{x['question']}", a="{x['answer']}"')
    print('metadata:', x['metadata'])
    # use the dataset's `score_answer` method for algorithmic verification
    assert data.score_answer(answer=x['answer'], entry=x) == 1.0

Output:

0: q="How many legs are there in total if you have 1 sea slug, 1 deer?", a="4"
metadata: {'animals': {'sea slug': 1, 'deer': 1}, 'total_legs': 4}
1: q="How many legs are there in total if you have 2 sheeps, 2 dogs?", a="16"
metadata: {'animals': {'sheep': 2, 'dog': 2}, 'total_legs': 16}
2: q="How many legs are there in total if you have 1 crab, 2 lobsters, 1 human, 1 cow, 1 bee?", a="42"
...

Contributing

Please see CONTRIBUTING.md.

If you have ideas for dataset generators please create an issue here or contact us in the #reasoning-gym channel of the GPU-Mode discord server.