Nodes/KJNodes for ComfyUI/Skip DiT Blocks KJ
ComfyUI Node Runs on cloud

Skip DiT Blocks KJ

Deleting transformer blocks for speed and seeing what you get away with

By kijai·Created 3 years ago·Updated 3 days ago· 3,521
Skip DiT Blocks KJ
  • model
  • model
◄double_blocks►
◄single_blocks►
◄start_percent0.00►
◄end_percent1.00►

What it does, bluntly

You give it block indices. Those blocks don't run. Their compute is gone - not quantized, not cached, not offloaded. Skipped.

That's cruder than the usual speed tricks. Distillation LoRAs teach a model to work in fewer steps; TeaCache and friends try to skip redundant work. This one saws out whole transformer layers and lets the picture tell you whether anyone noticed. On a diffusion transformer with 20 double and 40 single blocks, that's a real chunk of your per-step time.

How it works

It's a model patch, not a sampler setting. The node parses your block strings - "10, 12, 20-25" becomes [10, 12, 20, 21, 22, 23, 24, 25], ranges included - and installs a wrapper on the model that, on every sampling step, injects "replace patches" into ComfyUI's DiT block dispatch table. A replace patch for a block receives its arguments and returns them untouched, which makes the block an identity function: the call site reads its outputs back out of the args dict, finds them unchanged, and carries on.

Two details are worth knowing because they change how you use it.

It respects a step range. start_percent and end_percent are checked against your position in sample_sigmas, so you can skip blocks only in the middle of sampling and leave the early and late steps intact - those are the ones that usually can't afford an amputation.

It tells you when it did nothing. The wrapper records which patches were actually reached; if any block you listed never got hit, it logs a warning. That's your diagnostic, and you'll see it a lot when you use the wrong list.

The inputs that matter

model - comes from your checkpoint loader (downstream of LoRAs, like any model patch), and the single model output goes on to the sampler.

double_blocks and single_blocks are where the confusion lives, and the tooltips are the only decent documentation anywhere:

  • double_blocks is the main block list for single-stack models - Wan, LTX, Qwen-Image. Yes, that's genuinely counter-intuitive.
  • single_blocks is for the single-stream blocks of Flux, Chroma and HunyuanVideo - and the main list for Qwen-Image 2.1, MOSS-Image and FIBO 2.

So on Flux you have two lists to experiment with; on Wan you pile everything into double_blocks and leave the other blank. Both accept 3, 5, 10-12. Both empty returns the model unchanged, which means a half-configured node fails silently by design.

start_percent / end_percent - 0 to 1, defaulting to the full run. Narrow the window once you've found a range that tolerates it.

Load Checkpoint → LoraLoader → Skip DiT Blocks KJ(model) → KSampler(model)

What it works on, and what silently doesn't

Flux, Chroma, Wan, LTX, Qwen-Image, HunyuanVideo, SD3, Kandinsky5 and others - anything exposing ComfyUI's DiT block replace patches, which is most of the current crop, because that's how everything from LoRA hooks to attention patches arrives.

Models without that mechanism - Lumina/Z-Image, Flux3, Krea2, HiDream are the ones named - are unaffected: no error, just a warning and a model that behaves exactly as before. If your "speedup" is exactly zero and your images are untouched, that's not placebo, that's an unsupported architecture.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
pip install -r ComfyUI-KJNodes/requirements.txt

Manager → KJNodes ("KJNodes for ComfyUI") → install → restart. Portable Windows installs run python_embeded\python.exe -m pip install -r ComfyUI\custom_nodes\ComfyUI-KJNodes\requirements.txt from the ComfyUI_windows_portable folder, per the README.

The dependency list is short and boring - pillow, color-matcher, matplotlib, mss, opencv-python-headless - with no models to download. What it does need is a ComfyUI recent enough to have the DiT block replace patch system, so an old install can defeat the whole thing.

Using it without wrecking your output

Keep the seed and prompt fixed, A/B one variable at a time, and start small - skip two blocks, then look closely at hands, text and small repeated detail. The failure mode is rarely "the image is obviously broken". It's "fine at a glance and slightly mushier everywhere", which is a taste you develop by comparing. And keep expectations calibrated: you removed block compute, not VAE decode or text encoding, so 30% of the blocks is not 30% wall clock.

The range window is the more interesting instrument: skip aggressively in the middle of the trajectory and skip nothing at the start or end. That tends to preserve composition and texture while still cutting real time, and it's the same reason distillation LoRAs keep their structure.

Common issues

A warning in the console that blocks were never reached. Wrong list, wrong indices, or an unsupported model. On Wan, an empty double_blocks with everything in single_blocks produces exactly this.

No speedup at all. First check the warning. If the model is supported, check whether the sampling loop is even your bottleneck - on short runs, model loading and VAE decode can dwarf it, so measure steps per second rather than total queue time.

Output that looks subtly wrong everywhere. You skipped blocks the model needed. Pull the range back, or restrict skipping to the middle. There's no "safe" number that generalizes across models, whatever a comment thread claims - the node is marked experimental for a reason.

CategoryKJNodes/experimental

Inputs (5)

NameTypeDefaultDescription
modelMODEL—
double_blocksSTRINGBlock indices to skip, comma separated, ranges allowed: '10, 12, 20-25'. This is the main block list for single-stack models like Wan, LTX and Qwen-Image.
single_blocksSTRINGSingle-stream block indices for Flux/Chroma/HunyuanVideo, and the main block list for Qwen-Image 2.1, MOSS-Image and FIBO 2.
start_percentFLOAT0.000–1Step-based sampling progress at which skipping starts.
end_percentFLOAT1.000–1Step-based sampling progress at which skipping ends.

Outputs (1)

NameTypeDescription
modelMODEL—