Repository navigation
Studio: seam-free VAE tiles for Qwen-Image-2.1 on low-VRAM tiers (fixes thin horizontal / vertical lines) - #12696
Merged
Merged
Conversation
The Qwen-Image-2.1 VAE compresses 16x, but diffusers gives it the Wan VAE's tile geometry in pixels (256 px tiles, 192 px stride). On this VAE that is a 16-latent tile with a 4-latent (64 px) blend, and the last row and column are 4-latent slivers. The decoder sees further than 4 latents past a tile edge, so every seam and the right / bottom sliver decode differently from their neighbours, and the short blend leaves thin vertical and horizontal lines about one tile long. Every tier that tiles the decode (the 12 GB and 16 GB streaming / offload plans) has drawn them since the family was added; resident loads decode untiled and never showed them. Decode this VAE in 32-latent tiles with at least a 16-latent overlap (the overlap ComfyUI tiles its decode with), spread evenly so the last tile ends at the image edge at full size. A tile gets no weight within 4 latents of an edge it shares with another tile and ramps to full weight over the next 8, normalised to 1 at every pixel, so the edge of an outer tile never shows where three tiles overlap (strides under 16 latents). A canvas within one tile decodes untiled. Tiles decode one at a time, so the decode peak does not grow with the canvas. Installed at load for every speed mode, before the fused batched tile decode, so it covers the fused and stock paths. Only the decode changes: the tiled encode and the tile attributes stay stock. vae_tile_side and the calibrated tiled-decode activation report the 512 px tile. Kill switch UNSLOTH_DIFFUSION_VAE_WIDE_TILES=0 (at load: skip the install; later: stock tiled decode per call). Tests cover the tile layout and blend weights at every size the Images page offers, the per-call memory guard at those sizes, and a tiny random AutoencoderKLQwenImage21 decoded tiled against untiled.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 4, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 4, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 4, 2026
…w-VRAM tiers The Qwen-Image-2.1 VAE compresses 16x, but diffusers gives it the Wan VAE's tile geometry in pixels (256 px tiles, 192 px stride). On this VAE that is a 16-latent tile with a 4-latent (64 px) blend, and the last row and column are 4-latent slivers. The decoder sees further than 4 latents past a tile edge, so every seam and the right / bottom sliver decode differently from their neighbours, and the short blend leaves thin vertical and horizontal lines about one tile long. Every tier that tiles the decode (the 12 GB and 16 GB streaming / offload plans) has drawn them since the family was added; resident loads decode untiled and never showed them. Decode this VAE in 32-latent tiles with at least a 16-latent overlap (the overlap ComfyUI tiles its decode with), spread evenly so the last tile ends at the image edge at full size. A tile gets no weight within 4 latents of an edge it shares with another tile and ramps to full weight over the next 8, normalised to 1 at every pixel, so the edge of an outer tile never shows where three tiles overlap (strides under 16 latents). A canvas within one tile decodes untiled. Tiles decode one at a time, so the decode peak does not grow with the canvas. The stock tiled encode (img2img and edit inputs on the same tiers) has the same geometry and seams; it gets the same tiles, blended in latent space. Installed at load for every speed mode, before the fused batched tile decode, so it covers the fused and stock paths. The VAE's tile attributes stay stock. vae_tile_side and the calibrated tiled-decode activation report the 512 px tile. Kill switch UNSLOTH_DIFFUSION_VAE_WIDE_TILES=0 (at load: skip the install; later: stock tiled decode / encode per call). Tests cover the tile layout and blend weights at every size the Images page offers, the per-call memory guard at those sizes, and a tiny random AutoencoderKLQwenImage21 decoded and encoded tiled against untiled.
…d seam-free tiled encode
The 32x32-latent decode tiles with 16-latent overlaps decode about 2.25x the canvas at 1024x1024 against about 1.7x for the stock tiles, which costs about 0.25 s per decode on an L4. When half the free VRAM holds them, take larger tiles, down to one untiled decode: fewer tiles decode less overlap, so they are faster and leave fewer seams. The tile sides are the fewest that cover each axis with 16-latent overlaps and fit the area budget (1.7 MiB of decode peak per latent of tile area, measured on 32x32 to 64x64 tiles, plus the fp32 output accumulator). With no room for more, the decode keeps the 32x32 tiles the planner budgets, so no plan or memory estimate changes. UNSLOTH_DIFFUSION_VAE_MAX_TILE caps the tile side.
…AM tiers The 12 / 16 GB tiers tile the VAE encode with diffusers' stock 16-latent tiles. The encoder attends over each tile, so the condition latent shifts everywhere, not only at the seams, and edits drift from the resident result. Encode in 64-latent tiles with 32-latent overlaps and the decode's normalised ramp blend: a 1024 px reference (the default) is one tile and matches the untiled encode exactly. Same kill switch as the decode.
# Conflicts: # studio/backend/core/inference/diffusion_vae_tiling.py # studio/backend/tests/test_diffusion_vae_tiling.py
…studio/vae-tile-seams-followup
…studio/q21-line-artifacts
# Conflicts: # studio/backend/core/inference/diffusion_vae_tiling.py # studio/backend/tests/test_diffusion_vae_tiling.py
This family only encodes edit inputs, at the reference resolution, and the per-call guard charges them as weighted condition pixels. Test that this covers the measured 64-latent encode tile (2,322 MiB unfused) at every reference resolution and output size, and describe the encode geometry in the module docstring.
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 5, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 5, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 5, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 5, 2026
Member
Author
|
@codex review |
1 similar comment
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This was referenced Oct 5, 2026
danielhanchen
added a commit
that referenced
this pull request
Oct 6, 2026
…stock, no low-VRAM OOM) (#12764) * Studio: decode Qwen-Image-2.1 in seam-free VAE tiles on low-VRAM tiers The Qwen-Image-2.1 VAE compresses 16x, but diffusers gives it the Wan VAE's tile geometry in pixels (256 px tiles, 192 px stride). On this VAE that is a 16-latent tile with a 4-latent (64 px) blend, and the last row and column are 4-latent slivers. The decoder sees further than 4 latents past a tile edge, so every seam and the right / bottom sliver decode differently from their neighbours, and the short blend leaves thin vertical and horizontal lines about one tile long. Every tier that tiles the decode (the 12 GB and 16 GB streaming / offload plans) has drawn them since the family was added; resident loads decode untiled and never showed them. Decode this VAE in 32-latent tiles with at least a 16-latent overlap (the overlap ComfyUI tiles its decode with), spread evenly so the last tile ends at the image edge at full size. A tile gets no weight within 4 latents of an edge it shares with another tile and ramps to full weight over the next 8, normalised to 1 at every pixel, so the edge of an outer tile never shows where three tiles overlap (strides under 16 latents). A canvas within one tile decodes untiled. Tiles decode one at a time, so the decode peak does not grow with the canvas. Installed at load for every speed mode, before the fused batched tile decode, so it covers the fused and stock paths. Only the decode changes: the tiled encode and the tile attributes stay stock. vae_tile_side and the calibrated tiled-decode activation report the 512 px tile. Kill switch UNSLOTH_DIFFUSION_VAE_WIDE_TILES=0 (at load: skip the install; later: stock tiled decode per call). Tests cover the tile layout and blend weights at every size the Images page offers, the per-call memory guard at those sizes, and a tiny random AutoencoderKLQwenImage21 decoded tiled against untiled. * Studio: decode and encode Qwen-Image-2.1 in seam-free VAE tiles on low-VRAM tiers The Qwen-Image-2.1 VAE compresses 16x, but diffusers gives it the Wan VAE's tile geometry in pixels (256 px tiles, 192 px stride). On this VAE that is a 16-latent tile with a 4-latent (64 px) blend, and the last row and column are 4-latent slivers. The decoder sees further than 4 latents past a tile edge, so every seam and the right / bottom sliver decode differently from their neighbours, and the short blend leaves thin vertical and horizontal lines about one tile long. Every tier that tiles the decode (the 12 GB and 16 GB streaming / offload plans) has drawn them since the family was added; resident loads decode untiled and never showed them. Decode this VAE in 32-latent tiles with at least a 16-latent overlap (the overlap ComfyUI tiles its decode with), spread evenly so the last tile ends at the image edge at full size. A tile gets no weight within 4 latents of an edge it shares with another tile and ramps to full weight over the next 8, normalised to 1 at every pixel, so the edge of an outer tile never shows where three tiles overlap (strides under 16 latents). A canvas within one tile decodes untiled. Tiles decode one at a time, so the decode peak does not grow with the canvas. The stock tiled encode (img2img and edit inputs on the same tiers) has the same geometry and seams; it gets the same tiles, blended in latent space. Installed at load for every speed mode, before the fused batched tile decode, so it covers the fused and stock paths. The VAE's tile attributes stay stock. vae_tile_side and the calibrated tiled-decode activation report the 512 px tile. Kill switch UNSLOTH_DIFFUSION_VAE_WIDE_TILES=0 (at load: skip the install; later: stock tiled decode / encode per call). Tests cover the tile layout and blend weights at every size the Images page offers, the per-call memory guard at those sizes, and a tiny random AutoencoderKLQwenImage21 decoded and encoded tiled against untiled. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: decode Qwen-Image-2.1 in larger tiles when free VRAM allows The 32x32-latent decode tiles with 16-latent overlaps decode about 2.25x the canvas at 1024x1024 against about 1.7x for the stock tiles, which costs about 0.25 s per decode on an L4. When half the free VRAM holds them, take larger tiles, down to one untiled decode: fewer tiles decode less overlap, so they are faster and leave fewer seams. The tile sides are the fewest that cover each axis with 16-latent overlaps and fit the area budget (1.7 MiB of decode peak per latent of tile area, measured on 32x32 to 64x64 tiles, plus the fp32 output accumulator). With no room for more, the decode keeps the 32x32 tiles the planner budgets, so no plan or memory estimate changes. UNSLOTH_DIFFUSION_VAE_MAX_TILE caps the tile side. * Studio: encode Qwen-Image-2.1 edit inputs in wide VAE tiles on low-VRAM tiers The 12 / 16 GB tiers tile the VAE encode with diffusers' stock 16-latent tiles. The encoder attends over each tile, so the condition latent shifts everywhere, not only at the seams, and edits drift from the resident result. Encode in 64-latent tiles with 32-latent overlaps and the decode's normalised ramp blend: a 1024 px reference (the default) is one tile and matches the untiled encode exactly. Same kill switch as the decode. * Studio: let a Qwen-Image-2.1 decode tile use three quarters of the free VRAM * Studio: format the Qwen-Image-2.1 VAE tiling files * Studio: pin that the edit guard covers one Qwen-Image-2.1 encode tile This family only encodes edit inputs, at the reference resolution, and the per-call guard charges them as weighted condition pixels. Test that this covers the measured 64-latent encode tile (2,322 MiB unfused) at every reference resolution and output size, and describe the encode geometry in the module docstring. * Studio: give the Qwen-Image-2.1 VAE test skip an explanatory reason * Studio: tighten the Qwen-Image-2.1 VAE tiling comments * Studio: trim the Qwen-Image-2.1 VAE tiling test comments * Studio: seam-free tiled decode for every image VAE whose stock tiles fall under the floor Read the stock tile and overlap off each VAE (Wan-family pixel tiles and strides, AutoencoderKL-style latent tiles and overlap factor) and its compression ratio, instead of covering only AutoencoderKLQwenImage21. Each tiled decode keeps diffusers' tiles when every tile is at least 32 latents and every overlap at least 16, and otherwise takes the wide, edge-aligned tiles (floor 32 / 16, or the stock tile when larger). This covers Qwen-Image / Qwen-Image-Edit / Krea-2 (8x, 8-latent blends), HunyuanImage-2.1 (32x, 12-latent tiles with 3-latent blends) and the edge-sliver sizes of AutoencoderKL / FLUX.2 (an 8-latent last tile at 1600 px), and keeps Qwen-Image-2.1 bit-identical. 4-D latents are supported, the decode budget scales per output pixel, and KEEP_STOCK holds VAEs that must keep stock tiles, with the measured reason. * Studio: size wide VAE tiles from measured per-class peaks, never decode more than stock at the floor - Decode budget per VAE class from measured bf16 peaks (unfused / fused MiB per latent): Qwen-Image 0.27 / 0.18, Qwen-Image-2.1 1.7 / 0.43, HunyuanImage-2.1 1.3, AutoencoderKL and FLUX.2 0.17 / 0.09, the worst of each ratio for an unmeasured class. Tiles are sized on the fused figure where the fused VAE kernels are installed. The old per-pixel figure was 5x HunyuanImage's peak and 2.9x AutoencoderKL's. - The floor layout of a VAE whose stock tile is larger than 32 latents picks the fewest tiles of the smallest side that keeps the overlap (two 116-latent tiles on a 1600 px FLUX.1 side, not two 128s), so it never decodes more than stock. - A VAE whose stock tile is smaller than the floor tile (HunyuanImage, Qwen-Image-2.1) decodes in its stock tiles, with a logged reason, when even the floor tile cannot fit the free VRAM. An OOM in the wide tiles retries at the floor tile, then in the stock tiles. - The stock tiles the wide path falls back to keep the fused batched tile loop on the Wan family. - Geometry and blend weights are cached per VAE. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: tighten the VAE tiling comments * Studio: at an AutoencoderKL / FLUX.2 edge sliver, take the widest tiles that decode no more than stock The wide floor for a VAE whose stock tile is the floor tile (AutoencoderKL, FLUX.2, which take the wide path only for an edge sliver) picked the smallest covering side (two 116-latent tiles on a 1600 px side). That kept the seam lines away but lost per-tile context against the 128-latent tiles: SDXL's worst 64 px window rose from 3.1 to 5.1 levels on DIV2K 0010. Now it takes the fewest decoder calls, then the largest tile, among layouts that decode no more latents per side than the stock loop: two 120-latent tiles (240 decoded latents, as stock, in 4 calls instead of 9). Qwen-Image, Qwen-Image-2.1 and HunyuanImage keep the fewest-latents choice. * Studio: grow AutoencoderKL / FLUX.2 wide tiles past the floor only into device-free memory A VAE whose stock tile is the floor tile takes the wide tiles only to drop an edge sliver. Counting the allocator's cached blocks as free let FLUX.1 at 1600 px on an 8 GB tier decode untiled (3.7 GB) out of the denoiser's cache; 3 of 5 decodes stalled on cache flushes (0.21 s median against stock's 0.08). Its tiles now grow past the floor only into the memory the device has free. Qwen-Image, Qwen-Image-2.1 and HunyuanImage still count the cache, as #12696 does (measured faster there), and the floor-fit check counts it for every VAE. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: trim the VAE tiling comments * Studio: drop restating VAE tiling comments --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
There are reports of thin horizontal / vertical lines in Qwen-Image-2.1 images on 12 GB and 16 GB cards, with the FP8, INT8 and GGUF (Q4_K_M) denoisers, on NVIDIA and AMD. Typical shapes: a lighter band about 8 px wide running a few hundred pixels down a face, and short greenish streaks in a plain sky near the right edge. A full-VRAM card does not show them.
The lines come from the VAE decode, not the denoiser. On a B200 with the card capped to 12 GiB (Studio's own planner picks the streaming tier), the final latent is bit-identical to the resident load's latent for all three prompts tried, but the decoded image is not: it differs by up to 69 levels along the VAE tile seams. Decoding that same saved latent with plain diffusers reproduces the lines exactly with
tiled_decodeand not at all without it.Why the tiles are wrong for this VAE:
AutoencoderKLQwenImage21the Wan VAE's tile geometry in pixels: 256 px tiles, 192 px stride, 64 px blend.The bug has been there since Qwen-Image-2.1 was added: the first commit that can render it on the 12 GiB tier (c121e80) already shows the lines, and so does main.
Change
New
diffusion_vae_tiling.py, installed on the Qwen-Image-2.1 VAE at load for every speed mode:UNSLOTH_DIFFUSION_VAE_MAX_TILE=<latents>caps the tile side; off CUDA the tiles stay at 32x32._decode, so the fused Triton VAE kernels still apply. It is installed before the speed optims, so the fused batched tile decode does not replace it.use_tilingon. The stock tiled encode has the same geometry, and because the encoder attends over the whole tile, its 16-latent tiles shift the condition latent everywhere, not only at the seams. It now uses 64-latent (1024 px) tiles with 32-latent overlaps and the same kind of normalised blend, applied to the encoder's moments in latent space, so an input up to 1024 px a side encodes as one tile, exactly as untiled. The VAE's tile attributes stay as diffusers sets them.vae_tile_sidereports the 512 px minimum tile.UNSLOTH_DIFFUSION_VAE_WIDE_TILES=0: at load it skips the install, so the fused batched tile decode installs as before. Set later, each decode and encode takes the stock tiled path.Results
The first two tables were measured on the first version of this change: fixed 32x32-latent tiles and a plain linear blend. The per-size sweep and the L4 timing further down are on the final version.
B200, Studio's real
DiffusionBackendin process, card capped with a VRAM simulator so the planner picks the same tier a 12 GB card gets. 1024x1024, 20 steps, guidance 6, fp8 text encoder. Three prompts: the pizza restaurant at dusk from the reports (seed 653672378), the pony and the golden husky (seed 1).Seam score: worst 64 px window mean of |image - untiled decode of the same latent|, in 8-bit levels, for the three prompts (sorted). Resident Studio vs plain untiled diffusers is 0.5 to 0.6 (fused kernel noise).
Real L4 (sm89, the same architecture as a 4070 Ti) and RTX PRO 6000 (sm120) on Colab, with a VRAM ballast leaving 11.9 GB free and the reported total capped to 12 GB, so the planner sees a real 12 GB card. Same settings, Studio installed from the same base commit with and without this change:
* a small saturated blob on the husky's chest, which the untiled decode of the same latent also draws; it is not a line. On base the L4 husky shows a column of pale dots, the same streak as in the reports.
Speed and memory on the B200, first version, base / this branch (shared card, medians of the warm renders):
Decode time on an L4
On an L4 with a real 12 GB budget, the first version, with fixed 32x32 tiles, made the warm decode slower: 0.76 to 0.77 s before and 1.01 to 1.02 s after at 1024x1024, about 30% more decoded area than main's 6x6 small tiles. The final version picks larger tiles when free VRAM allows. Here it is on the same Colab L4 setup, Studio installed from the same base commit with and without this change, pony prompt, warm (second) render at each size, 8 steps:
Every image size
Real renders at every size the Images page offers for this model:
Setup: Studio's
DiffusionBackendat the 12 GiB tier, 8 steps, guidance 1.The seam score is measured against the untiled decode of each render's own latent. Latents are bit-identical between base and this branch in all 40 B200 cells and all 20 RTX PRO 6000 cells.
Real L4 with the 12 GB budget (ballast to 11,903 MiB free, total capped to 12 GB): GGUF Q4_K_M, group offload with the VAE tiled, pony, 8 steps, guidance 1. Measured on the first version (fixed 32x32 tiles, plain linear blend); the final version's L4 decode times are in the L4 table above.
Tiled encode (edits)
The same tiers encode edit inputs with
use_tilingon, with the same 16-latent tiles, 4-latent blends and slivers. The encoder attends over the whole tile, so small tiles shift the condition latent everywhere and the edit derails, not only at the seams: on the 12 GiB tier, a "snowy winter" edit of the pony came back as the original meadow with a smeared pony.End to end through Studio's
DiffusionBackendon the B200 with the VRAM simulator, GGUF Q4_K_M, edit workflow, seed 7. The reference arm is the same tree with the input encode forced untiled (two runs of it are bit-identical, so the floor is 0). Score: mean absolute difference of the final image from the reference, in 8-bit levels:Images
12 GiB tier, GGUF Q4_K_M, crops at a tile seam. Left: main (tiled). Middle: this PR (tiled). Right: the untiled decode of the same latent:
Colab L4, real 12 GB budget, FP8. Each pair is a tiled decode next to the untiled decode of the same latent; the worst-scoring window is shown for each arm. Main leaves a dotted column on the seam; with this PR the only difference left is a small colour blob that the untiled decode draws as well:
Real T4 and capped L4
Tested on a real T4 (sm75, 15 GB, no bf16) and on an L4 capped to 12 GB and 16 GB. Both arms ran Studio's own
./install.sh --localfrom the merge base (7911672), and the head arm ran this branch (45aec80). Each arm loaded Studio's realDiffusionBackendwith the same seeds. To save T4 time every render used 8 steps.Setup:
qwen-image-2.1-Q4_K_M.gguf). Colab T4 High-RAM for Auto onQwen/Qwen-Image-2.1. On sm75 Auto resolves to a dense fp16 transformer, because Studio offers no fp8 or int8 there. The text encoder stays dense, becausetext_encoder_quant='fp8'is refused on sm75. Each config ran once with no cap and once capped to 12 GB.mem_get_infototal cap, at 12 GB (11.9 GB free) and at 16 GB (15.6 GB free). GGUF Q4_K_M and FP8.What differs from the B200 results:
Edit on the L4 (GGUF Q4_K_M):
Edit of the pony image, "Make it a snowy winter scene", seed 7, 8 steps. The reference arm is this branch with the input encode forced untiled.
At 12 GB with reference resolution 1024, Studio refuses the edit with
ImageActivationShortfallError(needs 5.56 GB, 4.72 GB usable) on both main and this branch, so that combination was not compared.T4, capped 12 GB, Auto (dense fp16), pony 1024x1024. Left: main (the black blocks are non-finite pixels from the fp16 tiled decode). Middle: this PR. Right: untiled decode of the same latent:
T4, capped 12 GB, GGUF Q4_K_M, pony 1024x1024:
L4, capped 12 GB, GGUF Q4_K_M, pizza 1024x1024:
L4, capped 12 GB, GGUF edit ("Make it a snowy winter scene"). Left: main. Middle: this PR. Right: untiled-encode reference:
Tests
tests/test_diffusion_vae_tiling.py(580 cases), covering:UNSLOTH_DIFFUSION_VAE_MAX_TILEcap, and the 32x32 fallback off CUDA or with no budget.AutoencoderKLQwenImage21decoded and encoded tiled vs untiled on CPU. The stock tiles show seams, and the new tiles cut the worst row / column error by more than 4x on the decode (measured 6 to 8x). An encode up to 1024 px a side is bit-identical to the untiled encode; a two-tile encode (1088x256, 256x1088) cuts the stock error by more than 2x. Encode weights sum to 1 at every length from 1 to 199. Larger budget tiles decode as close to untiled as the 32x32 tiles.vae_tile_side.Not covered
Real-card runs above are one render per arm (no A/A); the capped L4 is a ballast plus a reported-total cap; the T4 had no 16 GB cap (15 GB card); no AMD card.
No consumer card and no AMD card. The 12 GB budget ran on an L4 (same architecture as the reported 4070 Ti) and an RTX PRO 6000 with a ballast, and on a B200 with a VRAM simulator. The defect is in the tile geometry, so it should not depend on the vendor, but ROCm was not run. INT8 and the 16 GB tier ran on the B200 only.
The budget-sized decode tiles were scored for seams on the B200 only. On the L4 they were timed but not scored; the L4 and RTX PRO 6000 per-size seam tables are from the first version.
Edits ran with GGUF Q4_K_M only; FP8 and INT8 share the VAE path but were not rendered with an input image. One input image per edit; multiple reference images go through the same per-image encode but were not run. Reference resolution 2048 could not be rendered at 12 or 16 GiB on any arm and is covered only offline.
The tile budget reads free VRAM just before the decode. Another process that takes VRAM during the decode (a browser or desktop on the same card) eats into the quarter left as margin; this was not tested on a shared consumer card.
Timings are one render per arm with no A/A run. The B200 was shared with other jobs.
Other 16x VAEs (Wan 2.2 with patchify) and the 8x Qwen-Image VAE keep the stock tiles; not measured for seams.