Nodes/ComfyUI_TGate/TGate Apply Advanced
ComfyUI Node

TGate Apply Advanced

T-GATE with all the levers, when the simple node isn't enough

By JettHu·Created 2 years ago·Updated 8 months ago· 103
TGate Apply Advanced
  • model
  • MODEL
start_at1.00
self_attn_start_at1.00
only_cross_attentiontrue
use_cpu_cachefalse

The simple TGate Apply is the pack's safe default: cross-attention caching, one knob, done. TGate Apply Advanced is the same trick with the rest of the controls exposed. For most people, the simple node is the right one - but "most" isn't "all", and if you've run out of headroom on start_at, or you're curious exactly how far attention caching can go before your image falls apart, this is the node that answers.

Same shape as its sibling: MODEL in, MODEL out, sitting between your checkpoint and the KSampler, training-free, no weights to download.

The mechanism

All three nodes in this pack share the same core. Each diffusion step recomputes cross-attention - the text-to-image wiring - and every step after that is largely the same wiring doing redundant work. T-GATE runs the first chunk of steps normally while caching those attention outputs, then reuses the cache for the rest of the run and stops paying for the unconditional CFG pass. That's where the 10–50% speedup comes from. What Advanced changes is how much you cache and when.

Inputs that matter

  • model - your MODEL from Load Checkpoint.
  • start_at - the fraction of steps that run normally before cross-attention caching engages. Default 1.0 means the cache never engages (a safety default, not a bug), so drop it to roughly 0.3–0.5 to see speed.
  • only_cross_attention - default True, and the README marks it [RECOMMEND]. True means cache only cross-attention, which is the quality-preserving mode. Set it False and the node also caches self-attention, buying more speed at the cost of noticeably more drift. There's history here: the pack's early versions cached everything and the output was inconsistent - the README's TODO literally says that's why the default went to cross-attention only.
  • self_attn_start_at - only read when only_cross_attention is False. A separate 0–1 fraction controlling when self-attention caching kicks in, useful if you want it to start later than cross-attention caching.
  • use_cpu_cache - optional. Offloads the cache to system RAM if AnimateDiff-style multi-batch renders OOM; it trades away some speed.

The one output is a MODEL feeding your KSampler.

Installing it

Identical to the rest of the pack: search "TGate" in ComfyUI Manager and install, or

cd ComfyUI/custom_nodes
git clone https://github.com/JettHu/ComfyUI_TGate

then restart. No pip dependencies, no model files, and it works across CNN-based U-Nets, transformer architectures, and consistency models alike.

When to actually use it

Honest answer: when the simple node's speed isn't enough and you're willing to A/B against your original output. Treat only_cross_attention=False as the experimental setting - it's the one that breaks image quality first. If you just want 20–30% off your SDXL renders, start_at 0.35 on the simple node does that with the least drama. Come to Advanced when you want that extra knob, or you need self-attention timing to be separate from cross-attention timing.

Same gotchas as its siblings: keep ComfyUI updated (the pack monkey-patches sampler internals and rots with version drift), tiled diffusion isn't supported, and Apple Silicon can hit torch/MPS quirks.

CategoryTGate

Inputs (5)

NameTypeDefaultDescription
modelMODEL
start_atFLOAT1.000–1
self_attn_start_atFLOAT1.000–1
only_cross_attentionBOOLEANtrue
use_cpu_cacheoptBOOLEANfalse

Outputs (1)

NameTypeDescription
MODELMODEL