# Repository Briefing: areal-project/AReaL
> Source: https://repoforai.com/repo/areal-project/AReaL (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/areal-project/AReaL
- **Official Docs / Website**: https://areal-ai.io
- **Category**: LLMs & Inference (大模型与推理微调)
- **Primary Language**: Python
- **License**: Apache-2.0
- **Engineering Health**: A+ (95/100 · Maintenance 35/35 · Adoption 20/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v2.1.1 (2026-11-04) — https://github.com/areal-project/AReaL/releases
- **Review Snapshot**: 2026-12-04
- **Deployment / Stack Signals**: Docker, GPU
- **Momentum**: 5,947 ★ total (+0 24h / +10 7d) · 683 forks
- **Topics**: `agent`, `llm`, `llm-agent`, `llm-reasoning`, `machine-learning-systems`, `mlsys`, `reinforcement-learning`, `rl`
- **When to Use**: Best for: Applied research and ML systems teams that need to train reasoning models or agents with reward feedback, compare RL algorithms, or scale rollout generation and optimization separately across GPUs. Skip if: You only need to serve a fixed checkpoint, call a hosted model API, or deploy a turnkey trainer without validating the model, inference backend, and weight-update combination.

## Overview
```text
### Architecture & Core Mechanics
AReaL is a Python reinforcement-learning trainer that uses inference engines to generate rollouts, not a standalone inference server. The 2.0 refactor puts training, inference, agent execution, and weight updates in separate services under `areal/v2/`. In the RL loop, rollout inference generates trajectories for training; the training backend updates the actor, and the weight-update service makes the new policy available for subsequent rollouts. Asynchronous execution lets generation and optimization overlap rather than forcing them to advance in lockstep.

Training can run on Megatron, PyTorch FSDP, or PyTorch Archon. Rollout inference runs on SGLang by default or on vLLM, with separate dependency manifests and lockfiles for the vLLM path. For an existing black-box agent, the online proxy provides an integration point through `base_url`; for teams that need more control over the training workflow, `examples/agent_workflow/` provides a separate starting point.

### Key Capabilities & Differentiators
The GSM8K examples offer comparable configurations for GRPO, PPO, DAPO, and GSPO, while the multi-turn math example discounts rewards across turns. The example suite also covers Hermes online RL, Tau2 customer-service agents, and GRPO for visual reasoning. Set `max_head_offpolicyness=0` to run synchronously and establish a baseline before testing asynchronous sampling.

Backend choice determines both the usable model set and the parallelism options. Megatron and Archon list pipeline and expert parallelism; FSDP lists neither. Qwen3-MoE is listed on all three training backends, but Qwen3.5 and Qwen3.5-MoE are listed only on Megatron and FSDP, and Gemma 3 only on FSDP. FSDP supports LoRA, Megatron lists LoRA with vLLM, and Archon does not support it. For inference, both SGLang and vLLM list tensor parallelism; vLLM lists pipeline parallelism, while SGLang lists data-parallel attention and expert parallelism. The table leaves those last two capabilities unspecified for vLLM.

### Trade-offs & Limitations
Compared with deploying SGLang or vLLM alone, AReaL adds a closed RL loop, not a simpler way to serve a fixed checkpoint. Compared with synchronous RL, overlapping generation and optimization can improve utilization when rollouts would otherwise leave training workers idle. The cost is that trajectories can come from an older policy. Benchmark evaluation quality alongside throughput, and monitor rollout staleness and weight-update time rather than treating generation throughput as the training result.

The service split lets teams size training and rollout capacity separately, but it also makes backend, model, and weight-transfer compatibility an operating concern. Qwen2 and Qwen2.5 text models illustrate the boundary: disk updates work in v1 and v2, XCCL requires both actor and rollout to use v1, and AWEX is unsupported. The package metadata still classifies the project as pre-alpha. Before a costly run, validate the exact release, model, and backend combination through an end-to-end update and evaluation cycle.

### Hardware & Deployment Guide
The package targets Linux, requires Python 3.11 or 3.12, and lists a CUDA 12 environment. The native CUDA quickstart uses `uv`, a FlashAttention wheel matched to Python, PyTorch, and CUDA, and `uv sync --extra cuda` for the default SGLang stack. The root `Dockerfile` defaults to an SGLang variant and accepts `--build-arg VARIANT=vllm`. For a native vLLM setup, use `pyproject.vllm.toml` and `uv.vllm.lock` in place of the default manifest and lockfile. A separate `Dockerfile.rocm` is present; confirm backend and model compatibility before committing to that path.

For a first run, use `examples/math/gsm8k_rl.py` with `examples/math/gsm8k_grpo.yaml` and `scheduler.type=local`. It downloads GSM8K and Qwen2-1.5B-Instruct, so a restricted-network deployment needs to stage those assets in advance. The multi-node Ray path uses `scheduler.type=ray` and sets `cluster.fileroot` to shared storage. Pin the release and backend together for repeatable runs: v2.0.0 introduced the service split, and v2.1.1 fixed the trainer to run initial evaluation before the first update.
```

## Key Capabilities
```text
- Service boundaries: AReaL 2.x separates training, inference, agent execution, and weight updates.
- Staleness control: `max_head_offpolicyness=0` selects synchronous execution for a baseline.
- Agent integration: The online proxy supports black-box integration through a `base_url` change; Hermes provides an end-to-end example.
- Parallelism: Megatron and Archon list pipeline and expert parallelism; the FSDP backend lists neither.
- LoRA compatibility: FSDP supports LoRA; Megatron lists it with vLLM, and Archon does not list support.
- Weight-update compatibility: Qwen2/Qwen2.5 text models support disk updates in v1 and v2; XCCL requires v1 actor and rollout, and AWEX is unsupported.
```

## Quick Start / Clone
```bash
git clone https://github.com/areal-project/AReaL
cd AReaL
pip install uv
# Install flash-attn pre-built wheel first to avoid compiling from source
# (pick the wheel matching your Python version; see https://github.com/mjun0812/flash-attention-prebuild-wheels/releases)
uv pip install "https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.7.16/flash_attn-2.8.3+cu128torch2.9-cp312-cp312-linux_x86_64.whl"
uv sync --extra cuda  # installs training packages + SGLang (default inference backend)
# For vLLM instead: cp pyproject.vllm.toml pyproject.toml && cp uv.vllm.lock uv.lock && uv sync --extra cuda
```
