This repository contains the official implementation of ADG (Angle Domain Guidance), as presented in our paper accepted at ICML 2025.
π Paper: Angle Domain Guidance: Latent Diffusion Requires Rotation Rather Than Extrapolation
π Conference: International Conference on Machine Learning (ICML), 2025
Our method is built upon the diffusers library, offering a plug-and-play interface that requires minimal modification to existing workflows. This repository includes:
- The implementation of the proposed ADG algorithm.
- Example code to run ADG with Stable Diffusion 3.5-large.
- Scripts to reproduce key visualization results from the paper.
# Create and activate conda environment
conda create -n adg python=3.10 -y
conda activate adg
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install diffusers transformers accelerateRun the ADG-enhanced sampling pipeline using the following example:
from diffusers import StableDiffusion3Pipeline
from method.ADG_SD3 import ADG_SD3
import torch
# Load the base pipeline
pipeline = StableDiffusion3Pipeline.from_pretrained(
"stabilityai/stable-diffusion-3.5-large", torch_dtype=torch.float16
)
# Inject ADG into the pipeline
setattr(pipeline, 'ADG', ADG_SD3.__get__(pipeline))
# Generate an image using ADG
prompt = "what you want"
image = pipeline.ADG(
prompt=prompt,
num_inference_steps=10,
guidance_scale=4,
num_images_per_prompt=1
).images[0]
image.save("output.jpg")To reproduce the key visualizations from the paper and validate experimental results, please refer to vis.ipynb. This notebook demonstrates how ADG enhances consistency and efficiency in diffusion sampling.
If you find this work helpful, please consider citing:
@inproceedings{jinangle,
title={Angle Domain Guidance: Latent Diffusion Requires Rotation Rather Than Extrapolation},
author={Jin, Cheng and Xiao, Zhenyu and Liu, Chutao and Gu, Yuantao},
booktitle={Forty-second International Conference on Machine Learning}
}