Sliding Window Guidance (Advanced)
Tile-based guidance for large images
- model
- MODEL
Most of the guidance nodes in this pack work on the whole latent at once. Sliding Window Guidance doesn't - it's built from "The Unreasonable Effectiveness of Guidance for Diffusion Models" (Kaiser et al.), and true to the name, it computes guidance over tiled windows of the image rather than globally. That's the same basic idea as tiled VAE decoding or tiled upscaling, but applied to the guidance computation itself, which is a different problem: local guidance can pick up on structure a single global pass would average away, at the cost of needing overlap to avoid seams between tiles.
The inputs that matter
scale(default 5) - guidance strength, same role as everywhere else in this pack.tile_width/tile_height(both default 768, range 16–16384 in steps of 8) - the window size guidance operates over. Keep these multiples of 8 like any other latent-dimension field in ComfyUI.tile_overlap(default 256) - how much adjacent tiles overlap, which is what keeps the seams between windows from showing up in the output. Note it's a full third of the default tile size, which tells you the author didn't consider that overlap optional.sigma_start/sigma_end- this is the one place in the pack where the defaults are asymmetric and worth reading carefully:sigma_startdefaults to -1 (unbounded, so guidance is active from the very first, noisiest step), whilesigma_enddefaults to a real value, 5.42. In practice that means SWG is front-loaded out of the box - active through the early, high-noise portion of the sampler and switched off once sigma drops to 5.42, rather than running the whole denoise like PAG or NAG do by default.
Output is a MODEL to plug into your KSampler.
How to install it
ComfyUI Manager: search "Perturbed-Attention Guidance" - this node lives in that pack. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/pamparamm/sd-perturbed-attention
Restart afterward. No models to fetch, no extra dependencies.
Common issues & troubleshooting
This is another of the newer, less-discussed nodes in the pack - there's no accumulated forum wisdom to draw on yet, so take the following as reasoning from how tiled processing generally behaves rather than confirmed community fixes.
Visible seams or repeating patterns at tile boundaries. The classic tiled-processing artifact. tile_overlap is your first lever - raise it before touching anything else. The default (256 against a 768 tile) is already generous, but if your tile_width/tile_height are much larger or smaller than default, scale the overlap proportionally rather than leaving it fixed.
No visible effect. Check the sigma window first - since sigma_end defaults to a real 5.42 rather than -1, SWG is off for the back half of sampling by default. If you expected it to shape the whole render, you'll need to lower sigma_end (or set both to -1) to keep it active longer.
Slow. Smaller tiles mean more of them, which means more guidance computations per step. If speed matters more than local detail, push tile_width/tile_height up before reaching for a lower scale.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| scale | FLOAT | 5.00–100 | — |
| tile_width | INT | 76816–16384 | — |
| tile_height | INT | 76816–16384 | — |
| tile_overlap | INT | 25616–16384 | — |
| sigma_start | FLOAT | -1.00-1–10000 | — |
| sigma_end | FLOAT | 5.42-1–10000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |