+15






![mintlify[bot]](/assets/img/avatar_default.png)


Mingyi
AdityaVKochar
mintlify[bot]
adhyan-jain
Adhyan Jain
Maitri-shah29
Adarsh Shirawalmath
Maitri Shah
Aditya Vardhan Kochar
Rishit Shivam
Rishitshivam
IshhanKheria
Ishita Joshi
Richard Chen
longGGGGGG
Richard
Nakul Sinha
Divyam Agrawal
Richardczl98
Krishang Zinzuwadia
nimeshas
Claude Opus 4.6
github-actions[bot]
Jignas Paturu
zijiexia
a3291b5654
Co-authored-by: AdityaVKochar <adityavardhankochar@gmail.com> Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> Co-authored-by: adhyan-jain <adhyanjain2006@gmail.com> Co-authored-by: Adhyan Jain <71976554+adhyan-jain@users.noreply.github.com> Co-authored-by: Maitri-shah29 <maitrirajivshah@gmail.com> Co-authored-by: Adarsh Shirawalmath <114558126+adarshxs@users.noreply.github.com> Co-authored-by: Maitri Shah <shah29maitri@gmail.com> Co-authored-by: Aditya Vardhan Kochar <80113212+AdityaVKochar@users.noreply.github.com> Co-authored-by: Rishit Shivam <164783543+pokymono@users.noreply.github.com> Co-authored-by: Rishitshivam <164783543+Rishitshivam@users.noreply.github.com> Co-authored-by: IshhanKheria <ishhankheria06@gmail.com> Co-authored-by: Ishita Joshi <ishitata.joshi@gmail.com> Co-authored-by: Richard Chen <104477092+Richardczl98@users.noreply.github.com> Co-authored-by: longGGGGGG <553746008@qq.com> Co-authored-by: Richard <richardchen@radixark.ai> Co-authored-by: Nakul Sinha <nakul.new4socials@gmail.com> Co-authored-by: Divyam Agrawal <ludicrouslytrue@gmail.com> Co-authored-by: Richardczl98 <Zhenlinc@stanford.edu> Co-authored-by: Krishang Zinzuwadia <krishangzinzuwadia@gmail.com> Co-authored-by: nimeshas <nimesha.s106@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jignas Paturu <86356085+JignasP@users.noreply.github.com> Co-authored-by: zijiexia <37504505+zijiexia@users.noreply.github.com>
434 lines
18 KiB
Plaintext
434 lines
18 KiB
Plaintext
---
|
|
title: "Cache-DiT Acceleration"
|
|
description: "Configure Cache-DiT acceleration for diffusion inference."
|
|
---
|
|
|
|
SGLang integrates [Cache-DiT](https://github.com/vipshop/cache-dit), a caching acceleration engine for Diffusion Transformers (DiT), to achieve up to **1.69x inference speedup** with minimal quality loss.
|
|
|
|
## Overview
|
|
|
|
**Cache-DiT** uses intelligent caching strategies to skip redundant computation in the denoising loop:
|
|
|
|
- **DBCache (Dual Block Cache)**: Dynamically decides when to cache transformer blocks based on residual differences
|
|
- **TaylorSeer**: Uses Taylor expansion for calibration to optimize caching decisions
|
|
- **SCM (Step Computation Masking)**: Step-level caching control for additional speedup
|
|
|
|
## Basic Usage
|
|
|
|
Enable Cache-DiT by exporting the environment variable and using `sglang generate` or `sglang serve` :
|
|
|
|
```bash
|
|
SGLANG_CACHE_DIT_ENABLED=true \
|
|
sglang generate --model-path Qwen/Qwen-Image \
|
|
--prompt "A beautiful sunset over the mountains"
|
|
```
|
|
|
|
## Diffusers Backend
|
|
|
|
Cache-DiT supports loading acceleration configs from a custom YAML file. For
|
|
diffusers pipelines (`diffusers` backend), pass the YAML/JSON path via `--cache-dit-config`. This
|
|
flow requires cache-dit >= 1.2.0 (`cache_dit.load_configs`).
|
|
|
|
### Single GPU inference
|
|
|
|
Define a `cache.yaml` file that contains:
|
|
|
|
```yaml
|
|
cache_config:
|
|
max_warmup_steps: 8
|
|
warmup_interval: 2
|
|
max_cached_steps: -1
|
|
max_continuous_cached_steps: 2
|
|
Fn_compute_blocks: 1
|
|
Bn_compute_blocks: 0
|
|
residual_diff_threshold: 0.12
|
|
enable_taylorseer: true
|
|
taylorseer_order: 1
|
|
```
|
|
|
|
Then apply the config with:
|
|
|
|
```bash
|
|
sglang generate \
|
|
--backend diffusers \
|
|
--model-path Qwen/Qwen-Image \
|
|
--cache-dit-config cache.yaml \
|
|
--prompt "A beautiful sunset over the mountains"
|
|
```
|
|
|
|
### Distributed inference
|
|
|
|
- 1D Parallelism
|
|
|
|
Define a parallelism only config yaml `parallel.yaml` file that contains:
|
|
|
|
```yaml
|
|
parallelism_config:
|
|
ulysses_size: auto
|
|
parallel_kwargs:
|
|
attention_backend: native
|
|
extra_parallel_modules: ["text_encoder", "vae"]
|
|
```
|
|
|
|
Then, apply the distributed inference acceleration config from yaml. `ulysses_size: auto` means that cache-dit will auto detect the `world_size` as the ulysses_size. Otherwise, you should manually set it as specific int number, e.g, 4.
|
|
|
|
Then apply the distributed config with: (Note: please add `--num-gpus N` to specify the number of gpus for distributed inference)
|
|
|
|
```bash
|
|
sglang generate \
|
|
--backend diffusers \
|
|
--num-gpus 4 \
|
|
--model-path Qwen/Qwen-Image \
|
|
--cache-dit-config parallel.yaml \
|
|
--prompt "A futuristic cityscape at sunset"
|
|
```
|
|
|
|
- 2D Parallelism
|
|
|
|
You can also define a 2D parallelism config yaml `parallel_2d.yaml` file that contains:
|
|
|
|
```yaml
|
|
parallelism_config:
|
|
ulysses_size: auto
|
|
tp_size: 2
|
|
parallel_kwargs:
|
|
attention_backend: native
|
|
extra_parallel_modules: ["text_encoder", "vae"]
|
|
```
|
|
Then, apply the 2D parallelism config from yaml. Here `tp_size: 2` means using tensor parallelism with size 2. The `ulysses_size: auto` means that cache-dit will auto detect the `world_size // tp_size` as the ulysses_size.
|
|
|
|
- 3D Parallelism
|
|
|
|
You can also define a 3D parallelism config yaml `parallel_3d.yaml` file that contains:
|
|
|
|
```yaml
|
|
parallelism_config:
|
|
ulysses_size: 2
|
|
ring_size: 2
|
|
tp_size: 2
|
|
parallel_kwargs:
|
|
attention_backend: native
|
|
extra_parallel_modules: ["text_encoder", "vae"]
|
|
```
|
|
Then, apply the 3D parallelism config from yaml. Here `ulysses_size: 2`, `ring_size: 2`, `tp_size: 2` means using ulysses parallelism with size 2, ring parallelism with size 2 and tensor parallelism with size 2.
|
|
|
|
### Hybrid Cache and Parallelism
|
|
|
|
Define a hybrid cache and parallel acceleration config yaml `hybrid.yaml` file that contains:
|
|
|
|
```yaml
|
|
cache_config:
|
|
max_warmup_steps: 8
|
|
warmup_interval: 2
|
|
max_cached_steps: -1
|
|
max_continuous_cached_steps: 2
|
|
Fn_compute_blocks: 1
|
|
Bn_compute_blocks: 0
|
|
residual_diff_threshold: 0.12
|
|
enable_taylorseer: true
|
|
taylorseer_order: 1
|
|
parallelism_config:
|
|
ulysses_size: auto
|
|
parallel_kwargs:
|
|
attention_backend: native
|
|
extra_parallel_modules: ["text_encoder", "vae"]
|
|
```
|
|
|
|
Then, apply the hybrid cache and parallel acceleration config from yaml.
|
|
|
|
```bash
|
|
sglang generate \
|
|
--backend diffusers \
|
|
--num-gpus 4 \
|
|
--model-path Qwen/Qwen-Image \
|
|
--cache-dit-config hybrid.yaml \
|
|
--prompt "A beautiful sunset over the mountains"
|
|
```
|
|
|
|
## Advanced Configuration
|
|
|
|
### DBCache Parameters
|
|
|
|
DBCache controls block-level caching behavior:
|
|
|
|
<table style={{width: "100%", borderCollapse: "collapse", tableLayout: "fixed"}}>
|
|
<colgroup>
|
|
<col style={{width: "12%"}} />
|
|
<col style={{width: "34%"}} />
|
|
<col style={{width: "14%"}} />
|
|
<col style={{width: "40%"}} />
|
|
</colgroup>
|
|
<thead>
|
|
<tr style={{borderBottom: "2px solid #d55816"}}>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.02)"}}>Parameter</th>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.05)"}}>Env Variable</th>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.02)"}}>Default</th>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.05)"}}>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>Fn</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>`SGLANG_CACHE_DIT_FN`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>1</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Number of first blocks to always compute</td>
|
|
</tr>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>Bn</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>`SGLANG_CACHE_DIT_BN`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>0</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Number of last blocks to always compute</td>
|
|
</tr>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>W</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>`SGLANG_CACHE_DIT_WARMUP`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>4</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Warmup steps before caching starts</td>
|
|
</tr>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>R</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>`SGLANG_CACHE_DIT_RDT`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>0.24</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Residual difference threshold</td>
|
|
</tr>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>MC</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>`SGLANG_CACHE_DIT_MC`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>3</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Maximum continuous cached steps</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
### TaylorSeer Configuration
|
|
|
|
TaylorSeer improves caching accuracy using Taylor expansion:
|
|
|
|
<table style={{width: "100%", borderCollapse: "collapse", tableLayout: "fixed"}}>
|
|
<colgroup>
|
|
<col style={{width: "12%"}} />
|
|
<col style={{width: "36%"}} />
|
|
<col style={{width: "14%"}} />
|
|
<col style={{width: "38%"}} />
|
|
</colgroup>
|
|
<thead>
|
|
<tr style={{borderBottom: "2px solid #d55816"}}>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.02)"}}>Parameter</th>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.05)"}}>Env Variable</th>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.02)"}}>Default</th>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.05)"}}>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>Enable</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>`SGLANG_CACHE_DIT_TAYLORSEER`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>false</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Enable TaylorSeer calibrator</td>
|
|
</tr>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>Order</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>`SGLANG_CACHE_DIT_TS_ORDER`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>1</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Taylor expansion order (1 or 2)</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
### Combined Configuration Example
|
|
|
|
DBCache and TaylorSeer are complementary strategies that work together, you can configure both sets of parameters
|
|
simultaneously:
|
|
|
|
```bash
|
|
SGLANG_CACHE_DIT_ENABLED=true \
|
|
SGLANG_CACHE_DIT_FN=2 \
|
|
SGLANG_CACHE_DIT_BN=1 \
|
|
SGLANG_CACHE_DIT_WARMUP=4 \
|
|
SGLANG_CACHE_DIT_RDT=0.4 \
|
|
SGLANG_CACHE_DIT_MC=4 \
|
|
SGLANG_CACHE_DIT_TAYLORSEER=true \
|
|
SGLANG_CACHE_DIT_TS_ORDER=2 \
|
|
sglang generate --model-path black-forest-labs/FLUX.1-dev \
|
|
--prompt "A curious raccoon in a forest"
|
|
```
|
|
|
|
### SCM (Step Computation Masking)
|
|
|
|
SCM provides step-level caching control for additional speedup. It decides which denoising steps to compute fully and
|
|
which to use cached results.
|
|
|
|
**SCM Presets**
|
|
|
|
SCM is configured with presets:
|
|
|
|
<table style={{width: "100%", borderCollapse: "collapse", tableLayout: "fixed"}}>
|
|
<colgroup>
|
|
<col style={{width: "18%"}} />
|
|
<col style={{width: "22%"}} />
|
|
<col style={{width: "22%"}} />
|
|
<col style={{width: "38%"}} />
|
|
</colgroup>
|
|
<thead>
|
|
<tr style={{borderBottom: "2px solid #d55816"}}>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.02)"}}>Preset</th>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.05)"}}>Compute Ratio</th>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.02)"}}>Speed</th>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.05)"}}>Quality</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>`none`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>100%</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>Baseline</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Best</td>
|
|
</tr>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>`slow`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>~75%</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>~1.3x</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>High</td>
|
|
</tr>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>`medium`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>~50%</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>~2x</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Good</td>
|
|
</tr>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>`fast`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>~35%</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>~3x</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Acceptable</td>
|
|
</tr>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>`ultra`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>~25%</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>~4x</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Lower</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
**Usage**
|
|
|
|
```bash
|
|
SGLANG_CACHE_DIT_ENABLED=true \
|
|
SGLANG_CACHE_DIT_SCM_PRESET=medium \
|
|
sglang generate --model-path Qwen/Qwen-Image \
|
|
--prompt "A futuristic cityscape at sunset"
|
|
```
|
|
|
|
**Custom SCM Bins**
|
|
|
|
For fine-grained control over which steps to compute vs cache:
|
|
|
|
```bash
|
|
SGLANG_CACHE_DIT_ENABLED=true \
|
|
SGLANG_CACHE_DIT_SCM_COMPUTE_BINS="8,3,3,2,2" \
|
|
SGLANG_CACHE_DIT_SCM_CACHE_BINS="1,2,2,2,3" \
|
|
sglang generate --model-path Qwen/Qwen-Image \
|
|
--prompt "A futuristic cityscape at sunset"
|
|
```
|
|
|
|
**SCM Policy**
|
|
|
|
<table style={{width: "100%", borderCollapse: "collapse", tableLayout: "fixed"}}>
|
|
<colgroup>
|
|
<col style={{width: "16%"}} />
|
|
<col style={{width: "42%"}} />
|
|
<col style={{width: "42%"}} />
|
|
</colgroup>
|
|
<thead>
|
|
<tr style={{borderBottom: "2px solid #d55816"}}>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.02)"}}>Policy</th>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.05)"}}>Env Variable</th>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.02)"}}>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>`dynamic`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>`SGLANG_CACHE_DIT_SCM_POLICY=dynamic`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>Adaptive caching based on content (default)</td>
|
|
</tr>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>`static`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>`SGLANG_CACHE_DIT_SCM_POLICY=static`</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>Fixed caching pattern</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
## Environment Variables
|
|
|
|
All Cache-DiT parameters can be configured via environment variables.
|
|
See [Environment variables](./environment-variables) for the complete list.
|
|
|
|
## Supported Models
|
|
|
|
SGLang Diffusion x Cache-DiT supports almost all models originally supported in SGLang Diffusion:
|
|
|
|
<table style={{width: "100%", borderCollapse: "collapse", tableLayout: "fixed"}}>
|
|
<colgroup>
|
|
<col style={{width: "30%"}} />
|
|
<col style={{width: "70%"}} />
|
|
</colgroup>
|
|
<thead>
|
|
<tr style={{borderBottom: "2px solid #d55816"}}>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.02)"}}>Model Family</th>
|
|
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.05)"}}>Example Models</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>Wan</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Wan2.1, Wan2.2</td>
|
|
</tr>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>Flux</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>FLUX.1-dev, FLUX.2-dev</td>
|
|
</tr>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>Z-Image</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Z-Image-Turbo</td>
|
|
</tr>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>Qwen</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Qwen-Image, Qwen-Image-Edit</td>
|
|
</tr>
|
|
<tr>
|
|
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>Hunyuan</td>
|
|
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>HunyuanVideo</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
## Performance Tips
|
|
|
|
1. **Start with defaults**: The default parameters work well for most models
|
|
2. **Use TaylorSeer**: It typically improves both speed and quality
|
|
3. **Tune R threshold**: Lower values = better quality, higher values = faster
|
|
4. **SCM for extra speed**: Use `medium` preset for good speed/quality balance
|
|
5. **Warmup matters**: Higher warmup = more stable caching decisions
|
|
|
|
## Limitations
|
|
|
|
- **SGLang-native pipelines**: Distributed support (TP/SP) is not yet validated; Cache-DiT will be automatically
|
|
disabled when `world_size > 1`.
|
|
- **SCM minimum steps**: SCM requires >= 8 inference steps to be effective
|
|
- **Model support**: Only models registered in Cache-DiT's BlockAdapterRegister are supported
|
|
|
|
## Troubleshooting
|
|
|
|
### SCM disabled for low step count
|
|
|
|
For models with < 8 inference steps (e.g., DMD distilled models), SCM will be automatically disabled. DBCache
|
|
acceleration still works.
|
|
|
|
## References
|
|
|
|
- [Cache-DiT](https://github.com/vipshop/cache-dit)
|
|
- [SGLang diffusion](../../sglang-diffusion/intro)
|