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:
- 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.
- 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.
- 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