Skip to content

zhushangwen/LTC-Accel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Accelerating Diffusion Sampling via Exploiting Local Transition Coherence

Sampling Time Comparison
(Results on Stable Diffusion v3.5. Left: 8-step LTC-Accel accelerated from 12-step original. Middle: 8-step original. Right: 12-step original.)

Why LTC-Accel

  • 🚀 Instant speed‑ups, zero retraining: Achieve significant sampling acceleration without touching your model weights.
  • 🔄 Architecturally agnostic: Seamlessly supports any base model and scheduler combination.
  • True plug‑and‑play: Drop it into your existing pipeline—no code rewrites, just faster results.

Updates

  • July 10, 2025: 🧪 Interactive Colab Demo released - experience LTC-Accel in real-time directly from your browser!
  • June 26, 2025: 🎉 Our paper accepted to ICCV 2025!
  • March 10, 2025: 🚀 Initial release of LTC-Accel with Stable Diffusion v3.5 support!

Instant Demo: Try on Colab

Before we dive into the details, we invite you to try our Quickstart Colab Demo to experience LTC-Accel's performance firsthand. Like what you see? A star would mean a lot to us!

Introduction

LTC-Accel is a training-free acceleration framework that enhances sampling efficiency in diffusion models by identifying and leveraging Local Transition Coherence (LTC) (shown in the left figure). Designed as model-agnostic solution, it integrates seamlessly with diverse pipelines while achieving up to 10× speedup when combined with distillation techniques.

image
image
(A concise illustration of the LTC‑Accel procedure.)

Quick Start

Installation

pip install -r requirements.txt

Usage

import torch
from diffusers import FlowMatchEulerDiscreteScheduler
from step import StableDiffusion3Pipeline  

torch.cuda.empty_cache()
def run_inference(device, model_id, inference_steps):
    torch.cuda.empty_cache()
    prompt = "A pretty girl with anime style"
    scheduler = FlowMatchEulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
    pipe = StableDiffusion3Pipeline.from_pretrained(
        model_id,
        torch_dtype=torch.bfloat16, 
    )
    pipe = pipe.to(device)
    pipe.scheduler = scheduler

    # Generate origrinal image
    gen1 = torch.Generator(device).manual_seed(0)
    images = pipe(prompt, num_inference_steps = inference_steps, l = inference_steps/4, r = inference_steps, device = device, generator = gen1).images  
    images[0].save(f"org_{inference_steps}steps.png")

    # Caluate w_g, one important step before applying LTC-Accel 
    # To show the convergence if w_g, we choose different seed
    gen2 = torch.Generator(device).manual_seed(1)
    images = pipe(prompt, num_inference_steps = inference_steps, cal_wg = True, skip_x = False, l = inference_steps/4, r = inference_steps, device = device, generator = gen2).images 

    # LTC-Accel process. l and r control the accelerate interval, feel free to modify. 
    gen3 = torch.Generator(device).manual_seed(0)
    images = pipe(prompt, num_inference_steps = inference_steps, cal_wg = False, skip_x = True, l = inference_steps/4, r = inference_steps, device = device, generator = gen3).images 
    images[0].save(f"LTC-Accel_{inference_steps}steps.png")

if __name__ == "__main__":
    #sd35
    model_id = "stabilityai/stable-diffusion-3.5-large"
    
    run_inference(device="cuda", model_id=model_id, inference_steps=40)

We use the Stable Diffusion v3.5 pipeline as an example, but feel free to customize the pipe and scheduler as needed.

  • The cal_wg flag controls whether to compute wg, which requires one additional full sampling pass and is essential for LTC‑Accel to function.
  • The skip_x flag determines whether LTC‑Accel is applied during sampling.
  • The l and r arguments define the step interval over which LTC‑Accel is active.

The remaining LTC-Accel parameters contribute marginally to acceleration efficiency. See step.py for implementation details.

Visualization

Baseline images are shown in the first and third columns; the corresponding LTC‑Accel accelerated results appear in the second and fourth columns.

image

Quantitative Results

Stable Diffusion v2 and v3.5

image

Video Model

image

Other Implementations and Plugins

We sincerely thank the authors listed below who implemented LTC-Accel in plugins or other contexts.

We're excited to collaborate—everyone is welcome to contribute. Contact us if you’d like to get involved.

Bibtex Citation

@article{zhu2025accelerating,
  title={Accelerating Diffusion Sampling via Exploiting Local Transition Coherence},
  author={Zhu, Shangwen and Zhang, Han and Yang, Zhantao and Peng, Qianyu and Pu, Zhao and Wang, Huangji and Cheng, Fan},
  journal={arXiv preprint arXiv:2503.09675},
  year={2025}
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages