Skip to content

[Bug] MiniMax-H3: decoding with VAE tiles larger than 256 px leaves a 16 px block grid #2310

Open

Description

@Windyskr

Git commit

3d315c4 (also seen on 0b3b98d)

Operating System & Version

Ubuntu 22.04

GGML backends

CUDA

Command-line arguments used

sd-cli -M vid_gen --diffusion-model Sakura-MiniMax-H3-FL2VA-Pruned-Q8_0-19.94GiB.gguf --llm <MiniMax-H3 Qwen3-VL-32B encoder, Q8_0> --vae minimax_h3_video_vae_fp16.safetensors --audio-vae minimax_h3_audio_vae_fp32.safetensors -p "A steam locomotive crosses a tall stone viaduct over a misty mountain valley at dawn, wide cinematic shot, billowing white steam, golden sunlight breaking through the clouds." --cfg-scale 1.0 --steps 20 -W 960 -H 544 --video-frames 22 -s 1234 --rng cpu --sage-attn --vae-tiling --vae-relative-tile-size 1x1

--vae-tiling --vae-tile-size 384x384 and 512x512 show the same artifact, weaker.

Steps to reproduce

  1. Generate a MiniMax-H3 clip with the default VAE tiling (256 px tiles).
  2. Generate the same seed with larger decode tiles (--vae-tiling --vae-tile-size 512x512 or --vae-relative-tile-size 1x1).
  3. Compare the decoded frames.

What you expected to happen

The same content, at most with different tile seams. docs/performance.md presents larger tiles as a memory/speed trade-off ("explicit spatial sizes are honored").

What actually happened

Every 16x16 pixel block (one decoder token) gets visible edges. Grid strength, measured as the gradient energy on 16 px boundaries relative to the average over all offsets (about 1.2 means no visible grid):

decode tiles x y
256 px (default) 1.28 1.20
384 px 1.61 1.40
512 px 2.30 2.32
full frame 2.86 2.45
full frame, --flash-attn auto,vae=off (OOM, retried at 480x272) 2.18 1.18

Visually, with 256 px tiles the sky is smooth; with full-frame tiles every 16x16 block has visible edges; with VAE flash attention off the horizontal edges disappear but vertical stripes remain.

Logs / error messages / stack trace

No errors.

Additional context / environment details

  • 2x RTX 3090 Ti, CUDA 12.4 build for sm_86.
  • The decoder is a ViT over latent tokens, and the reference implementation ships with 256 px tiles (diffusers AutoencoderKLMiniMaxH3: "MiniMax-H3 was released with tiling enabled ... disabling tiling changes the output"), so larger tiles may simply be out of distribution.
  • Flash attention in the decoder (K/V cast to F16) makes it worse at long sequences: turning it off for the VAE removes the horizontal lines, but not the vertical ones. At the default 256 px tiles, VAE flash attention on and off are indistinguishable (PSNR 46-47 dB).
  • Suggestion: clamp or warn for MiniMax-H3 decode tiles above 256 px, and/or note it next to "explicit spatial sizes are honored" in docs/performance.md.

Activity

  1. farawayso commented on Nov 9, 2026

    @farawayso
    Contributor

    Cross-referencing #2268: on Windows + ROCm (RX 7900 XTX, commit 290148d), the default 256 px tiles are not a performance bottleneck — a 1024x576x124 decode finished decode_first_stage in ~66 s (~1.9 it/s per 15-tile segment), with the VAE compute buffer (521 MB) fully resident in VRAM. That supports clamping H3 decode tiles at 256 px without a meaningful cost on high-VRAM cards, plus a note in docs/performance.md. I have not A/B-tested tiles >256 px on ROCm, so I can't confirm whether the 16 px grid reproduces on this backend.

  2. Windyskr commented on Nov 10, 2026

    @Windyskr
    ContributorAuthor

    Follow-up with a corrected diagnosis: the flash-attention part of my report was wrong, and the grid has a simpler cause.

    Correction. The "full frame, VAE FA off" run ran out of memory, and the OOM retry decoded it with 480x272 tiles, so it changed the tile size as well as flash attention. With the same 480x272 tiles, VAE FA on and off give the same grid (x 2.18 / y 1.15 vs x 2.15 / y 1.14, PSNR 49.6 dB between the two outputs). VAE flash attention plays no role.

    Cause. The decoder's RoPE positions are normalized to the tile: (2 * (i + 0.5) / N - 1) * 2 * pi per axis, where N is the tile size in latent tokens (minimax_h3_vae.hpp#L812-L815). The diffusers reference does the same ("length-normalized to [-1, 1) per axis", L279-L284, L463-L467), so the port is faithful. Every tile spans the same position range, so the spacing between neighboring tokens depends on N. The model was released with 256 px tiles (N = 16); any other N gives the decoder a token spacing the released configuration never uses, and the error shows up at the 16x16 pixel patch boundaries. Larger and smaller tiles both trigger it.

    Measured on one latent decoded with different tiles, using the command from the report (Q8_0, 20 steps, seed 1234, 960x544, 22 frames). The table in the report mixed two setups (the 384 and 512 px rows came from a different run); this one does not. A repeated 256 px run gave bit-identical frames.

    decode tiles tokens per tile tiles grid x grid y decode
    128 px 8 x 8 10x5 2.64 2.86 4.4 s
    256 px (default) 16 x 16 5x3 1.25 1.15 4.8 s
    384 px 24 x 24 3x2 1.66 1.38 4.8 s
    480x272 px 30 x 17 3x3 2.18 1.15 5.7 s
    512 px 32 x 32 2x2 2.43 2.41 5.3 s
    full frame 60 x 34 1x1 3.08 2.67 3.8 s

    Each axis follows its own token count: 480x272 tiles are 17 tokens tall, so y stays clean while x shows the grid. (384 px is the one row where x and y differ at equal N; its two tiles in y overlap by 14 of 24 rows, so blending probably averages part of it out.)

    What this means for the suggestion:

    • Clamping only above 256 px is not enough. Tiles below 256 px also produce the grid, and the OOM retry halves H3 tiles from 256 to 128 px (backend_fit.cpp#L510-L526), so a decode that runs out of memory at 256 px gets the grid without any warning about quality.
    • So the rule would be "H3 decode tiles are 16 latent tokens per axis": warn when an explicit size differs, keep the OOM retry from shrinking H3 tiles below 256 px (or warn when it does), and note it next to "explicit spatial sizes are honored" in docs/performance.md. An axis shorter than 256 px still gets one smaller tile; the reference does the same.
    • On cost (re the comment above): decode times differ by about 1 s here, with full frame the fastest, out of about 62 s for the whole run. Keeping 256 px tiles costs little.
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions