AIDC-AI / Diffusion-SDPO

huggingface.co
Total runs: 0
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: November 11 2025
text-to-image

Introduction of Diffusion-SDPO

Model Details of Diffusion-SDPO

Diffusion-SDPO: Safeguarded Direct Preference Optimization for Diffusion Models

GitHub Repo

📝 Introduction

Diffusion-SDPO is a plug-in training rule for preference alignment of diffusion models. It computes an adaptive scale for the loser branch based on the alignment between winner and loser output-space gradients, so that each update theoretically does not increase the winner's loss to first order . This preserves the preferred output while still widening the preference margin. The safeguard is model-agnostic and drops into Diffusion-DPO, DSPO, and DMPO with negligible overhead. See our paper for details (derivation of the safety bound, the output-space approximation, and the closed-form solution).

This repository is the official implementation of paper Diffusion-SDPO .

image
🔧 Setup
pip install -r requirements.txt
📦 Model Checkpoints

All checkpoints are initialized from Stable Diffusion (SD1.5 or SDXL) and trained as described in the paper.
Each name below means {base model} + {DPO variant} with our safeguarded winner-preserving rule (SDPO) :

🚀 Model Training
Example: SD1.5 + Diffusion-DPO with SDPO safeguard

Start training by running the provided script. It auto-detects the number of GPUs and launches with accelerate .

bash scripts/train/sd15_diffusion_dpo.sh

Key arguments in this example

  • --train_method selects Diffusion-DPO as the baseline. Choices : [diffusion-dpo, dspo, dmpo]
  • --beta_dpo controls the DPO temperature or strength.
  • --use_winner_preserving enables our SDPO safeguard that rescales only the loser branch’s backward signal to avoid increasing the winner loss to first order.
  • --winner_preserving_mu sets the safeguard strength. Larger values are more conservative.
  • --mixed_precision bf16 and --allow_tf32 improve throughput on recent NVIDIA GPUs.
📊 Evaluation

We provide one-click evaluation scripts for SD1.5 and SDXL. They take a unet.pth checkpoint and will:

  1. generate images for three prompt groups: papv2 , hpsv2 , partiprompts
  2. compute PickScore , HPSv2 , Aesthetics , CLIP , and ImageReward
  3. print a summary to the console
  4. optionally, compare two model checkpoints and report per-metric win rates across all prompts

The prompts come from prompts/ :

  • papv2.json is deduplicated from the Pick-a-Pic v2 test set to ensure prompts are unique
  • hpsv2.json and partiprompts.json are standard prompt suites used for qualitative and quantitative checks integrated from HPDv2 and Parti .
Quick start

SD1.5 checkpoint

bash scripts/eval/test_sd15.sh /path/to/your/unet.pth

SDXL checkpoint

bash scripts/eval/test_sdxl.sh /path/to/your/unet.pth

Win-rate comparison

# A/B win-rate comparison across all prompts from one group (papv2, hpsv2, partiprompts)
# A.json / B.json are the generation manifests produced by your eval runs.

bash scripts/eval/test_vs.sh \
  --json_a path/to/A.json \
  --json_b path/to/B.json \
  --label_a "your label A" \
  --label_b "your label B"

Example:

bash scripts/eval/test_vs.sh \
  --json_a /path/to/sdxl/diffusion-dpo/hpsv2_seed0_1024x1024_50s_7.5cfg.json \
  --json_b /path/to/sdxl/dmpo/hpsv2_seed0_1024x1024_50s_7.5cfg.json \
  --label_a "diffusion_dpo_sdxl_hpsv2" \
  --label_b "dmpo_sdxl_hpsv2"
📚 Citation

If you find TeEFusion helpful, please cite our paper:

@article{fu2025diffusion,
  title={{Diffusion-SDPO}: Safeguarded Direct Preference Optimization for Diffusion Models},
  author={Fu, Minghao and Wang, Guo-Hua and Cui, Tianyu and Chen, Qing-Guo and Xu, Zhao and Luo, Weihua and Zhang, Kaifu},
  journal={arXiv:2511.03317},
  year={2025}
}
🙏 Acknowledgments

The code is built upon Diffusers , Transformers , Diffusion-DPO and DSPO .

📄 License

This project is licensed under the Apache License, Version 2.0 (SPDX-License-Identifier: Apache-2.0) with additional use restrictions. You can find the full text of the license(s) in the following path: ./LICENSE

🚨 Disclaimer

