Skip to content

NVIDIA-NeMo/Gym

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

347 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

NeMo Gym

RequirementsQuick StartAvailable EnvironmentsDocumentation & ResourcesCommunity & SupportCitations

NeMo Gym is a library for building reinforcement learning (RL) training environments for large language models (LLMs). It provides infrastructure to develop environments, scale rollout collection, and integrate seamlessly with your preferred training framework.

🏆 Why NeMo Gym?

  • Scaffolding and patterns to accelerate environment development: multi-step, multi-turn, and user modeling scenarios
  • Contribute environments without expert knowledge of the entire RL training loop
  • Test environments and throughput end-to-end, independent of the RL training loop
  • Interoperable with existing environments, systems, and RL training frameworks
  • Growing collection of training environments and datasets for Reinforcement Learning from Verifiable Reward (RLVR)

Important

NeMo Gym is currently in early development. You should expect evolving APIs, incomplete documentation, and occasional bugs. We welcome contributions and feedback - for any changes, please open an issue first to kick off discussion!

🔗 Ecosystem

NeMo Gym is part of NVIDIA NeMo, NVIDIA's GPU-accelerated platform for building and training generative AI models. NeMo Gym integrates with a growing number of RL training frameworks and environment libraries; see the Ecosystem page for full details and tutorials.

Training Frameworks: NeMo RLOpenRLHFUnslothmore →

Environment Libraries: Reasoning GymAviarymore →

📋 Requirements

NeMo Gym is designed to run on standard development machines:

Hardware Requirements Software Requirements
GPU: Not required for NeMo Gym library operation
• GPU may be needed for specific resources servers or model inference (see individual server documentation)
Operating System:
• Linux (Ubuntu 20.04+, or equivalent)
• macOS (11.0+ for x86_64, 12.0+ for Apple Silicon)
• Windows (via WSL2)
CPU: Any modern x86_64 or ARM64 processor (e.g., Intel, AMD, Apple Silicon) Python: 3.12 or higher
RAM: Minimum 8 GB (16 GB+ recommended for larger environments) Git: For cloning the repository
Storage: Minimum 5 GB free disk space for installation and basic usage Internet Connection: Required for downloading dependencies and API access

Additional Requirements

  • API Keys: OpenAI API key with available credits (for the quickstart examples)
    • Other model providers supported (Azure OpenAI, self-hosted models via vLLM)
  • Ray: Automatically installed as a dependency (no separate setup required)

🚀 Quick Start

Install NeMo Gym, start the servers, and collect your first verified rollouts for RL training.

Setup

# Clone the repository
git clone git@github.com:NVIDIA-NeMo/Gym.git
cd Gym

# Install UV (Python package manager)
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env

# Create virtual environment
uv venv --python 3.12
source .venv/bin/activate

# Install NeMo Gym
uv sync --extra dev --group docs

Configure Your API Key

Create an env.yaml file that contains your OpenAI API key and the policy model you want to use. Replace your-openai-api-key with your actual key. This file helps keep your secrets out of version control while still making them available to NeMo Gym.

echo "policy_base_url: https://api.openai.com/v1
policy_api_key: your-openai-api-key
policy_model_name: gpt-4.1-2025-04-14" > env.yaml

Note

We use GPT-4.1 in this quickstart because it provides low latency (no reasoning step) and works reliably out-of-the-box. NeMo Gym is not limited to OpenAI models—you can use self-hosted models via vLLM or any OpenAI-compatible inference server. See the documentation for details.

Start Servers

Terminal 1 (start servers):

# Start servers (this will keep running)
config_paths="resources_servers/example_single_tool_call/configs/example_single_tool_call.yaml,\
responses_api_models/openai_model/configs/openai_model.yaml"
ng_run "+config_paths=[${config_paths}]"

Terminal 2 (interact with agent):

# In a NEW terminal, activate environment
source .venv/bin/activate

# Interact with your agent
python responses_api_agents/simple_agent/client.py

