Skip to content

[Bug] Qwen-Image-2512 produces black images with Q4_K_M and other k-quant types (activation dequantization overflow) #1385

@ianbmacdonald

Description

@ianbmacdonald

Git commit

master-506-1f30df9 (ships with lemonade 10.0.1)

Operating System & Version

Ubuntu 26.04 LTS and Debian 13

GGML backends

ROCm 7.2.1

Command-line arguments used

sd-cli \
  --diffusion-model qwen-image-2512-Q4_K_M.gguf \
  --vae qwen_image_vae.safetensors \
  --llm Qwen2.5-VL-7B-Instruct-UD-Q4_K_XL.gguf \
  --cfg-scale 2.5 --sampling-method euler -v --steps 40 \
  -H 1024 -W 1024 --diffusion-fa --flow-shift 3 \
  -p 'Aerial drone photograph of a vast field of bright yellow wildflowers' \
  -o output.png --preview proj

Steps to reproduce

  1. Download models:
huggingface-cli download unsloth/Qwen-Image-2512-GGUF qwen-image-2512-Q4_K_M.gguf
huggingface-cli download unsloth/Qwen2.5-VL-7B-Instruct-GGUF Qwen2.5-VL-7B-Instruct-UD-Q4_K_XL.gguf
huggingface-cli download Comfy-Org/Qwen-Image_ComfyUI split_files/vae/qwen_image_vae.safetensors
  1. Run image generation (adjust paths to your HF cache):
sd-cli \
  --diffusion-model /path/to/qwen-image-2512-Q4_K_M.gguf \
  --vae /path/to/qwen_image_vae.safetensors \
  --llm /path/to/Qwen2.5-VL-7B-Instruct-UD-Q4_K_XL.gguf \
  --cfg-scale 2.5 --sampling-method euler -v --steps 40 \
  -H 1024 -W 1024 --diffusion-fa --flow-shift 3 \
  -p 'Aerial drone photograph of a vast field of bright yellow wildflowers with the text "Hello World" spelled out in deep purple lavender flowers, sharp contrast between yellow and purple, natural organic letter shapes formed by flower beds, golden hour lighting, rolling countryside landscape, high altitude perspective looking straight down, photorealistic, 8K resolution' \
  -o output.png --preview proj
  1. Observe preview images — generation starts correctly but output progressively degrades and becomes completely black around step 6/40.

What you expected to happen

A valid image matching the prompt, as produced when using Q5_0 or Q8_0 quantization of the same model.

What actually happened

The diffusion process starts producing a recognizable image in early steps, but the output degrades to solid black as sampling progresses. The final output is a completely black image.

Using --preview proj confirms the image is forming in early steps before going black — this is not a VAE decoding issue.

Affected and working quantization types

Suggested from comment Q4_0, Q4_1, Q5_1, Q4_K, Q5_K (including Q4_K_M, Q4_K_S, Q5_K_M, Q5_K_S)

Produced heavily distorted images: Q4_0,
Produced black images: Q4_K_M, Q5_K_M, Q5_K_S
Produced normal images: Q4_1, Q4_K_S, Q5_0, Q5_1, Q8_0

Important: The original Qwen-Image (non-2512) model works correctly with Q4_K_M. This suggests the Qwen-Image-2512 variant's weight distribution is more prone to triggering the overflow condition.

Root cause analysis

@bssrdf identified the underlying issue in a recent comment on #851 (link):

For certain quantized types, there could be activation dequantization overflows for MMQ_Q8_1_DS_LAYOUT_DS4 layout. This applies to Q4_0, Q4_1, Q5_1, Q4_K, and Q5_K. [...] The culprit is half2 ds4[4] used in struct block_q8_1_mmq, where quantizing activation to q8_1 could overflow when scale is out of fp16 range.

The set of affected quant types exactly matches what we observe — all types that use the MMQ_Q8_1_DS_LAYOUT_DS4 layout produce black images, while types that don't (Q5_0, Q8_0) work correctly.

Possibly related

Workaround

Used Q5_0 quantization instead of recommended Q4_K_M for the diffusion model. It avoids the affected ds4 layout while maintaining reasonable file size and generation speed.

Additional context / environment details

Tested via the Lemonade project's sd-cpp integration, which pins sd-cpp at master-506-1f30df9. Tracking issue: lemonade-sdk/lemonade#1411.

Hardware: AMD GPU with ROCm 7.2.1, inbox amdgpu driver on Ubuntu 26.04 and Debian 13.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions