Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

ADG: Angle Domain Guidance: Latent Diffusion Requires Rotation Rather Than Extrapolation

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


🔧 Overview

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.

🚀 Quick Start

1. Set Up Environment

# 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 accelerate

2. Run ADG

Run 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")

📊 Visualization & Reproducibility

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.


Note on Earlier Stable Diffusion Models

Thanks to the community feedback for pointing out the low-saturation issue when adapting ADG to SD1.5. We note that ADG is mainly recommended for newer latent diffusion models, such as Stable Diffusion 3 / 3.5. Earlier models such as Stable Diffusion 1.5 may depend more strongly on classifier-free guidance extrapolation to improve saturation and contrast. Since ADG replaces extrapolation with bounded angle-domain rotation, directly applying it to these earlier models may lead to lower-saturation images. We therefore recommend using ADG with more recent diffusion models.


📎 Citation

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}
}

About

No description, website, or topics provided.

Resources

Stars

11 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages