Nodes/ComfyUI/HyperTile
ComfyUI Node Runs on cloud

HyperTile

Sample big SDXL latents without OOMing your card

By Comfy-Org·Created 4 years ago·Updated about an hour ago· 129,964
HyperTile
  • model
  • MODEL
tile_size256
swap_size2
max_depth0
scale_depthfalse

HyperTile is a VRAM-saver from the SDXL high-resolution era, and its whole trick is that it doesn't reduce the image at all - it reduces how much spatial context the attention layers see at once. The model still samples the full latent; HyperTile just splits the attention computation into tiles, so the quadratic cost of attention stops blowing up your VRAM budget as the image gets bigger. It's the patch you reach for when a 1536x1536 or 2048x2048 SDXL render is bumping against an out-of-memory error.

It's a port of tfernd's HyperTile technique that landed in ComfyUI core, and it's honestly aged better than most 2023 tricks - the "tile the attention to fit" idea is exactly what modern context-window and long-video nodes do one level up. But be honest about its scope: it's for UNet-based models (SD 1.5, SDXL, Pony/Illustrious), and it trades a little quality for the memory savings. On modern DiTs it attaches to nothing.

How it works

HyperTile patches the model's self-attention. Before the attention at a given UNet depth runs, it reshapes the query/key/value tensors so the spatial map is split into n_h × n_w tiles, runs attention on each tile independently, then reassembles the result. Because attention cost scales with the square of the token count, and each tile has a fraction of the tokens, the memory (and speed) win is real.

Two inputs govern the behavior:

  • tile_size (default 256) sets the target spatial size per tile - the code clamps it to at least 32 in the latent, then picks random divisors so the image splits into a small number of near-tile-sized pieces.
  • swap_size (default 2) controls how many divisor options the random pick chooses from. Higher values shuffle more but cost more quality.

The random part is deliberate: the tile grid shifts slightly every run, so the seams between tiles don't bake into a fixed pattern. The patched attention is applied down the UNet depths up to max_depth (0 applies at the deepest block only; scale_depth grows the tile factor with depth).

Inputs and what to set

  • tile_size - default 256. Lower = more tiles = more memory saved, more quality lost. 256 is the community sweet spot; don't chase huge savings unless you're stuck.
  • swap_size - default 2. Higher values increase seam-randomness and lower quality; 2 is the standard.
  • max_depth (default 0) and scale_depth (default off) - depth controls how many UNet levels get tiled. Start with the defaults; you'll rarely need more.

Output: the patched MODEL. It's built into ComfyUI core.

Common issues & troubleshooting

You can see the tiles. At aggressive settings you get faint grid patterns or reduced long-range coherence (objects that should span the image relate less). Back off tile_size or swap_size if it's visible. This is a memory trade - it's supposed to cost something.

No effect on DiT/flow models. Same rule as every UNet patch in this family. If the model doesn't have the UNet attention layout HyperTile expects, you get a silent no-op.

Not a substitute for tiled VAE decode. HyperTile saves memory during sampling. The VAE decode of a huge latent is a separate memory hog, and for that you want the dedicated tiled decode approach - they stack, but they're different problems.

Categorymodel/patch/unet

Inputs (5)

NameTypeDefaultDescription
modelMODEL
tile_sizeINT2561–2048
swap_sizeINT21–128
max_depthINT00–10
scale_depthBOOLEANfalse

Outputs (1)

NameTypeDescription
MODELMODEL