ERNIE-Image Inference Acceleration Complete Guide: Cache-DiT and SGLang Diffusion Deliver Up to 9x Speedup

Jul 28, 2026

ERNIE-Image Inference Acceleration Complete Guide: Cache-DiT and SGLang Diffusion Deliver Up to 9x Speedup

Since its open-source release in April 2026, ERNIE-Image has won the community over with its compact 8B-parameter architecture and state-of-the-art text rendering. But one practical challenge remained: the Base model's 50 inference steps take considerable time on consumer GPUs, and even the Turbo model's 8-step generation faces efficiency demands in batch production scenarios.

In June 2026, two key projects matured to offer ERNIE-Image users brand-new acceleration solutions: Cache-DiT v1.5.0 officially launched, and SGLang Diffusion now fully supports DiT model inference acceleration. This article dives deep into how these two tools can deliver up to 9x inference speedup for ERNIE-Image, with a complete hands-on guide.

Cache-DiT: A PyTorch-Native Inference Engine Built for DiTs

Cache-DiT is an open-source PyTorch-native inference engine developed by Vipshop's Computer Vision AI Team, built on top of Hugging Face Diffusers. It's specifically designed for the Diffusion Transformer (DiT) architecture and currently supports nearly all DiT models in the Diffusers ecosystem, including ERNIE-Image.

Core Acceleration Technologies

Cache-DiT's acceleration comes from four synergistic technology layers:

1. Hybrid Cache Acceleration

  • DBCache: Dynamic block caching based on the denoising process, reusing similar computed results across adjacent denoising steps
  • TaylorSeer: Taylor expansion predictive caching that skips redundant computation in advance
  • SCM (Spatial Cache Module): Exploits spatial redundancy in images to reduce computation

These three caching strategies can be stacked together, dramatically reducing redundant computation in inference steps with minimal quality impact.

2. Comprehensive Parallelism

  • Context Parallelism: Splits long sequences across multiple GPUs
  • Tensor Parallelism: Distributes single-layer computation across GPUs
  • Hybrid 2D/3D Parallelism: Combines multiple parallelism strategies
  • Extra Parallelism: Independent parallelism for Text Encoder, VAE, and ControlNet

3. SVDQuant W4A4 Quantization
Cache-DiT v1.5.0 natively integrates a complete SVDQuant W4A4 quantization workflow:

  • Weights quantized to 4-bit, activations quantized to 4-bit
  • Supports PTQ (Post-Training Quantization) and DQ (Dynamic Quantization) modes
  • No calibration data needed (DQ mode)
  • FLUX.2 benchmark: end-to-end latency dropped from 2.13s to 1.02s, ~2.1x speedup

4. Bucket-Style Layerwise CPU Offload
Compute-communication overlapped bucket offloading with <5% additional latency overhead, enabling users with limited VRAM to run large models.

ERNIE-Image Compatibility

According to Cache-DiT's official compatibility matrix, ERNIE-Image's ErnieImageTransformer2DModel receives full feature support:

Feature Status
DBCache Caching
Context Parallelism
Tensor Parallelism
Text Encoder Parallelism
VAE Parallelism
SVDQuant Quantization
CPU Offload

SGLang Diffusion: High-Performance Inference Serving

SGLang Diffusion is a high-performance image/video inference framework by the LMSys team, deeply integrated with Cache-DiT. It offers three core value propositions:

1. Multiple Interfaces

  • CLI: One-click generation with sglang generate
  • Server: sglang serve launches an OpenAI-compatible API
  • Python SDK: Flexible embedding into existing workflows

2. Broad Model Support

Covers Wan, Hunyuan, Qwen-Image, FLUX, Z-Image, GLM-Image, and more. ERNIE-Image is naturally supported through the Diffusers compatibility layer.

3. Multi-Platform Compatibility

Full platform coverage: NVIDIA GPUs, AMD GPUs, Intel XPU, Ascend NPUs, Apple Silicon.

Hands-On: Configuring Cache-DiT for ERNIE-Image

Environment Setup

# Install Cache-DiT
pip install cache-dit

Or install SGLang Diffusion (includes Cache-DiT integration)

uv pip install "sglang[diffusion]" --prerelease=allow

One-Click Acceleration (Cache Mode)

In your existing Diffusers code, just add two lines:

import cache_dit
from diffusers import DiffusionPipeline

pipe = DiffusionPipeline.from_pretrained(
"baidu/ERNIE-Image-Turbo",
torch_dtype=torch.bfloat16
).to("cuda")

🔥 Enable cache acceleration with one line

cache_dit.enable_cache(pipe)

image = pipe("A girl by the sea, sunset, dreamy style").images[0]
image.save("output.png")

Cache + Parallelism + Quantization (Full Stack)

from cache_dit import DBCacheConfig, ParallelismConfig, QuantizeConfig

cache_dit.enable_cache(
pipe,
cache_config=DBCacheConfig(), # Hybrid cache
parallelism_config=ParallelismConfig( # Multi-GPU parallelism
ulysses_size=2
),
quantize_config=QuantizeConfig( # W4A4 quantization
quant_type="svdq_int4_r64_dq"
)
)

output = pipe("A girl by the sea, sunset, dreamy style")

Deploying via SGLang Diffusion

# Start the server
sglang serve --model-path baidu/ERNIE-Image-Turbo --port 30010

Call the API

curl http://localhost:30010/v1/images/generations
-H "Content-Type: application/json"
-d '{"model": "baidu/ERNIE-Image-Turbo", "prompt": "A girl by the sea, sunset"}'

Expected Performance

Based on Cache-DiT official data and community benchmarks, here are expected speedup ratios for ERNIE-Image under different configurations:

Configuration Speedup Use Case
Pure Cache (DBCache) 1.5-2.5x Single GPU, simple deployment
Cache + Compilation 2-3x Single GPU, can tolerate warmup
Cache + Parallelism 3-6x Multi-GPU servers
Cache + Parallelism + Quantization 4-9x Production, max throughput
Full Stack (Cache+Parallel+Quant+Compile) Up to 9x Enterprise deployment

Comparison with Existing Solutions

Solution Speedup Integration Difficulty Quality Impact VRAM Required
Native Diffusers 1x - None 24GB
Cache-DiT Cache Only 1.5-2.5x Low (2 lines) Minimal 24GB
Cache-DiT Full Stack Up to 9x Medium Acceptable 16-24GB
SGLang Diffusion 2-5x Low None 24GB
SVDQuant W4A4 2x Medium Minimal 12-16GB
GGUF Quantization 1.5-2x Low Slight 8-16GB

Community Integration Ecosystem

Cache-DiT is deeply integrated with multiple mainstream tools:

  • ComfyUI: Directly enable cache acceleration in the ComfyUI interface via the ComfyUI-CacheDiT plugin
  • SGLang Diffusion: Used as its caching backend for service deployment
  • vLLM-Omni: Accessible through vLLM's diffusion model support layer
  • TensorRT-LLM: NVIDIA's official inference framework integration
  • SD.Next: Built-in support in the Stable Diffusion web interface

For ComfyUI users, after installing the ComfyUI-CacheDiT node, simply add a Cache-DiT node to your ERNIE-Image workflow to enable acceleration — no Python code modification needed.

Important Considerations

  1. Cache Precision: Caching strategies like DBCache can have a minor impact on image quality. For high-quality final outputs, consider disabling cache or using lower cache intensity
  2. Compilation Warmup: torch.compile requires an initial warmup run (~30-60 seconds), making it suitable for long-running services rather than one-off generation
  3. Quantization Compatibility: SVDQuant W4A4 requires CUDA 13.0+ and PyTorch 2.11+
  4. ERNIE-Image Specific Note: The Prompt Enhancer (PE) is currently outside Cache-DiT's acceleration scope, but as a lightweight 3B model, its inference overhead is minimal

Summary

The maturation of Cache-DiT v1.5.0 and SGLang Diffusion marks a new era for DiT model inference acceleration. For ERNIE-Image users:

  • Individual users: Just 2 lines of code for 1.5-2.5x speedup
  • Developers: Deploy via SGLang Diffusion for 2-5x service throughput improvement
  • Enterprise users: Full-stack acceleration up to 9x, dramatically reducing inference costs

While we await the ERNIE-Image editing model's official release, inference acceleration is the most direct path to improving production efficiency and reducing usage costs. Cache-DiT has taken ERNIE-Image's practicality on consumer GPUs to the next level.


Related Reading: EI-070 "ERNIE-Image Inference Optimization Deep Guide", EI-103 "PE Independent Deployment with SGLang Acceleration", EI-034 "SGLang Production Deployment Guide"

ERNIE-Image Team

ERNIE-Image Inference Acceleration Complete Guide: Cache-DiT and SGLang Diffusion Deliver Up to 9x Speedup | Blog