H3 SLA Attention:
H3SLAAttention applies block-sparse self-attention to MiniMax-H3 models to reduce the work needed for long video-generation sequences. Instead of attending equally to every part of a sequence, it quickly scores groups of information, then performs full attention only on the groups judged most relevant. The selection happens at runtime; the node does not load or train a sparsity model. This can improve generation speed, particularly for longer or higher-resolution clips, while shorter sequences can remain on dense attention when sparse routing would not help. The source reports speed gains for a specific 5090 test setup, not a guarantee for every workflow. The node also provides controls for preserving audio and reference information, keeping selected sampling steps dense, and choosing attention implementations.
H3 SLA Attention Input Parameters:
model
The required MODEL to patch for MiniMax-H3 attention. Connect the model you intend to sample with; this node changes how its attention is run rather than generating an image or video by itself. There is no numeric range or default model. If the patch cannot be applied, the node returns the original model unchanged.
sparsity_ratio
The fraction of key blocks skipped during sparse attention: higher values generally reduce attention work but leave fewer blocks available for full attention. This required float defaults to 0.80, has a minimum of 0.0 and maximum of 0.95, and uses a 0.05 widget step. At 0.0, sparsity is disabled without removing the node. The tooltip identifies about 0.60 as the speed break-even point, 0.85 as the value used for SLA turbo LoRA distillation, and 0.90 as another validated, faster setting; actual performance and quality depend on your workflow.
block_size
The number of sequence tokens that share one block-selection decision. This required combo defaults to "32"; its complete list of choices is not present in the supplied source because it is imported through BLOCK_SIZES. Smaller blocks allow finer routing, which matters especially for speech: the source reports robotic speech at 128 and clean speech at 64, with further quality improvement observed at 32 for a marginal slowdown. The tooltip suggests 128 only when you generate without meaningful audio. This setting is unrelated to the model’s attention-head width.
min_seq_len
The sequence-length threshold below which attention stays dense rather than using sparse block selection. This optional integer defaults to 12228, with a minimum of 0, maximum of 1000000, and widget step of 1024. It protects short text-refiner attention from sparsification and avoids sparse-routing overhead on short or low-resolution clips. Lower it only when you know the affected sequence is long enough to benefit.
dense_last_steps
The number of final sampling steps run with full, dense attention. This optional integer defaults to 0 and ranges from 0 to 8. Keeping the final step dense can recover fine detail, but it adds work; 0 matches the original turbo LoRA distillation setup described in the source. These steps are added to, not substituted for, those specified by dense_steps.
protect_audio
Whether to always attend blocks overlapping language tokens, target audio, and audio-reference segments. This optional boolean defaults to False; its choices are True (“protect”) and False (“uniform (turbo parity)”). Enabling it reserves attention for those audio-related blocks, while disabling it retains turbo-style uniform sparsity. The tooltip reports that partially protected or unprotected audio was unstable for little speed gain. Visual-reference protection is controlled separately.
enabled
Whether the node attempts to apply its attention patch. This optional boolean defaults to True; True selects sparse operation and False selects dense bypass. When False, the node passes the model through unchanged, making it useful for a like-for-like baseline without rewiring your workflow.
dense_steps
Explicit zero-based sampling-step indices that should use dense attention in addition to dense_last_steps. This optional string defaults to "1"; no length limit or numeric range is specified. Examples in the source include "0,1" and "0-2"; a blank string selects no explicit steps. Keeping early steps dense can help preserve composition and prompt adherence while later steps use sparse attention.
dense_backend
The attention implementation used when this node takes a dense path, such as for short sequences or steps selected by dense_steps or dense_last_steps. This optional combo defaults to "comfy_kitchen"; its complete option list is not available in the supplied source because it comes from DENSE_BACKENDS. The tooltip describes comfy_kitchen as a fast int8 option, pytorch as an unquantized reference option with a speed cost, auto as using the globally active backend, and sage:* modes as SageAttention choices that require the sageattention package. If a SageAttention mode or kernel is unavailable, the source says it falls back to the already-active backend with a logged warning. This setting does not select the sparse-path engine.
disable_fp16_accum
Whether to force off reduced-precision fp16/bf16 matrix-multiplication accumulation for this model’s sampling run, regardless of the global --fast fp16_accumulation flag. This optional boolean defaults to True; True disables that reduction path and is marked recommended, while False follows the global fast setting. The tooltip reports a quality cost on H3 without a throughput gain in its measurements; turn it off chiefly when comparing against your global setting.
stabilize_motion
Whether to bias each layer’s block choices toward those selected on the previous step for target-video queries. This optional boolean defaults to False; its choices are on and off. It targets faint double-exposure artifacts on fast motion caused by near-tied block choices changing between steps, rather than serving as a general quality control. Text and audio choices remain step-local, and the tooltip notes increased VRAM use. The comfy_kitchen sparse engine does not support this feature.
reference_protection
The amount of special protection given to image and video reference blocks. This optional combo defaults to "Off"; the complete list comes from REFERENCE_PROTECTION_MODES and is not supplied, but the tooltip describes Off, Light, and Heavy Enforcement. Off gives references no special quota, although they can still be chosen through ordinary scoring. Light guarantees the best-scoring 15% of each visual-reference range at fixed 0.85 reference sparsity. Heavy Enforcement guarantees all specified vision, conditioning/image-reference, and video-reference blocks; the source warns it may be unusable with maximum reference-size mode. This feature is not supported by the comfy_kitchen sparse engine.
tail_correction
Whether to include a pooled contribution representing key blocks omitted by sparse top-k selection, instead of treating their contribution as zero. This optional boolean defaults to False; its choices are on and off. It may matter most when sparsity is high, but the source explicitly labels its effect on H3 output quality experimental and not validated, so compare renders before relying on it. The engine tooltip says the comfy_kitchen kernel has a built-in pooled tail term and honors this setting’s on/off value.
use_int8_qk
Whether to quantize query and key data to int8 for the selected sparse attention blocks while keeping the value-side calculation at full precision. This optional boolean defaults to True; its choices are on and off. It affects the sparse computation rather than the dense backend, and the source labels hardware speed, launch stability, and H3 output quality untested for this option. When engine is "comfy_kitchen", this toggle is ignored because that kernel handles quantization internally.
engine
The implementation used for the sparse attention path. This optional combo offers "triton" and "comfy_kitchen" and defaults to "comfy_kitchen"; although its tooltip calls Triton the default, the schema and execution signature both set "comfy_kitchen". Triton is the node pack’s own kernel and supports the listed routing controls. The comfy_kitchen option calls its compiled sol_attn kernel and requires comfy-kitchen>=0.2.32; it cannot provide reference quotas, multiple protected ranges, or cross-step motion stabilization, and it handles int8 quantization internally. If the selected kernel is unavailable or fails, the source describes a dense fallback; if applying the patch itself raises an exception, this node returns the original model unchanged.
H3 SLA Attention Output Parameters:
MODEL
The sole output is a MODEL for downstream sampling, in the same output position regardless of whether sparse attention was enabled. When patching succeeds, it is the model returned by the attention patch and uses the configured behavior during sampling. When enabled is off or patching raises an exception, it is the original model passed through unchanged; the output’s presence alone therefore does not prove that sparsity is active.
H3 SLA Attention Usage Tips:
- For a meaningful speed comparison, run the same workflow with
enabledon and off. Check the log if results suggest no change: an unsuccessful patch returns the original model. - For speech, start with
block_sizeset to"32"or try"64"if it is available in your installation. Considerprotect_audio=Truewhen audio is unstable; avoid"128"when intelligible speech matters. - If prompt adherence or composition suffers, keep early steps dense with
dense_steps="0,1"or"0-2". To prioritize final detail, trydense_last_steps=1and compare the added render time. - Use
sparsity_ratioaround0.85as a source-documented turbo LoRA reference point, then compare with0.90for speed. Avoid assuming lower sparsity is faster: the tooltip places its approximate break-even point at0.60. - Leave
min_seq_lenat its default unless you understand which H3 sequences your workflow produces. Raising the threshold favors dense attention more often; lowering it can expose short sequences to unnecessary routing work. - Choose
engine="triton"if you needstabilize_motionorreference_protection. Withengine="comfy_kitchen", those unsupported controls do not provide their intended effect. - Treat
tail_correctionand Triton’suse_int8_qkas settings to test against a known-good render rather than assumed quality or speed improvements.
H3 SLA Attention Common Errors and Solutions:
[H3Utils] SLA disabled; model passed through unchanged.
- Explanation:
enabledis off. This is an intentional bypass, not a failed render. - Solution: Set
enabled=Truewhen you want the node to attempt sparse attention.
[H3Utils] SLA patch failed; passing the model through unchanged (attention will NOT be sparsified).
- Explanation: An exception occurred while applying the patch. The source identifies missing Triton support, an incompatible GPU, or a ComfyUI API change as possible causes; the accompanying traceback contains the specific cause.
- Solution: Read the traceback, check that your installation and GPU support the selected engine, and update or install the needed components. You can continue with the unchanged dense model while troubleshooting.
Sparse kernel unavailable or throws an exception; attention falls back to dense
- Explanation: The engine tooltip describes dense fallback when either sparse kernel cannot run. The supplied node class does not specify an exact message for this case, and a successful model output does not by itself establish that sparse attention ran.
- Solution: Inspect your logs for the underlying kernel error, confirm the selected engine’s dependencies, and compare timing with
enabled=Falseafter resolving it.
comfy-kitchen kernel unavailable or incompatible
- Explanation: The
comfy_kitchensparse engine requirescomfy-kitchen>=0.2.32for its compiledsol_attnkernel. An older or missing installation may prevent that engine from running. - Solution: Install a compatible comfy-kitchen version, or select
engine="triton"if your setup supports it. Check the log to confirm whether attention fell back to dense.
SageAttention backend unavailable; warning and fallback to the active backend
- Explanation: A
sage:*dense backend requires the sageattention package and the requested kernel in its installed version. The tooltip says an unavailable choice produces a logged warning and uses the already-active backend instead; it does not provide an exact warning string. - Solution: Install or update sageattention, choose an available SageAttention mode, or use
dense_backend="comfy_kitchen","pytorch", or"auto"as appropriate.
Reference protection or motion stabilization has no effect with engine="comfy_kitchen"
- Explanation: That sparse engine cannot implement reference quotas or cross-step motion stabilization. The source says unsupported controls are disabled with one-time log warnings rather than approximated.
- Solution: Select
engine="triton"if you needreference_protectionorstabilize_motion; otherwise leave those controls off.
Triton int8 sparse attention fails to launch
- Explanation: The
use_int8_qktooltip warns that some GPU/Triton combinations may encounter a launch failure and that this path has not been validated on hardware in the supplied source. - Solution: With
engine="triton", tryuse_int8_qk=Falseand rerun a known-good workflow. Review the traceback if the failure persists.
Sparse attention is slower than dense attention
- Explanation: Routing blocks has overhead. The source places the approximate sparsity break-even point at
0.60and keeps short sequences dense because they may not benefit. - Solution: Compare identical runs with
enabledon and off, test a source-documented highersparsity_ratioif quality permits, and retain the defaultmin_seq_lenguard unless you have evidence it should change.
