Instructions to use bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16") model = AutoModelForCausalLM.from_pretrained("bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16") 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16
- SGLang
How to use bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16 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 "bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16" \ --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": "bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16", "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 "bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16" \ --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": "bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16 with Docker Model Runner:
docker model run hf.co/bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16
Apertus-8B-Instruct-2509-NVFP4A16
NVFP4 quantization of swiss-ai/Apertus-8B-Instruct-2509 — part of the Swiss AI Apertus model family. 8B dense transformer supporting 1,811 languages with 65K context.
W4A16 — weights in FP4, activations in FP16 (weight-only quantization). See also Apertus-8B-Instruct-2509-NVFP4 for the full W4A4 variant.
Key Specs
| Original (BF16) | NVFP4 (this) | |
|---|---|---|
| Size on disk | ~16 GB | ~5 GB |
| Compression | — | ~3.0x |
| Parameters | 8B | 8B |
| Architecture | Dense transformer, xIELU activation | same |
| Context window | 65,536 tokens | 65,536 tokens |
| Languages | 1,811 | 1,811 |
Serving with vLLM
vllm serve bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16 \
--quantization modelopt \
--dtype auto \
--kv-cache-dtype fp8 \
--gpu-memory-utilization 0.85 \
--max-model-len 65536 \
--trust-remote-code
DGX Spark
VLLM_NVFP4_GEMM_BACKEND=marlin vllm serve bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16 \
--quantization modelopt \
--dtype auto \
--kv-cache-dtype fp8 \
--max-model-len 65536 \
--trust-remote-code
Testing
This is an instruct model with tool use support — use the chat completions endpoint.
Quantization Details
- Method: NVIDIA Model Optimizer (modelopt) v0.43
- Format: NVFP4 — E2M1 weights with per-group FP8 scales (group size 16)
- Calibration: 4096 samples from CNN/DailyMail, batch size 32, seq_len 1024
- Hardware: NVIDIA H200 GPU
- Quantization script: included as
quantize.py
About Apertus
Apertus is built by Swiss AI — a fully open, privacy-first model family trained on 4,096 GH200 GPUs. Key features:
- 1,811 native languages
- Novel xIELU activation + AdEMAMix optimizer
- EU AI Act compliant, respects opt-out consent
- Full training transparency (weights, data, scripts all public)
License
Apache 2.0 — inherited from the base model.
Citation
If you use this model, please cite the original Apertus work:
@misc{swisstransformer2025apertus,
title = {Apertus},
author = {Swiss Transformer},
year = {2025},
url = {https://huggingface.co/swiss-ai}
}
Credits
Quantized by Mario Iseli on an NVIDIA H200. Built and validated with AI-engineering assistance from Anthropic.
📬 mario@marioiseli.com ☕ Buy me a coffee if this makes your inference go brrrrrr! 🚀
- Downloads last month
- 12
Model tree for bg-digitalservices/Apertus-8B-Instruct-2509-NVFP4A16
Base model
swiss-ai/Apertus-8B-2509