Quantization details
- Scheme — W4A4 — FP4 (E2M1) weights group 16 + FP8 scale, FP4 activations, stored as compressed-tensors
nvfp4-pack-quantized.
- Kept in BF16 — token embeddings, the LM head, and all RMSNorms (about 21% of all parameters in this build).
- Post-training quantization (no retraining). Tokenizer /
chat_template identical to the original.
Benchmarks (measured)
Every column was measured with the same harness and settings — lm-evaluation-harness on vLLM, greedy, few-shot completion (no chat template). Percentages are recovery vs. the BF16 original.
Table with columns: Benchmark, BF16 (original), FP8-dynamic, AWQ-8bit, NVFP4A16, NVFP4 (this repo), AWQ-4bit| Benchmark | BF16 (original) | FP8-dynamic | AWQ-8bit | NVFP4A16 | NVFP4 (this repo) | AWQ-4bit |
|---|
| MMLU (5-shot) | 59.74 | 59.56 (99.7%) | 59.86 (100.2%) | 56.81 (95.1%) | 53.50 (89.5%) | 56.31 (94.3%) |
| GSM8K (5-shot, strict) | 73.01 | 71.27 (97.6%) | 73.01 (100.0%) | 65.20 (89.3%) | 55.04 (75.4%) | 65.96 (90.3%) |
| ARC-Challenge (0-shot) | 43.94 | 44.20 (100.6%) | 43.86 (99.8%) | 43.43 (98.8%) | 40.10 (91.3%) | 44.88 (102.1%) |
| Winogrande (5-shot) | 64.40 | 63.22 (98.2%) | 64.40 (100.0%) | 62.75 (97.4%) | 59.04 (91.7%) | 62.12 (96.4%) |
| KMMLU (5-shot, direct) | 37.65 | 38.38 (101.9%) | 38.27 (101.7%) | 35.56 (94.4%) | 34.06 (90.5%) | 30.73 (81.6%) |
| HAE-RAE (0-shot) | 39.05 | 38.13 (97.7%) | 39.14 (100.2%) | 35.38 (90.6%) | 30.16 (77.2%) | 36.94 (94.6%) |
| Average | 52.97 | 52.46 (99.0%) | 53.09 (100.2%) | 49.85 (94.1%) | 45.32 (85.6%) | 49.49 (93.4%) |
⚠️ Note: average recovery is 85.6% — noticeable degradation at this precision; prefer an 8-bit build if quality matters most.
Evaluation (measured)
Fidelity to the BF16 original on an internal mixed EN/KO set (100 prompts, BF16 greedy answers scored under each build).
Table with columns: Metric, This model, BF16 original| Metric | This model | BF16 original |
|---|
| Perplexity (lower = closer) | 2.1439 | 1.5988 (+34.1%) |
| Top-1 next-token agreement | 79.1% | 98.9% |
⚠️ Note: noticeable 4-bit degradation here; prefer the 8-bit (FP8 / AWQ INT8) builds.
Requirements
Table | |
|---|
| Runtime | vLLM — the architecture is in vLLM; tested here with vLLM 0.32.0. |
| vLLM install | vLLM 0.32 itself needs Python 3.11–3.14, torch 2.13 (CUDA 13.0 build, so an NVIDIA driver with CUDA 13 support), transformers ≥5.16.1,<5.20 and compressed-tensors 0.17.0 (both pinned by vLLM; 0.17.0 reads this checkpoint, which was saved with 0.19.0 — do not upgrade it separately). |
| GPU | Full FP4 (W4A4) speed on Blackwell — B200/GB200 (sm100), B300 (sm103), RTX 50xx / RTX PRO 6000 (sm120). Turing–Hopper (sm75–90) fall back to weight-only FP4 (slower, vLLM warns). V100 (sm70) is not supported. (Kernel choice per GPU from vLLM 0.32's selection code; only B200 was run here.) |
| Memory | Weights: 2.2 GB. Add KV cache (grows with context length × concurrent requests) and a few GB for activations / CUDA graphs; use --tensor-parallel-size N when the weights do not fit one GPU. |
| Transformers (without vLLM) | transformers>=4.56.0 + compressed-tensors>=0.15.0 (checked 4.56.0 / 4.56.2 / 4.57.6 with FP8, AWQ-4bit, NVFP4A16). |
| trust_remote_code | not needed |
Usage (vLLM)
Start an OpenAI-compatible server:
vllm serve axteam/MiniCPM5-2B-NVFP4 --max-model-len 32768
Query it:
curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{ "model": "axteam/MiniCPM5-2B-NVFP4", "messages": [{"role": "user", "content": "대한민국의 수도는 어디인가요?"}], "temperature": 1.0, "top_p": 0.95, "max_tokens": 512}'
Offline inference in Python:
from vllm import LLM, SamplingParams llm = LLM(model="axteam/MiniCPM5-2B-NVFP4", max_model_len=32768)params = SamplingParams(temperature=1.0, top_p=0.95, max_tokens=1024)out = llm.chat([{"role": "user", "content": "Explain model quantization in two sentences."}], params)print(out[0].outputs[0].text)
Recommended sampling (from the original generation_config.json): temperature=1.0, top_p=0.95.
Thinking mode is on by default in the chat template; to turn it off pass chat_template_kwargs={"enable_thinking": False} (Python llm.chat(..., chat_template_kwargs=...), or "chat_template_kwargs": {"enable_thinking": false} in the request body).
Reducing KV-cache memory (optional, serve-time)
The KV cache is kept in BF16 by default. KV-cache precision is a runtime choice, independent of the
weight quantization above; for long contexts or large batches FP8 roughly halves KV-cache memory:
vllm serve axteam/MiniCPM5-2B-NVFP4 --kv-cache-dtype fp8
License
Quantized derivative of openbmb/MiniCPM5-2B (Apache-2.0). Original weights & tokenizer belong to OpenBMB.
한국어 요약
openbmb/MiniCPM5-2B 를 NVFP4 (W4A4, FP4) 로 양자화한 서빙용(4-bit) 모델입니다. 작성: axteam.
- 방식 — 가중치·활성화 모두 FP4(W4A4). Blackwell FP4 텐서코어용. 형식 compressed-tensors
nvfp4-pack-quantized.
- BF16 유지 — 토큰 임베딩·LM 헤드·모든 norm.
- PTQ(재학습 없음), 토크나이저·chat_template 원본 동일.
- 품질(실측) — BF16 대비 perplexity 2.1439(원본 1.5988, +34.1%), top-1 79.1%(원본 98.9%). 내부 영/한 100문항.
- ⚠️ 4비트 열화가 큼 — 8비트(FP8/AWQ INT8) 권장.
- 벤치마크(실측) — MMLU · GSM8K · ARC-Challenge · Winogrande · KMMLU · HAE-RAE 평균 BF16 52.97 → 이 모델 45.32 (회복률 85.6%). lm-evaluation-harness · vLLM, 모든 형식 같은 설정.
- ⚠️ 회복률 85.6% — 이 정밀도에서 열화가 눈에 띔. 품질 우선이면 8비트 권장.
- 요구사항 — vLLM (0.32.0 에서 실측); GPU FP4(W4A4) 제 속도는 Blackwell(B200·B300·RTX 50xx/PRO 6000). Turing~Hopper 는 가중치 전용 FP4 로 자동 전환(느림); 가중치 2.2 GB + KV 캐시; Transformers 직접 사용: transformers ≥4.56.0 + compressed-tensors ≥0.15.0.
- 실행 —
vllm serve axteam/MiniCPM5-2B-NVFP4 --max-model-len 32768 로 OpenAI 호환 서버(포트 8000), 또는 Python LLM(model="axteam/MiniCPM5-2B-NVFP4").chat(...) (위 예시). 권장 샘플링 temperature=1.0, top_p=0.95. thinking 끄기: chat_template_kwargs={"enable_thinking": False}.
- KV 캐시 절감(런타임) —
--kv-cache-dtype fp8.