Collect Rollouts

Terminal 2 (keep servers running in Terminal 1):

# Create a simple dataset with one query
echo '{"responses_create_params":{"input":[{"role":"developer","content":"You are a helpful assistant."},{"role":"user","content":"What is the weather in Seattle?"}]}}' > weather_query.jsonl

# Collect verified rollouts
ng_collect_rollouts \
    +agent_name=example_single_tool_call_simple_agent \
    +input_jsonl_fpath=weather_query.jsonl \
    +output_jsonl_fpath=weather_rollouts.jsonl

# View the result
cat weather_rollouts.jsonl | python -m json.tool

This generates training data with verification scores!

Clean Up Servers

Terminal 1 with the running servers: Ctrl+C to stop the ng_run process.

Next Steps

Now that you can generate rollouts, choose your path:

  • Start training — Train models using NeMo Gym with your preferred RL framework. See the Training Tutorials.

  • Use an existing environment — Browse the Available Environments below to find an environment that matches your goals.

  • Build a custom environment — Implement or integrate existing tools and define task verification logic. Get started with the Creating a Training Environment tutorial.

📦 Available Environments

NeMo Gym includes a curated collection of environments for training and evaluation across multiple domains:

Example Environment Patterns

Purpose: Demonstrate NeMo Gym patterns and concepts.

Name Demonstrates Config README
Multi Step Multi-step tool calling example_multi_step.yaml README
Session State Mgmt Session state management (in-memory) example_session_state_mgmt.yaml README
Single Tool Call Basic single-step tool calling example_single_tool_call.yaml README

Environments for Training & Evaluation

Purpose: Training-ready environments with curated datasets.

Tip

Each resources server includes example data, configuration files, and tests. See each server's README for details.