We used compliance checking algorithms during the training process, to ensure the compliance of the trained model(s) to the best of our ability. Due to complex data and the diversity of language model usage scenarios, we cannot guarantee that the model is completely free of copyright issues or improper content. If you believe anything infringes on your rights or generates improper content, please contact us, and we will promptly address the matter.

Runs of AIDC-AI Diffusion-SDPO on huggingface.co

0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About Diffusion-SDPO huggingface.co Model

More Diffusion-SDPO license Visit here:

https://choosealicense.com/licenses/apache-2.0

Diffusion-SDPO huggingface.co

Diffusion-SDPO huggingface.co is an AI model on huggingface.co that provides Diffusion-SDPO's model effect (), which can be used instantly with this AIDC-AI Diffusion-SDPO model. huggingface.co supports a free trial of the Diffusion-SDPO model, and also provides paid use of the Diffusion-SDPO. Support call Diffusion-SDPO model through api, including Node.js, Python, http.

Diffusion-SDPO huggingface.co Url

https://huggingface.co/AIDC-AI/Diffusion-SDPO

AIDC-AI Diffusion-SDPO online free

Diffusion-SDPO huggingface.co is an online trial and call api platform, which integrates Diffusion-SDPO's modeling effects, including api services, and provides a free online trial of Diffusion-SDPO, you can try Diffusion-SDPO online for free by clicking the link below.

AIDC-AI Diffusion-SDPO online free url in huggingface.co:

https://huggingface.co/AIDC-AI/Diffusion-SDPO

Diffusion-SDPO install

Diffusion-SDPO is an open source model from GitHub that offers a free installation service, and any user can find Diffusion-SDPO on GitHub to install. At the same time, huggingface.co provides the effect of Diffusion-SDPO install, users can directly use Diffusion-SDPO installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

Diffusion-SDPO install url in huggingface.co:

https://huggingface.co/AIDC-AI/Diffusion-SDPO

Url of Diffusion-SDPO

Diffusion-SDPO huggingface.co Url

Provider of Diffusion-SDPO huggingface.co

AIDC-AI
ORGANIZATIONS

Other API from AIDC-AI

huggingface.co

Total runs: 117.5K
Run Growth: 4.7K
Growth Rate: 3.98%
Updated:August 15 2025
huggingface.co

Total runs: 18.8K
Run Growth: 14.3K
Growth Rate: 76.35%
Updated:February 13 2026
huggingface.co

Total runs: 12.5K
Run Growth: -13.7K
Growth Rate: -109.21%
Updated:February 13 2026
huggingface.co

Total runs: 11.3K
Run Growth: -35.3K
Growth Rate: -312.00%
Updated:August 15 2025
huggingface.co

Total runs: 1.6K
Run Growth: 0
Growth Rate: 0.00%
Updated:February 26 2025
huggingface.co

Total runs: 1.4K
Run Growth: 270
Growth Rate: 19.58%
Updated:March 04 2025
huggingface.co

Total runs: 982
Run Growth: -45.0K
Growth Rate: -4582.28%
Updated:August 15 2025
huggingface.co

Total runs: 688
Run Growth: 387
Growth Rate: 56.25%
Updated:August 15 2025
huggingface.co

Total runs: 426
Run Growth: -476
Growth Rate: -111.74%
Updated:July 03 2025
huggingface.co

Total runs: 398
Run Growth: -7
Growth Rate: -1.76%
Updated:November 23 2024
huggingface.co

Total runs: 326
Run Growth: 320
Growth Rate: 98.16%
Updated:June 09 2026
huggingface.co

Total runs: 300
Run Growth: -37
Growth Rate: -12.33%
Updated:August 15 2025
huggingface.co

Total runs: 59
Run Growth: -898
Growth Rate: -1522.03%
Updated:February 28 2025
huggingface.co

Total runs: 39
Run Growth: 28
Growth Rate: 71.79%
Updated:May 29 2025
huggingface.co

Total runs: 38
Run Growth: -6
Growth Rate: -15.79%
Updated:August 15 2025
huggingface.co

Total runs: 27
Run Growth: 9
Growth Rate: 33.33%
Updated:November 21 2024
huggingface.co

Total runs: 13
Run Growth: 8
Growth Rate: 61.54%
Updated:July 30 2025
huggingface.co

Total runs: 11
Run Growth: -14
Growth Rate: -127.27%
Updated:November 21 2024
huggingface.co

Total runs: 6
Run Growth: 1
Growth Rate: 16.67%
Updated:August 19 2025
huggingface.co

Total runs: 6
Run Growth: 0
Growth Rate: 0.00%
Updated:November 14 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:December 19 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:December 03 2025