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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: minimax-h3-community-license-agreement
|
| 4 |
+
base_model: MiniMaxAI/MiniMax-H3
|
| 5 |
+
tags:
|
| 6 |
+
- video
|
| 7 |
+
- vae
|
| 8 |
+
- decoder
|
| 9 |
+
- nvfp4
|
| 10 |
+
- fp4
|
| 11 |
+
- quantization
|
| 12 |
+
- blackwell
|
| 13 |
+
- fastvideo
|
| 14 |
+
- minimax-h3
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# FastH3 NVFP4 VAE Decoder
|
| 18 |
+
|
| 19 |
+
NVFP4 (4-bit floating point) replacements for the video decoder of the
|
| 20 |
+
[MiniMax-H3](https://huggingface.co/MiniMaxAI/MiniMax-H3) VAE, built for the FastH3
|
| 21 |
+
stacks in [FastVideo](https://github.com/hao-ai-lab/FastVideo).
|
| 22 |
+
|
| 23 |
+
The H3 video decoder is a 36-block ViT (hidden size 2048, SwiGLU FFN 8192). These
|
| 24 |
+
decoders quantize every transformer-block linear (Q, K, V, attention output, FFN in,
|
| 25 |
+
FFN out) to NVFP4 W4A4: weights and activations both in E2M1 with E4M3 scales per
|
| 26 |
+
16 values. They were trained with quantization-aware distillation (QAD) against the
|
| 27 |
+
original full-precision decoder. `proj_in`, `proj_out`, norms, register tokens and
|
| 28 |
+
`post_quant_conv` stay in high precision. They decode the same latents as the
|
| 29 |
+
original VAE, so no DiT or encoder changes are needed.
|
| 30 |
+
|
| 31 |
+
## Two tiers
|
| 32 |
+
|
| 33 |
+
| Tier | Folder | Decoder blocks | Resident weights after packing | Use it when |
|
| 34 |
+
|---|---|---:|---:|---|
|
| 35 |
+
| Quality, **C-v4** | `quality-36L/` | 36 (full depth) | ~1.36 GB | you want output that looks the same as the original decoder |
|
| 36 |
+
| Fast, **F8-v2** | `fast-8L/` | 8 | ~0.30 GB | decode time or memory matters most and you can accept some loss |
|
| 37 |
+
|
| 38 |
+
For comparison, the original decoder's weights are 9.7 GB in fp32 or 4.8 GB in bf16.
|
| 39 |
+
|
| 40 |
+
## Quality
|
| 41 |
+
|
| 42 |
+
LPIPS (AlexNet) against the original fp32 decoder on the same latents. Lower is better.
|
| 43 |
+
|
| 44 |
+
| Latents | Quality tier (C-v4) LPIPS / PSNR | Fast tier (F8-v2) LPIPS / PSNR |
|
| 45 |
+
|---|---:|---:|
|
| 46 |
+
| FastH3 V2 generations (9 clips, 480p) | 0.0104 / 37.9 dB | 0.0684 / 28.5 dB |
|
| 47 |
+
| FastH3 OmniRef generations (20 clips) | 0.0039 / 46.0 dB | 0.0276 / 36.1 dB |
|
| 48 |
+
| Real videos, VAE-encoded, held out (6 clips) | 0.0038 / 45.0 dB | 0.0330 / 34.3 dB |
|
| 49 |
+
|
| 50 |
+
These numbers were reproduced from the released files through FastVideo's loader path,
|
| 51 |
+
with weights packed to FP4 and the fused kernels.
|
| 52 |
+
|
| 53 |
+
### Blind side-by-side votes
|
| 54 |
+
|
| 55 |
+
Raters watched decoded clips side by side without knowing which decoder made which
|
| 56 |
+
clip. The clips came from FastH3 V2 and OmniRef generations.
|
| 57 |
+
|
| 58 |
+
| Pairing | Result (wins–losses, ties) |
|
| 59 |
+
|---|---|
|
| 60 |
+
| Quality tier vs original decoder | 2–2, 7 ties: indistinguishable |
|
| 61 |
+
| Quality tier vs TAEH3 | 11–0 |
|
| 62 |
+
| Fast tier vs TAEH3 | 7–1 |
|
| 63 |
+
| Fast tier vs original decoder | 0–7, 3 ties |
|
| 64 |
+
|
| 65 |
+
## Speed
|
| 66 |
+
|
| 67 |
+
Decode time for an 832x480, 124-frame clip on one GB200, warm, using FastVideo's fused
|
| 68 |
+
NVFP4 kernels with every spatial tile batched in one decoder call:
|
| 69 |
+
|
| 70 |
+
| Decoder | Seconds per clip |
|
| 71 |
+
|---|---:|
|
| 72 |
+
| Original decoder, fp16, `torch.compile` | 0.98 |
|
| 73 |
+
| Quality tier (C-v4) | 0.53 |
|
| 74 |
+
| Fast tier (F8-v2) | 0.13 |
|
| 75 |
+
|
| 76 |
+
## Hardware
|
| 77 |
+
|
| 78 |
+
NVFP4 matrix multiplies need an NVIDIA Blackwell GPU:
|
| 79 |
+
|
| 80 |
+
- sm_100: B200, GB200
|
| 81 |
+
- sm_120: RTX 50-series, RTX PRO 6000 Blackwell
|
| 82 |
+
- sm_121: DGX Spark (GB10)
|
| 83 |
+
|
| 84 |
+
On GB10, FastVideo uses the cuDNN FP4 GEMM backend; elsewhere it uses CUTLASS
|
| 85 |
+
through FlashInfer. The two produce bit-identical output. The fused decoder kernels
|
| 86 |
+
were benchmarked on GB200 and DGX Spark.
|
| 87 |
+
|
| 88 |
+
On GPUs without FP4 tensor cores (Hopper, Ada, Ampere and older) or on CPU/MPS, the
|
| 89 |
+
FP4 kernels are unavailable, so loading or decoding with these files fails. There is
|
| 90 |
+
no automatic fallback. Use the original H3 VAE decoder on that hardware.
|
| 91 |
+
|
| 92 |
+
## How to use with FastVideo
|
| 93 |
+
|
| 94 |
+
> **Not merged upstream yet.** The loader lives on a FastVideo fork branch,
|
| 95 |
+
> [`aryan5v/FastVideo@aryan/h3-nvfp4-vae-spark`](https://github.com/aryan5v/FastVideo/tree/aryan/h3-nvfp4-vae-spark).
|
| 96 |
+
> The training and benchmark code is on
|
| 97 |
+
> [`aryan/h3-nvfp4-decoder`](https://github.com/aryan5v/FastVideo/tree/aryan/h3-nvfp4-decoder).
|
| 98 |
+
> Names and formats may change before the code is merged.
|
| 99 |
+
|
| 100 |
+
1. Install FastVideo from the fork branch, with FlashInfer, on a Blackwell GPU.
|
| 101 |
+
2. Download a tier and convert it to the `.pt` format the loader reads. The
|
| 102 |
+
conversion only regroups the tensors; values are unchanged.
|
| 103 |
+
|
| 104 |
+
```bash
|
| 105 |
+
hf download FastVideo/FastH3-NVFP4-VAE-Decoder --local-dir fasth3-nvfp4-vae
|
| 106 |
+
python fasth3-nvfp4-vae/convert_to_fastvideo_pt.py \
|
| 107 |
+
fasth3-nvfp4-vae/quality-36L/decoder.safetensors quality-36L.pt
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
3. Point FastVideo at it and run any MiniMax-H3 / FastH3 pipeline as usual:
|
| 111 |
+
|
| 112 |
+
```bash
|
| 113 |
+
export FASTVIDEO_H3_VAE_NVFP4_DECODER=$PWD/quality-36L.pt
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
When the VAE loads, FastVideo:
|
| 117 |
+
|
| 118 |
+
- replaces the decoder with the NVFP4 one;
|
| 119 |
+
- skips the INT8 ConvRot decoder overlay;
|
| 120 |
+
- packs the weights to FP4, so only the packed weights stay on the GPU;
|
| 121 |
+
- runs the decode in bf16 autocast, the precision the decoders were trained in.
|
| 122 |
+
|
| 123 |
+
Which host VAE each tier needs:
|
| 124 |
+
|
| 125 |
+
- **Quality tier (36 blocks):** the stack's `vae/` folder must hold the full
|
| 126 |
+
36-block VAE from `MiniMaxAI/MiniMax-H3`. The 26-block light VAE in the FastH3
|
| 127 |
+
V2/Trim repos is too shallow, and the loader will refuse it.
|
| 128 |
+
- **Fast tier (8 blocks):** any H3 video VAE works, including the 26-block light
|
| 129 |
+
VAE that ships with FastH3 V2/Trim. The loader cuts the VAE down to 8 blocks.
|
| 130 |
+
|
| 131 |
+
Useful environment variables:
|
| 132 |
+
|
| 133 |
+
- `FASTVIDEO_H3_VAE_NVFP4_FUSED=1`: use the fused kernels. This is the default.
|
| 134 |
+
- `FASTVIDEO_H3_VAE_NVFP4_CUDA_GRAPH=1`: replay small decoder calls as CUDA graphs.
|
| 135 |
+
This is the default.
|
| 136 |
+
- `FASTVIDEO_H3_VAE_TILE_BATCH`: how many spatial tiles go into one decoder call.
|
| 137 |
+
`12` covers all tiles at 832x480.
|
| 138 |
+
|
| 139 |
+
## Files
|
| 140 |
+
|
| 141 |
+
```
|
| 142 |
+
quality-36L/decoder.safetensors # C-v4 weights
|
| 143 |
+
quality-36L/config.json # architecture + NVFP4 settings
|
| 144 |
+
fast-8L/decoder.safetensors # F8-v2 weights
|
| 145 |
+
fast-8L/config.json
|
| 146 |
+
convert_to_fastvideo_pt.py # safetensors -> FastVideo loader .pt
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
Each `decoder.safetensors` holds `decoder.*` and `post_quant_conv.*` tensors. The
|
| 150 |
+
safetensors header carries the NVFP4 settings (`format`, `nvfp4_metadata`). The
|
| 151 |
+
quantized linear weights are stored as bf16 master weights. FastVideo turns them
|
| 152 |
+
into NVFP4 at load with the same deterministic quantizer used in training, so the
|
| 153 |
+
files on disk are larger than the resident sizes above:
|
| 154 |
+
|
| 155 |
+
- quality tier: 4.86 GB on disk;
|
| 156 |
+
- fast tier: 1.10 GB on disk.
|
| 157 |
+
|
| 158 |
+
## Training
|
| 159 |
+
|
| 160 |
+
- **Teacher:** the original 36-block MiniMax-H3 video decoder.
|
| 161 |
+
- **Students:**
|
| 162 |
+
- Quality tier: the full 36-block decoder.
|
| 163 |
+
- Fast tier: 8 evenly spaced blocks of the H3 decoder.
|
| 164 |
+
- Both were trained over several QAD rounds, each starting from the previous one.
|
| 165 |
+
- **Method:** quantization-aware distillation. The forward pass uses exactly the
|
| 166 |
+
NVFP4 numerics used at inference; gradients pass straight through the quantizer.
|
| 167 |
+
The loss is pixel L1 plus LPIPS. The activation global scale is fixed at 1.0 and
|
| 168 |
+
no Hadamard rotation is used.
|
| 169 |
+
- **Data:** decoder tiles cut from latents of FastH3 generations plus real video:
|
| 170 |
+
- FastH3 V1, V2 (NVFP4 and bf16), Trim (NVFP4, FP8, bf16) and OmniRef DiT
|
| 171 |
+
outputs, i.e. the latents the decoder sees in production;
|
| 172 |
+
- VAE-encoded real videos.
|
| 173 |
+
- **Checkpoint selection:** mean LPIPS on held-out FastH3 V2 and OmniRef latents.
|
| 174 |
+
|
| 175 |
+
## Limitations
|
| 176 |
+
|
| 177 |
+
- These are lossy decoders. Blind raters could not tell the quality tier from the
|
| 178 |
+
original. The fast tier lost every decisive vote against the original, so check
|
| 179 |
+
your own content before using it.
|
| 180 |
+
- They require Blackwell FP4 hardware, as described above.
|
| 181 |
+
- They only decode video. The encoder and the audio VAE are unchanged.
|
| 182 |
+
|
| 183 |
+
## License
|
| 184 |
+
|
| 185 |
+
These weights are derived from the MiniMax-H3 VAE and are subject to the
|
| 186 |
+
[MiniMax-H3 Community License Agreement](https://huggingface.co/MiniMaxAI/MiniMax-H3).
|