Nodes/comfyui_bmab/BMAB KSampler with Kohya Deep Shrink
ComfyUI Node

BMAB KSampler with Kohya Deep Shrink

High resolution without a second sampling pass

By portu-sim·Created 2 years ago·Updated 8 months ago· 124
BMAB KSampler with Kohya Deep Shrink
  • bind
  • image
  • lora
  • BMAB bind
  • image
steps20
cfg_scale8.0
sampler_name
scheduler
denoise0.40
scale2.000
width512
height512
block_number3
start_percent0.000
end_percent0.350
downscale_after_skiptrue
downscale_method
upscale_method

Every model has a native resolution it was trained at, and pushing past it directly tends to get you tiling, duplicated limbs, or a second head growing out of a shoulder. The usual fix is a two-pass hires fix: generate small, upscale, run a second low-denoise pass. Deep Shrink is a different answer to the same problem - instead of two full sampling passes, it shrinks the U-Net's internal working resolution for the early part of a single denoising run, then lets it scale back up for the rest, so the model spends its early, structure-defining steps at something closer to the resolution it actually knows. This is the technique behind ComfyUI core's own PatchModelAddDownscale (Kohya Deep Shrink) node, and it traces back to the same kohya-ss behind the well-known LoRA training scripts - a distinct trick from that trainer, not part of it, but the same author's name attached to both. BMAB folds the technique into its own sampler node so it fits directly into a BMAB bind pipeline instead of needing a separate model-patching node wired in beforehand.

The parameters that make it work

This is the densest input list in the whole pack, but it maps cleanly onto "when" and "how much":

  • scale (0-4, default 2) - how much the internal resolution gets shrunk during the affected window. Higher means a more aggressive shrink, which pushes the sampler further from your target resolution during those early steps.
  • block_number (1-32, default 3) - which U-Net block the downscale gets applied at. This is a genuinely technical knob; the default is a reasonable starting point and most people won't need to touch it unless they're chasing a specific artifact.
  • start_percent / end_percent (default 0 / 0.35) - the window, as a fraction of total denoising steps, where the shrink is active. 0 to 0.35 means the first third or so of the run happens at reduced resolution, and the rest proceeds normally - this is deliberately front-loaded, since the early steps are what establish overall composition and are the most damaging to get wrong at the wrong resolution.
  • downscale_after_skip (boolean, default true) - a structural detail of exactly where in the block the downscale is applied.
  • downscale_method / upscale_method - five interpolation choices each (bicubic, nearest-exact, bilinear, area, bislerp), controlling how the resize itself is done going down and coming back up. bislerp and bicubic are the common choices when smoothness matters more than speed.
  • width / height - your actual target generation resolution, unlike BMAB KSampler Hires. Fix, which has no resolution fields of its own and instead relies on whatever's already been resized upstream.

Everything else - steps, cfg_scale, sampler_name, scheduler (defaulting to "Use same sampler"/"Use same scheduler," inheriting from the bind), denoise (default 0.4) - matches the shape of BMAB's other refinement-style sampler nodes.

Inputs, outputs, install

Optional inputs are image and lora, same as the rest of BMAB's sampler family. Output is the standard bind plus image pair.

ComfyUI Manager: search comfyui_bmab, install, restart. By hand:

cd ComfyUI/custom_nodes
git clone https://github.com/portu-sim/comfyui_bmab.git
cd comfyui_bmab
pip install -r requirements.txt

plus comfyui_controlnet_aux and ComfyUI_IPAdapter_plus, the two companion packs the README lists as required for comfyui_bmab overall.

Deep Shrink versus a plain hires fix, in practice

Deep Shrink's real advantage is speed - one sampling pass instead of two, since you're not paying for a full second denoise the way BMAB KSampler Hires. Fix requires. The trade-off is that it's a blunter instrument: you're picking a window and a scale rather than directly controlling a second pass's own strength, so getting a specific look sometimes takes more trial and error on start_percent/end_percent/scale than just running a conventional two-pass hires fix would. If your images are coming out with structure baked in wrong (bad overall composition, not just soft detail), try narrowing the window or lowering scale before reaching for anything else - that window is doing the structural work, and too aggressive a shrink for too long can undercook exactly the steps that decide the composition.

CategoryBMAB/sampler

Inputs (17)

NameTypeDefaultDescription
bindBMAB bind
stepsINT200–10000
cfg_scaleFLOAT8.00–100
sampler_nameCOMBO45 options: Use same sampler, euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, +39
schedulerCOMBO10 options: Use same scheduler, simple, sgm_uniform, karras, exponential, ddim_uniform, +4
denoiseFLOAT0.400–1
scaleFLOAT2.0000–4
widthINT5120–16384
heightINT5120–16384
block_numberINT31–32
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
imageoptIMAGE
loraoptBMAB lora

Outputs (2)

NameTypeDescription
BMAB bindBMAB bind
imageIMAGE