Nodes/ComfyUI/PatchModelAddDownscale (Kohya Deep Shrink)
ComfyUI Node Runs on cloud

PatchModelAddDownscale (Kohya Deep Shrink)

The SDXL composition trick that survived

By Comfy-Org·Created 4 years ago·Updated about an hour ago· 129,962
PatchModelAddDownscale (Kohya Deep Shrink)
  • model
  • MODEL
block_number3
downscale_factor2.000
start_percent0.000
end_percent0.350
downscale_after_skiptrue
downscale_method
upscale_method

PatchModelAddDownscale is the ComfyUI implementation of Kohya's "Deep Shrink," a trick that makes SDXL draw better compositions at high resolution. The core idea is almost stupidly simple: during the early denoising steps, downscale the UNet's internal features so the model "sees" the image smaller and settles the overall layout before it gets lost in detail. It's the kind of patch that sounds like a hack and then you try it on a 1216x1216 SDXL render and the composition just... works.

Deep Shrink is a survivor. It's an SDXL/SD1.5-era technique from 2023, and unlike most of its peers it never fully died - it's still the recommended answer in the low hundreds of threads across 2024-2026 whenever someone asks "how do I stop SDXL from cutting heads off at high res." It won't help a DiT-based model (no UNet blocks to downscale), but for the Illustrious/Pony/SDXL world it's a genuine, free improvement.

How it works

The node picks one UNet input block (block_number, default 3) and, while sampling is within a start_percent to end_percent window, downscales the features at that block by downscale_factor. Because the early sampling steps decide composition, shrinking the spatial resolution there forces the model to think about the whole frame before committing to local detail. Once sampling passes end_percent, the downscale stops and the model refines at full resolution.

Two implementation details worth knowing. downscale_after_skip (default on) places the patch after the skip connection - Kohya's preferred position for SDXL. And the node automatically upscales the patched block's output back to the skip connection's size so the UNet doesn't choke on mismatched shapes. The downscale_method and upscale_method combos (bicubic, nearest-exact, bilinear, area, bislerp) control the resampling quality - keep bicubic.

The inputs that matter

  • downscale_factor - default 2.0. 2x is the standard; you'll rarely need more.
  • start_percent / end_percent - default 0 to 0.35, meaning the downscale runs through the first 35% of denoising. That's the sweet spot - long enough to set composition, short enough that detail work runs at full res.
  • block_number - default 3. Deep Shrink's classic position. Fiddle only if you know what you're doing.

Output is the patched MODEL. Ships inside ComfyUI core; there are no model files to download.

Common issues & troubleshooting

It doesn't touch the image size - it patches sampling. Some people expect this node to upscale or resize their latent. It doesn't. It only changes how the UNet processes features during early steps. The resolution you set elsewhere is what you get.

DiT and flow models: skip it. No UNet input blocks, no effect. People try it on Z-Image or Flux out of habit and get exactly nothing. On those models the composition problem is better solved with sampling-schedule patches instead.

Too much downscaling blurs early structure. If your render looks soft or the layout feels vague, the factor is too high or the window too long - drop end_percent toward 0.25 or the factor to 1.5. Halos at object edges usually mean downscale_after_skip is off and the skip connection mismatch is being patched awkwardly; flip it back on.

Categorymodel/patch/unet

Inputs (8)

NameTypeDefaultDescription
modelMODEL
block_numberINT31–32
downscale_factorFLOAT2.0000.1–9
start_percentFLOAT0.0000–1
end_percentFLOAT0.3500–1
downscale_after_skipBOOLEANtrue
downscale_methodCOMBO5 options: bicubic, nearest-exact, bilinear, area, bislerp
upscale_methodCOMBO5 options: bicubic, nearest-exact, bilinear, area, bislerp

Outputs (1)

NameTypeDescription
MODELMODEL