Instructions to use axteam/Qwen3.5-2B-FP8-dynamic with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use axteam/Qwen3.5-2B-FP8-dynamic with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="axteam/Qwen3.5-2B-FP8-dynamic") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("axteam/Qwen3.5-2B-FP8-dynamic") model = AutoModelForMultimodalLM.from_pretrained("axteam/Qwen3.5-2B-FP8-dynamic", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use axteam/Qwen3.5-2B-FP8-dynamic with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "axteam/Qwen3.5-2B-FP8-dynamic" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "axteam/Qwen3.5-2B-FP8-dynamic", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/axteam/Qwen3.5-2B-FP8-dynamic
- SGLang
How to use axteam/Qwen3.5-2B-FP8-dynamic 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 "axteam/Qwen3.5-2B-FP8-dynamic" \ --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": "axteam/Qwen3.5-2B-FP8-dynamic", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "axteam/Qwen3.5-2B-FP8-dynamic" \ --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": "axteam/Qwen3.5-2B-FP8-dynamic", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use axteam/Qwen3.5-2B-FP8-dynamic with Docker Model Runner:
docker model run hf.co/axteam/Qwen3.5-2B-FP8-dynamic
Qwen3.5-2B ยท FP8 (dynamic)
8-bit quantization of Qwen/Qwen3.5-2B, produced for efficient vLLM serving. Quantized by axteam.
| Base model | Qwen/Qwen3.5-2B |
| Method | FP8 (dynamic) |
| Format | compressed-tensors float-quantized (scheme FP8_DYNAMIC) |
| Weights / activations | W8A8 โ FP8 E4M3 weights (per-output-channel scale), dynamic per-token FP8 activations |
| Architecture | Hybrid (linear-attention + full-attention) ยท Dense ยท multimodal (vision) ยท MTP head |
| Size on disk | ~3.2 GB |
| Calibration | None (data-free static weight scales) |
| License | Apache-2.0 |
Quantization details
- Scheme โ W8A8 โ FP8 E4M3 weights (per-output-channel scale), dynamic per-token FP8 activations, stored as compressed-tensors
float-quantized(schemeFP8_DYNAMIC). - Kept in BF16 โ the vision tower & projector (
model.visual.*), the multi-token-prediction head (mtp.*), all RMSNorms, token embeddings, the LM head, the SSM non-linear parts (linear_attn.conv1d/A_log/dt_bias). Left unquantized to preserve quality (about 40% of all parameters in this build). - Tokenizer /
chat_template/generation_configare identical to the original.config.jsonis the original plus aquantization_configblock.
This is post-training quantization (PTQ) โ no retraining. FP8 dynamic is calibration-free.
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) | 53.33 | 48.18 (90.3%) | 53.54 (100.4%) | 54.27 (101.8%) | 55.22 (103.5%) | 60.38 (113.2%) |
| GSM8K (5-shot, strict) | 58.23 | 56.63 (97.3%) | 56.56 (97.1%) | 54.51 (93.6%) | 51.71 (88.8%) | 54.06 (92.8%) |
| ARC-Challenge (0-shot) | 41.47 | 41.98 (101.2%) | 41.30 (99.6%) | 41.04 (99.0%) | 39.51 (95.3%) | 39.59 (95.5%) |
| Winogrande (5-shot) | 64.56 | 63.22 (97.9%) | 64.48 (99.9%) | 64.48 (99.9%) | 61.09 (94.6%) | 62.51 (96.8%) |
| KMMLU (5-shot, direct) | 43.29 | 42.58 (98.4%) | 43.20 (99.8%) | 42.01 (97.1%) | 41.14 (95.0%) | 42.10 (97.3%) |
| HAE-RAE (0-shot) | 45.65 | 45.00 (98.6%) | 45.10 (98.8%) | 44.91 (98.4%) | 42.07 (92.2%) | 41.06 (90.0%) |
| Average | 51.09 | 49.60 (97.1%) | 50.70 (99.2%) | 50.21 (98.3%) | 48.46 (94.8%) | 49.95 (97.8%) |
Evaluation (measured)
Fidelity to the BF16 original on an internal mixed English/Korean set (100 prompts, BF16 greedy answers scored under each build โ same harness for every row).
| Metric | This model | BF16 original |
|---|---|---|
| Perplexity (lower = closer) | 1.8710 | 1.8515 (+1.1%) |
| Top-1 next-token agreement | 94.4% | 98.9% |
These measure fidelity to the base model, not absolute task scores.
Requirements
| Runtime | vLLM โ the architecture is in vLLM โฅ 0.17.0; 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 | NVIDIA Turing (sm75, e.g. T4) or newer. FP8 math runs on Ada / Hopper / Blackwell (sm89+); on Turing and Ampere vLLM switches to weight-only FP8 automatically. V100 (sm70) is not supported. (Kernel choice per GPU from vLLM 0.32's selection code; only B200 was run here.) |
| Memory | Weights: 3.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>=5.2.0 + compressed-tensors>=0.15.0 (checked on CPU with Qwen3.5-0.8B FP8 / AWQ-4bit / NVFP4A16 / NVFP4). |
| trust_remote_code | not needed |
Usage (vLLM)
Start an OpenAI-compatible server:
vllm serve axteam/Qwen3.5-2B-FP8-dynamic --max-model-len 32768
Query it:
curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "axteam/Qwen3.5-2B-FP8-dynamic",
"messages": [{"role": "user", "content": "๋ํ๋ฏผ๊ตญ์ ์๋๋ ์ด๋์ธ๊ฐ์?"}],
"max_tokens": 512
}'
Offline inference in Python:
from vllm import LLM, SamplingParams
llm = LLM(model="axteam/Qwen3.5-2B-FP8-dynamic", max_model_len=32768)
params = SamplingParams(max_tokens=1024)
out = llm.chat([{"role": "user", "content": "Explain model quantization in two sentences."}], params)
print(out[0].outputs[0].text)
# image input (URL or data: URI)
messages = [{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": "https://example.com/your-image.png"}},
{"type": "text", "text": "Describe this image."},
]}]
out = llm.chat(messages, params)
print(out[0].outputs[0].text)
Thinking mode is off by default in this model's chat template; to turn it on pass
chat_template_kwargs={"enable_thinking": True}(Pythonllm.chat(..., chat_template_kwargs=...), or"chat_template_kwargs": {"enable_thinking": true}in the request body). Text-only serving: add--limit-mm-per-prompt '{"image": 0, "video": 0}'to skip loading the vision encoder's memory budget.
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/Qwen3.5-2B-FP8-dynamic --kv-cache-dtype fp8
License
Quantized derivative of Qwen/Qwen3.5-2B (Apache-2.0). All original weights, tokenizer and chat template belong to the Qwen team.
ํ๊ตญ์ด ์์ฝ
Qwen/Qwen3.5-2B ๋ฅผ FP8 (dynamic) ๋ก ์์ํํ ์๋น์ฉ(8-bit) ๋ชจ๋ธ์
๋๋ค. ์์ฑ: axteam.
- ๋ฐฉ์ โ FP8 E4M3. ๊ฐ์ค์น๋ ์ถ๋ ฅ ์ฑ๋๋ง๋ค ์ค์ผ์ผ ํ๋(์ ์ ยท๋ณด์ ๋ถํ์), ํ์ฑํ๋ ์ถ๋ก ์ ํ ํฐ๋ง๋ค ๋์ FP8. ํ์ compressed-tensors
float-quantized(schemeFP8_DYNAMIC). - BF16 ์ ์ง โ ๋น์ ํ์ยทMTP ํค๋ยท๋ชจ๋ normยท์๋ฒ ๋ฉ/LM ํค๋ยทSSM ๋น์ ํ๋ถ(conv1d/A_log/dt_bias).
- PTQ โ ์ฌํ์ต ์์.
- ํ์ง(์ค์ธก) โ BF16 ์๋ณธ ๋๋น perplexity 1.8710(์๋ณธ 1.8515, +1.1%), top-1 ์ผ์น๋ 94.4%(์๋ณธ 98.9%). ๋ด๋ถ ์/ํ 100๋ฌธํญ, ๊ฐ์ ํ๋ค์ค.
- ๋ฒค์น๋งํฌ(์ค์ธก) โ MMLU ยท GSM8K ยท ARC-Challenge ยท Winogrande ยท KMMLU ยท HAE-RAE ํ๊ท BF16 51.09 โ ์ด ๋ชจ๋ธ 49.60 (ํ๋ณต๋ฅ 97.1%). lm-evaluation-harness ยท vLLM, ๋ชจ๋ ํ์ ๊ฐ์ ์ค์ .
- ๋ผ์ด์ ์ค โ ์๋ณธ Apache-2.0 ํ์๋ฌผ. ๊ฐ์ค์นยทํ ํฌ๋์ด์ ยทchat_template ๊ถ๋ฆฌ๋ Qwen ํ.
- ์๊ตฌ์ฌํญ โ vLLM โฅ0.17.0 (0.32.0 ์์ ์ค์ธก); GPU Turing(sm75) ์ด์. FP8 ์ฐ์ฐ์ AdaยทHopperยทBlackwell(sm89+), ๊ทธ ์๋๋ vLLM ์ด ๊ฐ์ค์น ์ ์ฉ FP8 ๋ก ์๋ ์ ํ; ๊ฐ์ค์น 3.2 GB + KV ์บ์; Transformers ์ง์ ์ฌ์ฉ: transformers โฅ5.2.0 + compressed-tensors โฅ0.15.0.
- ์คํ โ
vllm serve axteam/Qwen3.5-2B-FP8-dynamic --max-model-len 32768๋ก OpenAI ํธํ ์๋ฒ(ํฌํธ 8000), ๋๋ PythonLLM(model="axteam/Qwen3.5-2B-FP8-dynamic").chat(...)(์ ์์). thinking ์ ๊ธฐ๋ณธ์ผ๋ก ๊บผ์ ธ ์์ โ ์ผ๋ ค๋ฉดchat_template_kwargs={"enable_thinking": True}. ์ด๋ฏธ์ง ์ ๋ ฅ์image_url๋ฉ์์ง๋ก. - KV ์บ์ ์ ๊ฐ(๋ฐํ์) โ
--kv-cache-dtype fp8.
- Downloads last month
- 22