1. Model Introduction
Krea-2 is a high-quality text-to-image diffusion model from Krea. It ships in two variants that share the same backbone and differ only in their sampling recipe:- Krea-2-Turbo - a distilled, few-step model that produces photorealistic images in only 8 inference steps with no classifier-free guidance (
guidance_scale = 1.0), ideal for fast and interactive generation. - Krea-2-Raw - the base (non-distilled) model that trades speed for maximum fidelity, using a longer schedule (~52 steps) with classifier-free guidance (
guidance_scale ≈ 4.5).
model_index.json plus sharded transformer/, text_encoder/, vae/, tokenizer/, and scheduler/ folders). SGLang loads them natively - just point --model-path at the repo, no conversion step required.
Key Features:
- Two variants, one pipeline: switch between fast (Turbo) and high-fidelity (Raw) by changing only the model path and the sampling settings.
- Photorealistic generation at 1024x1024 and other resolutions.
- Native diffusers loading: components (DiT, text encoder, VAE, scheduler) are read straight from the repo’s
model_index.json.
2. SGLang-diffusion Installation
SGLang-diffusion offers multiple installation methods. You can choose the most suitable installation method based on your hardware platform and requirements. Please refer to the official SGLang-diffusion installation guide for installation instructions.3. Model Deployment
This section covers deploying Krea-2-Turbo for fast, high-quality image generation.3.1 Basic Configuration
Krea-2-Turbo generates high-quality images in only 8 inference steps. Launch the server with:Command
guidance_scale = 1.0.
3.2 Configuration Tips
Currently supported optimizations are listed here.--num-gpus: Number of GPUs to use.- Multi-GPU (tensor and/or sequence parallelism): see Section 3.3.
3.3 Multi-GPU: tensor and sequence parallelism
Krea-2 supports two multi-GPU axes that can be combined;--num-gpus must equal
tp_size × ulysses_degree.
- Tensor parallelism (
--tp-size N) shards the DiT weights across GPUs, lowering per-GPU VRAM. Krea-2’s attention heads (48 query / 12 KV) and text heads (20) are divisible by a tp size of 1, 2, or 4. - Sequence parallelism / Ulysses (
--ulysses-degree N) shards the image-token sequence across GPUs while keeping the text prefix replicated. It does not shard weights (per-GPU VRAM is unchanged), but its output is bitwise-identical to single-GPU. It currently requires a single prompt per request (ragged/padded multi-prompt batches under SP are not supported — use--tp-sizefor those).
Command
--tp-size 2 and
--ulysses-degree 2 each give ~1.7× denoise speedup over single-GPU; the hybrid
TP=2 × SP=2 reaches ~2.8× on 4 GPUs. Choosing: on memory-constrained GPUs prefer
--tp-size (it shards the ~24 GB DiT, e.g. ~38 GB → ~27 GB per GPU on 2 GPUs); on
large-VRAM GPUs sequence parallelism is marginally faster and numerically exact, and
the two compose for the highest throughput.
4. API Usage
For complete API documentation, please refer to the official API usage guide.4.1 Generate an Image
Generate an image with the OpenAI-compatible images API:Example
Command
4.2 Advanced Usage
4.2.1 Cache-DiT Acceleration
SGLang integrates Cache-DiT, a caching acceleration engine for Diffusion Transformers (DiT), to speed up inference with minimal quality loss. Enable it by settingSGLANG_CACHE_DIT_ENABLED=true. For more details, see the SGLang Cache-DiT documentation.
Cache-DiT works for both Krea-2 variants with no extra configuration: SGLang tracks each request’s classifier-free-guidance mode, so Krea-2-Turbo (no CFG, guidance_scale = 1.0) and Krea-2-Raw (CFG, guidance_scale ≈ 4.5) both cache correctly and automatically.
Basic Usage
Command
Caching has the most headroom on Raw’s longer schedule; the 8-step distilled Turbo has only a few cacheable steps after warmup.
Advanced Usage
- DBCache Parameters: DBCache controls block-level caching behavior:
| Parameter | Env Variable | Default | Description |
|---|---|---|---|
| Fn | SGLANG_CACHE_DIT_FN | 1 | Number of first blocks to always compute |
| Bn | SGLANG_CACHE_DIT_BN | 0 | Number of last blocks to always compute |
| W | SGLANG_CACHE_DIT_WARMUP | 4 | Warmup steps before caching starts |
| R | SGLANG_CACHE_DIT_RDT | 0.24 | Residual difference threshold |
| MC | SGLANG_CACHE_DIT_MC | 3 | Maximum continuous cached steps |
- TaylorSeer Configuration: TaylorSeer improves caching accuracy using Taylor expansion (best suited to the longer Raw schedule; not recommended for the 8-step Turbo):
| Parameter | Env Variable | Default | Description |
|---|---|---|---|
| Enable | SGLANG_CACHE_DIT_TAYLORSEER | false | Enable TaylorSeer calibrator |
| Order | SGLANG_CACHE_DIT_TS_ORDER | 1 | Taylor expansion order (1 or 2) |
Command
4.2.2 Memory & CPU Offload
Krea-2’s DiT is ~24 GB in bf16 (the bulk of the model). On memory-constrained GPUs you can keep less of it resident:--dit-layerwise-offload: stream the DiT’s transformer blocks layer-by-layer with async host-to-device prefetch overlap, so only a small working set stays on the GPU. This is the primary way to fit Krea-2 on a single consumer / 32 GB-class card, at a modest latency cost. Tune the memory/latency trade-off with--dit-offload-prefetch-size(0.0prefetches one layer for the lowest memory; larger values prefetch more layers — faster but more memory).--dit-cpu-offload: keep the whole DiT in host memory. Combine it with--dit-layerwise-offloadfor the lowest peak GPU memory (weights stay on host and only the layers needed for the current step are brought on-device).--text-encoder-cpu-offload: offload the Qwen3-VL text encoder (it is idle during the denoise loop).--vae-cpu-offload: offload the VAE.--pin-cpu-memory: pin host memory for offload. Add only as a temporary workaround if you hitCUDA error: invalid argument.
5. Benchmark
Test Environment:- Hardware: NVIDIA H200 GPU (1x)
- Model: krea/Krea-2-Turbo (8 inference steps)
- sglang diffusion version: 0.5.13
Command
5.1 Generate an image
Benchmark Command:Command
Output
5.2 Generate images with high concurrency
Benchmark Command:Command
Output
