█

AI/TLDR

Buy me a coffee
Buy me a coffee

Molt

A small, PyTorch-native framework for fully asynchronous agentic RL on LLMs

RLHF & AlignmentOpen source
Language
Python
License
Apache-2.0
$git clone https://github.com/NVIDIA-NeMo/labs-molt.git
IN SHORT

What is Molt?

Molt is an open-source reinforcement learning framework for research on LLM agents, published under the NVIDIA-NeMo GitHub organisation. It sits in the RLHF & Alignment category of the Training & Fine-Tuning tools and is open-source, written in Python and licensed Apache-2.0. To get started: clone the repository.

Overview

Molt is an open-source reinforcement learning framework for research on LLM agents, published under the NVIDIA-NeMo GitHub organisation. It covers both supervised fine-tuning and online RL, and describes itself as agentic-first and PyTorch / Hugging Face-native: the agent is the program, the trainer is a single actor, and the reward is any Python you write inside an environment or chat agent — graders, multi-turn tools, vision-language environments or LLM-as-judge calls.

The whole stack is three components. Ray handles placement and the asynchronous queues between them, vLLM generates rollouts, and NVIDIA AutoModel with FSDP2 trains the model in plain PyTorch. Rollout, training and weight sync overlap, and the README reports roughly 9.2K lines of RL code that scale from an 8B model to trillion-parameter-class mixture-of-experts models such as DeepSeek-V3 using tensor, expert and context parallelism. Molt is based on OpenRLHF and keeps much of its package layout.

Molt architecture diagram: a vLLM router for rollout, the agent (Env or ChatAgent), a Ray queue and a single-actor RL trainer, linked by an asynchronous weight sync
Molt's fully asynchronous loop: the agent talks to vLLM rollout engines, trajectories flow through a Ray queue to a single-actor PyTorch / FSDP2 trainer, and new weights sync back to vLLM.Molt README ↗

Every RL run points at one Python module that exports an AgentRunner. You either subclass Env, a Gymnasium-style step/reset interface where the framework drives vLLM and tokenization, or ChatAgent, where your own code drives the loop through the OpenAI or Anthropic SDK against an auto-launched local server. Token ids, logprobs, rewards and multimodal tensors stay aligned from rollout to training, so multi-turn, vision and tool-call traces share one format.

What it does

  • Two agent interfaces: a Gymnasium-style Env with step() and a ChatAgent that speaks OpenAI Chat Completions or Anthropic Messages to the rollout engines
  • Fully asynchronous runtime on Ray with async rollout queues, partial rollout and weight sync to vLLM
  • Advantage estimators including REINFORCE, RLOO, GRPO, Dr. GRPO, PPO with a GAE critic, FlashREINFORCE and on-policy distillation to a frozen teacher
  • NVIDIA AutoModel + FSDP2 training with tensor, expert and context parallelism and Adam CPU offload for the largest actors
  • MoE stability tools: rollout routing replay (R3), router freeze and importance-sampling correction for train/rollout logprob mismatch
  • Configured entirely through CLI flags, with LoRA support and ready-made recipes for Qwen3, Nemotron-Omni and GLM models on a single node or Slurm

Getting started

Molt is run from a clone of the repository. The README recommends its Docker image, which bakes in the CUDA 13 stack (PyTorch, vLLM, TransformerEngine, NVIDIA AutoModel) for A100, H100, H200, B200 and GB200 GPUs; a local editable install requires CUDA 13.

Clone the repository

The launch scripts, reference agents and recipes live in the repo, and the container mounts this checkout.

bashbash
git clone https://github.com/NVIDIA-NeMo/labs-molt.git
cd labs-molt

Get the container, or install locally

Pull the published image (recommended). For development outside the container, install in editable mode with the vLLM extra; the PyPI package is not a supported install path.

bashbash
docker pull hijkzzz/molt:latest

# or, outside the container (CUDA 13 required)
pip install -e ".[vllm]"

Write an agent

An RL run needs one module exporting AgentRunner. The Env path returns a Result with the reward from step(); four reference agents ship under examples/python/agents/.

pythonpython
from molt.agents import Env, Result, StepEnvRunner

class MathEnv(Env):
    async def step(self, state) -> Result:
        # state: observation_text, action_text, label, sampling_params
        reward = grade(state["action_text"], state["label"])
        return Result(reward=reward, terminated=True)

class AgentRunner(StepEnvRunner):
    def __init__(self):
        super().__init__(MathEnv)

Launch RL training

Point the trainer at a model, a prompt dataset and the agent module. Add flags such as --rollout.n_samples_per_prompt with grpo or rloo, or --train.async_queue_size to decouple rollout from training.

bashbash
python3 -m molt.cli.train_rl_ray \
  --actor.model_name_or_path /path/to/automodel \
  --data.prompt_dataset /path/to/prompts.jsonl \
  --data.input_key input \
  --train.agent_path examples/python/agents/math.py \
  --vllm.num_engines 2 \
  --vllm.tensor_parallel_size 2 \
  --rollout.batch_size 128 \
  --train.batch_size 128 \
  --train.micro_batch_size 1 \
  --algo.advantage.estimator reinforce \
  --algo.kl.init_coef 0 \
  --fsdp.attn_implementation te \
  --ckpt.output_dir ./ckpt/rl

Or start from a recipe

Reference launch scripts under examples/scripts/ cover single-node quick starts and Slurm runs.

bashbash
MODEL_PATH=/path/to/Qwen3-4B bash examples/scripts/quick_start/rl_qwen3_4b.sh

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Research new RL algorithms or loss terms for LLMs in a codebase small enough to read end to end
  • Train a multi-turn, tool-using or vision-language agent with RL, using any Python function as the reward
  • Run RL on an agent that already talks to an OpenAI- or Anthropic-compatible API by pointing its client at Molt's session server
  • Scale the same RL or distillation script from a single-node dense model to a large mixture-of-experts model on a Slurm cluster

How Molt compares

Molt alongside other open-source rlhf & alignment tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Heretic★ 44kA command-line tool that removes refusal behaviour from transformer language models by directional ablation, using an Optuna parameter search that co-minimizes refusals and KL divergence from the original model.
Open-R1★ 26.5kAn open reproduction of the DeepSeek-R1 reasoning pipeline, with scripts for GRPO training and reasoning-data generation.
verl★ 24.4kVolcano Engine's RL post-training framework (HybridFlow) for building GRPO, PPO, and other RL pipelines on top of FSDP, Megatron, and vLLM.
TRL★ 19.9kHugging Face's post-training library with trainers for SFT, reward modeling, DPO, PPO, and GRPO to align language models with preferences.
Agent Lightning★ 19kAn open-source trainer from Microsoft that improves AI agents built with any framework using reinforcement learning, prompt optimization, and supervised fine-tuning.
ART★ 10.9kOpenPipe's Agent Reinforcement Trainer for post-training LLM agents on multi-step tasks using GRPO and rule- or judge-based rewards.
OpenRLHF★ 10.2kA Ray- and vLLM-based RLHF framework that scales PPO, GRPO, and REINFORCE++ training to models with 70B+ parameters.
Molt★ 1.4kA small, PyTorch-native framework for fully asynchronous agentic RL on LLMs