Minimax_H3_TST_AttentionPatch
\"Attention correction\" sounds like snake oil — here's what Minimax_H3_TST_AttentionPatch does
- model
- model
Two in, one out, one real knob. If you're expecting a lot from this node, the author would agree with you - the README's own table lists its effect as limited (效果有限). It's a patch node you bolt between the model loader and the sampler, and the honest reason to try it is that you've got temporal flicker or small faces disintegrating and you've exhausted the obvious fixes.
The failure mode it targets is real enough. In any chunked video model, the model has to hand state from frame to frame through attention, and that transfer sometimes over-mixes (everything smears into its neighbours) and sometimes fragments (each frame stops agreeing with the last). Both show up as flicker, and both get worse on small faces where there just aren't many tokens.
How it works
The node wraps the model and installs a transformer_options["optimized_attention_override"] callback - the same hook SageAttention and other attention patchers use, so it plays in that ecosystem rather than fighting it.
On each attention call it looks at the actual q/k/v, isolates the video rows, and computes a spectral tension for the frame-level transfer operator: per head, it builds a softmax frame-to-frame attention matrix, measures how entropic its rows are versus how concentrated that operator is once you look at its own spectrum, and returns the difference. Positive tension means over-mixing; negative means fragmentation (the source comment points at this being the paper's formulation, not a house metric).
That scalar then becomes a per-head temperature on the video-row queries:
gamma = exp(tension * tau * layer_weight * step_weight)
with a cosine layer weight that hits harder in deep layers and a cosine step weight that hits harder early in the schedule. So tau isn't a blunt multiplier - a bad frame state in a deep layer at step 2 gets a firm correction, and a healthy one barely moves.
Three details that make it a real integration rather than a hack. A length guard refuses attention calls shorter than the video segment, so token-refiner passes don't advance the internal counters - only genuine video attention does. The layer count self-corrects after the first forward instead of trusting a guess. And the callback chains: it picks up whatever optimized_attention_override is already on the model and keeps it innermost, so your SageAttention patch and this node both apply.
Inputs and output
model - the H3 model, and the patched model goes to your sampler. The clone is made inside the node, so the upstream model isn't mutated.
tau - correction strength, default 0.2, range 0–1. The author's range is 0.1–0.3, with 0.3 worth a shot when small faces are really collapsing. And tau = 0.0 is a genuinely useful setting: the node logs that it's passing through and mounts nothing at all, which gives you a clean A/B baseline without rewiring anything. Do that first - one fixed seed, tau 0 versus tau 0.2, same everything else.
That's the entire schema. One output, model.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/supElement/ComfyUI_MinimaxH3_AutoContext.git
cd ComfyUI_MinimaxH3_AutoContext
pip install -r requirements.txt
Or ComfyUI Manager → search ComfyUI_MinimaxH3_AutoContext → Install → restart. This node has no model files and no extra dependencies of its own.
Where to place it in the graph: model loader → [other attention patch nodes] → this node → sampler. The direction matters. It must sit downstream of any node that assigns an override directly (Kijai-style SageAttention patchers, for instance), because a node that mounts later will replace what's already on the key. ComfyUI's official ModelAttentionBackend uses a separate registry and is position-agnostic, so that combination is fine anywhere. This node also works with the pack's chunked sampler - it's a model wrapper, so it affects every segment's every attention call.
Common issues
The node isn't in the menu at all. Not a config problem - it needs a recent ComfyUI. Its imports (comfy_api.latest, comfy.patcher_extension) don't exist on older builds, and the pack's __init__.py catches that failure and prints a warning, so the whole pack loads minus this node. Update ComfyUI and restart.
Your outputs didn't change after you turned it on. They should have - the node prints a notice that TST alters results and the sampler's latent cache has to be regenerated, same as after swapping a LoRA or a speedup node. Tick clear_cache on the sampler (or delete ComfyUI/output/cache/node_<node id>/) and re-run. It writes its tau into transformer_options specifically so the sampler can fold the value into the cache fingerprint.
A/B testing shows no difference. Set tau to 0 for the baseline and 0.2–0.3 for the test, same fixed seed, and compare the same frames. If there's really nothing, that's within expectations for this node - it's a correction for a specific temporal failure, not a quality knob, and it won't rescue a clip whose problem is the prompt, the chunk length or the resolution. Which is the useful thing to know: when flicker is bad because you're pushing 15 seconds through too-short chunks, no attention patch will fix it. Change the chunking.
You're also running Sage Attention or another attention patcher. Keep this node downstream of it. If you put it upstream, you'll silently lose the correction and the log won't tell you.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | Input model (MiniMax H3); connect the patched model output to the sampler node 输入模型 (MiniMax H3),输出补丁后的模型接到采样节点 | |
| tau | FLOAT | 0.200–1 | Correction strength. 0=pass through without patching (usable as an A/B baseline). Typical range 0.1~0.3, try 0.3 when small faces break down badly. Actual correction = tau * layer weight(stronger in deep layers) * step weight(stronger early) 校正强度。0=透传不挂载 (可作 A/B 基线)。常用范围 0.1~0.3,小脸崩坏明显时可试 0.3。实际校正量 = tau * 层权重(深层更强) * 步权重(早期更强) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |