Skip to content

[Bug] Qwen-Image-2.1 periodic grid artifacts #2193

Open

Description

@lvml

Git commit

git rev-parse HEAD
fd21ecf

Operating System & Version

Arch Linux

GGML backends

Vulkan

Command-line arguments used

sd-cli --backend Vulkan0 --diffusion-model qwen-image-2.1-Q8_0.gguf --vae qwen_image_2.1_vae_fp16.safetensors --llm Qwen3VL-8B-Instruct-F16.gguf --cfg-scale 6.0 --sampling-method euler --steps 40 --width 512 --height 512 --seed 10022 -o "test_output.png" -p "A square-format realistic outdoor photograph shows a narrow muddy hiking path winding through dense green forest under warm, dappled sunlight. The scene is viewed at roughly eye level, creating strong depth as the trail leads from the lower-right foreground toward the upper-right middle distance. Tall conifer trunks and leafy deciduous trees fill the background, with dark evergreen branches arching over the left side of the path and bright summer foliage catching yellow-green highlights on both sides. The ground is richly textured with exposed tree roots crossing beneath the trail, damp soil, small stones, ferns, grasses, moss-covered rocks, fallen branches, thin sticks, dry twigs, and patches of low undergrowth.\n\nThe lighting is bright midday summer sunlight filtering through the canopy, producing high-contrast patches of gold, green, brown, and deep shadow. The overall style is detailed, cinematic, naturalistic, and highly realistic, with a documentary-adventure feel and sharp attention to textures such as mud, bark, water ripples, moss, leaves, and tangled undergrowth."

Steps to reproduce

(The symptom I describe here looks like what was reported in #2041 - but that bug is closed as fixed, even though I see the same error with the current git master head.)

To reproduce, run the command:

sd-cli --backend Vulkan0 \
  --diffusion-model qwen-image-2.1-Q8_0.gguf \
  --vae qwen_image_2.1_vae_fp16.safetensors \
  --llm Qwen3VL-8B-Instruct-F16.gguf \
  --cfg-scale 6.0 \
  --sampling-method euler \
  --steps 40 \
  --width 512 \
  --height 512 \
  --seed 10022 \
  -o "test_output.png" \
   -p "A square-format realistic outdoor photograph shows a narrow muddy hiking path winding through dense green forest under warm, dappled sunlight. The scene is viewed at roughly eye level, creating strong depth as the trail leads from the lower-right foreground toward the upper-right middle distance. Tall conifer trunks and leafy deciduous trees fill the background, with dark evergreen branches arching over the left side of the path and bright summer foliage catching yellow-green highlights on both sides. The ground is richly textured with exposed tree roots crossing beneath the trail, damp soil, small stones, ferns, grasses, moss-covered rocks, fallen branches, thin sticks, dry twigs, and patches of low undergrowth.\n\nThe lighting is bright midday summer sunlight filtering through the canopy, producing high-contrast patches of gold, green, brown, and deep shadow. The overall style is detailed, cinematic, naturalistic, and highly realistic, with a documentary-adventure feel and sharp attention to textures such as mud, bark, water ripples, moss, leaves, and tangled undergrowth."

The resulting 512x512 image shows an obvious and extreme case of the "grid artifacts".

The symptom appears to be very dependent on the prompt content as to whether it occurs or not - above prompt generates a foliage-rich scene which seem prone to provoke this symptom.

Notice that the prompt wording was processed with the Qwen-Image-2.1 prompt enhancement model, so it should not contain any weird/invalid description.

I tried with/without flash attention - no difference.
I tried with/without --tiled-vae - no difference.
I tried a different quantization of the diffusion model - no (relevant) difference.
I tried also the "-turbo" version of Qwen-Image-2.1, the symptom is less prominent in the results, but there are also (seemingly smaller) grid artifacts.

What you expected to happen

A clean forest scenery being rendered.

What actually happened

A forest scene is rendered, but looks terrible because of intense grid artifacts.

Logs / error messages / stack trace

sd-cli verbose output:

ggml_vulkan: Found 1 Vulkan devices:
ggml_vulkan: 0 = AMD Radeon 780M Graphics (RADV PHOENIX) (radv) | uma: 1 | fp16: dot2 | bf16: 0 | fp4: 0 | warp size: 64 | shared memory: 65536 | int dot: 1 | matrix cores: KHR_coopmat
[I] loading diffusion model from '/home/llm/qwen_image_2_1/qwen-image-2.1-Q8_0.gguf' --- diffusion_engine.cpp:739
[I] load /home/llm/qwen_image_2_1/qwen-image-2.1-Q8_0.gguf using gguf format --- model_loader.cpp:216
[I] loading llm from '/home/llm/qwen_image_2_1/Qwen3VL-8B-Instruct-F16.gguf' --- diffusion_engine.cpp:796
[I] load /home/llm/qwen_image_2_1/Qwen3VL-8B-Instruct-F16.gguf using gguf format --- model_loader.cpp:216
[I] loading vae from '/home/llm/qwen_image_2_1/qwen_image_2.1_vae_fp16.safetensors' --- diffusion_engine.cpp:810
[I] load /home/llm/qwen_image_2_1/qwen_image_2.1_vae_fp16.safetensors using safetensors format --- model_loader.cpp:222
[I] Version: Qwen Image 2.1  --- diffusion_engine.cpp:1017
[I] auto-fit plan: --- backend_fit.cpp:323
[I]   devices: --- backend_fit.cpp:324
[I]     Vulkan0      AMD Radeon 780M Graphics (RADV PHOENIX) free  52084 MiB, budget  51572 MiB --- backend_fit.cpp:326
[I]     RAM          free  47980 MiB, params budget  43182 MiB --- backend_fit.cpp:333
[I]   compute-device weight cache priority: diffusion > te > vae --- backend_fit.cpp:336
[I]   components (params: compute device -> RAM -> other GPU -> disk): --- backend_fit.cpp:337
[I]     DiT          params   7286 MiB, compute reserve  2048 MiB -> compute Vulkan0, params Vulkan0 --- backend_fit.cpp:346
[I]     Conditioner  params  15623 MiB, compute reserve  2048 MiB -> compute Vulkan0, params Vulkan0 --- backend_fit.cpp:346
[I]     VAE          params    644 MiB, compute reserve  1024 MiB -> compute Vulkan0, params Vulkan0 --- backend_fit.cpp:346
[I] auto-fit: --backend "Vulkan0" --- backend_fit.cpp:474
[I] Weight type stat:                      f32: 210  |     f16: 492  |    q8_0: 196  |    bf16: 4     --- diffusion_engine.cpp:1650
[I] Conditioner weight type stat:          f32: 145  |     f16: 254   --- diffusion_engine.cpp:1651
[I] Diffusion model weight type stat:      f32: 65   |    q8_0: 196  |    bf16: 4     --- diffusion_engine.cpp:1652
[I] VAE weight type stat:                  f16: 238   --- diffusion_engine.cpp:1653
[W] no vision weights detected, vision disabled --- llm.hpp:448
[I] using VAE for encoding / decoding --- model_builders.cpp:664
[I] flash attention auto: Vulkan0 -> on (probe: normal 3.674 ms, flash 2.750 ms) --- flash_attn.cpp:94
[I] conv2d direct auto: Vulkan0 -> on (probe: im2col 0.451 ms, direct 0.353 ms) --- conv_direct.cpp:82
[W] conv3d direct auto: Vulkan0 -> off (probe output check failed) --- conv_direct.cpp:79
[I] total params memory size = 22367.43MB (VRAM 22367.43MB, RAM 0.00MB): text_encoders 14436.18MB(VRAM), diffusion_model 7286.88MB(VRAM), vae 644.38MB(VRAM), controlnet 0.00MB(N/A), extensions 0.00MB(N/A) --- diffusion_engine.cpp:1444
[I] running in FLOW mode --- diffusion_engine.cpp:1590
[I] generate_image 512x512 --- image.cpp:822
[I] Using 'qwen' preset for reference images --- diffusion_engine.cpp:3261
[I] get_sigmas with Flux scheduler --- denoiser.hpp:1196
[I] sampling using Euler method --- request.cpp:427
[I] qwen3vl build cached graph cut plan done (taking 1 ms) --- ggml_graph_cut.cpp:1032
  |##################################################| 397/397 -   5.42GB/s
[I] loading tensors completed, taking 2.60s (read: 0.63s, memcpy: 0.00s, convert: 0.00s, copy_to_backend: 1.74s) --- model_loader.cpp:1400
[I] qwen3vl build cached graph cut plan done (taking 1 ms) --- ggml_graph_cut.cpp:1032
[I] get_learned_condition completed, taking 4.53s --- image.cpp:537
[I] generating image: 1/1 - seed 10022 --- image.cpp:874
[I] qwen_image_2_1 build cached graph cut plan done (taking 2 ms) --- ggml_graph_cut.cpp:1032
  |##################################################| 265/265 -   5.08GB/s
[I] loading tensors completed, taking 1.40s (read: 0.14s, memcpy: 0.00s, convert: 0.00s, copy_to_backend: 1.08s) --- model_loader.cpp:1400
[I] qwen_image_2_1 build cached graph cut plan done (taking 2 ms) --- ggml_graph_cut.cpp:1032
  |=>                                                |  1/40 -  10.04s/it - ETA 06:31[I] qwen_image_2_1 build cached graph cut plan done (taking 1 ms) --- ggml_graph_cut.cpp:1032
[I] qwen_image_2_1 build cached graph cut plan done (taking 1 ms) --- ggml_graph_cut.cpp:1032
  |==================================================| 40/40 -   7.08s/it
[I] sampling completed, taking 288.48s --- image.cpp:907
[I] generating 1 latent images completed, taking 288.48s --- image.cpp:919
[I] decoding 1 latents --- image.cpp:562
[I] wan_vae build cached graph cut plan done (taking 0 ms) --- ggml_graph_cut.cpp:1032
  |##################################################| 128/128 -   2.35GB/s
[I] loading tensors completed, taking 0.20s (read: 0.02s, memcpy: 0.00s, convert: 0.00s, copy_to_backend: 0.10s) --- model_loader.cpp:1400
[I] latent 1 decoded, taking 4.34s --- image.cpp:628
[I] decode_first_stage completed, taking 4.34s --- image.cpp:632
[I] generate_image completed in 297.36s --- image.cpp:1058
[I] save result image 0 to 'test_output.png' (success) --- main.cpp:496
[I] 1/1 images saved --- main.cpp:572
emitted one output image

Additional context / environment details

The resulting, obviously distorted image:

Image

Activity

  1. added
    bugSomething isn't working
    on Oct 22, 2026
  2. Green-Sky commented on Oct 22, 2026

    @Green-Sky
    Contributor

    Have you tried a cfg scale of 3.0 or similar?

  3. lvml commented on Oct 22, 2026

    @lvml
    Author

    @Green-Sky : I have tried --cfg-scale 1.0 and now also --cfg-scale 3.0, the results look equally distorted.

    I should mention that using above prompt, the bug is visible with any seed value I tried, but of course I could test only so many.
    However, the bug is much less likely reproduced with other prompts I tried. It really seems foliage with high contrast provokes it.

  4. clort81 commented on Oct 23, 2026

    @clort81

    https://huggingface.co/madebyollin/texture-fix-vae-for-qwen-image-2.1

    This fixes the fine grain i see, but that significant pattern might be something else.

    Also i never run up to 40 steps, 20-26 more like it.

  5. lvml commented on Oct 23, 2026

    @lvml
    Author

    6. https://huggingface.co/madebyollin/texture-fix-vae-for-qwen-image-2.1
    This fixes the fine grain i see, but that significant pattern might be something else.

    Yes, the primarily disturbing bigger grid artifacts are not fixed by using that "texture-fix-vae-for-qwen-image-2.1", just tried it as well.

    6. Also i never run up to 40 steps, 20-26 more like it.

    Well, the official Qwen-Image-2.1 documentation recommends to use 40 steps.

  6. lvml commented on Oct 23, 2026

    @lvml
    Author

    In order to quantify the distortions we are seeing in the example, I asked my local AI to write a script to compute and visualize the pixel-period spectrum of the grid artifacts:

    grid_distortion_analyzer.py

    Image

    (Non-distorted images do not show such exposed peaks as in the above.)

  7. Green-Sky commented on Oct 23, 2026

    @Green-Sky
    Contributor

    Can you compare your f16 vae to the bf16 vae?

  8. lvml commented on Oct 23, 2026

    @lvml
    Author

    9. Can you compare your f16 vae to the bf16 vae?

    Sure, here is the same kind of spectrum computed on the result with that texture-fix-vae-for-qwen-image-2.1:

    Image
  9. lvml commented on Oct 23, 2026

    @lvml
    Author

    Here is an enhanced version of the grid_distortion_analyzer.py script that adds a --check option if someone wants to automate the process of checking an image for "grid artifacts". Unlike the two 1-dimensional spectra displayed in the diagram computed otherwise, the --check option computes a 2-dimensional FFT to allow for a better automatic separation of "bad" and "good" images.

    You can also have the script output the 2-dimensional FFTs now, e.g. grid_distortion_analyzer.py --fft2d test_output_bad.png producing:

    Image
  10. lvml commented on Oct 24, 2026

    @lvml
    Author

    I wanted to check whether the grid artifacts would also occur in output from Qwen's own hosted Qwen-image instances. At https://chat.qwen.ai/c/guest the chatbot appears to use Qwen-Image-3.0 for image generation, so I thought I would give that a try while already being there, and indeed the (2048x2048) image it created for the same prompt showed the same kind of 4 and 8 pixel grid patterns as the local Qwen-Image-2.1 this issue is about.

    I had some fun asking Qwen's chatbot about the grid patterns, not sure its answers provided any useful insight, click this this image link to view the chat screenshot.

    And btw., asking chat.qwen.ai for a lower resolution image did not work, it created yet another 2048x2048 image with the same grid artifact issue, so I was unable to disprove its claim that lower resolutions would be less prone to the issue.

    I sent some feedback to feedback@qwen.com about this issue, but of course I have no idea if that yields any reaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions