Instructions to use daslab-testing/Apertus-0.5B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use daslab-testing/Apertus-0.5B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="daslab-testing/Apertus-0.5B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("daslab-testing/Apertus-0.5B-Instruct") model = AutoModelForCausalLM.from_pretrained("daslab-testing/Apertus-0.5B-Instruct") 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
- vLLM
How to use daslab-testing/Apertus-0.5B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "daslab-testing/Apertus-0.5B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "daslab-testing/Apertus-0.5B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/daslab-testing/Apertus-0.5B-Instruct
- SGLang
How to use daslab-testing/Apertus-0.5B-Instruct 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 "daslab-testing/Apertus-0.5B-Instruct" \ --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": "daslab-testing/Apertus-0.5B-Instruct", "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 "daslab-testing/Apertus-0.5B-Instruct" \ --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": "daslab-testing/Apertus-0.5B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use daslab-testing/Apertus-0.5B-Instruct with Docker Model Runner:
docker model run hf.co/daslab-testing/Apertus-0.5B-Instruct
Apertus-0.5B-Instruct
Table of Contents
Model Summary
Apertus-0.5B-Instruct is a highly efficient, sub-billion parameter language model designed to extend the fully-open and compliant Apertus ecosystem to highly constrained hardware environments.
The model relies on a dense transformer architecture featuring grouped-query attention and xIELU activations. To achieve high performance with a minimized memory footprint, it uses tied embeddings and a deeper, thinner architectural design.
Instead of standard pre-training, Apertus-0.5B-Instruct was created using pre-training distillation (PD) from the Apertus-8B-Instruct-2509 teacher model. It was trained on 1.7T tokens from Phase 5 of the original Apertus data pipeline—the highest quality tier of filtered documents, code, and instruction samples. Post-training included supervised fine-tuning (SFT) and alignment similar to that of the original Apertus.
Key features
- Fully open model: open weights + open data + full training details including all data and training recipes
- Massively Multilingual: 1811 natively supported languages
- Compliant Apertus is trained while respecting opt-out consent of data owners (even retrospectivey), and avoiding memorization of training data
- Cost-Effective Distillation: Trained using a 90%/10% mix of KL-Divergence and label cross-entropy derived from the 8B teacher model, drastically reducing the required compute.
- Hardware Optimized: Specifically optimized for memory-limited scenarios like mobile and edge deployments, with quantized checkpoints available for Apple devices (MLX) in INT2, INT3, INT4, and INT6 formats.
For more details refer to the original Apertus technical report and the new Apertus distillation technical report.
How to use
The modeling code for Apertus is available in transformers v4.56.0 and later, so make sure to upgrade your transformers version. You can also load the model with the latest vLLM which uses transformers as a backend.
pip install -U transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "swiss-ai/Apertus-0.5B-Instruct"
device = "cuda" # for GPU usage or "cpu" for CPU usage
# load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
).to(device)
# prepare the model input
prompt = "Give me a brief explanation of gravity in simple terms."
messages_think = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages_think,
tokenize=False,
add_generation_prompt=True,
)
model_inputs = tokenizer([text], return_tensors="pt", add_special_tokens=False).to(model.device)
# Generate the output
generated_ids = model.generate(**model_inputs, max_new_tokens=32768)
# Get and decode the output
output_ids = generated_ids[0][len(model_inputs.input_ids[0]) :]
print(tokenizer.decode(output_ids, skip_special_tokens=True))
We recommend setting
temperature=0.8andtop_p=0.9in the sampling parameters.
Evaluation
Post-Training Multilingual Evaluation: Performance of the Apertus-0.5B-Instruct model across multilingual benchmarks compared to models in similar size classes.
| Model | Average | MMLU | TruthfulQA | Arc | IF | LogiQA |
|---|---|---|---|---|---|---|
| Apertus-0.5B-Instruct | 0.318 | 0.258 | 0.461 | 0.225 | 0.328 | 0.279 |
| gemma-3-270m-it | 0.289 | 0.242 | 0.465 | 0.215 | 0.236 | 0.205 |
| Qwen3-0.6B | 0.401 | 0.377 | 0.464 | 0.222 | 0.541 | 0.353 |
| gemma-3-1b-it | 0.406 | 0.409 | 0.457 | 0.250 | 0.509 | 0.379 |
| EuroLLM-1.7B-Instruct | 0.291 | 0.260 | 0.433 | 0.250 | 0.222 | 0.269 |
While Apertus-0.5B-Instruct demonstrates competitive baseline multilingual chatting performance, it may lack in specific capabilities such as advanced math and complex instruction following due to its highly constrained parameter count.
Training
Model Architecture
- Architecture Type: Dense transformer decoder with grouped-query attention.
- Layers: 20.
- Model Dimension: 1024.
- MLP Dimension: 6144.
- Heads (Q/KV): 16/4.
- Tied Embeddings: Yes.
- Activation Function: xIELU.
- Compute / Storage Size: 0.4B parameters.
Pre-Training Details
- Training Tokens: 1.7T.
- Optimizer: AdEMAMix with WSD schedule and weight decay.
- Sequence Handling: Documents packed into chunks of 4096 tokens with cross-document attention masked.
- Total Compute: 0.2E22 FLOPs.
Software & hardware
- GPUs: 64 GH200
- Training Framework: Megatron-LM
Open resources
All elements used in the training process are made openly available
- Training data reconstruction scripts: github.com/swiss-ai/pretrain-data
- The training intermediate checkpoints are available on the different branches of this same repository
Limitations
Apertus can produce text on a variety of topics, but the generated content may not always be factually accurate, logically consistent, or free from biases present in the training data. These models should be used as assistive tools rather than definitive sources of information. Users should always verify important information and critically evaluate any generated content.
Legal Aspects
EU AI Act Transparency Documentation and Code of Practice
Data Protection and Copyright Requests
For removal requests of personally identifiable information (PII) or of copyrighted content, please contact the respective dataset owners or us directly
Output Filter for PII
- Currently no output filter is provided.
- Please check this site regularly for an output filter that can be used on top of the Apertus LLM. The filter reflects data protection deletion requests which have been addressed to us as the developer of the Apertus LLM. It allows you to remove Personal Data contained in the model output. We strongly advise downloading and applying this output filter from this site every six months.
Contact
To contact us, please send an email to llm-requests@swiss-ai.org
Citation
@misc{TODO}
- Downloads last month
- 169
Model tree for daslab-testing/Apertus-0.5B-Instruct
Base model
swiss-ai/Apertus-8B-2509