zechengtang/Spark-H3

Adaptive Block Sparse Attention for MiniMax-H3

Python

109

146 commits

updated Oct 19, 2026

See the code

README

Spark-H3

Adaptive Block Sparse Attention for MiniMax-H3

Reblock similar tokens · Reweight tail tokens

Spark-H3 technical blog Spark-H3 on arXiv Spark-H3 on Hugging Face Spark-H3 ComfyUI node Special thanks to community contributors Usage and configuration guide License: Apache 2.0

English · 简体中文

🎬 Demo  ·  🚀 Quick Start  ·  🧩 ComfyUI  ·  📖 Technical Blog  ·  🧭 Project Status

ComfyUI v0.1.4: Adds ComfyUI 0.40.x support and sparse_scope=joint-video for video-conditioned Ref2VA. Release notes and downloads

Spark-VPack v0.1.0: A separate ComfyUI plugin that compresses reference videos in native Ref2VA workflows. Release notes and download

👉 Ref2VA 任务加速解决方案


✨ Spark-Attn

Spark-Attn is a block sparse attention method for MiniMax-H3 video generation. It combines two operations:

  • 🧩 Reblocking groups similar tokens into blocks so sparse attention can select more relevant interactions.
  • ⚖️ Reweighting assigns different weights to tokens within each tail block when building key/value summaries, with a correction for attention mass.

Spark-H3 provides the Spark attention kernels and MiniMax-H3 inference integration.

🎬 Demo

Native MiniMax-H3 · VDN Selected Prompt 06 · 1344×768 · 14.4 seconds. The three panels compare Dense, Spark-H3 Fidelity (2.19×), and Spark-H3 Speed (3.12×). The animated preview and linked clip cover the final 5.4 seconds, starting at 9 seconds.

Animated Native MiniMax-H3 attic comparison: Dense, Spark-H3 Fidelity, and Spark-H3 Speed

Watch the full 14.4-second comparison

🚀 Quick Start

Set up your H3 pipeline using the upstream MiniMax-H3 instructions, then install Spark in the same environment with a compatible PyTorch/CUDA stack:

python -m pip install -e '.[cuda]'

Wrap an already loaded pipeline with the Spark installer:

from h3_sparse_attention import install_h3_spark_attn

# MiniMaxH3Scheduler includes the terminal sigma=0 in num_inference_steps,
# but that terminal point does not run the transformer.
num_denoise_steps = 19
num_inference_steps = num_denoise_steps + 1

with install_h3_spark_attn(
    pipe.transformer,
    num_denoise_steps=num_denoise_steps,
    warmup_mode="warmup_steps",
    warmup_steps=4,
    dense_layers=0,
    topk_ratio=0.1,
):
    result = pipe(**inputs, num_inference_steps=num_inference_steps)

🧩 ComfyUI Installation

Spark-H3 provides standalone nodes for ComfyUI 0.38.x, 0.39.x, and 0.40.x on Linux and Windows x86_64. Release packages support GeForce RTX 30-series GPUs (SM86), GeForce RTX 40-series GPUs (SM89), GeForce RTX 50-series and RTX PRO 5000/6000 Blackwell GPUs (SM120). Choose the CUDA 13.0 package matching your operating system and GPU architecture. ComfyUI and model weights are not included.

Download v0.1.4, or see the ComfyUI guide or 中文安装指南 for downloads, installation, and example workflows.

For reference-video compression in native Ref2VA workflows, install the separate Spark-VPack v0.1.0 plugin.

Step-count convention

MiniMaxH3Scheduler includes the final σ=0 endpoint in num_inference_steps, so the default num_inference_steps=50 runs 49 denoising steps. See the Hugging Face scheduler documentation.

🧭 Project Status & Roadmap

StatusItemResources
✅ AvailableFused Spark kernels for SM80, SM86, SM89, and SM120Kernel documentation · Performance matrix
✅ AvailableStandalone ComfyUI node packaging with wheel-first installation and source fallbackComfyUI guide
✅ AvailableRelease Ref2VA inference examplesSpark-Ref2VA Preview
🚧 In progressTest and validate the ComfyUI implementation on SM120 GPUs, including GeForce RTX 50 series and RTX PRO 5000/6000 Blackwell—
🗓️ PlannedStandalone stable ComfyUI implementation without a comfy-kitchen dependency—
🗓️ PlannedFused Spark kernels for SM90 and SM100Pending resources
🗓️ PlannedRelease the technical report—

🤝 Acknowledgments

Thanks to MiniMax-H3 and Sol-Attn / Sol-Engine for the model and attention infrastructure. See the third-party notices for kernel attributions and included licenses.

❤️ Special Thanks

  • Thanks to Smthem for support and help during the development of Spark-H3's ComfyUI plugin.
  • Thanks to AI绘画KK for relaying the community's requests for Windows support and providing valuable workflow cases for plugin testing.
  • Thanks to AIwood爱屋研究室 for identifying a bug when Spark-H3 was used in a two-pass sampling workflow and suggesting a switch to Kitchen as the dense backend, which further improved the plugin's speedup ratio.

📄 License

Spark-Attn’s original code and documentation are licensed under the Apache License 2.0. Third-party components retain their original licenses and notices; see third-party notices. MiniMax-H3 model weights remain subject to their upstream license.

minimax-h3
sparse-attention

zechengtang/Spark-H3

