KJNodes/experimentalgenerated

MiniMax H3 Low VRAM Attention(MiniMaxLowVRAMAttention)

MiniMax H3 Low VRAM Attention is a model patch that reduces the peak VRAM used by the MiniMax H3 attention without changing the underlying math.

Mini Max Low VRAM Attention

model
model
head_chunks
4
KJNodes

Description

MiniMax H3 Low VRAM Attention is a model patch that reduces the peak VRAM used by the MiniMax H3 attention without changing the underlying math. It works by splitting the attention call into head groups, so the kernel's internal transients (the int8 q/k copies and the fp32 accumulator) shrink proportionally to the chunk count, for the portion of the call where the fused qkv buffer is still alive. It also frees the qkv buffer and the normed block input as soon as they are consumed, rather than holding them for the duration of the attention.

Because heads are processed independently, splitting them into groups does not alter the result: the output is identical to the unpatched model. This node is intended as a drop-in memory optimization when MiniMax H3 attention is the source of an out-of-memory error or a tight VRAM budget, not as a quality or speed knob.

This node lives in the KJNodes/experimental category.

Inputs

model

The MODEL to patch. The patch is applied to this model instance and passed through to the output; it does not modify the checkpoint on disk. Connect the model you would otherwise sample with (for example the output of a model loader or another patch node).

head_chunks

Type: INT, Default: 4, Range: 1–56, Step: 1

The number of head groups to split the attention call into. Kernel-internal transients scale down with this value, while the result stays unchanged because the heads are independent.

  • 1 disables the split (a single group) and behaves like the unpatched attention path, using the most memory.
  • Higher values reduce peak transient VRAM further, at the cost of more attention launches and some overhead.
  • The upper bound of 56 corresponds to the head count, so the practical useful range is from 1 up to the number of heads in the model.

Increase this only as far as needed to fit in VRAM; start at the default of 4 and raise it if you still run out of memory.

Outputs

MODEL output

The patched model with the low-VRAM MiniMax H3 attention applied. Its output is numerically identical to the unpatched model, so it can be used anywhere the original model would be used.

Usage Notes

  • This is a memory optimization, not a sampler or a model. It should be inserted into your existing model chain, typically right before the sampler or after other model patches.
  • Since the math is unchanged, you do not need to compare outputs or adjust sampler settings; only peak VRAM (and slightly, speed) is affected.
  • Prefer the lowest head_chunks value that keeps you within your VRAM budget. Raising it beyond what is necessary adds launch overhead for no additional benefit.
  • If you are not running MiniMax H3 attention, this patch provides no benefit; it targets the MiniMax H3 attention kernel specifically.
  • Marked experimental, so its behavior or parameter range may change in future releases of ComfyUI-KJNodes.

Comments

Sign in with GitHub to join the discussion.

Loading comments…