Reinforcement Learning Framework for Visual Generation
See the code
|
GenRLReinforcement Learning Framework for Visual Generation |
GenRL is a scalable, modular reinforcement learning framework for optimizing visual generation models — from images to videos — with plug-and-play reward functions, multi-GPU distributed training, and first-class support for diffusion & flow-based generators.
🚀 Getting Started · 📖 Algorithms · 🏛️ Model Zoo · 📊 Performance · 🏗️ Architecture
| Algorithm | Type | Status | Description |
|---|---|---|---|
| FlowGRPO | Policy Gradient | ✅ Supported | Group Relative Policy Optimization — compute advantages per-group with optional per-prompt stat tracking |
| MixGRPO | Policy Gradient | ✅ Supported | SDE sampling and GRPO-guided optimization only within the window |
| CPS | Policy Gradient | ✅ Supported | A novel sampling formulation that adheres to the Coefficient-Preserving property |
| LongCat-Video | Policy Gradient | ✅ Supported | Strong performance with multi-reward RLHF |
| DiffusionNFT | Reward-conditioned Fine-tuning | 🚧 Coming Soon | Online RL paradigm that optimizes diffusion models directly on the forward process via flow matching |
| ReFL | Differentiable Reward Optimization | 🚧 Coming Soon | A direct tuning algorithm to optimize diffusion models against a scorer |
| DiffusionDPO | DPO | 🚧 Coming Soon | Direct Preference Optimization (DPO), a simpler alternative to RLHF which directly optimizes a policy under a classification objective. |
💡 GenRL is designed to be algorithm-agnostic. Adding a new RL algorithm only requires implementing a new trainer — everything else (rewards, data, logging) is reusable. For GRPO-based algorithms, most implementations only need to modify a small amount of code in the trainer.
| Model | Modality | Parameters | Status |
|---|---|---|---|
| Wan2.1-T2V | Text → Video | 1.3B | ✅ Supported |
| Wan2.1-T2V | Text → Video | 14B | ✅ Supported |
| Wan2.2-T2V | Text → Video | 14B | 🚧 Coming Soon |
| Wan2.2-I2V | Image → Video | 14B | 🚧 Coming Soon |
| HunyuanImage-3.0-Instruct | Image → Image | 80B | 🚧 Coming Soon |
| Reward | Domain | Source | Description |
|---|---|---|---|
video_ocr | 📝 Text | Built-in | OCR accuracy reward — measures text rendering quality via PaddleOCR |
hpsv3_general | 🖼️ Aesthetics | HPSv3 | Human Preference Score v3 — general aesthetic quality |
hpsv3_percentile | 🖼️ Aesthetics | HPSv3 | HPSv3 percentile-based reward normalization |
videoalign_mq | 🎬 Motion | VideoAlign | Video motion quality assessment |
videoalign_ta | 🎬 Alignment | VideoAlign | Video text-alignment score |
| Custom | 🔧 Any | User-defined | Bring your own reward via reward_module config |
🔗 Multiple rewards can be composed with configurable weights — GenRL supports both reward-weighted and advantage-weighted composition modes.
FlowGRPO Original |
GenRL FlowGRPO |
Performance Comparison: Under the same settings (using config/default.yaml with 8 GPU training), the original FlowGRPO repository reaches an OCR score of approximately 0.28 at around 3k steps, while our GenRL implementation achieves an OCR score close to 0.3 at only 1.2k steps, demonstrating superior training efficiency and convergence.
HPSv3 General |
HPSv3 Percentile |
VideoAlign-MQ |
VideoAlign-TA |
LongCat Reproduction: Our GenRL implementation successfully reproduces LongCat (not yet open-sourced) on the Wan2.1-T2V 1.3B model. Training with 64 H100 GPUs up to 1.5k steps, all four reward metrics continue to improve normally, demonstrating stable and effective multi-reward RLHF training. The training dataset consists of ~200k carefully filtered prompts (datasets/filtered_prompts/), ensuring high-quality training data for optimal RL performance.
The following video demonstrates the quality improvement achieved by GenRL training:
Video Layout: The video consists of 8 sub-videos arranged in a 2×4 grid:
Important: This repository uses Git LFS for large dataset files. Make sure Git LFS is installed before cloning.
# Install Git LFS (if not already installed)
# Ubuntu/Debian
sudo apt-get install git-lfs
# macOS
brew install git-lfs
# Initialize Git LFS
git lfs install
# Clone the repository (Git LFS will automatically download large files)
git clone https://github.com/ModelTC/GenRL.git
cd GenRL
💡 Note: The
datasets/filtered_prompts/directory contains large JSON files (~300MB) stored with Git LFS. If you encounter download issues, you can manually pull LFS files withgit lfs pull.
pip install -r requirements.txt
git submodule update --init --recursive
videoalign_mq / videoalign_ta rewards)cd genrl/reward/VideoAlign/checkpoints
git lfs install
git clone https://huggingface.co/KwaiVGI/VideoReward
mv VideoReward/* .
mv VideoReward/.* . 2>/dev/null || true
rm -rf VideoReward
cd ../../../..
video_ocr reward)python -c "from paddleocr import PaddleOCR; ocr = PaddleOCR(use_angle_cls=False, lang='en', use_gpu=False, show_log=False)"
hpsv3_general / hpsv3_percentile rewards)pip install flash-attn==2.7.4.post1 --no-build-isolation
# Single node, 8 GPUs (LoRA + FSDP)
accelerate launch train.py --config config/default.yaml
# Multi-node (8 nodes × 8 GPUs)
torchrun --nnodes=8 --nproc_per_node=8 \
--rdzv_backend=c10d \
--rdzv_endpoint=${MASTER_ADDR}:${MASTER_PORT} \
train.py --config config/longcat.yaml
Trained models (LoRA adapters or full-parameter checkpoints) can be directly used for inference (exemplified by Wan2.1-T2V-1.3B-Diffusers with LoRA training):
Using Diffusers Library (PEFT-compatible):
import torch
from diffusers import AutoencoderKLWan, WanPipeline
from diffusers.utils import export_to_video
from peft import PeftModel
# Available models: Wan-AI/Wan2.1-T2V-14B-Diffusers, Wan-AI/Wan2.1-T2V-1.3B-Diffusers
model_id = "Wan-AI/Wan2.1-T2V-1.3B-Diffusers"
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
pipe.to("cuda")
# Load LoRA adapter (if using LoRA training)
pipe.transformer = PeftModel.from_pretrained(
pipe.transformer,
"path/to/final_model/transformer" # Path to LoRA checkpoint after training
)
prompt = "A cat walks on the grass, realistic"
negative_prompt = "Bright tones, overexposed, static, blurred details, worst quality, low quality"
output = pipe(
prompt=prompt,
negative_prompt=negative_prompt,
height=480,
width=832,
num_frames=81,
guidance_scale=5.0
).frames[0]
export_to_video(output, "output.mp4", fps=15)
Using LightX2V (for accelerated inference):
import torch
from diffusers import AutoencoderKLWan, WanPipeline
from peft import PeftModel
# Load base model
model_id = "Wan-AI/Wan2.1-T2V-1.3B-Diffusers"
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
# Load and merge LoRA adapter
pipe.transformer = PeftModel.from_pretrained(
pipe.transformer,
"path/to/final_model/transformer" # Path to LoRA checkpoint
)
pipe.transformer = pipe.transformer.merge_and_unload() # Merge LoRA weights into base model
# Save merged model (optional)
merged_model_path = "path/to/merged_model"
pipe.save_pretrained(merged_model_path)
After merging, you can directly use LightX2V for accelerated inference. See the LightX2V inference script for example usage.
💡 Note: LoRA adapters saved by GenRL are fully compatible with the PEFT library, allowing seamless integration with standard diffusers workflows and third-party inference frameworks like LightX2V.
GenRL/
├── 🚀 train.py # Entry point
├── 📁 config/ # YAML configs
│ ├── default.yaml # Default (OCR, FlowGRPO)
│ └── longcat.yaml # Multi-reward, LongCat
├── 📁 genrl/
│ ├── config.py # Config schema & loader
│ ├── constants.py # Global constants
│ ├── data.py # Dataset & dataloaders
│ ├── rewards.py # Multi-reward composition
│ ├── advantages.py # Advantage computation (GRPO)
│ ├── stat_tracking.py # Per-prompt stat tracking
│ ├── ema.py # EMA wrapper
│ ├── 📁 trainer/
│ │ ├── base_trainer.py # Abstract base trainer
│ │ ├── wan_trainer.py # Wan model trainer
│ │ ├── sampling.py # Sampling epoch logic
│ │ ├── evaluation.py # Eval & video logging
│ │ ├── diffusion.py # Log-prob computation
│ │ └── embeddings.py # Text embedding utils
│ ├── 📁 reward/
│ │ ├── ocr.py # OCR reward
│ │ ├── hpsv3.py # HPSv3 reward
│ │ ├── videoalign.py # VideoAlign rewards
│ │ ├── 📁 HPSv3/ # HPSv3 submodule
│ │ └── 📁 VideoAlign/ # VideoAlign submodule
│ └── 📁 diffusers_patch/
│ └── wan_pipeline_with_logprob.py # SDE step with log-prob
├── 📁 datasets/ # Prompt datasets
└── 📁 scripts/
└── launch.sh # Launch script
All training behavior is controlled by a single YAML file. Key sections:
| Section | What it controls |
|---|---|
reward_fn | Reward functions & weights (e.g., video_ocr: 1.0, hpsv3_general: 1.0) |
sample | Sampling: batch size, num steps, guidance scale, SDE type, noise level |
train | Training: learning rate, clip range, advantage clipping, LoRA rank, EMA |
accelerate | Distributed: FSDP, mixed precision, num GPUs/nodes |
paths | Model path, dataset path, save directory, resume checkpoint |
config/default.yaml)run_name: my_experiment
seed: 42
num_epochs: 100000
height: 240
width: 416
frames: 33
reward_fn:
video_ocr: 1.0
trainer: wan
use_lora: true
sample:
batch_size: 8
num_steps: 20
guidance_scale: 4.5
sde_type: flow_sde
train:
learning_rate: 1.0e-4
clip_range: 1.0e-3
lora_r: 32
ema: true
accelerate:
distributed_type: FSDP
mixed_precision: bf16
num_processes: 8
logs/
└── <experiment>/
└── <run_name>_<timestamp>/
├── 📁 checkpoints/ # Periodic checkpoints
│ └── checkpoint-{step}/
│ ├── ema/ # EMA states (if enabled)
│ ├── unwrapped_model/ # Model weights
│ │ └── transformer/
│ │ ├── adapter_config.json # LoRA config (if LoRA)
│ │ ├── adapter_model.safetensors # LoRA weights (if LoRA)
│ │ └── README.md # Model card
│ ├── optimizer_0/ # Optimizer states (for resuming)
│ ├── pytorch_model_fsdp_0/ # FSDP sharded model states
│ ├── random_states_*.pkl # Random states for each rank (for reproducibility)
│ └── metadata.json # Step & config metadata
├── 📁 final_model/ # Final trained model
│ └── transformer/
│ ├── adapter_config.json # LoRA config (if LoRA)
│ └── adapter_model.safetensors # LoRA weights (if LoRA)
├── 📁 eval_videos/ # Evaluation videos
└── 📁 sample_videos/ # Training sample videos
| Feature | Details |
|---|---|
| 🎯 RL Algorithm | GRPO with per-prompt stat tracking & advantage clipping |
| 🧬 SDE Types | flow_sde, flow_cps — unified SDE formulation for rectified flow |
| 🪟 Windowed Training | sde_window_size / sde_window_range for timestep sub-sampling |
| 📊 Reward Composition | Multi-reward weighted sum, advantage-weighted mode |
| 🧮 KL Regularization | Optional KL reward to constrain policy drift |
| 🎚️ Guidance | Configurable classifier-free guidance for sampling & evaluation |
| 💾 Checkpointing | Periodic + final model saves with FSDP sharded state dict |
| 📈 Logging | WandB integration with training curves, sample videos, eval videos |
| 🔁 EMA | Exponential moving average with configurable decay & update interval |
| 🧩 LoRA | PEFT LoRA with configurable rank, alpha, and target modules |
| 🔒 Reproducibility | Deterministic seeding with SEED_EPOCH_STRIDE for all stochastic ops |
We provide LoRA checkpoints fine-tuned with reinforcement learning (GRPO) on the Wan2.1-T2V-1.3B model. More checkpoints will be released soon.
| Model | Steps | LoRA Rank | HuggingFace |
|---|---|---|---|
| Wan2.1-T2V-1.3B-longcat-step500 | 500 | 128 | 🤗 Link |
| Wan2.1-T2V-1.3B-longcat-step1000 | 1000 | 128 | 🤗 Link |
| Wan2.1-T2V-1.3B-longcat-step1500 | 1500 | 128 | 🤗 Link |
GenRL is built upon the excellent work of the open-source community. We would like to thank:
GenRL is licensed under the Apache License 2.0.
See LICENSE.txt for the full license text.
If you find GenRL useful in your research, please cite:
@misc{genrl,
author = {GenRL Contributors},
title = {GenRL: Reinforcement Learning Framework for Visual Generation},
year = {2026},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/ModelTC/GenRL}},
}
If you find GenRL useful, please give us a ⭐!
114 commits
Python
99.7%
Reinforcement Learning Framework for Visual Generation
See the code
|
GenRLReinforcement Learning Framework for Visual Generation |
GenRL is a scalable, modular reinforcement learning framework for optimizing visual generation models — from images to videos — with plug-and-play reward functions, multi-GPU distributed training, and first-class support for diffusion & flow-based generators.
🚀 Getting Started · 📖 Algorithms · 🏛️ Model Zoo · 📊 Performance · 🏗️ Architecture
| Algorithm | Type | Status | Description |
|---|---|---|---|
| FlowGRPO | Policy Gradient | ✅ Supported | Group Relative Policy Optimization — compute advantages per-group with optional per-prompt stat tracking |
| MixGRPO | Policy Gradient | ✅ Supported | SDE sampling and GRPO-guided optimization only within the window |
| CPS | Policy Gradient | ✅ Supported | A novel sampling formulation that adheres to the Coefficient-Preserving property |
| LongCat-Video | Policy Gradient | ✅ Supported | Strong performance with multi-reward RLHF |
| DiffusionNFT | Reward-conditioned Fine-tuning | 🚧 Coming Soon | Online RL paradigm that optimizes diffusion models directly on the forward process via flow matching |
| ReFL | Differentiable Reward Optimization | 🚧 Coming Soon | A direct tuning algorithm to optimize diffusion models against a scorer |
| DiffusionDPO | DPO | 🚧 Coming Soon | Direct Preference Optimization (DPO), a simpler alternative to RLHF which directly optimizes a policy under a classification objective. |
💡 GenRL is designed to be algorithm-agnostic. Adding a new RL algorithm only requires implementing a new trainer — everything else (rewards, data, logging) is reusable. For GRPO-based algorithms, most implementations only need to modify a small amount of code in the trainer.
| Model | Modality | Parameters | Status |
|---|---|---|---|
| Wan2.1-T2V | Text → Video | 1.3B | ✅ Supported |
| Wan2.1-T2V | Text → Video | 14B | ✅ Supported |
| Wan2.2-T2V | Text → Video | 14B | 🚧 Coming Soon |
| Wan2.2-I2V | Image → Video | 14B | 🚧 Coming Soon |
| HunyuanImage-3.0-Instruct | Image → Image | 80B | 🚧 Coming Soon |
| Reward | Domain | Source | Description |
|---|---|---|---|
video_ocr | 📝 Text | Built-in | OCR accuracy reward — measures text rendering quality via PaddleOCR |
hpsv3_general | 🖼️ Aesthetics | HPSv3 | Human Preference Score v3 — general aesthetic quality |
hpsv3_percentile | 🖼️ Aesthetics | HPSv3 | HPSv3 percentile-based reward normalization |
videoalign_mq | 🎬 Motion | VideoAlign | Video motion quality assessment |
videoalign_ta | 🎬 Alignment | VideoAlign | Video text-alignment score |
| Custom | 🔧 Any | User-defined | Bring your own reward via reward_module config |
🔗 Multiple rewards can be composed with configurable weights — GenRL supports both reward-weighted and advantage-weighted composition modes.
FlowGRPO Original |
GenRL FlowGRPO |
Performance Comparison: Under the same settings (using config/default.yaml with 8 GPU training), the original FlowGRPO repository reaches an OCR score of approximately 0.28 at around 3k steps, while our GenRL implementation achieves an OCR score close to 0.3 at only 1.2k steps, demonstrating superior training efficiency and convergence.
HPSv3 General |
HPSv3 Percentile |
VideoAlign-MQ |
VideoAlign-TA |
LongCat Reproduction: Our GenRL implementation successfully reproduces LongCat (not yet open-sourced) on the Wan2.1-T2V 1.3B model. Training with 64 H100 GPUs up to 1.5k steps, all four reward metrics continue to improve normally, demonstrating stable and effective multi-reward RLHF training. The training dataset consists of ~200k carefully filtered prompts (datasets/filtered_prompts/), ensuring high-quality training data for optimal RL performance.
The following video demonstrates the quality improvement achieved by GenRL training:
Video Layout: The video consists of 8 sub-videos arranged in a 2×4 grid:
Important: This repository uses Git LFS for large dataset files. Make sure Git LFS is installed before cloning.
# Install Git LFS (if not already installed)
# Ubuntu/Debian
sudo apt-get install git-lfs
# macOS
brew install git-lfs
# Initialize Git LFS
git lfs install
# Clone the repository (Git LFS will automatically download large files)
git clone https://github.com/ModelTC/GenRL.git
cd GenRL
💡 Note: The
datasets/filtered_prompts/directory contains large JSON files (~300MB) stored with Git LFS. If you encounter download issues, you can manually pull LFS files withgit lfs pull.
pip install -r requirements.txt
git submodule update --init --recursive
videoalign_mq / videoalign_ta rewards)cd genrl/reward/VideoAlign/checkpoints
git lfs install
git clone https://huggingface.co/KwaiVGI/VideoReward
mv VideoReward/* .
mv VideoReward/.* . 2>/dev/null || true
rm -rf VideoReward
cd ../../../..
video_ocr reward)python -c "from paddleocr import PaddleOCR; ocr = PaddleOCR(use_angle_cls=False, lang='en', use_gpu=False, show_log=False)"
hpsv3_general / hpsv3_percentile rewards)pip install flash-attn==2.7.4.post1 --no-build-isolation
# Single node, 8 GPUs (LoRA + FSDP)
accelerate launch train.py --config config/default.yaml
# Multi-node (8 nodes × 8 GPUs)
torchrun --nnodes=8 --nproc_per_node=8 \
--rdzv_backend=c10d \
--rdzv_endpoint=${MASTER_ADDR}:${MASTER_PORT} \
train.py --config config/longcat.yaml
Trained models (LoRA adapters or full-parameter checkpoints) can be directly used for inference (exemplified by Wan2.1-T2V-1.3B-Diffusers with LoRA training):
Using Diffusers Library (PEFT-compatible):
import torch
from diffusers import AutoencoderKLWan, WanPipeline
from diffusers.utils import export_to_video
from peft import PeftModel
# Available models: Wan-AI/Wan2.1-T2V-14B-Diffusers, Wan-AI/Wan2.1-T2V-1.3B-Diffusers
model_id = "Wan-AI/Wan2.1-T2V-1.3B-Diffusers"
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
pipe.to("cuda")
# Load LoRA adapter (if using LoRA training)
pipe.transformer = PeftModel.from_pretrained(
pipe.transformer,
"path/to/final_model/transformer" # Path to LoRA checkpoint after training
)
prompt = "A cat walks on the grass, realistic"
negative_prompt = "Bright tones, overexposed, static, blurred details, worst quality, low quality"
output = pipe(
prompt=prompt,
negative_prompt=negative_prompt,
height=480,
width=832,
num_frames=81,
guidance_scale=5.0
).frames[0]
export_to_video(output, "output.mp4", fps=15)
Using LightX2V (for accelerated inference):
import torch
from diffusers import AutoencoderKLWan, WanPipeline
from peft import PeftModel
# Load base model
model_id = "Wan-AI/Wan2.1-T2V-1.3B-Diffusers"
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
# Load and merge LoRA adapter
pipe.transformer = PeftModel.from_pretrained(
pipe.transformer,
"path/to/final_model/transformer" # Path to LoRA checkpoint
)
pipe.transformer = pipe.transformer.merge_and_unload() # Merge LoRA weights into base model
# Save merged model (optional)
merged_model_path = "path/to/merged_model"
pipe.save_pretrained(merged_model_path)
After merging, you can directly use LightX2V for accelerated inference. See the LightX2V inference script for example usage.
💡 Note: LoRA adapters saved by GenRL are fully compatible with the PEFT library, allowing seamless integration with standard diffusers workflows and third-party inference frameworks like LightX2V.
GenRL/
├── 🚀 train.py # Entry point
├── 📁 config/ # YAML configs
│ ├── default.yaml # Default (OCR, FlowGRPO)
│ └── longcat.yaml # Multi-reward, LongCat
├── 📁 genrl/
│ ├── config.py # Config schema & loader
│ ├── constants.py # Global constants
│ ├── data.py # Dataset & dataloaders
│ ├── rewards.py # Multi-reward composition
│ ├── advantages.py # Advantage computation (GRPO)
│ ├── stat_tracking.py # Per-prompt stat tracking
│ ├── ema.py # EMA wrapper
│ ├── 📁 trainer/
│ │ ├── base_trainer.py # Abstract base trainer
│ │ ├── wan_trainer.py # Wan model trainer
│ │ ├── sampling.py # Sampling epoch logic
│ │ ├── evaluation.py # Eval & video logging
│ │ ├── diffusion.py # Log-prob computation
│ │ └── embeddings.py # Text embedding utils
│ ├── 📁 reward/
│ │ ├── ocr.py # OCR reward
│ │ ├── hpsv3.py # HPSv3 reward
│ │ ├── videoalign.py # VideoAlign rewards
│ │ ├── 📁 HPSv3/ # HPSv3 submodule
│ │ └── 📁 VideoAlign/ # VideoAlign submodule
│ └── 📁 diffusers_patch/
│ └── wan_pipeline_with_logprob.py # SDE step with log-prob
├── 📁 datasets/ # Prompt datasets
└── 📁 scripts/
└── launch.sh # Launch script
All training behavior is controlled by a single YAML file. Key sections:
| Section | What it controls |
|---|---|
reward_fn | Reward functions & weights (e.g., video_ocr: 1.0, hpsv3_general: 1.0) |
sample | Sampling: batch size, num steps, guidance scale, SDE type, noise level |
train | Training: learning rate, clip range, advantage clipping, LoRA rank, EMA |
accelerate | Distributed: FSDP, mixed precision, num GPUs/nodes |
paths | Model path, dataset path, save directory, resume checkpoint |
config/default.yaml)run_name: my_experiment
seed: 42
num_epochs: 100000
height: 240
width: 416
frames: 33
reward_fn:
video_ocr: 1.0
trainer: wan
use_lora: true
sample:
batch_size: 8
num_steps: 20
guidance_scale: 4.5
sde_type: flow_sde
train:
learning_rate: 1.0e-4
clip_range: 1.0e-3
lora_r: 32
ema: true
accelerate:
distributed_type: FSDP
mixed_precision: bf16
num_processes: 8
logs/
└── <experiment>/
└── <run_name>_<timestamp>/
├── 📁 checkpoints/ # Periodic checkpoints
│ └── checkpoint-{step}/
│ ├── ema/ # EMA states (if enabled)
│ ├── unwrapped_model/ # Model weights
│ │ └── transformer/
│ │ ├── adapter_config.json # LoRA config (if LoRA)
│ │ ├── adapter_model.safetensors # LoRA weights (if LoRA)
│ │ └── README.md # Model card
│ ├── optimizer_0/ # Optimizer states (for resuming)
│ ├── pytorch_model_fsdp_0/ # FSDP sharded model states
│ ├── random_states_*.pkl # Random states for each rank (for reproducibility)
│ └── metadata.json # Step & config metadata
├── 📁 final_model/ # Final trained model
│ └── transformer/
│ ├── adapter_config.json # LoRA config (if LoRA)
│ └── adapter_model.safetensors # LoRA weights (if LoRA)
├── 📁 eval_videos/ # Evaluation videos
└── 📁 sample_videos/ # Training sample videos
| Feature | Details |
|---|---|
| 🎯 RL Algorithm | GRPO with per-prompt stat tracking & advantage clipping |
| 🧬 SDE Types | flow_sde, flow_cps — unified SDE formulation for rectified flow |
| 🪟 Windowed Training | sde_window_size / sde_window_range for timestep sub-sampling |
| 📊 Reward Composition | Multi-reward weighted sum, advantage-weighted mode |
| 🧮 KL Regularization | Optional KL reward to constrain policy drift |
| 🎚️ Guidance | Configurable classifier-free guidance for sampling & evaluation |
| 💾 Checkpointing | Periodic + final model saves with FSDP sharded state dict |
| 📈 Logging | WandB integration with training curves, sample videos, eval videos |
| 🔁 EMA | Exponential moving average with configurable decay & update interval |
| 🧩 LoRA | PEFT LoRA with configurable rank, alpha, and target modules |
| 🔒 Reproducibility | Deterministic seeding with SEED_EPOCH_STRIDE for all stochastic ops |
We provide LoRA checkpoints fine-tuned with reinforcement learning (GRPO) on the Wan2.1-T2V-1.3B model. More checkpoints will be released soon.
| Model | Steps | LoRA Rank | HuggingFace |
|---|---|---|---|
| Wan2.1-T2V-1.3B-longcat-step500 | 500 | 128 | 🤗 Link |
| Wan2.1-T2V-1.3B-longcat-step1000 | 1000 | 128 | 🤗 Link |
| Wan2.1-T2V-1.3B-longcat-step1500 | 1500 | 128 | 🤗 Link |
GenRL is built upon the excellent work of the open-source community. We would like to thank:
GenRL is licensed under the Apache License 2.0.
See LICENSE.txt for the full license text.
If you find GenRL useful in your research, please cite:
@misc{genrl,
author = {GenRL Contributors},
title = {GenRL: Reinforcement Learning Framework for Visual Generation},
year = {2026},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/ModelTC/GenRL}},
}
If you find GenRL useful, please give us a ⭐!
114 commits
Python
99.7%