--- license: apache-2.0 library_name: transformers pipeline_tag: text-generation base_model: tencent/Hy3 base_model_relation: quantized tags: - hunyuan - hy3 - moe - text-generation - nvfp4 - compressed-tensors - quantized - vllm --- # Hy3 — NVFP4 (routed experts, MSE scales) > **A 4-bit NVFP4 quantization of [`tencent/Hy3`](https://huggingface.co/tencent/Hy3).** > The original model card is preserved in full [below](#model-introduction). Weight-only NVFP4 quant produced with [**qstream**](https://github.com/olka/qstream) using MSE-optimal group-scale selection: the routed MoE experts (≈95% of the weights) are quantized to 4-bit; everything quality-sensitive stays BF16. > ## ⚠️ MARLIN-only (this is a **W4A16** build) > > Because the activations stay BF16 (**weight-only, W4A16**), vLLM serves this build > **exclusively on the MARLIN NvFp4 kernel**. The faster FlashInfer fp4 tensor-core > backends (`flashinfer_trtllm` / `cutlass` / `cutedsl`) are **W4A4** and *reject a > weight-only scheme* — `--moe-backend flashinfer_trtllm` fails with > `kernel does not support QuantKey(u8, scale(f8e4m3))`, so vLLM auto-selects MARLIN. > > **Consequence:** measured **~26% slower** than the MXFP4 sibling with MTP > (**674 vs 849 tok/s**, aggregate at concurrency 16 on one B300). If throughput > matters, prefer [**`olka-fi/Hy3-MXFP4`**](https://huggingface.co/olka-fi/Hy3-MXFP4), > which runs on the standard MXFP4 path. A FlashInfer-capable W4A4 variant needs > activation calibration (planned separately — see [below](#serving-with-vllm)). | | | |---|---| | **Size** | **169 GB** (down from ~590 GB BF16 source, ~29%) | | **Format** | compressed-tensors `nvfp4-pack-quantized`, **weight-only (W4A16)** — E2M1 4-bit weights + FP8-E4M3 group-16 scales + FP32 per-tensor global scale | | **Base** | [tencent/Hy3](https://huggingface.co/tencent/Hy3) — 295B MoE (21B active, 3.8B MTP), 80 layers + 1 MTP layer, 192 experts top-8 + 1 shared, 256K context | ### What is quantized to what | Component | Precision | Why | |---|---|---| | Routed experts (`…mlp.experts.{0..191}.{gate,up,down}_proj`), incl. the MTP layer | **NVFP4** (4-bit) | the bulk of the weights — the only place worth the size win | | Shared expert (`…mlp.shared_mlp.*`) | **BF16** | always-on path — quantizing it amplifies error across every token | | Attention, MoE router, dense-layer MLPs | **BF16** | sensitive / small — kept native | | Embeddings, `lm_head`, all norms | **BF16 / F32** | unchanged | ### Quality & faithfulness Functional evals run **end-to-end on a single NVIDIA B300 (275 GB)** with the **MARLIN** NvFp4 MoE kernel (see [Serving](#serving-with-vllm) — this build is MARLIN-only). | Metric | Result | What it shows | |---|---|---| | **WikiText-2 perplexity** (raw test, 290,674 tokens, 2048-ctx) | **5.356** | language modeling intact | | **GSM8K** (full 1319-task, CoT, greedy) | **1263 / 1319 (95.8%)** | math/reasoning preserved | | **MTP acceptance** (`num_speculative_tokens=1`, 104.6k draft tokens on GSM8K) | **83.4%** | the MTP draft layer speculates well — free decode speedup, lossless | | **Routed-expert SQNR** (sampled, NVFP4 vs BF16) | **≈ 21.3 dB** (‖W−dequant‖/‖W‖ ≈ 8.65%) | ~2 dB better weight reconstruction than the MXFP4 sibling (FP8 group scale vs E8M0) | ### Fidelity, footprint & provenance - **MTP preserved:** the MTP draft layer (layer 80) is served with `--speculative-config '{"method":"mtp","num_speculative_tokens":1}'` and reaches **83.4%** draft-token acceptance — lossless (GSM8K unchanged with it on). - **Footprint:** ~169 GB — fits a single large-VRAM GPU (verified on one **B300, 275 GB**) or multi-GPU tensor parallelism. `fastsafetensors` loads it in ~90 s. - **Provenance:** built with [qstream](https://github.com/olka/qstream), experts-only, NVFP4 with MSE-optimal FP8-E4M3 group-scale selection (group_size 16). ### Serving with vLLM `HYV3ForCausalLM` is natively supported. **This is a weight-only (W4A16) build, so vLLM serves it on the MARLIN NvFp4 kernel** — the FlashInfer fp4 tensor-core backends (`flashinfer_trtllm`/`cutlass`/`cutedsl`) are **W4A4** and reject a weight-only scheme (`kernel does not support QuantKey(u8, scale(f8e4m3))`), so vLLM auto-selects MARLIN. ```bash vllm serve olka-fi/Hy3-nvfp4-mse \ --served-model-name hy3 --tensor-parallel-size 1 \ --max-model-len 4096 --gpu-memory-utilization 0.90 \ --load-format fastsafetensors \ --speculative-config '{"method":"mtp","num_speculative_tokens":1}' ``` > **`config.json` note.** The `ignore` list uses regex (`re:.*mlp\.down_proj$`), which > already covers vLLM's shared-expert load path — no per-layer literal fixes needed. ### vs the MXFP4 sibling ([`olka-fi/Hy3-MXFP4`](https://huggingface.co/olka-fi/Hy3-MXFP4)) Despite ~2 dB **better weight reconstruction**, this NVFP4-mse build measured **slightly worse downstream** than MXFP4 — higher weight SQNR did not translate to better quality: | | MXFP4 | **NVFP4-mse** | |---|---|---| | GSM8K (1319) | 96.3% | 95.8% | | WikiText-2 PPL | **5.12** | 5.356 | | MTP acceptance | 82.8% | 83.4% | | Throughput +MTP (conc. 16, 1×B300) | **849 tok/s** | 674 tok/s | | Size | 160 GB | 169 GB | | vLLM kernel | standard MXFP4 path | **MARLIN-only (W4A16)** | **Recommendation: prefer the MXFP4 build** — better perplexity, smaller, broader kernel support. Part of the NVFP4 PPL gap may be the MARLIN kernel rather than the quantization. > **Future work — W4A4 for FlashInfer.** This build is weight-only. A W4A4 variant > (adding FP4 activation quantization via per-expert input scales) would run on the fast > FlashInfer fp4 tensor-core kernels; producing it needs activation calibration and is > planned separately. --- > ⬇️ **The original `tencent/Hy3` model card follows, unmodified.** ⬇️
中文 | English
🖥️ Official Website | 💬 GitHub
--- ## Table of Contents - [Model Introduction](#model-introduction) - [Stronger Agent Performance](#stronger-agent-performance) - [Product Experience: More Reliable, More Cost-Effective](#product-experience-more-reliable-more-cost-effective) - [Benchmark Appendix](#benchmark-appendix) - [News](#news) - [Model Links](#model-links) - [Quickstart](#quickstart) - [Deployment](#deployment) - [vLLM](#vllm) - [SGLang](#sglang) - [Finetuning](#finetuning) - [Quantization](#quantization) - [License](#license) - [Contact Us](#contact-us) --- ## Model Introduction **Hy3** is a 295B-parameter Mixture-of-Experts (MoE) model with 21B active parameters and 3.8B MTP layer parameters, developed by the Tencent Hy Team. Following the Hy3 Preview launch in late April, we gathered feedback from 50+ product teams. We fixed various issues in task execution and interaction, and improved both the quality and scale of our post-training pipeline. Today, we are launching Hy3. It significantly outperforms similar-size models and rivals flagship open-source models with 2-5x the parameters. It also shows solid gains in utility across productivity tasks and real-world applications. | Property | Value | |:---|:---| | Architecture | Mixture-of-Experts (MoE) | | Total Parameters | 295B | | Activated Parameters | 21B | | MTP Layer Parameters | 3.8B | | Number of Layers (excluding MTP layer) | 80 | | Number of MTP Layers | 1 | | Attention Heads | 64 (GQA, 8 KV heads, head dim 128) | | Hidden Size | 4096 | | Intermediate Size | 13312 | | Context Length | 256K | | Vocabulary Size | 120832 | | Number of Experts | 192 experts, top-8 activated | | Supported Precisions | BF16 | ## Stronger Agent Performance Building on Hy3 Preview, we improved post-training data quality and diversity while scaling up RL training. Hy3 shows solid gains across reasoning, agentic workflows, and long-context tasks. Its performance is close to leading flagship models, both domestic and international.
Hy3 is developed by the Tencent Hy Team.