Tencent-Hunyuan/UniRL

UniRL is a Framework for Unified Multimodal Model Reinforcement Learning

UniRL – Reinforcement Learning for Unified Multimodal Models

What it is – UniRL is an open‑source Python framework that lets researchers and engineers apply a single reinforcement‑learning (RL) loop to a wide variety of multimodal generative models (text‑to‑image, text‑to‑video, vision‑language, large language models, and “unified” models that combine autoregressive and diffusion components). The loop is the classic RL post‑training cycle: generate samples, score them with a reward service, compute advantages, update the policy, and sync the new weights back to the rollout workers.

Key ideas

  • Layered, composable architecture – entry‑points are driven by Hydra configs and instantiate a trainer that wires together:
    • Rollout engines (vLLM‑Omni, SGLang, etc.)
    • RL algorithms (both standard ones like GRPO and team‑proposed ones such as Flow‑DPPO, DRPO, CPPO)
    • Model bundles (diffusion, AR, unified models)
    • Reward services (any external scorer)
    • Distributed runtime (Ray DevicePool, FSDP, LoRA/full‑weight sync)
  • Multiple training modes – diffusion RL, autoregressive (AR) RL, supervised fine‑tuning (SFT), prompt‑enhancement, unified RL, agentic RL, and async variants that separate rollout and training workers.
  • Broad model support – ready‑to‑run recipes for dozens of state‑of‑the‑art models (Stable Diffusion 3.5, FLUX.2‑Klein, Qwen‑Image, various video diffusion models, Qwen‑3 series LLMs/VLMs, HunyuanVideo, etc.). Each recipe is a YAML config that selects a model, algorithm, rollout backend, and any special flags.
  • Team‑proposed algorithms – novel RL methods introduced by the UniRL team:
    • Flow‑DPPO – divergence‑based trust‑region for diffusion/flow models.
    • DRPO – smooth advantage‑weighted quadratic regularizer for token‑level LLM RL.
    • CPPO – position‑weighted cumulative‑prefix trust‑region mask. All come with step‑by‑step tutorials and runnable examples.

How to use it

  1. Install (see INSTALL.md).
  2. Pick a recipe, e.g. diffusion/sd3/sd3_trainside.yaml.
  3. Run the entry‑point, e.g. python -m unirl.train_diffusion --config-name=diffusion/sd3/sd3_trainside.
  4. The framework launches rollout workers, generates samples, scores them, and updates the model automatically. Multi‑node and GPU‑slab configurations are supported.

Who it’s for – researchers building RL‑based fine‑tuning pipelines for generative AI, product teams that need a unified way to improve multimodal models with reward signals, and anyone wanting to experiment with the new algorithms (Flow‑DPPO, DRPO, CPPO) on top of popular diffusion or LLM back‑ends.

Documentation & community – full docs at https://unirl‑project.github.io/unirl/, a WeChat group for Chinese‑language discussion, and a roadmap that lists upcoming model/algorithm extensions.

License – Apache‑2.0.

Related

  • Project
  • Dispatch
  • Project
  • Project
  • Project