Skip to content

h3: MiniMax H3 video and audio generation on MLX (draft proposal, non-lane family) - #384

Closed
drowzeys wants to merge 2 commits into
ashhart:mainfrom
drowzeys:h3-mlx
Closed

drowzeys wants to merge 2 commits into
ashhart:mainfrom
drowzeys:h3-mlx

Conversation

@drowzeys

@drowzeys drowzeys commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Draft, as a proposal. CONTRIBUTING asks for an issue before a new model family, and this one sits outside three of the rules every change must keep. I am opening it as a draft so the code and measurements are in one place for that conversation; close it if a video engine does not belong in TensorFold.

Thank you first: this is built on your family and kernel structure and on the tensor-unit practice in kernels/qwen/dense/v1/lane_qmm.py. The H3 code itself is adapted from mrbizarro's minimax-h3-mlx, and the int8 scheme follows antirez's h3.c. THIRD_PARTY_NOTICES.md records both.

What it is

MiniMax H3 is a joint video and audio diffusion model: a 33B transformer denoises one packed sequence of video, audio and text rows for N steps, then a ViT decodes video tiles. This adds families/h3 and kernels/minimax/h3/v1:

  • the transformer on the released bfloat16 checkpoint, the packed sequence, both sigma schedules and the joint denoise loop;
  • adapters (runner layout and FastVideo fastvideo-lora-v2), merged in float32;
  • int8 SwiGLU, QKV (with the q/k norm and rotation in the kernel) and attention-output kernels on the M5 tensor units;
  • the video decoder, with the same int8 kernels by default;
  • docs/recipes/minimax-h3.md with the measurements, and rows in the family, kernel and recipe tables.

It is two commits on 0.6.5 (609ca419), all in new files apart from the three table rows and THIRD_PARTY_NOTICES.md. The second adds first-frame image to video: the sampler holds the encoded keyframe rows at their noise level and steps only the generated rows.

Where it does not fit the rules

  1. Lanes. H3 does not decode tokens. The family exports no load, sets LANES = False, and tensorfold serve does not route it. Nothing in the lane engine, the server or any existing family is touched.
  2. Exact output. There is no drafted-against-serial contract to keep. What I can state instead: the bfloat16 transformer equals minimax-h3-mlx's on a real first step (zero difference with the same input rounding), and the float32 video decode equals its decode on real latents.
  3. No precision traded for speed. The int8 kernels trade precision, on purpose: activations are quantized per row at run time. They are opt-in flags on the tool for the transformer and a default with a float32 switch for the video decoder. A 20-step int8 render keeps the bfloat16 composition with different detail; with a 3-forward distilled adapter it lands on a different composition. If this is the "precision mode" conversation the guide mentions, I am glad to have it in an issue instead.

It is not complete

  • The text encoder (Qwen3-VL hidden states), the audio decoder and the MP4 writer are not ported. tools/h3_generate_dev.py borrows minimax-h3-mlx's, so the tool needs that repository on the path.
  • No tensorfold generate, no checkpoint detection through families.detect (H3 is a diffusers layout with no root config.json), no resident engine.
  • Text to video and a first frame only; no last frame or reference images. The first frame is encoded by minimax-h3-mlx's VAE encoder and vision tower, which are not ported either.

