How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="axteam/MiniCPM5-2B-FP8-dynamic")
messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe(messages)
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("axteam/MiniCPM5-2B-FP8-dynamic")
model = AutoModelForCausalLM.from_pretrained("axteam/MiniCPM5-2B-FP8-dynamic", device_map="auto")
messages = [
    {"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
	messages,
	add_generation_prompt=True,
	tokenize=True,
	return_dict=True,
	return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

MiniCPM5-2B ยท FP8 (dynamic)

8-bit quantization of openbmb/MiniCPM5-2B for vLLM serving. Quantized by axteam.

Base model openbmb/MiniCPM5-2B
Method FP8 (dynamic)
Format compressed-tensors float-quantized (scheme FP8_DYNAMIC)
Weights / activations W8A8 โ€” FP8 E4M3 weights (per-channel), dynamic per-token FP8 activations
Architecture Dense (Llama-architecture) ยท text-only
Size on disk ~3.1 GB
Calibration None (data-free)
License Apache-2.0

Quantization details

  • Scheme โ€” W8A8 โ€” FP8 E4M3 weights (per-channel), dynamic per-token FP8 activations, stored as compressed-tensors float-quantized (scheme FP8_DYNAMIC).
  • 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.

Benchmark BF16 (original) FP8-dynamic (this repo) AWQ-8bit NVFP4A16 NVFP4 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%)

Evaluation (measured)

Fidelity to the BF16 original on an internal mixed EN/KO set (100 prompts, BF16 greedy answers scored under each build).

Metric This model BF16 original
Perplexity (lower = closer) 1.6494 1.5988 (+3.2%)
Top-1 next-token agreement 92.9% 98.9%

Usage (vLLM)

Start an OpenAI-compatible server:

vllm serve axteam/MiniCPM5-2B-FP8-dynamic --max-model-len 32768

Query it:

curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
  "model": "axteam/MiniCPM5-2B-FP8-dynamic",
  "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-FP8-dynamic", 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-FP8-dynamic --kv-cache-dtype fp8

License

Quantized derivative of openbmb/MiniCPM5-2B (Apache-2.0). Original weights & tokenizer belong to OpenBMB.


ํ•œ๊ตญ์–ด ์š”์•ฝ

openbmb/MiniCPM5-2B ๋ฅผ FP8 (dynamic) ๋กœ ์–‘์žํ™”ํ•œ ์„œ๋น™์šฉ(8-bit) ๋ชจ๋ธ์ž…๋‹ˆ๋‹ค. ์ž‘์„ฑ: axteam.

  • ๋ฐฉ์‹ โ€” FP8 E4M3, ๊ฐ€์ค‘์น˜ ์ฑ„๋„๋ณ„ ์Šค์ผ€์ผ(์ •์ ยท๋ณด์ •๋ถˆํ•„์š”), ํ™œ์„ฑํ™” ๋™์  FP8. ํ˜•์‹ compressed-tensors float-quantized (scheme FP8_DYNAMIC).
  • BF16 ์œ ์ง€ โ€” ํ† ํฐ ์ž„๋ฒ ๋”ฉยทLM ํ—ค๋“œยท๋ชจ๋“  norm.
  • PTQ(์žฌํ•™์Šต ์—†์Œ), ํ† ํฌ๋‚˜์ด์ €ยทchat_template ์›๋ณธ ๋™์ผ.
  • ํ’ˆ์งˆ(์‹ค์ธก) โ€” BF16 ๋Œ€๋น„ perplexity 1.6494(์›๋ณธ 1.5988, +3.2%), top-1 92.9%(์›๋ณธ 98.9%). ๋‚ด๋ถ€ ์˜/ํ•œ 100๋ฌธํ•ญ.
  • ๋ฒค์น˜๋งˆํฌ(์‹ค์ธก) โ€” MMLU ยท GSM8K ยท ARC-Challenge ยท Winogrande ยท KMMLU ยท HAE-RAE ํ‰๊ท  BF16 52.97 โ†’ ์ด ๋ชจ๋ธ 52.46 (ํšŒ๋ณต๋ฅ  99.0%). lm-evaluation-harness ยท vLLM, ๋ชจ๋“  ํ˜•์‹ ๊ฐ™์€ ์„ค์ •.
  • ์‹คํ–‰ โ€” vllm serve axteam/MiniCPM5-2B-FP8-dynamic --max-model-len 32768 ๋กœ OpenAI ํ˜ธํ™˜ ์„œ๋ฒ„(ํฌํŠธ 8000), ๋˜๋Š” Python LLM(model="axteam/MiniCPM5-2B-FP8-dynamic").chat(...) (์œ„ ์˜ˆ์‹œ). ๊ถŒ์žฅ ์ƒ˜ํ”Œ๋ง temperature=1.0, top_p=0.95. thinking ๋„๊ธฐ: chat_template_kwargs={"enable_thinking": False}.
  • KV ์บ์‹œ ์ ˆ๊ฐ(๋Ÿฐํƒ€์ž„) โ€” --kv-cache-dtype fp8.
Downloads last month
28
Safetensors
Model size
3B params
Tensor type
BF16
ยท
F8_E4M3
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for axteam/MiniCPM5-2B-FP8-dynamic

Quantized
(130)
this model

Collection including axteam/MiniCPM5-2B-FP8-dynamic