Adaptive Block Sparse Attention for MiniMax-H3

Python

109

146 commits

updated Oct 19, 2026

See the code

README

Spark-H3

Adaptive Block Sparse Attention for MiniMax-H3

Reblock similar tokens · Reweight tail tokens

Spark-H3 technical blog Spark-H3 on arXiv Spark-H3 on Hugging Face Spark-H3 ComfyUI node Special thanks to community contributors Usage and configuration guide License: Apache 2.0

English · 简体中文

🎬 Demo  ·  🚀 Quick Start  ·  🧩 ComfyUI  ·  📖 Technical Blog  ·  🧭 Project Status

ComfyUI v0.1.4: Adds ComfyUI 0.40.x support and sparse_scope=joint-video for video-conditioned Ref2VA. Release notes and downloads

Spark-VPack v0.1.0: A separate ComfyUI plugin that compresses reference videos in native Ref2VA workflows. Release notes and download

👉 Ref2VA 任务加速解决方案


✨ Spark-Attn

Spark-Attn is a block sparse attention method for MiniMax-H3 video generation. It combines two operations:

  • 🧩 Reblocking groups similar tokens into blocks so sparse attention can select more relevant interactions.
  • ⚖️ Reweighting assigns different weights to tokens within each tail block when building key/value summaries, with a correction for attention mass.

Spark-H3 provides the Spark attention kernels and MiniMax-H3 inference integration.

🎬 Demo

Native MiniMax-H3 · VDN Selected Prompt 06 · 1344×768 · 14.4 seconds. The three panels compare Dense, Spark-H3 Fidelity (2.19×), and Spark-H3 Speed (3.12×). The animated preview and linked clip cover the final 5.4 seconds, starting at 9 seconds.

Animated Native MiniMax-H3 attic comparison: Dense, Spark-H3 Fidelity, and Spark-H3 Speed

Watch the full 14.4-second comparison

🚀 Quick Start

Set up your H3 pipeline using the upstream MiniMax-H3 instructions, then install Spark in the same environment with a compatible PyTorch/CUDA stack:

python -m pip install -e '.[cuda]'

Wrap an already loaded pipeline with the Spark installer:

from h3_sparse_attention import install_h3_spark_attn

# MiniMaxH3Scheduler includes the terminal sigma=0 in num_inference_steps,
# but that terminal point does not run the transformer.
num_denoise_steps = 19
num_inference_steps = num_denoise_steps + 1

with install_h3_spark_attn(
    pipe.transformer,
    num_denoise_steps=num_denoise_steps,
    warmup_mode="warmup_steps",
    warmup_steps=4,
    dense_layers=0,
    topk_ratio=0.1,
):
    result = pipe(**inputs, num_inference_steps=num_inference_steps)

🧩 ComfyUI Installation

Spark-H3 provides standalone nodes for ComfyUI 0.38.x, 0.39.x, and 0.40.x on Linux and Windows x86_64. Release packages support GeForce RTX 30-series GPUs (SM86), GeForce RTX 40-series GPUs (SM89), GeForce RTX 50-series and RTX PRO 5000/6000 Blackwell GPUs (SM120). Choose the CUDA 13.0 package matching your operating system and GPU architecture. ComfyUI and model weights are not included.

Download v0.1.4, or see the ComfyUI guide or 中文安装指南 for downloads, installation, and example workflows.

For reference-video compression in native Ref2VA workflows, install the separate Spark-VPack v0.1.0 plugin.

Step-count convention

MiniMaxH3Scheduler includes the final σ=0 endpoint in num_inference_steps, so the default num_inference_steps=50 runs 49 denoising steps. See the Hugging Face scheduler documentation.

🧭 Project Status & Roadmap

StatusItemResources
✅ AvailableFused Spark kernels for SM80, SM86, SM89, and SM120Kernel documentation · Performance matrix
✅ AvailableStandalone ComfyUI node packaging with wheel-first installation and source fallbackComfyUI guide
✅ AvailableRelease Ref2VA inference examplesSpark-Ref2VA Preview
🚧 In progressTest and validate the ComfyUI implementation on SM120 GPUs, including GeForce RTX 50 series and RTX PRO 5000/6000 Blackwell—
🗓️ PlannedStandalone stable ComfyUI implementation without a comfy-kitchen dependency—
🗓️ PlannedFused Spark kernels for SM90 and SM100Pending resources
🗓️ PlannedRelease the technical report—

🤝 Acknowledgments

Thanks to MiniMax-H3 and Sol-Attn / Sol-Engine for the model and attention infrastructure. See the third-party notices for kernel attributions and included licenses.

❤️ Special Thanks

  • Thanks to Smthem for support and help during the development of Spark-H3's ComfyUI plugin.
  • Thanks to AI绘画KK for relaying the community's requests for Windows support and providing valuable workflow cases for plugin testing.
  • Thanks to AIwood爱屋研究室 for identifying a bug when Spark-H3 was used in a two-pass sampling workflow and suggesting a switch to Kitchen as the dense backend, which further improved the plugin's speedup ratio.

📄 License

Spark-Attn’s original code and documentation are licensed under the Apache License 2.0. Third-party components retain their original licenses and notices; see third-party notices. MiniMax-H3 model weights remain subject to their upstream license.

minimax-h3
sparse-attention

Significant stargazers

smthemex

427 followers · starred Sep 2026

SereinH

206 followers · starred Sep 2026