Instructions to use philbert440/Hy4-flash-W4A16-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Local Apps Settings
- vLLM
How to use philbert440/Hy4-flash-W4A16-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "philbert440/Hy4-flash-W4A16-AWQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "philbert440/Hy4-flash-W4A16-AWQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/philbert440/Hy4-flash-W4A16-AWQ
- SGLang
How to use philbert440/Hy4-flash-W4A16-AWQ with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "philbert440/Hy4-flash-W4A16-AWQ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "philbert440/Hy4-flash-W4A16-AWQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "philbert440/Hy4-flash-W4A16-AWQ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "philbert440/Hy4-flash-W4A16-AWQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use philbert440/Hy4-flash-W4A16-AWQ with Docker Model Runner:
docker model run hf.co/philbert440/Hy4-flash-W4A16-AWQ
Hy4-flash W4A16 AWQ (g32)
This checkpoint is a 4-bit quantization of Tencent Hy4-flash (155.5B MoE, ~12B active, 1M context, built-in DFly2 drafter, and multi-image/video vision tower) at base revision d88c9dfd96ba, targeting 4× Tesla V100 32GB GPUs (128 GB total VRAM).
- Engine repo & recipe: philbert440/hy4-flash-v100 (HY4-V100.md)
- Prebuilt SM70 wheel: release
hy4-fast15-20261130 - Benchmarks & notes: https://philtompkins.com/models/hy4-flash
Quick Start (4× V100-32GB)
You will need: 4× V100 32GB GPUs (NVLink recommended), ~60 GiB host RAM (for pinned Engram tables), 168.5 GB disk, CUDA 12.8 toolkit, gcc-14/g++-14, Python 3.12, uv, and huggingface-hub (hf).
1. Download the weights
hf download philbert440/Hy4-flash-W4A16-AWQ --local-dir Hy4-flash-W4A16-AWQ
(cd Hy4-flash-W4A16-AWQ && sha256sum -c SHA256SUMS)
The download is 168.5 GB and already includes hy4-v100-shared-w8.safetensors (the shared-expert int8 sidecar) and all vit.* vision tower weights. No separate cache download or rebind step is needed.
2. Install the prebuilt SM70 engine wheel
TAG=hy4-fast15-20261130
WHEEL=1cat_vllm-1.5.4.dev157+hy4fast15.20261130-cp312-cp312-linux_x86_64.whl
gh release download "$TAG" -R philbert440/hy4-flash-v100 -p "$WHEEL" -p SHA256SUMS
sha256sum -c --ignore-missing SHA256SUMS
uv venv --python 3.12 .venv
uv pip install --python .venv/bin/python "./$WHEEL" ninja --torch-backend=cu128
(Without gh, download the wheel and SHA256SUMS from the hy4-fast15-20261130 release page. To build from source instead, see HY4-V100.md.)
3. Launch the server (DFly2 + Multi-Image/Video + Fused Prefill)
export CUDA_DEVICE_ORDER=PCI_BUS_ID CUDA_VISIBLE_DEVICES=0,1,2,3 # one NVLink quad
export VLLM_HY4_PROFILE=fast15
export HY4_W8_SHARED_SIDECAR=1
export VLLM_HY4_DFLY_GRAPHS=both
export VLLM_WORKER_MULTIPROC_METHOD=spawn VLLM_USE_V2_MODEL_RUNNER=0
export VLLM_SM70_QUANT_BACKEND=turbomind VLLM_USE_BREAKABLE_CUDAGRAPH=0
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export NCCL_PROTO=Simple
export CUDA_HOME=/usr/local/cuda-12.8 NVCC_CCBIN=g++-14
# Optional: prefix with `numactl --cpunodebind=<node> --preferred=<node>` for your GPUs' NUMA node
.venv/bin/vllm serve Hy4-flash-W4A16-AWQ --served-model-name hy4-flash \
--hf-overrides '{"architectures":["HYV4FlashVLForConditionalGeneration"]}' \
--limit-mm-per-prompt '{"image":8,"video":1}' \
--tensor-parallel-size 4 --decode-context-parallel-size 1 \
--dtype half --kv-cache-dtype fp8_ds_mla \
--max-model-len 262144 --max-num-batched-tokens 8192 --max-num-seqs 8 \
--gpu-memory-utilization 0.97 \
--enable-chunked-prefill --no-disable-hybrid-kv-cache-manager --enable-prefix-caching \
--enable-prompt-tokens-details \
--reasoning-parser hy_v4 --enable-auto-tool-choice --tool-call-parser hy_v4 \
--speculative-config '{"num_speculative_tokens":5,"method":"dfly"}' \
--compilation-config '{"mode":0}' --no-async-scheduling
- Text-only (more KV cache): drop
--hf-overridesand--limit-mm-per-prompt(453,532KV tokens atB=8192, or557,237atB=4096). With multimodal enabled above, 3D MRoPE runs natively in fused CUDA (HY4_F7_ATTN_PREP+VLLM_HY4_POSITION_FUSIONstay active — zero decode regression) with399,247KV tokens free. - Full 1M-token context (
1,048,576tokens): drop--hf-overrides/--limit-mm-per-promptand set--decode-context-parallel-size 2 --max-model-len 1048576 --max-num-batched-tokens 4096 --max-num-seqs 2(1,113,862KV tokens with DFly2;1,223,988plain). - Plain decode / high concurrency: drop
--speculative-configand--no-async-scheduling, set--compilation-config '{"mode":0,"cudagraph_mode":"FULL_DECODE_ONLY"}', and raise--max-num-seqs 16.
4. Smoke test
curl -s http://localhost:8000/v1/chat/completions -H 'Content-Type: application/json' -d '{
"model": "hy4-flash",
"max_tokens": 64,
"messages": [{"role": "user", "content": "Name the capital of France."}],
"chat_template_kwargs": {"reasoning_effort": "no_think"}
}'
Thinking is enabled by default; pass "chat_template_kwargs": {"reasoning_effort": "no_think"} (or "none") per request to disable it.
What is quantized
- Routed experts (layers 1–41). Quantized to asymmetric uint4 (group size 32, AWQ GEMM layout) from Tencent's BF16 weights using sequential layer-by-layer GPTQ with diagonal-Hessian clipping search.
- Engram tables (layers 1, 11, 21, 31). Encoded to E4M3 with BF16 per-row scales using Tencent's exact FP8 round trip.
- Shared-expert int8 sidecar (
hy4-v100-shared-w8.safetensors). Optional int8 g32 GPTQ packs of the unchanged BF16 shared expert for the V100 engine's fast profiles. The model index does not list it, so other loaders ignore it. - Attention, dense MLP, router, norms, embeddings, LM head, vision tower (
vit.*), DFly2 drafter. Preserved at Tencent's source precision.
The file layout, tensor names, shapes, dtypes, and safetensors headers follow the AWQ-g32 layout established by leoncca/Hy4-flash-AWQ-g32, so any loader that supports that layout loads this checkpoint unchanged.
Method
| Part | Format | How it was made |
|---|---|---|
| Routed experts, layers 1–41 | uint4 asymmetric, group size 32, integer zero points, FP16 scales, AWQ GEMM packing | GPTQ in natural column order with a diag(H)-weighted clipping search and damping 1e-5. Layers are fitted in order, each calibrated on the outputs of the already-quantized layers below it. |
| Engram tables (layers 1, 11, 21, 31) | E4M3 codes with BF16 per-row scales | Re-encoded from the BF16 table with Tencent's FP8 round trip (s = amax/448 in FP32, E4M3 codes, BF16 scale), matching Tencent's runtime numerics within 6e-15 normed relative error. |
| Shared expert (sidecar) | int8 symmetric, group size 32, FP16 scales | GPTQ codes of the unchanged BF16 shared expert used by the V100 engine's fast profiles. |
| Attention, dense MLP, router, norms, embeddings, LM head, vision tower, drafter | unchanged | Preserved at Tencent's source precision. |
Calibration. 581,183 tokens in windows of up to 2,048 tokens:
| Source | Tokens | Share |
|---|---|---|
| Agentic coding-assistant sessions (private, sanitized, not released) | 360,270 | 62.0% |
| Magicoder-OSS-Instruct-75K (code) | 72,024 | 12.4% |
| Aya dataset (multilingual) | 60,514 | 10.4% |
| Glaive function calling v2 (tool use) | 48,116 | 8.3% |
| GSM8K train (math) | 30,069 | 5.2% |
| OASST2 train (chat) | 10,190 | 1.8% |
- Sanitizing the private sessions. Secrets, names, hosts, addresses, and identifiers were replaced with placeholders prior to calibration.
- Privacy checks. Membership and verbatim-continuation probes on calibration windows against session-disjoint held-out windows found no memorization gain (membership gap +0.0007 nats/token
[−0.022, +0.024]; verbatim gain −0.11 tokens[−0.39, +0.14]). - File scan. A scan of every released file found no calibration text, paths, hostnames, or identifiers.
Quality vs tencent/Hy4-flash BF16
All quality numbers compare this checkpoint directly against the tencent/Hy4-flash BF16 base model on 40 held-out prompts × 64 teacher-forced decode positions (2,560 positions total).
Logit fidelity
| Evaluation path | Mean KL(W4A16 ‖ BF16) | p95 KL | Top-1 agreement with BF16 |
|---|---|---|---|
| Offline FP32 forward (weights only) | 0.0409 nats | 0.201 nats | 95.16% |
V100 engine (fast15, chunk 4096, 1 stream) |
0.0407 nats | — | 95.04% |
DFly2 speculative acceptance vs BF16 base
Paired evaluation of Tencent's built-in DFly2 drafter (k=5 drafts) on 40 held-out prompts (2,360 verify positions) comparing this W4A16-AWQ checkpoint directly against tencent/Hy4-flash BF16 in FP32 reference forward. Brackets are paired case-bootstrap 95% intervals.
| DFly2 regime | tencent/Hy4-flash BF16 |
This checkpoint (W4A16-AWQ) | Delta [95% CI] | Retention vs BF16 |
|---|---|---|---|---|
Raw k=5 accepted tokens / verify |
1.7975 | 1.7564 | −0.0411 [−0.0754, −0.0089] |
97.71% |
fast15 variable verify (var@0.45) |
1.7186 (width 3.619) | 1.6852 (width 3.636) | −0.0335 [−0.0661, −0.0025] |
98.05% |
| Slot-1 acceptance rate | 70.97% | 71.06% | +0.09 pp | 100.1% |
| Per-slot acceptance (slots 1–5) | 71.0 / 46.1 / 29.7 / 19.7 / 13.3% | 71.1 / 45.0 / 28.5 / 18.7 / 12.4% | — | — |
| Decode top-1 agreement (W4A16 vs BF16) | — | 93.09% (2,383 / 2,560) | — | — |
Speed, multimodal & long-context verification (4× V100-SXM2-32GB)
Measured from the prebuilt hy4-fast15-20261130 SM70 wheel on 4× Tesla V100-SXM2-32GB (NVLink, 300 W), TP4, FP8 (fp8_ds_mla) KV cache, HY4_W8_SHARED_SIDECAR=1.
| Measure | fast14 (chunk 2048) |
fast15 (20261129.7, B=4096) |
fast15 (20261130, B=8192 + NCCL_PROTO=Simple) |
|---|---|---|---|
| Plain decode, short context (C1 / C4 / C8 / C16) | ~107 / 307.5 / — / — tok/s | 113.2 / 323.8 / 472.0 / 589.8 tok/s | 113.2 / 323.8 / 472.0 / 589.8 tok/s |
| DFly2 speculative decode, real prompts (C1) | 138.1 tok/s | 168.4–171.3 tok/s | 166.3–171.0 tok/s (with Vision/Video + 3D MRoPE active!) |
| DFly2 concurrency, random (C1 / C4 / C8 aggregate) | — | 303.8 / 607.8 / 418.2 tok/s | 303.8 / 607.8 / 418.2 tok/s |
| Cold prefill ~15K / ~61K / ~123K (fused DSA V3c) | — | 4,600 / 4,243 / 4,073 tok/s (B=4096) |
5,191 / 4,851 / 4,624 tok/s (+13–15%) |
Multimodal (image_url / multi-image / video_url) |
single image (no F7) | single image (no F7) | multi-image + video, full 3D MRoPE F7 decode (0.39–0.78 s) |
Full 1M-token context (DCP=2 plain) prefill / decode |
— | 309.23 s (3,391 tok/s) / 76.3–90.4 tok/s | 309.23 s (3,391 tok/s) / 76.3–90.4 tok/s |
Full 1M-token context (DCP=2 + DFly2) 128K–512K decode |
— | 146.4 / 144.4 / 260.2 tok/s | 146.4 / 144.4 / 260.2 tok/s (1,113,862 KV) |
Engram Triton cold JIT kernels / tool_choice |
5 cubins / off | 0 cubins (CUDA) / 13/13 live | 0 cubins (CUDA) / 13/13 live |
Full 1M-token context verification (DCP=2)
Verified up to the full native 1,048,576-token window (--tensor-parallel-size 4 --decode-context-parallel-size 2 --max-model-len 1048576, 1,223,988 KV cache tokens plain / 1,113,862 KV tokens with DFly2, 88–93 s boot) with direct 2-GPU NVLink P2P IPC active across target and all 12 DFly2 draft layers. Five needles placed at [8%, 30%, 50%, 70%, 92%] depth plus streaming decode:
| Context length | Needles found | Prefill TTFT (20261129 → .7/20261130) |
Plain decode | DCP=2 + DFly2 |
|---|---|---|---|---|
| 131,072 (128K) | 5/5 | 37.08 s → 31.46 s (4,162 tok/s) |
90.42 tok/s (+28.8%) | 146.4 tok/s (2.76 tok/step, 5/5) |
| 262,144 (256K) | 4/5* | 78.07 s → 65.05 s (4,028 tok/s) |
89.21 tok/s (+30.6%) | 144.4 tok/s (2.45 tok/step, 4/5*) |
| 524,288 (512K) | 5/5 | 170.41 s → 138.57 s (3,783 tok/s) |
85.38 tok/s (+36.0%) | 260.2 tok/s (3.83 tok/step, 5/5) |
| 1,048,576 (1M) | 5/5 | 392.33 s → 309.23 s (3,391 tok/s, −83.1 s) |
76.33 tok/s (+37.0%) | fits 1M (315.4 s prefill, 4.88 tok/step) |
*At 256K, the 30% depth needle landed adjacent to a prompt-injection security log in the synthetic filler text; all other depths (including 5/5 at 128K, 512K, and 1M) passed cleanly.
Known limits
- Calibration domain. Calibration is weighted towards agentic coding sessions (62%) alongside public code, multilingual, tool-use, math, and chat datasets (38%).
- Engine-side dense int8 conversion. Dense projections and the small-batch LM head are converted to int8 at load time by the V100 engine (
VLLM_HY4_PROFILE=fast15); that is an engine runtime choice, not baked into the checkpoint's BF16/FP16 tensors. - Measurement scope. Logit KL was measured on contexts up to ~2,000 tokens, long-context needle retrieval up to 1,048,576 tokens (with the 256K 30%-depth filler-collision caveat noted above), and serving throughput on 4× V100-SXM2-32GB.
- DFly2 speculative retention. Relative to
tencent/Hy4-flashBF16, this 4-bit checkpoint retains 98.05% of DFly2var@0.45acceptance (−0.0335accepted tokens/verify, 97.71% rawk=5).
License and attribution
The original model is by the Tencent Hy Team. The AWQ-g32 file layout, packing format, configuration, and unchanged non-expert files follow the format established by leoncca/Hy4-flash-AWQ-g32. This derivative is distributed under the Tencent Hy License, Version 1.0. See NOTICE for every changed or added file, and SHA256SUMS to verify file integrity.
- Downloads last month
- 294
Model tree for philbert440/Hy4-flash-W4A16-AWQ
Base model
tencent/Hy4-flash