AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
An Asynchronous Reinforcement Learning Engine for Omni-Modal Post-Training at Scale
Translation pending
Developer toolsPython · ShellGitHub @redai-studioSelf-installOwner unconfirmed
Paste into Claude or ChatGPT for installation instructions suited to your environment.
Have you tried it? One tap is enough. No sign-in needed.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Installable projects can be verified without a deployment domain. Use GitHub sign-in for a personal repository, or the repository verification file above for an organization repository.
Ask about other verification options
Loading the full README. The saved excerpt is shown below.
Relax: An Asynchronous Reinforcement Learning Engine for Omni-Modal Post-Training at Scale Towards Async, Omni-Modal RL at Scale, Just Relax.Read the full README ↗
Towards Async, Omni-Modal RL at Scale, Just Relax.
Relax (Reinforcement Engine Leveraging Agentic X-modality) is a high-performance reinforcement learning post-training framework open-sourced by the Xiaohongshu AI Infra Team for multimodal large language models. Built on Ray Serve with a service-oriented architecture, Relax uses Megatron-LM as the training backend and SGLang as the inference engine. Through the TransferQueue data transfer system, it achieves complete decoupling of training and inference, supporting end-to-end multimodal RL training from text to images, videos, and audio.
--balance-data with sub-batched forward to minimize GPU wasteray_native) and cross-cluster (external) federation modes| 📣 Updates |
|---|
| [08/20/2026] 🧠 Added M2PO, RLOO, and two REINFORCE++ variants, with runnable RLOO and REINFORCE++ recipes plus an Algorithm Reference covering all four. |
| [08/19/2026] 🤖 Added multi-agent training with multi-context trajectory export and a Search-R1 reference recipe. |
| [08/18/2026] 🪶 LoRA RL now supports MoE models in both adapter and merge workflows. See the LoRA Training Guide. |
[05/26/2026] 🔁 New Hybrid execution mode — streaming data + in-process ref/actor_fwd, with --balance-data support. See the Hybrid Training Guide. |
| [05/11/2026] 🚀 Support for Qwen3.6 series models (text + VLM)! |
| [04/15/2026] 🎉 Relax is now open-source! |
Relax adopts a six-layer service-oriented architecture where every role is deployed as an independent Ray Serve deployment, cleanly separating orchestration, components, engines, backends, and distributed capabilities:
| Layer | Responsibility |
|---|---|
| Entrypoints | train.py — signal handling, CLI parsing, Ray cluster connection, Controller launch |
| Orchestration | Controller (training loop, global restart), Service (placement groups, lifecycle), Registry (role & algorithm mapping) |
| Components | Ray Serve deployments: Actor, Rollout, Critic, ActorFwd, Advantages, GenRM |
| Engine | SGLang rollout engine, pluggable reward functions, request router, data filters |
| Backends | Megatron-LM training backend (TP/PP/CP/EP) and SGLang inference engine |
| Distributed | Ray Actor groups (RolloutManager / GenRMManager) and DCS (Distributed Checkpoint Service) for NCCL/GLOO weight sync |
Three execution modes are supported:
max_staleness=0).TensorBackuper + _switch_model (like Colocate). Enables streaming pipelines plus --balance-data without paying for standalone ref/actor_fwd services.📖 Learn more: Architecture Guide · Fully Async Training · Hybrid Training · Elastic Rollout Scaling
| Algorithm | Type | Description |
|---|---|---|
| PPO | Actor-Critic | Proximal Policy Optimization |
| GRPO | Policy Optimization | Group Relative Policy Optimization |
| M2PO | Policy Optimization | Second-Moment Trust Policy Optimization |
| RLOO | Policy Optimization | REINFORCE Leave-One-Out |
| REINFORCE++ | Policy Optimization | Token KL-to-go with global normalization |
| REINFORCE++-baseline | Policy Optimization | Group-baseline REINFORCE++ variant |
| GSPO | Policy Optimization | Group-wise Sequence-level Policy Optimization |
| SAPO | Policy Optimization | Soft Adaptive Policy Optimization |
| CISPO | Policy Optimization | Clipped Importance-ratio Soft Policy Optimization |
| On-Policy Distillation | Knowledge Transfer | Teacher-student KL penalty distillation |
📖 See the Algorithm Reference for objectives, recipes, and execution-mode constraints.
Relax is designed for omni-modal RL training — text, vision, and audio in one unified framework. Multimodal data is configured via the --multimodal-keys flag, with complete image/video/audio processing pipelines under relax/utils/multimodal/ for fine-grained control over image token counts, video frame sampling, and audio sample rates.
| Model Family | Sizes | Modality | Typical Tasks | Backend |
|---|---|---|---|---|
| Qwen3 | 4B, 30B-A3B (MoE) | Text | Math reasoning, code, multi-turn dialogue, tool use | Megatron |
| Qwen3-VL | 4B, 30B-A3B | Vision + Language | Visual QA, image understanding, multimodal reasoning | Megatron |
| Qwen3.5 | 4B, 9B, 27B, 35B-A3B, 122B-A10B, 397B-A17B | Text + Vision | Reasoning, SFT, visual QA, multimodal reasoning | Megatron |
| Qwen3-Omni | 30B-A3B | Text + Vision + Audio | Audio-visual QA, omni-modal understanding | Megatron |
| Qwen3.6 | 27B, 35B-A3B | Text + Vision | Reasoning, visual QA, multimodal reasoning | Megatron |
| Qwen3.8 | 27B | Text + Vision | Reasoning, SFT, visual QA, multimodal reasoning | Megatron |
| GLM5 | 744B-A40B (MoE) | Text | Math reasoning, code, multi-turn dialogue | Megatron |
| Kimi K2.6 | ~1T-A32B (MoE) | Vision + Language | Visual QA, multimodal reasoning; INT4 QAT training | Megatron |
| Kimi K3 | ~2.78T (MoE) | Vision + Language |
📖 New architectures are integrated through Megatron Bridge; see the External Model Integration Guide for the rollout, training, and weight-conversion hooks.
The recommended way to run Relax is via the official Docker image, which ships with all CUDA, PyTorch, Megatron-LM, SGLang, and Ray dependencies pre-installed and version-matched.
# Pull the official image
docker pull ghcr.io/redai-studio/relaxrl:latest
# Launch a container with GPUs, shared memory, and your workspace mounted
docker run -it --gpus all --ipc=host --network=host \
-v /path/to/your/workspace:/root \
ghcr.io/redai-studio/relaxrl:latest bash
# Inside the container
git clone https://github.com/redai-studio/Relax.git /root/Relax
cd /root/Relax && pip install -e .
📖 For GPU driver requirements, multi-node setup, and persistent storage mounts, see the Installation Guide.
Three end-to-end tasks cover text, vision-language, and omni-modal training. Each task downloads a public HuggingFace dataset and model, then launches training with a single script. Set EXP_DIR=/root (or wherever your models and datasets live) and the scripts will locate them automatically.
Train Qwen3-4B on dapo-math-17k with GRPO. Reward is rule-based answer extraction plus symbolic math verification.
hf download --repo-type dataset zhuzilin/dapo-math-17k --local-dir /root/dapo-math-17k
hf download Qwen/Qwen3-4B --local-dir /root/Qwen3-4B
cd /root/Relax && export EXP_DIR=/root
bash scripts/training/text/run-qwen3-4B-8xgpu.sh
Train Qwen3-VL-4B on multimodal-open-r1-8k-verified with GRPO using the openr1mm reward.
hf download --repo-type dataset lmms-lab/multimodal-open-r1-8k-verified \
--local-dir /root/multimodal-open-r1-8k-verified
hf download Qwen/Qwen3-VL-4B-Instruct --local-dir /root/Qwen3-VL-4B-Instruct
cd /root/Relax && export EXP_DIR=/root
bash scripts/training/multimodal/run-qwen3-vl-4B-8xgpu.sh
Train Qwen3-Omni-30B-A3B on AVQA-R1-6K with GRPO and a multiple-choice reward.
hf download --repo-type dataset harryhsing/AVQA-R1-6K --local-dir /root/AVQA-R1-6K
hf download Qwen/Qwen3-Omni-30B-A3B-Instruct --local-dir /root/Qwen3-Omni-30B-A3B-Instruct
cd /root/Relax && export EXP_DIR=/root
bash -x scripts/entrypoint/spmd-multinode.sh \
scripts/training/multimodal/run-qwen3-30B-A3B-omni-16xgpu.sh
Once running, you should see logs like:
Finish rollout 0/200
training step 0/200
Checkpoints are saved in Megatron DCP format; convert them to HuggingFace weights with scripts/tools/convert_torch_dist_to_hf_bridge.py.
📖 Full walkthrough: Quick Start Guide · Customize Training · Configuration Guide
In fully-async mode, Rollout, Actor, ActorFwd, Reference, and Advantages run on independent GPU clusters in parallel. Three mechanisms make this efficient:
--max-staleness precisely controls how off-policy training data can drift, flexibly balancing on-policy accuracy and throughput.Relax provides first-class support for multi-turn, closed-loop "execute → observe → decide" training:
BaseInteractionEnv interface (reset, step, format_observation) lets environments evolve independently of the sampler.image_data on the Rollout side and multimodal_train_inputs on the training side are incrementally merged each turn so visual observations concatenate correctly.max_turns, token-budget exhaustion, and env-signalled done. The DeepEyes example demonstrates Agentic multi-turn GRPO with Qwen3-VL-30B-A3B.Since 60–70% of RL training time is spent in the Rollout phase, Relax exposes HTTP REST APIs to dynamically add or remove inference engines mid-training without interrupting the training loop:
ray_native mode — specify a target engine count; Relax allocates resources and launches new SGLang engines inside the current Ray cluster.external mode — register SGLang engines already deployed in other clusters for cross-cluster federated inference on preemptible or idle resources.Scaling is asynchronous, idempotent, mutually exclusive, and supports graceful drain-and-remove plus cancellation with rollback. Engines from startup parameters are protected; only dynamically added engines can be scaled in.
Training uses Megatron-LM with full Tensor / Pipeline / Context / Expert parallelism for MoE and ultra-deep models. Inference uses SGLang with process-lifecycle management. New model architectures plug in through Megatron Bridge for automatic HF ↔ Megatron weight conversion.
Built-in rewards for math (DeepScaler, DAPO), GPQA, F1, IFBench, multiple-choice, multimodal Open-R1, and GenRM (generative LLM-as-judge). Add a custom reward by dropping a single file into relax/engine/rewards/.
Full bilingual documentation is available at redai-studio.github.io/Relax.
| Example | Description |
|---|---|
| Algorithm Recipes | RLOO, REINFORCE++, CISPO, and related policy optimizers |
| DeepEyes | Multi-modal vision-language RL with Qwen3-VL |
| Search-R1 | Search-augmented single-agent and multi-agent RL |
| Mini-SWE-Agent | Agentic RL for software-engineering tasks |
| NeMo Gym Agentic | Agentic environment integrations and runnable recipes |
| On-Policy Distillation | Teacher-student knowledge distillation via KL penalty |
| Project | Description |
|---|---|
| HyperEyes | A parallel multimodal search agent that uses Relax for efficient RL training, combining visual grounding and retrieval to search across multiple entities concurrently. |
| Iris | An open-weight search agent family post-trained with Relax from Qwen3.5/3.6, designed for long-horizon search, iterative evidence gathering, and context management. |
We welcome contributions of all kinds! Please read our Contributing Guide to get started.
Relax ships a set of Claude Code slash-command skills under skills/ to accelerate development and operations. Invoke them in Claude Code with /skill-name.
| Skill | Description |
|---|---|
/code-review | Expert review of git changes — SOLID violations, security risks, ML/distributed training issues |
/debug-hang | Automatically diagnose Ray distributed training hangs — collects call stacks and actor states |
/dev | Develop and debug Relax code; submit and monitor jobs on a remote Ray cluster |
/doc-writer | Write and maintain bilingual (English + Chinese) VitePress documentation |
/git-commit | Create Conventional Commits with rich markdown body and auto-run pre-commit hooks |
/model-integration | Step-by-step guide for integrating new model architectures into the training pipeline |
/perf-doctor | Audit training launch scripts for performance and GPU memory misconfiguration |
/ssh-ray-cluster | SSH into a remote Ray cluster head node to inspect status, logs, and debug jobs |
/verl-to-relax | Migrate RL recipes from verl to Relax (rewards, tool envs, launch scripts) |
/creating-skills | Guide for authoring new Claude Code skills following Anthropic best practices |
If you find Relax useful in your research, please cite:
@software{relax2026,
title = {Relax: An Asynchronous Reinforcement Learning Engine for Omni-Modal Post-Training at Scale},
author = {Relax Contributors},
url = {https://arxiv.org/abs/2604.11554},
year = {2026}
}
This project is licensed under the Apache License 2.0.
Relax is built upon the shoulders of excellent open-source projects:
We sincerely thank all contributors and the open-source community for making this project possible.
| Full-parameter / LoRA SFT, GRPO, HF export |
| Megatron |
| dots.mocr | 3B | Vision + Language | OCR, document understanding, multimodal reasoning | Megatron |