Nodes/ComfyUI_TGate/TGate Apply
ComfyUI Node

TGate Apply

The closest thing to a free 10–50% speedup for SD1.5 and SDXL

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

If your SD1.5 or SDXL renders feel slow and you don't want to swap checkpoints, drop steps, or babysit a distilled model, TGate Apply is one of the few speed hacks that feel like a free lunch. Not a whole lunch - you give up a little detail - but the pack's own benchmark claims 10–50% off render time while the composition of your image mostly survives. That's a trade worth knowing about.

This is the ComfyUI port of T-GATE, a 2024 research project (HaozheLiu-ST/T-GATE) about timestep-aware cross-attention caching. JettHu's version became the de facto implementation in ComfyUI, and "TGate Apply" - the node with the short name - is the pack's recommended config with the fiddly knobs hidden. If you only install one node from this pack, this is it.

Why it's fast

Diffusion sampling runs many steps, and every step recomputes cross-attention: the part that wires your prompt tokens into the latent. Early in sampling that wiring genuinely changes; a few steps in, it's mostly settled. T-GATE exploits that. It runs the first chunk of your steps normally, caching each transformer block's cross-attention output. Then, for the rest of the run, it reuses the cached value instead of recomputing it - and because that cache already carries the positive/negative guidance, it also stops running the unconditional CFG pass. Most of the wall-clock win comes from cutting that redundant work, which is why the composition survives: the prompt-to-image wiring is frozen while everything else keeps refining. And it's training-free - no weights, no LoRA, no model downloads.

Inputs and outputs

Only three inputs exist on this node, and honestly two matter.

  • model - your MODEL from Load Checkpoint (or any MODEL-patching chain). Feed it in, take it out.
  • start_at - the knob. It's a 0–1 fraction of total steps. The default is 1.0, which means the cache never engages and the node does literally nothing - that's not a bug, it's a safe default. Set it around 0.3–0.5; the README's own speed comparisons use 0.35 and 0.5. Lower start_at means the cache kicks in earlier: faster, and less faithful. 0.35 is a good starting point, then A/B against your original.
  • use_cpu_cache - optional. Offloads the attention cache to system RAM. Only reach for it if multi-batch renders (AnimateDiff is the classic case) OOM your VRAM, and be aware it eats into the speedup.

The single output is a MODEL. Wire it straight into your KSampler's model input. That's the entire graph change - Load Checkpoint → TGate Apply → KSampler.

Installing it

The pack has no extra Python dependencies and downloads no model files; it only needs torch, which ComfyUI already ships.

In ComfyUI Manager, search "TGate" (or "ComfyUI_TGate"), hit Install, restart. Or the manual way:

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

Restart ComfyUI. That's genuinely all of it.

The usual trouble

  • Nothing got faster. You left start_at at 1.0. Drop it to 0.35 and re-run - this is the #1 gotcha with this pack.
  • Errors after a ComfyUI update. The pack monkey-patches Comfy's sampler internals, so it's sensitive to version drift. The README is blunt: keep both sides current, because old versions of either one break it.
  • Quality drift. "Slightly reduces quality" is doing polite work. Community A/Bs (this node vs DeepCache, an older sibling trick that skips whole UNet layers instead of caching attention) found T-GATE holds faces and composition but loses or randomizes fine detail, especially if you push start_at down hard. If you're rendering detailed portraits, test before you trust it.
  • Platform quirks. Apple Silicon users hit torch/MPS version issues (the README links a GitHub issue), and tiled-diffusion workflows are explicitly unsupported - there's an open repo issue for it.
CategoryTGate

Inputs (3)

NameTypeDefaultDescription
modelMODEL
start_atFLOAT1.000–1
use_cpu_cacheoptBOOLEANfalse

Outputs (1)

NameTypeDescription
MODELMODEL