[prototype] TGATE cross-attention reuse (not adopted)
Reuse the prompt's cross-attention after step 6, and save almost nothing
- model
- MODEL
The intuition is good, which is why it got tested
T-GATE comes from arXiv:2404.02747, and the premise is one most people who've watched a sampling run would nod at: the prompt's influence is front-loaded. CFG does its structural work in the first handful of steps - that's why CFG early-stop works at all. So after step 6, why recompute cross-attention between your tokens and the prompt's text embeddings every single step? Cache the cross-attention output and reuse it.
That's what this node does. And the pack's own measurement is: with TaylorSeer and CFG early-stop already in the chain, the base pass isn't faster and the image changes; on a face-detail pass it saves 7%, which is under 1% of a whole image's render time. Measured, not adopted. mode defaults to off.
This is the most interesting of the pack's three rejects to me, because the failure isn't "the idea is wrong". The idea is fine and it's published. The failure is redundancy: cross-attention was not the bottleneck once the bigger levers were already pulled. If you were running without TaylorSeer and CFG early-stop, you'd probably see a real number here. Stack three acceleration techniques and the third one buys nothing, because the first two already took the same time.
How it works
It wraps the model's cross-attention. From step index gate_step onward, instead of computing attention between the current tokens and the text embeddings, it returns the cached output from the last computed step. Before gate_step everything is computed normally, and the cache is refreshed on every computed step, so the reuse window starts after the prompt has had its say. cache_device decides whether the cached tensors live on the GPU or in system RAM - the RAM option trades transfers for VRAM, which is the usual deal and only worth it when you're desperate.
Inputs and outputs
model- the model to patch.mode-off(default) oron.gate_step(6) - the step index from which the cross-attention output is reused. The tooltip is literal: "from this step index on the cross-attention output is reused." Lower means more reuse and more drift; higher means less of both.cache_device-cuda(default) orcpu.
One output, MODEL.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/nyanmi-1828/ComfyUI-WeightFerry
Manager → WeightFerry → install → restart works too. No dependencies beyond ComfyUI. NVIDIA, ComfyUI 0.38.0+. It's filed under WeightFerry/prototype (not adopted) with a [prototype] menu prefix.
Where it goes wrong
Deciding it's useless based on the author's numbers. The author measured it in a chain that already had TaylorSeer and CFG early-stop in it. If your graph has neither, TGATE is not competing with them and may well pay for itself. The honest framing is "this didn't stack", not "this doesn't work" - and it's cheap to time: two runs, one bypassed.
Setting gate_step too low. At 2 or 3 you're freezing the prompt's contribution before composition is resolved. In practice that means the image follows your prompt loosely and then stops correcting - which reads as "the prompt didn't do much", not as an artifact. If you're testing, start at 6 or higher.
Expecting it to help at short step counts. On a 6–12 step Turbo run, gating from step 6 saves you a handful of steps in the tail where it matters least. There's no room for this technique in a short schedule.
Forgetting which pass you patched. Like the pack's other enhancers, it applies to the sampler it's wired into. Put it on the base pass and the face-detail pass keeps full cross-attention; put it on the detail pass and you get that 7% with its visible cost on exactly the part of the image people stare at. The author's note is that the -7% was on face detail, which is the pass you least want to approximate.
Conflating "prototype" with "experimental but promising". Here it means the opposite: the experiment ran, the answer was no. Three of these ship in the pack, all off by default, all documented with their reasons. That's more honest than most node packs manage, and it's worth reading enhancers/prototypes.py before you spend a night tuning one of them - the docstring at the top tells you the outcome in four lines.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| mode | COMBO | off | 2 options: off, on |
| gate_step | INT | 61–1000 | from this step index on the cross-attention output is reused |
| cache_device | COMBO | cuda | 2 options: cuda, cpu |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |