Instructions to use bg-digitalservices/Apertus-8B-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-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-2509-NVFP4A16")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("bg-digitalservices/Apertus-8B-2509-NVFP4A16") model = AutoModelForCausalLM.from_pretrained("bg-digitalservices/Apertus-8B-2509-NVFP4A16", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bg-digitalservices/Apertus-8B-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-2509-NVFP4A16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bg-digitalservices/Apertus-8B-2509-NVFP4A16", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/bg-digitalservices/Apertus-8B-2509-NVFP4A16
- SGLang
How to use bg-digitalservices/Apertus-8B-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-2509-NVFP4A16" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bg-digitalservices/Apertus-8B-2509-NVFP4A16", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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-2509-NVFP4A16" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bg-digitalservices/Apertus-8B-2509-NVFP4A16", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use bg-digitalservices/Apertus-8B-2509-NVFP4A16 with Docker Model Runner:
docker model run hf.co/bg-digitalservices/Apertus-8B-2509-NVFP4A16
Apertus-8B-2509-NVFP4A16
NVFP4 quantization of swiss-ai/Apertus-8B-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-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-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-2509-NVFP4A16 \
--quantization modelopt \
--dtype auto \
--kv-cache-dtype fp8 \
--max-model-len 65536 \
--trust-remote-code
Testing
This is a base model.
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
- 21
Model tree for bg-digitalservices/Apertus-8B-2509-NVFP4A16
Base model
swiss-ai/Apertus-8B-2509