Agentic Reinforcement Learning

Molt

An Agentic-First RL Framework for Research

Ray, vLLM, and NVIDIA AutoModel: the smallest PyTorch-native stack for 1T-class fully-async, multimodal, multi-turn agentic RL. About 9.2K lines of RL code, clean enough to read end to end.

Jian Hu, Huiying Li, Hao Zhang, Binfeng Xu, Yifan Zhang, Shaokun Zhang, Hemil Desai, Michael Demoret, Pavlo Molchanov, Jan Kautz, Yi Dong
NVIDIA  ·  arXiv:2607.21653
Agentic-FirstFully AsyncRay · vLLM · AutoModel1T-Class MoE

Overview

Molt is agentic-first and PyTorch-native. The agent is the program; the trainer is a single actor; reward is any Python you write inside an Env or ChatAgent: graders, multi-turn tools, VLM environments, LLM-as-judge. Three components carry the rest: Ray for placement and async queues, vLLM for rollout, and NVIDIA AutoModel + FSDP2 for training in pure PyTorch.

That is the whole stack: about 9.2K lines of RL code that scale to 1T-class MoE on vLLM with TP / EP / CP, think DeepSeek-V3 at --fsdp.ep_size 256, with Adam CPU offload for the largest actors. One agent API, one trainable actor, clean enough to read end to end.

Read the Tech Report Code

Three Boxes, One Async Loop

Molt architecture: Agent, vLLM rollout, Ray async queue, single-actor AutoModel/FSDP2 trainer, fully async.
Figure: Molt's architecture. An agent drives vLLM rollout, a Ray async queue connects it to a single-actor AutoModel/FSDP2 trainer, and rollout, training, and weight sync overlap fully.

Ray owns placement and the async queue between the three boxes; that is the entire runtime. The contract is token-first: token ids, logprobs, action ranges, rewards, and multimodal tensors stay aligned from rollout to training. Anything you can compute in Python is a valid reward, including LLM-as-judge calls back through the same vLLM engines that drive rollout.

Why Molt

01

Agentic-first

One Gymnasium-aligned API, Env.step() or ChatAgent.run(), covers graders, multi-turn tools, VLM environments, and OpenAI/Anthropic-compatible servers. Iterate on environments in plain Python; the trainer stays untouched.

02

Fully-async runtime

Ray placement, async rollout queues, vLLM engines, partial rollout, and weight sync overlap, so a DeepSeek-V3-class actor stays fed without bespoke infrastructure.

03

PyTorch-native

FSDP2 + NVIDIA AutoModel, pure PyTorch end to end. Hack the model in the language you already write, with no backend ceremony.

04

Single-actor simplicity

One actor with an optional KL reference; the whole RL graph fits on a page. Every gradient is explicit, and every loss term is one file away.

05

Frontier-scale MoE

AutoModel + FSDP2 with TP / EP / CP and Adam CPU offload, MoE-native. The same script that trains 8B scales to 1T-class MoE with no rewrite between scales.

06

Small, hackable surface

About 9.2K LOC of RL code across three thin layers with a token-first data contract. Fork one layer without touching the others; read it in an afternoon.

MoltOpenRLHFverlslime
Training backendPyTorch / FSDP2 + NVIDIA AutoModelDeepSpeed ZeRO-3FSDP / FSDP2 / MegatronMegatron (FSDP exp.)
Rollout enginevLLM (Ray)vLLM (Ray)vLLM / SGLang / TRT-LLMSGLang only
RL topologyactor (+ optional PPO critic)actor + critic + RMactor + critic + RMactor + critic + RM
Reward sourceagent Pythonagent / endpoint / RMagent / RM / endpointrollout fn / RM
ParallelismTP / EP / CP, MoE-nativeZeRO-3 / FSDPTP / PP / EP / SPTP / PP / DP / CP / EP
RL code size~9.2K LOC~7.2K~62K~25K
Design centeragentic-first researchRLHF coverageproduction breadthMegatron throughput

Features

Algorithms

Estimators: reinforce, reinforce_baseline, rloo, grpo, dr_grpo, gae (PPO with a value model on its own Ray group), and on_policy_distill. Optional reference workers provide KL regularization; the reference doubles as the distillation teacher.

On-policy distillation

One switch turns the reference model into a frozen teacher and makes per-token reverse KL to it the entire training signal: no scalar reward, no group baseline, no whitening. Point the agent path at a real tool-use agent to distill a multi-turn distribution.

IS correction

Async and partial rollout make the training-side logprobs diverge from vLLM's generation-time logprobs. Molt corrects the off-policy update with gated per-token importance ratios: token, seq, or geo granularity crossed with mask, clip, or trunc treatment, covering TIS, IcePop, and MIS-style sequence masking.

MoE routing stability

Rollout and training routers pick experts independently, which breaks importance sampling. Molt closes the gap with fp32 router precision, Rollout Routing Replay (R3) that replays vLLM's exact top-k selection in the training forward, and an optional router freeze.

Multimodal, multi-turn agents

Text and VLM prompts with image payloads; assistant spans are derived from the model's own chat template. Context compaction is detected automatically: a rewritten prefix seals the current token-exact segment and starts a fresh one, so external harnesses work unchanged.

MTP speculative rollout

Checkpoints that ship a multi-token-prediction head can speed up generation via vLLM speculative decoding with one flag. Acceptance is by rejection sampling, so rollout logprobs stay unbiased for the RL objective; it changes throughput, never the learned policy.

Quick Start

Install from the repo (or pull the prebuilt container, recommended for the full CUDA stack):

git clone https://github.com/NVIDIA-NeMo/labs-molt.git
cd labs-molt
pip install -e ".[vllm]"      # or: docker pull hijkzzz/molt:latest
# checkout-free: pip install "molt-rl[vllm]"

Launch RL with one trainable actor and your agent as the reward:

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

Reference recipes under examples/scripts/ span Qwen3-4B dense text RL, Qwen3.6-35B-A3B VLM RL with a multi-turn Python tool, Nemotron-Omni-30B-A3B hybrid SSM MoE at CP8+EP8, on-policy distillation, and GLM-5.2 ~750B RL at EP256.

Citation

If you use Molt in your research, please cite:

@article{hu2026molt,
  title         = {Molt: A Scalable PyTorch-Native Training Framework for Agentic Reinforcement Learning},
  author        = {Hu, Jian and Li, Huiying and Zhang, Hao and Xu, Binfeng and Zhang, Yifan and Zhang, Shaokun and Desai, Hemil and Demoret, Michael and Molchanov, Pavlo and Kautz, Jan and Dong, Yi},
  year          = {2026},
  eprint        = {2607.21653},
  archivePrefix = {arXiv},
  primaryClass  = {cs.LG},
  url           = {https://arxiv.org/abs/2607.21653}
}