Resources Server Domain Description Value Train Validation License Config Dataset
Arc Agi knowledge Solve puzzles designed to test intelligence. See https://arcprize.org/arc-agi. Improve puzzle-solving capabilities. - - arc_agi.yaml -
Aviary agent Multi-hop question answering on the HotPotQA dataset with Wikipedia search Improve knowledge and agentic capability Apache 2.0 hotpotqa_aviary.yaml -
Aviary math GSM8k benchmark with calculator tool Test math and agentic capability Apache 2.0 gsm8k_aviary.yaml -
Calendar agent Multi-turn calendar scheduling dataset. User states events and constraints in natural language; model schedules events to satisfy all constraints. Improve multi-turn instruction following capabilities Apache 2.0 calendar.yaml Nemotron-RL-agent-calendar_scheduling
Calendar agent Multi-turn calendar scheduling dataset. User states events and constraints in natural language; model schedules events to satisfy all constraints. Improve multi-turn instruction following capabilities Creative Commons Attribution 4.0 International calendar_v2.yaml Nemotron-RL-Instruction-Following-Calendar-v2
Circle Click other Click on circles in images - - - - circle_click.yaml -
Code Gen coding Model must submit the right code to solve a problem Improve competitive coding capabilities Apache 2.0 code_gen.yaml nemotron-RL-coding-competitive_coding
Equivalence Llm Judge agent Short bash command generation questions with LLM-as-a-judge Improve foundational bash and IF capabilities GNU General Public License v3.0 nl2bash-equivalency.yaml -
Equivalence Llm Judge knowledge Short answer questions with LLM-as-a-judge Improve knowledge-related benchmarks like GPQA / HLE - - - equivalence_llm_judge.yaml -
Ether0 knowledge ether0 chemistry benchmark verifiers Evalutate chemistry knowledge and reasoning with ether0 benchmark - - ether0.yaml -
Finance Sec Search agent SEC EDGAR filing search for financial analysis questions Enable LLMs to search and analyze SEC filings - - - finance_sec_search.yaml -
Genrm Compare rlhf GenRM pairwise comparison for RLHF training Compare multiple candidate responses using GenRM model - Creative Commons Attribution 4.0 International genrm_compare.yaml Nemotron-RL-Identity-Following-v1
Google Search agent Multi-choice question answering problems with search tools integrated Improve knowledge-related benchmarks with search tools - Apache 2.0 google_search.yaml Nemotron-RL-knowledge-web_search-mcqa
Gpqa Diamond knowledge GPQA Diamond multiple-choice question answering problems Evaluate graduate-level scientific reasoning via MCQ verification - MIT gpqa_diamond.yaml -
Instruction Following instruction_following Instruction following datasets targeting IFEval and IFBench style instruction following capabilities Improve IFEval and IFBench - Apache 2.0 instruction_following.yaml Nemotron-RL-instruction_following
Jailbreak Detection safety Jailbreak detection with Nemotron judge + combined reward - - - jailbreak_detection_nemotron_combined_reward_tp8.yaml -
Math Advanced Calculations agent An instruction following math environment with counter-intuitive calculators Improve instruction following capabilities in specific math environments - Apache 2.0 math_advanced_calculations.yaml Nemotron-RL-math-advanced_calculations
Math Formal Lean math Lean4 formal proof verification environment Improve formal theorem proving capabilities - Apache 2.0 nemotron_clean_easy.yaml -
Math Formal Lean math Lean4 formal proof verification environment Improve formal theorem proving capabilities - Apache 2.0 nemotron_first_try_hard.yaml -
Math Formal Lean math Lean4 formal proof verification environment Improve formal theorem proving capabilities - Apache 2.0 nemotron_medium_500.yaml -
Math Formal Lean math Lean4 formal proof verification environment Improve formal theorem proving capabilities - Apache 2.0 nemotron_very_easy.yaml -
Math Formal Lean math Lean4 formal proof verification environment Improve formal theorem proving capabilities - MIT math_formal_lean.yaml -
Math Formal Lean math Lean4 formal proof verification environment with multi-turn self-correction Improve formal theorem proving capabilities - MIT math_formal_lean_multi_turn.yaml -
Math With Code math Model solves competitive math problems using simple calculator tools Improve math and simple tool use capabilities - Apache 2.0 math_with_code.yaml -
Math With Judge math DAPO17k math dataset with math-verify Improve math capabilities including AIME 24 / 25 Apache 2.0 dapo17k.yaml -
Math With Judge math MathStackOverflow math dataset with math-verify Improve math capabilities including AIME 24 / 25 Creative Commons Attribution-ShareAlike 4.0 International math_stack_overflow.yaml Nemotron-RL-math-stack_overflow
Math With Judge math OpenMathReasoning math dataset with math-verify and LLM-as-a-judge Improve math capabilities including AIME 24 / 25 Creative Commons Attribution 4.0 International math_with_judge.yaml Nemotron-RL-math-OpenMathReasoning
Mcqa knowledge Multi-choice question answering problems Improve benchmarks like MMLU / GPQA / HLE Apache 2.0 mcqa.yaml Nemotron-RL-knowledge-mcqa
Mini Swe Agent coding A software development with mini-swe-agent orchestration Improve software development capabilities, like SWE-bench MIT mini_swe_agent.yaml SWE-Gym
Multichallenge knowledge MultiChallenge benchmark evaluation with LLM judge - - Creative Commons Attribution 4.0 International multichallenge_nrl.yaml Nemotron-RL-Instruction-Following-MultiTurnChat-v1
Multichallenge knowledge MultiChallenge benchmark evaluation with LLM judge - - TBD multichallenge.yaml -
Newton Bench math Scientific law discovery tasks through agentic experimentation across 12 physics domains Improve science, reasoning, and tool use capabilities - Apache 2.0 newton_bench.yaml -
Ns Tools agent NeMo Skills tool execution with math verification - - - - ns_tools.yaml -
Over Refusal Detection - - - - over_refusal_detection.yaml -
Reasoning Gym knowledge Over 100 tasks including algebra, arithmetic, computation, cognition, geometry, graph theory, logic, and many common games. Improve robustness, generalization, broad knowledge and reasoning - Apache 2.0 reasoning_gym.yaml Nemotron-RL-ReasoningGym-v1
Single Step Tool Use With Argument Comparison agent Conversational tool-use RL from expert trajectories; behavior cloning per step across auth, lookup, and servicing domains. - Creative Commons Attribution 4.0 International single_step_tool_use_with_argument_comparison.yaml Nemotron-RL-Agentic-Conversational-Tool-Use-Pivot-v1
Single Step Tool Use With Argument Comparison agent General function-calling RL dataset using expert trajectories; behavior cloning to match expert tool calls per step. - Creative Commons Attribution 4.0 International toolcall_schema_single_step_tool_use_with_argument_comparison.yaml Nemotron-RL-Agentic-Function-Calling-Pivot-v1
Single Step Tool Use With Argument Comparison agent GitHub-issue dataset for software-engineering agents; refactored from SWE-Gym and SWE-Bench-Verified for NeMo Gym. - Creative Commons Attribution 4.0 International swe_pivot_single_step_tool_use_with_argument_comparison.yaml Nemotron-RL-Agentic-SWE-Pivot-v1
Single Step Tool Use With Argument Comparison agent The model must output the next correct call in a given trajectory involving search tools. Improve agentic search capability. Apache 2.0 search_pivot_single_step_tool_use_with_argument_comparison.yaml -
Structured Outputs instruction_following Check if responses are following structured output requirements in prompts Improve instruction following capabilities Apache 2.0 structured_outputs_json.yaml Nemotron-RL-instruction_following-structured_outputs
Swerl Gen coding Running sandboxed evaluation for SWE-style tasks (either patch generation or reproduction test generation) Improve SWE capabilities useful for benchmarks like SWE-bench Apache 2.0 swerl_gen.yaml -
Swerl Llm Judge coding SWE-style multiple-choice LLM-judge tasks scored via ... choice. Improve SWE capabilities useful for benchmarks like SWE-bench MIT swerl_llm_judge.yaml -
Tavily Search agent Model uses search tools to satisfy a user query. Measure agentic search capability Apache 2.0 tavily_search_judge_vllm_model.yaml -
Terminus Judge agent single-step terminal based task (rubrics v4 judge prompt) Improve on terminal-style tasks Apache 2.0 terminus_judge.yaml -
Terminus Judge agent single-step terminal based task (simple judge prompt) Improve on terminal-style tasks Apache 2.0 terminus_judge_simple.yaml -
Text To Sql coding Text-to-SQL generation with LLM-as-a-judge equivalence checking Improve text-to-SQL capabilities across multiple dialects - - - text_to_sql.yaml -
Workplace Assistant agent Workplace assistant multi-step tool-using environment Improve multi-step tool use capability Apache 2.0 workplace_assistant.yaml Nemotron-RL-agent-workplace_assistant
Xlam Fc agent Salesforce xlam-function-calling-60k tool calling tasks Improve tool-calling capabilities Apache 2.0 xlam_fc.yaml -
Xstest safety XSTest safety benchmark - exaggerated safety (over-refusal) evaluation Evaluate model safety calibration between helpfulness and harmlessness - - - xstest.yaml -
Xstest safety XSTest safety benchmark - exaggerated safety (over-refusal) evaluation Evaluate model safety calibration between helpfulness and harmlessness - - - xstest_string_match.yaml -

📖 Documentation & Resources

🤝 Community & Support

We'd love your contributions! Here's how to get involved:

📚 Citations

If you use NeMo Gym in your research, please cite it using the following BibTeX entry:

@misc{nemo-gym,
  title = {NeMo Gym: An Open Source Library for Scaling Reinforcement Learning Environments for LLM},
  howpublished = {\url{https://github.com/NVIDIA-NeMo/Gym}},
  author={NVIDIA},
  year = {2025},
  note = {GitHub repository},
}