> ## Documentation Index
> Fetch the complete documentation index at: https://miles.radixark.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Miles-Diffusion Documentation

[Miles-diffusion](https://github.com/radixark/miles_diffusion) is currently a standalone repository built on
[Miles](https://github.com/radixark/miles)' design philosophy, focused on RL post-training for image and video diffusion
models. [sglang-diffusion](https://github.com/sgl-project/sglang/tree/main/python/sglang/multimodal_gen) serves the
rollout, and the DiT trains under **FSDP2** on a backend that co-evolves with Miles' own. Models load from a diffusers
pipeline, or from a native package when a family brings its own modeling. Shipped recipes carry explicit
[verification levels](https://miles.radixark.com/docs/diffusion/user-guide/recipe-verification.md). Custom rewards, losses, and rollout functions plug in through flags.

## Core features

* **Verified Recipes for Latest Diffusion Models.** Launchers for Wan2.2-T2V-A14B, Qwen-Image,
  LTX-2.3, Cosmos3-Nano, SD3.5, Krea-2, FLUX 3 Image Klein, and MiniMax H3. `TrainPipelineConfig` allows for easy
  model support.
* **Quality control on three fronts.** Deterministic mode supports bit-for-bit comparisons for recipes covered by
  committed E2E standards; sglang-side monkey patches reduce train/rollout mismatches; and an FSDP2 param-dtype patch
  provides per-parameter fp32 control under the mixed-precision policy. See [Deterministic
  Training](https://miles.radixark.com/docs/diffusion/advanced/deterministic.md) and [Dtype Control](https://miles.radixark.com/docs/diffusion/advanced/dtype-control.md).
* **SFT, DiffusionNFT, and Flow-GRPO under one trainer.** The loss type, training-batch preparation, rollout function,
  and reward function are all **replaceable components**, so integrating a new algorithm — or swapping in your own
  customized component — is easy.
* **Sglang native.** Rollout runs **on the inference engine itself** — the sglang-diffusion serving stack — with RL
  support and optimizations living engine-side. An optional curated set of monkey patches aligns selected engine
  operations with the training-side forward.
* **Multiple parallelisms.** The rollout engines scale with **tensor and sequence parallelism** to support large models
  and very long contexts; training scales with **USP (Ulysses × Ring)**, built from each family's diffusers `_cp_plan` —
  or a self-written one — for agile model integration.
* **LoRA training support.** With `--lora-ipc-weight-sync`, PEFT LoRA on the FSDP2 actor ships only
  `lora_A`/`lora_B` pairs to colocated rollout engines over CUDA IPC; the engine merges them into its weights or
  evaluates them unmerged, per `--sglang-lora-merge-mode`. See
  [LoRA Training and Weight Sync](https://miles.radixark.com/docs/diffusion/advanced/lora.md).

## Supported models

Each model name links to its recipe page. Every documented recipe is labeled with a
[recipe verification level](https://miles.radixark.com/docs/diffusion/user-guide/recipe-verification.md). SD3.5, Qwen-Image, Wan2.2,
LTX-2.3, Cosmos3-Nano, and MiniMax H3 also appear in the
[Miles model list](https://miles.radixark.com/docs/index.md#supported-models).

| Model | Task | Canonical recipes |
| - | - | - |
| [Stable Diffusion 3.5](https://miles.radixark.com/docs/diffusion/models/sd3/sd3.md) | T2I | Flow-GRPO + OCR, Flow-GRPO + HPSv2.1, Flow-GRPO + OCR & PickScore, DiffusionNFT + PickScore |
| [Qwen-Image](https://miles.radixark.com/docs/diffusion/models/qwen-image/qwen-image.md) | T2I | Flow-GRPO + PickScore (flow\_grpo-aligned) |
| [Qwen-Image 2.1](https://miles.radixark.com/docs/diffusion/models/qwen-image/qwen-image-21.md) | T2I | Flow-GRPO + PickScore |
| [Wan2.2-T2V-A14B](https://miles.radixark.com/docs/diffusion/models/wan/wan2-2.md) | T2V | Flow-GRPO + PickScore, LoRA SFT |
| [LTX-2.3](https://miles.radixark.com/docs/diffusion/models/ltx/ltx2.md) | T2V | Flow-GRPO + PickScore |
| [Cosmos3-Nano](https://miles.radixark.com/docs/diffusion/models/cosmos/cosmos3.md) | T2I | Flow-GRPO + PickScore |
| [Krea-2](https://miles.radixark.com/docs/diffusion/models/krea/krea2.md) | T2I | DiffusionNFT + OCR (2- and 8-GPU sync, 6 + 2 async) |
| [FLUX 3 Image Klein](https://miles.radixark.com/docs/diffusion/models/flux3/flux3-image.md) | T2I | DiffusionNFT + PickScore (LoRA), Flow-GRPO + HPSv2.1 (full finetune) |
| [MiniMax H3](https://miles.radixark.com/docs/diffusion/models/h3/h3.md) | T2VA | Flow-GRPO + PickScore (t2va, video branch, 2 GPUs), LoRA SFT (t2va, 8 GPUs) |

## Feature support matrix

* ✅ **Recipe-backed** — exercised by a canonical recipe in `scripts/` or a CI test.
* 🟡 **Implemented** — the code path exists, but no shipped recipe or test covers this combination yet.
* ❌ **Not supported** — no working code path for this combination today.

| | SD3.5 | Qwen-Image | Wan2.2 | LTX-2.3 | Cosmos3 |
| - | - | - | - | - | - |
| Flow-GRPO (`policy_loss`) | ✅ | ✅ | ✅ | ✅ | ✅ |
| DiffusionNFT (`nft`) | ✅ | 🟡 | 🟡 | 🟡 | 🟡 |
| SFT (`sft_loss`, `--train-only`) | ❌ | ❌ | ✅ | ❌ | ❌ |
| LoRA + IPC weight sync | ✅ | ✅ | ✅ | 🟡 | ✅ |
| Single-prompt multi-gen (microgroup > 1) | ✅ | ✅ | ✅ | 🟡 | ❌ |
| USP sequence parallelism | ❌ | ❌ | ✅ | ❌ | ❌ |
| Deterministic mode | ✅ | ✅ | ✅ | ✅ | ✅ |

The built-in SFT rollout encodes only Wan2.2 and MiniMax H3 (`miles/rollout/encoder_hub/`); other families need a custom
encoder or rollout.

## Start here

1. **[Installation](https://miles.radixark.com/docs/diffusion/getting-started/installation.md)** — Docker image, pinned dependency versions, bare-metal setup.
2. **[Quick Start](https://miles.radixark.com/docs/diffusion/getting-started/quick-start.md)** — a working Flow-GRPO run on SD3.5 with 2 GPUs.
3. **[Core Concepts](https://miles.radixark.com/docs/diffusion/user-guide/concepts.md)** — the four objects in every miles-diffusion job and the loop that connects
   them.
4. **[Launch Scripts](https://miles.radixark.com/docs/diffusion/user-guide/launch-script.md)** — every argument group in a launch script, annotated.
5. **[Rewards](https://miles.radixark.com/docs/diffusion/user-guide/rewards.md)** — built-in reward models and custom reward hooks.
6. **Model guides** — per-model config and recipes, starting from the [supported models](#supported-models) table above.

## Contribute

* GitHub: [github.com/radixark/miles\_diffusion](https://github.com/radixark/miles_diffusion)
* Miles (LLM RL): [github.com/radixark/miles](https://github.com/radixark/miles)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.