h3-sparse-attn
Block-sparse self-attention for the MiniMax H3 video DiT. Each query block attends to its top-k key blocks of 128 tokens; the skipped blocks are folded back in as one summary row each. Training-free, so the released H3 checkpoint runs unchanged.
Requires sm_120 (RTX 5090, RTX PRO 6000 Blackwell), bf16, head_dim 128, forward only. Anything else falls back to the attention H3 already ships.
This is an approximation: same quality, but not the same sample as full attention at a fixed seed. top_k sets how
far it drifts.
Install
pip install h3-sparse-attn
Use
import h3_sparse_attn
h3_sparse_attn.patch(model, top_k=64)
model is a MiniMaxH3Transformer3DModel or a pipeline holding one. top_k counts 128-token key blocks.
Measured
RTX PRO 6000 Blackwell Server Edition, bf16, 56 heads, head_dim 128, top_k=64. Sequence lengths are what H3 packs
at 24 fps. "Step" is one denoising step of the 50-layer DiT.
| Video | Sequence | Attention | Speedup | Step | Speedup |
|---|---|---|---|---|---|
| 768p 5s | 37,740 | 112.4 → 30.7 ms | 3.7x | 10.67 → 6.47 s | 1.6x |
| 768p 10s | 73,416 | 426.6 → 61.8 ms | 6.9x | 31.26 → 12.70 s | 2.5x |
| 768p 15s | 103,996 | 862.7 → 91.0 ms | 9.5x | 57.12 → 18.11 s | 3.2x |
| 2K 5s | 133,644 | 1435.6 → 121.8 ms | 11.8x | 89.22 → 23.48 s | 3.8x |
License
MIT
Metadata
Release files for h3-sparse-attn 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| h3_sparse_attn-0.1.0.tar.gz | 13.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| h3_sparse_attn-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.7 kB
Release files / h3_sparse_attn-0.1.0.tar.gz
| Download URL | h3_sparse_attn-0.1.0.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7843a8d49cc551db3c741dc9bce889d32adf82ab53590ce84957072c970aa46b
|
|
BLAKE2b-256 checksum How to use checksums |
b45641eadd0aed4c2d3e4d1a6038e85f7bdb6805338c10dbf16149abb59e2182
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.
Transparency logRelease files / h3_sparse_attn-0.1.0-py3-none-any.whl
| Download URL | h3_sparse_attn-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd27b0d68e77d4e3bd0b6798482e311a284fa598e1850289d2dd2dcddf1057d6
|
|
BLAKE2b-256 checksum How to use checksums |
4847f3215d68e07f1d1a25fa21658df46bc6a70f3228a8055991771606631561
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.
Transparency log