Simple to use · Easy to extend · Ascend-friendly
English | 简体中文
Why Hyper-RL · Architecture · Installation · Quick Start · Examples · Documentation
Hyper-RL is a reinforcement learning framework for large language models and tool-using agents. HyperParallel provides parallel training, vLLM provides sampling, and Hyper-RL connects tasks, trajectories, learning, and policy publication.
Optional OPD/MOPD reuses the synchronous training pipeline with a single teacher, per-sample routing across multiple teachers, pure distillation, or joint optimization with task RL. The current objective is sampled k1 PG and requires strict tokenizer compatibility.
Reduce deployment dependencies while keeping training easy to understand and run.
- Minimal stack: HyperParallel handles training and parallelism; vLLM handles sampling. Synchronous training uses direct orchestration without Ray.
- Explicit training flow: SyncTrainer organizes sampling, learning, weight publication, evaluation, and recovery, making execution easier to trace and debug.
- Clear starting point: A pinned runtime image, model configurations, and launch scripts support a Qwen3-4B single-step check of the training pipeline.
- Human-readable, agent-traceable: Developers use feature navigation to locate configurations, implementations, and tests. Coding agents enter through AGENTS.md and the Hyper-RL rules, reading the same authoritative documents as needed.
Clear extension boundaries with a reusable training pipeline.
- Algorithms decoupled from orchestration: Advantage estimators and policy losses support registered extensions. Algorithms compatible with existing training roles reuse the Trainer; core orchestration customizes sampling and learning execution mechanisms.
- Tasks, tools, and rewards in Python: Replace scoring logic or add tool interactions without modifying distributed training or weight publication. See the reward example.
- Two agentic interaction styles: Environment supports framework-driven turns; AgentProgram hosts user programs. Built-in Codex / DeepSeek harnesses perform episode GRPO on actual per-call trajectories; custom programs still require adaptation. See Agentic RL.
- Model and backend adaptation at defined boundaries: New models reuse HyperParallel capabilities with training/inference adapters and weight mapping. Other inference backends can be extended and independently validated in downstream forks. See extension interfaces and infrastructure choices.
Organize training and sampling around Ascend computation, memory, and communication capabilities.
- FSDP training: Reuse HyperParallel state sharding, prefetching, and compute-communication overlap with validated FSDP, TP, and EP combinations for dense and Qwen3-30B-A3B recipes. See FSDP optimization.
- Colocated and disjoint deployment: Qwen3 dense supports shared or separate training/inference devices, publishing weights through NPU IPC or HCCL respectively. Colocated deployment releases and restores sampling resources by phase. MoE currently requires colocation; see supported capabilities.
- Streaming weight synchronization: native-vLLM uses full_gather, sending one bucket at a time over IPC/HCCL and releasing buffers after acknowledgment.
The independent HyperMulticore package provides one-sided communication and multicore MoE compute-communication overlap as an optimization foundation. Hyper-RL integration and end-to-end benefits remain to be validated.
Preserve generation evidence, check probability differences, and define policy publication boundaries.
- Original samples throughout training: Preserve generated tokens, logprobs, action masks, and policy identity, avoiding changes from re-tokenization. Tool feedback and environment observations provide context and do not contribute to policy loss. See the trajectory contract.
- Only published policies can sample: The synchronous flow consumes trajectories from one published version. Sampling resumes only after weight transfer, worker identity checks, and cache reset complete. Parameter publication and probability consistency are validated separately.
Task extensions, training orchestration, and the inference/parallel-training infrastructure share an explicit sampling-to-publication loop. See the architecture guide for component contracts.
Clone the standalone repository and use a compatible Linux ARM64 / Ascend runtime. The pinned HyperParallel wheel is included in .artifacts/ for CPython 3.12; users do not need to build HyperParallel separately.
git clone --branch master https://github.com/mindspore-ai/hyper-rl.git
cd hyper-rlSee installation and the runtime image guide for dependencies, model/data mounts, and driver requirements.
Inside the prepared runtime container, run the eight-device Qwen3-4B recipe from the repository root. Replace the model and dataset paths with your mounted locations.
bash docker/install_runtime.sh
export PYTHONPATH="$PWD${PYTHONPATH:+:$PYTHONPATH}"
torchrun --standalone --nproc_per_node=8 \
scripts/train_rl.py examples/gsm8k/configs/qwen3_4b_gsm8k_gspo.yaml \
--model.weights_path=/path/to/Qwen3-4B \
--model.tokenizer_path=/path/to/Qwen3-4B \
--data.train_path=/path/to/gsm8k/train.parquet \
--data.test_path=/path/to/gsm8k/test.parquet \
--train.max_steps=2Use --train.max_steps=1 for a one-step smoke run. See the GSM8K guide for prepared data and Docker launchers.
| Example | Entry |
|---|---|
| GSM8K | Math training |
| Search-R1 | Tool-using agents |
| Python code | Code generation and grading |
| SWE-Smith | Repository agents |
| OPD/MOPD | Teacher-guided training |
| Consistency | Train/rollout probability checks |
Support depends on the model, task, and deployment topology.
| Area | Capabilities |
|---|---|
| Training | GRPO, GSPO, PPO, and single-node asynchronous GRPO |
| Tasks | Math, tool-using agents, Python code, and SWE-Smith |
| Models | Qwen3 dense/MoE and Qwen3.5-family text recipes |
| Runtime | vLLM sampling, streaming weight synchronization, and checkpoint recovery |
| Optional | Reward Model scoring and OPD/MOPD |
MoE currently supports colocated GRPO. Multimodal and multi-node training remain planned. See the examples and deployment guide for configurations and validation boundaries.
Define tasks, tools, and rewards in Python. The GSM8K agent is a starting point for reward customization; see extension points for data, algorithm, and runtime interfaces.
| Guide | Contents |
|---|---|
| Installation | Runtime and pinned HyperParallel wheel |
| Architecture | Training lifecycle and extension interfaces |
| Agentic RL | Multi-turn interactions and program agents |
| vLLM Rollout | Deployment, weight synchronization, and supported combinations |
| Feature Navigation | Configuration, implementation, and test entry points |
See CONTRIBUTING.md for development checks and contribution guidelines.
Hyper-RL is released under the Apache License 2.0.