Execution Modes
SGLang Diffusion exposes two related but distinct modes:
The realtime server retains model-specific state such as the causal self-attention
KV cache, cross-attention cache, decoder history, and pending control events.
State is isolated per session and is not reused by unrelated requests.
A causal DiT is not automatically a realtime session model. The pipeline must
also register a realtime adapter and implement the WebSocket session lifecycle.
Supported Realtime Pipelines
Use the model cookbooks for launch commands, request schemas, and control-token
details:
For the complete model list, see
Supported Models and Optimization Compatibility.
Causal Cache Controls
Realtime requests can override two model defaults:realtime_causal_sink_size: amount of stable prefix history retained as an attention sinkrealtime_causal_kv_cache_num_frames: recent causal history retained in the rolling KV-cache window
--kv-cache-quant {off,int4,int2} option compresses completed cache chunks.
It is disabled by default and is lossy when enabled. Start with int4; use
int2 only when the additional memory reduction is worth the larger quality
risk.
See Causal KV-Cache Quantization
for installation, storage policy, tuning options, memory/latency tradeoffs, and
current limitations.
Deployment Considerations
- Keep
--kv-cache-quant offwhen bit-exact BF16 cache behavior is required. - Benchmark a representative session length. Short clips may not exercise cold-cache packing and can hide both its memory benefit and packing overhead.
- Treat sequence parallelism as model-specific. Follow the model cookbook and the Sequence Parallelism guide instead of assuming one mesh is best for every realtime pipeline.
- Realtime WebSocket clients must send an initialization message before control events. The exact MessagePack schema and output encoding are documented in each model cookbook.