Receipt

  • Environment. TensorFold 0.6.5 + this commit, MLX 0.32.3, mlx-lm 0.32.0, Mac Studio M5 Ultra 256 GB, macOS 27.0.1. Checkpoint MiniMaxAI/MiniMax-H3, FL2VA partition. Adapter: lightx2v MiniMax H3 Turbo v1.0 in runner layout.

  • Exactness. bench_concurrent.py and token_sha do not apply. tools/h3_generate_dev.py --parity: video and audio max difference 0.0 against minimax-h3-mlx 7919020 on a real first step. Float32 video decode against its decode on real latents: max difference 0.0.

  • Speed, 5 second 864x480 clip, 124 frames, 15,918 rows, same session:

    Forwards Per forward Denoise Clip
    bfloat16 20 13.9 s 277 s about 305 s
    int8 MLP, fused QKV, attention output; int8 video decoder 20 9.3 s 190 s 210 s
    Turbo adapter, same int8 3 9.0 s 27.6 s about 50 s

    Per block: MLP 81.0 to 41.4 ms, QKV with norm and rotation 46.1 to 22.5 ms, attention output 12.2 to 7.0 ms, attention 92.8 ms unchanged. Video decode 17.3 to 10.7 s at 47.1 dB. For scale on the same Mac: antirez's h3.c takes 7.85 s a step and 202 s for the 20-step clip, so per step this is still slower than h3.c.

  • Prompt speed. Not applicable; no prefill, kernel, engine or server path of an existing family is changed.

  • Tests. Host suite on the M5 Ultra: 4979 passed, 609 skipped, 14 failed. The same 14 fail on untouched 0.6.5 in this environment (tests/control/test_cli.py x4, tests/control/test_pty.py x1, tests/test_glm5_prompt_kernels.py x1, tests/test_lane_fuse.py x8); I installed .[test] without tui, and did not look into the lane-fuse and GLM ones. New: tests/test_h3_*.py, 33 tests, which skip the kernel cases where the tensor operations are unavailable. They are new tests for new code, so they did not exist to fail before.

  • What I did not run. Any Mac other than an M5 Ultra: M1-M4 have no tensor units, where the family falls back to bfloat16, untested. Less than 256 GB of memory (the float32 adapter merge peaks at 103 GB). CUDA: the family has no CUDA engine. Picture quality beyond stills: motion and audio were not reviewed by eye or ear.

What did not work

Recorded in the recipe page: an int8 flash-style attention kernel reaches parity with MLX attention and no better (95.5 against 95.8 ms), and block-sparse attention is not sparse enough on this model to pay.

Notes for landing

  • Files are under 400 lines each. The measurements live in the recipe page, as the other recipes do.
  • The commit carries a tool co-author trailer; I know you remove those when you land a commit.
  • MiniMax H3 is under the MiniMax H3 Community License, which limits territories. No weights are included.

A packaged install with a one-shot script and sample clips is at https://github.com/drowzeys/keys-Mac-TensorFold-MiniMax-H3-MLX.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PrUiTH1dGwnVKrpFLkoGHj

drowzeys and others added 2 commits October 4, 2026 09:16
A non-lane family: the 33B diffusion transformer, packed sequence, schedules
and joint denoise loop, adapter merging in float32, int8 MLP / QKV / attention
output kernels on the M5 tensor units, and the video decoder. The transformer
and the float32 video decode equal minimax-h3-mlx's on real inputs.

The text encoder, audio decoder and MP4 writer are not ported;
tools/h3_generate_dev.py borrows minimax-h3-mlx's. docs/recipes/minimax-h3.md
has the measurements.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PrUiTH1dGwnVKrpFLkoGHj
The sampler takes encoded keyframe rows, noises them to 0.999 from the request
generator before the video and audio noise (the reference's draw order), holds
them for every step and steps only the generated rows. The tool's --first-frame
encodes the image with minimax-h3-mlx's VAE encoder and vision tower.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PrUiTH1dGwnVKrpFLkoGHj
@ashhart

ashhart commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Thank you, @drowzeys. Opening this as a proposal, and saying plainly where it sits outside the rules, made it easy to judge. Zero difference against minimax-h3-mlx on a real first step is a careful parity check.

We're closing it. TensorFold's engine is built around token lanes, where drafted rows are verified in one forward and match serial decoding exactly. H3 denoises rather than decodes, so there is no lane round for it, and its int8 kernels trade precision, which we don't do. The Python engine is also frozen (#286), and the Zig engine drives Metal directly without MLX, so an MLX family would have nowhere to land.

Your GLM-5.3 work in #159 is the kind we want, and it waits for GLM on the Zig engine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants