Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0f13451
Add DR-GRPO loss (#24)
fdrose Mar 19, 2026
9b9d8b6
Globally reduce load balancing loss across DP ranks (#40)
kiddyboots216 Mar 27, 2026
c37ab97
Add opt-in MoE LoRA PEFT export flag (#44)
felix-588 Mar 27, 2026
ec37d38
Fix rank-0 shard broadcast deadlock (#54)
kiddyboots216 Mar 31, 2026
7af920f
Fix TFLOPs accounting and improve wandb/startup metrics (#48)
qywu Mar 31, 2026
d34c2c1
Increase packing bins NFS retry for multi-node visibility delays (#55)
qywu Apr 1, 2026
1876282
Add pre-commit hooks for formatting and code quality (#65)
qywu Apr 1, 2026
6d36113
Improve dummy dataset generation and packing (#49)
qywu Apr 2, 2026
46eca4a
Fuse MoE expert gate and up projections (#64)
kiddyboots216 Apr 3, 2026
c1fb95e
Improve RMSNorm modes and fused residual path (#50)
qywu Apr 3, 2026
3c52a2e
Use rank-local node cache dirs for Triton, TorchInductor, and Quack (…
kiddyboots216 Apr 6, 2026
dc543e1
Default train_router=False for MoE (#53)
qywu Apr 6, 2026
58af943
Fix LoRA mixed-precision and 2-node 397B all-ranks loading paths (#72)
kiddyboots216 Apr 6, 2026
aca3f53
Respect deferred QLoRA MoE expert loading (#68)
kiddyboots216 Apr 6, 2026
8148612
Add SignSGD optimizer support (#86)
kiddyboots216 Apr 7, 2026
1648ebf
[Feat] Move MoE routing weights before down_proj (#87)
kiddyboots216 Apr 7, 2026
03bd373
qwen3.5 correction (#59)
zzz0906 Apr 8, 2026
3c809a5
Enforce import-outside-top-level with targeted lazy imports (#74)
kiddyboots216 Apr 8, 2026
0f005bb
Add hybrid_shared LoRA args to offline Trainer (#63)
qywu Apr 8, 2026
d669b47
Fix checkpoint utils import in arguments (#96)
kiddyboots216 Apr 9, 2026
5e2c9c1
Make example configs path-generic (#99)
kiddyboots216 Apr 10, 2026
0082dc3
Fix package import cycles for LoRA and runner modules (#101)
kiddyboots216 Apr 10, 2026
80b03fc
Improve documentation: installation, server training, RL guide, and R…
qywu Apr 10, 2026
6ebc5a5
Fix NCCL weight sync rendezvous port reuse (#70)
kiddyboots216 Apr 10, 2026
e10eb56
Make create_session return usable sessions (#111)
kiddyboots216 Apr 10, 2026
38732cc
Fix causal attention FLOP accounting (#104)
kiddyboots216 Apr 10, 2026
6f9e782
Optimizer refactoring + Muon efficiency improvements (#90)
kiddyboots216 Apr 11, 2026
99d3fa4
Fix Qwen3.5-35B MoE routing and fused_recurrent kwargs bug (#121)
qywu Apr 11, 2026
6171928
Unified gradient_checkpointing_method: +12-22% MoE throughput with me…
qywu Apr 14, 2026
9a5f5a0
Fix NCCL collective mismatch in packing bin computation causing distr…
AmanSinghal927 Apr 15, 2026
2b03328
[Perf] Fused SiLU+mul kernels in Triton MoE EP group GEMM (#113)
zzz0906 Apr 16, 2026
5d8ec39
Add Llama 3 model support (#125)
qywu Apr 16, 2026
a160a7d
feat(distributed): unified eFSDP gradient scaling with factor=1.0 (#83)
qywu Apr 16, 2026
a9223b0
Fix Llama 3 LoRA target names and gate/up bias load asymmetry (#145)
qywu Apr 16, 2026
4dab134
[Feat] Add Qwen2/Qwen2.5 model support (#94)
qywu Apr 16, 2026
55ed3b6
Remove worker_port from inference endpoint registration (#110)
kiddyboots216 Apr 16, 2026
5897e7a
Fix all CPU test failures (#142)
qywu Apr 16, 2026
6b40ec4
Fix hybrid-shared MoE LoRA checkpoint roundtrip (#135)
kiddyboots216 Apr 17, 2026
ad2577b
Lazy import repeat_kv (#147)
connermanuel Apr 17, 2026
de00085
Sync src/ to match upstream snapshot
qywu Apr 18, 2026
b139a5a
Apply ruff-format fixes
qywu Apr 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[codespell]
skip = *.lock,*.json,submodules/*,.venv/*,.git,docs/node_modules/*
ignore-words-list = dout,te,subtile,parm,mot,numer
29 changes: 29 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0

- name: Install pre-commit
run: uv tool install "pre-commit~=4.5"

- name: Cache pre-commit envs
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-

- name: Run pre-commit checks
run: SKIP=no-commit-to-branch pre-commit run --all-files --show-diff-on-failure
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "submodules/xorl-client"]
path = submodules/xorl-client
url = https://github.com/togethercomputer/xorl-client
[submodule "submodules/xorl-sglang"]
path = submodules/xorl-sglang
url = https://github.com/togethercomputer/xorl-sglang
34 changes: 34 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
default_stages: [pre-commit, pre-push, manual]
exclude: ^(submodules/|\.venv/)

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-symlinks
- id: destroyed-symlinks
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--allow-multiple-documents]
- id: check-toml
- id: check-ast
- id: check-added-large-files
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: detect-private-key
- id: debug-statements
- id: no-commit-to-branch
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.4
hooks:
- id: ruff
args: [--fix-only]
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
args: ["--config", ".codespellrc"]
additional_dependencies:
- tomli
23 changes: 22 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,28 @@ Add ring attention support for long-context training

## Code Style

- Python: follow existing style, run `ruff check` and `ruff format` before pushing
We use [pre-commit](https://pre-commit.com/) to enforce formatting and catch common issues. Set it up once:

```bash
pip install -e ".[lint]"
pre-commit install
```

This runs automatically on every `git commit`. To check the entire codebase manually:

```bash
pre-commit run --all-files
```

The hooks include:
- **ruff** — auto-fixes imports and lint issues
- **ruff-format** — code formatting (line length 120)
- **codespell** — catches typos
- **trailing-whitespace / end-of-file-fixer** — file hygiene

CI runs the same hooks, so if pre-commit passes locally, CI will too.

Additional guidelines:
- No dead code, no commented-out blocks
- Type hints on public APIs

Expand Down
68 changes: 63 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,18 @@

XoRL is a distributed training framework designed for large language models with composable parallelism and flexible training modes.

**The XoRL stack consists of three repos:**

| Repo                        | Description |
|---|---|
| **[xorl](https://github.com/togethercomputer/xorl-internal)** | Distributed training framework — local SFT/pretraining and server-mode RL training |
| **[xorl-client](https://github.com/togethercomputer/xorl-client)** | Lightweight Python SDK for driving the xorl training server (forward/backward, optimizer steps, checkpointing, sampling) |
| **[xorl-sglang](https://github.com/togethercomputer/xorl-sglang)** | Fork of [SGLang](https://github.com/sgl-project/sglang) with weight-sync APIs, MoE routing export, and numerical alignment for online RL |

**Two training modes:**

- **Local** — `torchrun`-based training for offline SFT and pretraining
- **Server** — REST API-driven training for online RL loops where an external orchestrator (e.g. [xorl_client](https://github.com/xorl-org/xorl_client)) controls the training loop
- **Server** — REST API-driven training for online RL loops where [xorl-client](https://github.com/togethercomputer/xorl-client) drives the training loop and [xorl-sglang](https://github.com/togethercomputer/xorl-sglang) serves inference

**Parallelism strategies** — mix and match freely:

Expand All @@ -40,14 +48,61 @@ XoRL is a distributed training framework designed for large language models with
## 🚀 Installation

```bash
git clone --recurse-submodules git@github.com:togethercomputer/xorl.git
cd xorl
uv sync
git clone --recurse-submodules git@github.com:togethercomputer/xorl-internal.git
cd xorl-internal
```

> Already cloned without `--recurse-submodules`? Run `git submodule update --init --recursive`

See the [installation guide](https://togethercomputer.github.io/xorl/getting-started/installation/) for full setup including optional dependencies (DeepEP, Flash Attention).
### Option A: uv (recommended)

```bash
uv sync
source .venv/bin/activate
```

### Option B: conda

```bash
conda create -n xorl python=3.12
conda activate xorl
pip install -e .
```

### Submodules

The repo includes two git submodules under `submodules/` (needed for server / online RL training):

- **[xorl-client](https://github.com/togethercomputer/xorl-client)** — Lightweight Python SDK (no PyTorch dependency) for driving the xorl training server. Provides `ServiceClient`, `TrainingClient`, `SamplingClient`, and `RestClient` with async-first `APIFuture` semantics, automatic request ordering, and Tinker API compatibility.
- **[xorl-sglang](https://github.com/togethercomputer/xorl-sglang)** — XoRL's fork of [SGLang](https://github.com/sgl-project/sglang) with NCCL-based weight sync endpoints, MoE routing data export (R3), and numerical alignment flags for online RL.

Install individually:

```bash
pip install -e submodules/xorl-client
pip install -e "submodules/xorl-sglang/python[all]"
```

Or use the bundled `pyproject.sglang.toml` which pins PyTorch to 2.9.1 (required by sglang) and installs everything together:

**uv:**
```bash
cp pyproject.sglang.toml pyproject.toml
uv sync
source .venv/bin/activate
```

**conda:**
```bash
conda create -n xorl-sglang python=3.12
conda activate xorl-sglang
cp pyproject.sglang.toml pyproject.toml
pip install -e .
```

> **Note:** The default `pyproject.toml` uses PyTorch 2.10.0. sglang requires PyTorch 2.9.1, so the two cannot coexist in the same environment unless you use `pyproject.sglang.toml`.

See the [installation guide](https://togethercomputer.github.io/xorl-internal/getting-started/installation/) for full setup including optional dependencies (DeepEP, Flash Attention).

## ⚡ Quick Start

Expand Down Expand Up @@ -78,11 +133,14 @@ See the [quick start guide](https://togethercomputer.github.io/xorl/getting-star
|---|---|---|
| Qwen3 | Dense | `Qwen/Qwen3-8B`, `Qwen/Qwen3-32B`, ... |
| Qwen3-MoE | Mixture-of-Experts | `Qwen/Qwen3-30B-A3B`, `Qwen/Qwen3-235B-A22B`, ... |
| Qwen3.5 | Dense | `Qwen/Qwen3.5-7B`, ... |
| Qwen3.5-MoE | Mixture-of-Experts | `Qwen/Qwen3.5-35B-A3B`, `Qwen/Qwen3.5-397B-A17B`, ... |

Models are loaded directly from HuggingFace checkpoints — no preprocessing needed. See the [supported models](https://togethercomputer.github.io/xorl/models/) page for details.

---

## 🤝 Contributing


See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, coding conventions, and how to run tests.
30 changes: 26 additions & 4 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,28 @@ export default defineConfig({
],
},
{
label: "Server Training",
label: "Server Training for RL",
collapsed: true,
items: [
{ label: "Overview", slug: "server-training/overview" },
{ label: "Server Architecture", slug: "server-training/architecture" },
{ label: "API Reference", slug: "server-training/api-reference" },
{ label: "RL Training", slug: "server-training/rl-training" },
{
label: "Training Server (xorl)",
collapsed: true,
items: [
{ label: "Launching & Configuration", slug: "server-training/training-server/launching" },
{ label: "API Reference", slug: "server-training/training-server/api-reference" },
],
},
{ label: "Inference: xorl-sglang", slug: "server-training/sglang" },
{
label: "Client SDK (xorl-client)",
collapsed: true,
items: [
{ label: "Overview", slug: "server-training/client-sdk/overview" },
{ label: "Training Loop Patterns", slug: "server-training/client-sdk/training-loop" },
{ label: "Loss Functions", slug: "server-training/client-sdk/loss-functions" },
],
},
{
label: "Weight Sync",
collapsed: true,
Expand All @@ -53,6 +67,14 @@ export default defineConfig({
{ label: "Backend: nccl_broadcast", slug: "server-training/weight-sync/nccl-broadcast" },
],
},
{
label: "Examples",
collapsed: true,
items: [
{ label: "SFT on No Robots", slug: "server-training/examples/sft-no-robots" },
{ label: "Password Memorization", slug: "server-training/examples/password-memorization" },
],
},
],
},
{
Expand Down
119 changes: 119 additions & 0 deletions docs/src/assets/rl-architecture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading