NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

DiffServe: Efficiently Serving Text-to-Image Diffusion Models with Query-Aware Model Scaling

Sohaib Ahmad, Qizheng Yang, Haoliang Wang, Ramesh K. Sitaraman, Hui Guan

TL;DR

DiffServe optimizes text-to-image diffusion model serving by implementing a query-aware model cascade that routes simpler prompts to lightweight models and complex ones to heavyweight models. Combined with a dynamic resource allocation framework, it improves image generation quality by up to 24% while slashing latency violations by 19-70% compared to state-of-the-art baselines.

What Problem Does This Paper Address?

Text-to-image diffusion models (like Stable Diffusion XL) are incredibly popular but computationally brutal to serve at scale. Service providers face a double whammy: high-quality models have massive inference latencies, and user query demand fluctuates wildly throughout the day.

Standard serving systems either statically over-provision hardware (wasting money and leaving GPUs idle during off-peak hours) or suffer massive Service Level Objective (SLO) latency violations during peak traffic. While multi-model selection systems exist, they typically route traffic based purely on system load, completely ignoring the fact that some text prompts are inherently easier to generate than others.

Methods

The authors introduce DiffServe, an end-to-end serving system that leverages query-aware model scaling through two main innovations:

  1. Diffusion Model Cascades with a Custom Discriminator: When a user submits a prompt, it is first processed by a fast, lightweight diffusion model. To decide if the generated image is good enough, DiffServe passes it to an image-side discriminator. Instead of using standard text-image alignment metrics, the authors trained an EfficientNet-V2 binary classifier to distinguish real images from generated ("fake") ones. The classifier's softmax confidence score acts as a proxy for image quality. If the score clears a specific threshold, the image is returned to the user; otherwise, the prompt is routed to a heavyweight model.
Figure 2. System architecture of DIFFSERVE: (1) The query from the client is sent to the load balancer, (2) The load balancer sends it to a worker with the lightweight model and the discriminator, (3) If the confidence score is greater than the threshold, the response is sent back to client, (4) Else, the query is sent to a worker with the heavyweight model, and (5) its output is sent to the client.
  1. MILP-Based Resource Management: To handle fluctuating workloads, DiffServe periodically solves a Mixed Integer Linear Programming (MILP) problem. This optimization framework dynamically adjusts the confidence threshold, allocates the number of GPU workers assigned to light vs. heavy models, and configures optimal batch sizes to maximize overall image quality while strictly respecting latency SLOs.

Datasets

The system was evaluated using the following datasets and traces:

  • MS-COCO 2017: Used to evaluate cascades generating 512x512 resolution images (SD-Turbo and SDXS as light models, SDv1.5 as the heavy model).
  • DiffusionDB: A large-scale prompt gallery dataset used for a higher-resolution 1024x1024 cascade (SDXL-Lightning as the light model, SDXL as the heavy model).
  • Microsoft Azure Functions Trace: A real-world workload trace used to simulate realistic, fluctuating query arrival rates over time.

Key Insights and Ideas

  • The "Easy Query" Phenomenon: For 20-40% of text prompts, lightweight single-step models generate images with similar or even better quality than computationally heavy 50-step models.
  • Standard Metrics Fail as Gatekeepers: Widely used metrics like CLIPScore and PickScore perform worse than random guessing when used as cascade discriminators. They fail to capture nuanced perceptual quality and visual realism, which is why DiffServe's real-vs-fake image discriminator design is so critical.
Figure 1. (a) The quality-latency trade-offs of systems serving independent diffusion models and diffusion model cascades with different discriminator designs with batch size one. The top panel uses diffusion model cascades built with SDv1.5 as the heavyweight model (H) and SD-Turbo as the lightweight model (L). The bottom panel uses SDXS as the lightweight model instead. Lower latency is achieved by using lighter models or treating more queries as easy in diffusion model cascades. FID is the lower the better. (b) The distribution of the difference in image quality between a lightweight model and a heavyweight model. Negative values in the x-axis mean the lightweight model’s generated image quality is better than those from the heavyweight model. Top panels use PickScore as the quality metric while bottom panels use confidence score from our proposed discriminator. (c) Illustration of how different resource allocation configurations affect serving throughput (QPS) and response quality (FID). All results use the dataset MS-COCO 2017 (Lin et al., 2014).
  • More Heavy Models $\neq$ Better Overall Quality: Counterintuitively, routing all queries to a heavyweight model can sometimes result in a worse overall Frechet Inception Distance (FID) score for the system. Incorporating a portion of outputs from lightweight models introduces structural diversity that aligns better with real-world image distributions.

Key Results

  • Better Quality, Fewer Delays: Compared to state-of-the-art systems like Proteus, DiffServe improves system image quality (FID) by up to 24% while maintaining 19-70% lower SLO latency violation rates under dynamic real-world traces.
  • Negligible Overhead: The image discriminator adds only a few milliseconds of latency (e.g., 10ms for EfficientNet on an A100), which is negligible compared to the multi-second execution times of diffusion models. Furthermore, the MILP solver finds optimal resource allocations in just ~10 milliseconds and runs asynchronously outside the critical path of query processing.

Limitations and Future Work

  • The Challenge of Feature Reuse: The authors attempted to optimize the cascade by passing intermediate latent outputs from the light model directly into the heavy model to save computation. However, this often degraded final image quality (e.g., increasing FID from 18.55 to 19.75), indicating that model compatibility in cascades remains a tricky problem.
  • Text-Only Predictive Routing: Currently, DiffServe must run the lightweight model before the discriminator can evaluate query difficulty. Predicting prompt complexity purely from the input text before any image generation takes place remains an open challenge.

Summary updated

BibTeX
@misc{ahmad2024diffserve,
  author = {Sohaib Ahmad and Qizheng Yang and Haoliang Wang and Ramesh K. Sitaraman and Hui Guan},
  title = {{DiffServe: Efficiently Serving Text-to-Image Diffusion Models with Query-Aware Model Scaling}},
  year = {2024},
  eprint = {2411.15381},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.15381},
}
Figure