Nodes/ComfyUI_Patches_ll/ApplyFirstBlockCachePatchAdvanced
ComfyUI Node Runs on cloud

ApplyFirstBlockCachePatchAdvanced

Flux at 1.8x

By lldacing·Created 2 years ago·Updated 8 months ago· 124
ApplyFirstBlockCachePatchAdvanced
  • model
  • model
residual_diff_threshold0.00
start_at0.00
end_at1.00

First Block Cache is the laziest speedup that still works. The idea: run only the first block of the transformer, compare its output to what the first block produced last step, and if nothing much changed, skip the other ~50 blocks and reuse the previous step's result. Flux at 20+ steps barely changes between consecutive steps most of the time, so you're skipping a lot of work that was going to be a rounding error anyway. This node is the "Advanced" version of that trick with a start/end window, and it's the one you'll actually tune.

It comes from ComfyUI_Patches_ll, a small pack by lldacing that wires the same caching ideas into Flux and a pile of video models. Same author's other pack, ComfyUI_PuLID_Flux_ll, is how you pair this with PuLID identity without losing the speedup. No models to download, no training - this is pure inference-time skipping, the runtime-cache cousin of the distilled checkpoints the community actually argues about.

How it works

The model's forward is rewritten (by the *ForwardOverrider node you must have upstream) to expose hook points. First Block Cache hooks into the double-block loop: it runs double block 0, measures the mean relative difference between that output and the previous step's, and if it's under your threshold, sets a flag that tells every remaining double block and every single block to do nothing. The previous step's residual is added back in at the end. Cheap probe, big skip.

Two knobs most people set, plus the window:

  • residual_diff_threshold - how similar a step must look before it gets skipped. Higher = more skipping = faster and fuzzier. The author's own reference: Flux 0.12 ≈ 1.8x, HunYuanVideo 0.1 ≈ 1.6x, LTXVideo 0.05 ≈ 1.2x, MochiVideo 0.03 ≈ 1.5x, WanVideo 0.05 ≈ 1.5x. 0 disables it entirely.
  • start_at / end_at - the fraction of the denoising schedule (0–1) where caching is allowed. 0.2 to 0.8 is the classic safe window: the start sets composition, the end sets fine detail, neither should be skipped.
  • model in, model out. It's a pass-through; wire it between your loader's model stream and the guider/KSampler.

One trap: the tooltip inside this node says LTXVideo: 0.5 (1.2x) - that's a typo. The README and the non-Advanced node both say 0.05, which is the number that actually behaves like 1.2x. Trust 0.05.

Installation

ComfyUI Manager should find it if you search ComfyUI_Patches_ll (it's registered on the Comfy registry). Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/lldacing/ComfyUI_Patches_ll.git
# restart ComfyUI

Needs ComfyUI ≥ 0.3.17 (the hook/patcher system it leans on landed around then). The pack's only Python deps are numpy and packaging - nothing heavy, no model files.

Common issues

  • MochiVideo turns out all-black or bad. The README is blunt: acceleration quality on Mochi is poor and can fail outright. Skip it there.
  • Nothing gets faster. This node is a no-op unless a *ForwardOverrider (DitForwardOverrider is the auto-detect one) sits in the same model path. Without it, the hooks are registered but never called - no error, just no speedup.
  • Smearing or blobs. Threshold too high. Dial it back; or tighten the window so the start/end of sampling is always computed.

Start at the table values, then push the threshold up until you notice, then back off one notch. That's the whole tuning procedure.

Categorypatches/speed

Inputs (4)

NameTypeDefaultDescription
modelMODEL
residual_diff_thresholdFLOAT0.000–1Flux: 0 (original), 0.12 (1.8x speedup). HunYuanVideo: 0 (original), 0.1 (1.6x speedup). LTXVideo: 0 (original), 0.5 (1.2x speedup). MochiVideo: 0 (original), 0.03 (1.5x speedup). WanVideo: 0 (original), 0.05 (1.5x speedup).
start_atFLOAT0.000–1
end_atFLOAT1.000–1

Outputs (1)

NameTypeDescription
modelMODEL