CoolFace
Modelpublic

bahadirakdemir/Z-Image-Turbo-FP8-attn-qkv-only

sourceHugging Faceapache-2.0updated 4mo agoView on Hugging Face
0likes4downloads
Model Card

Z-Image-Turbo FP8 — attn-qkv-only

Only the attention QKV projection is FP8; everything else stays in BF16.

★ The overall best practical choice in our benchmark is `online_fp8` (5.937 s/image, -24.2% vs BF16, peak GPU 13.34 GB — 38.4% less than BF16). It runs straight from the upstream `Tongyi-MAI/Z-Image-Turbo` checkpoint with --quantization-config '{"method":"fp8"}' — no separate download. The pre-quantized variants in this family are useful when you want deterministic static scales (calibrated offline, frozen on disk) or when online quantization is not desired.

This variant (attn-qkv-only) → mean latency 7.344 s/image (-6.2% vs BF16), peak GPU 20.21 GB (6.7% less than BF16's 21.66 GB), image quality PSNR 24.41 dB / SSIM 0.8423 vs the BF16 reference at identical (prompt, seed).

This is one of 7 FP8 quantization policies of `Tongyi-MAI/Z-Image-Turbo` prepared for vLLM-Omni serving. Each variant differs only in which transformer submodules are quantized to FP8 (E4M3 with per-tensor static scales); everything else stays in BF16.

In the tables below, ★ marks the overall best choice (online_fp8) and ← marks the row that corresponds to this repo.

Quick start (vLLM-Omni)

bash
docker run --rm --gpus all --ipc=host \
  -p 18002:8002 \
  -e HF_HOME=/hf_cache \
  -e DIFFUSION_ATTENTION_BACKEND=TORCH_SDPA \
  -e VLLM_ATTENTION_BACKEND=FLASH_ATTN \
  -v /your/hf/cache:/hf_cache \
  your-vllm-omni:latest \
    vllm-omni serve bahadirakdemir/Z-Image-Turbo-FP8-attn-qkv-only \
    --omni --host 0.0.0.0 --port 8002 \
    --gpu-memory-utilization 0.90 \
    --tensor-parallel-size 1 \
    --quantization-config '{"method":"modelopt","quant_method":"FP8","is_checkpoint_fp8_serialized":true,"kv_cache_quant_method":null,"exclude_modules":["model*","lm_head*","*feed_forward*","*to_out*"]}'

Then call the OpenAI-style image API:

bash
curl -s http://127.0.0.1:18002/v1/images/generations \
  -H "Content-Type: application/json" \
  -d '{
    "model": "bahadirakdemir/Z-Image-Turbo-FP8-attn-qkv-only",
    "prompt": "a cinematic photograph of an old fisherman standing on a foggy pier at sunrise",
    "size": "1024x512",
    "num_inference_steps": 8,
    "guidance_scale": 0.0,
    "n": 1,
    "response_format": "b64_json"
  }'

Benchmark — all 7 FP8 policies at 8 steps, 1024×512 on NVIDIA GB10

Same hardware, same (prompt, seed) tuples, same Docker image, fresh container per variant.

Pass A — DIFFUSION_ATTENTION_BACKEND=SAGE_ATTN

VariantMean latency (s)Steps/sPeak GPU (GB)Δ latency vs BF16Mem savingsPSNR vs BF16 (dB)SSIM vs BF16
bf16_base7.8311.0221.66+0.0%+0.0%refref
★online_fp85.9371.3513.34-24.2%+38.4%21.050.7942
full6.1631.3016.02-21.3%+26.0%20.580.7645
ffn-attn-qkv6.0071.3316.48-23.3%+23.9%20.990.7766
ffn-attn-out6.4001.2517.41-18.3%+19.6%19.760.7634
ffn-only6.8211.1717.88-12.9%+17.5%20.660.7789
attn-only7.0551.1319.74-9.9%+8.8%22.920.8413
←attn-qkv-only7.3441.0920.21-6.2%+6.7%24.410.8423
attn-out-only7.6231.0521.18-2.7%+2.2%26.930.9027

PSNR / SSIM are computed against the BF16 reference image at the same prompt and seed. Higher is better; BF16 is ref (it's the reference).

Pass B — top variants at DIFFUSION_ATTENTION_BACKEND=TORCH_SDPA

On NVIDIA GB10 (compute capability SM 12.1), FLASH_ATTN is platform-gated and silently falls back to TORCH_SDPA. SageAttention has a small but consistent overhead vs TORCH_SDPA on Blackwell, so the production recommendation is TORCH_SDPA.

VariantMean latency (s)Steps/sPeak GPU (GB)Δ latency vs BF16
bf16_base7.1451.1221.66+0.0%
★online_fp85.6371.4213.32-21.1%
full5.7061.4016.03-20.1%
ffn-attn-qkv5.2081.5416.48-27.1%

Image comparisons

Same 3 prompts rendered across every variant with identical seeds. Click for full resolution.

Prompt 0 — "a cinematic photograph of an old fisherman standing on a foggy pier at sunrise"

[image]

Prompt 1 — "a detailed watercolor painting of a mountain village beside a clear blue lake"

[image]

Prompt 2 — "a futuristic city street at night with neon reflections on wet pavement"

[image]

Benchmark parameters

ParameterValue
Resolution1024 × 512
Inference steps8
Guidance scale0.0
Seeds1235, 1236, 1237 (one per prompt)
Warm-up images per variant1
Timed runs per variant3
Prompts3 (foggy pier, mountain village, neon street)
Engineyour-vllm-omni:latest (vLLM-Omni)
Server flags--omni --gpu-memory-utilization 0.90 --tensor-parallel-size 1
GPU memory utilization0.90
Tensor parallel size1
HardwareNVIDIA GB10 (Grace Blackwell, SM 12.1)
Latency metricWall-clock seconds for one HTTP /v1/images/generations round-trip, averaged over 3 timed runs after 1 warm-up
GPU memory metricPeak per-process GPU memory sampled via nvidia-smi --query-compute-apps=pid,used_memory while the container is running
Image qualityPSNR (dB) and SSIM, scikit-image, winsize=11, channelaxis=-1, against the BF16 image at the same (prompt, seed)

All 7 repos in this family

  • —bahadirakdemir/Z-Image-Turbo-FP8-full
  • —bahadirakdemir/Z-Image-Turbo-FP8-ffn-only
  • —bahadirakdemir/Z-Image-Turbo-FP8-ffn-attn-out
  • —bahadirakdemir/Z-Image-Turbo-FP8-ffn-attn-qkv
  • —bahadirakdemir/Z-Image-Turbo-FP8-attn-only
  • —bahadirakdemir/Z-Image-Turbo-FP8-attn-out-only
  • —bahadirakdemir/Z-Image-Turbo-FP8-attn-qkv-only ← you are here

License & attribution

  • —Apache 2.0, inherited from upstream Tongyi-MAI/Z-Image-Turbo.
  • —Quantization: NVIDIA ModelOpt FP8 PTQ with 8 calibration prompts × 9 denoise steps each.
  • —Serving: vLLM-Omni.
  • —Benchmarked on NVIDIA GB10 (Grace Blackwell, SM 12.1), 2026-05-17.