Instructions to use merabro/Apertus-ParlTopics-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use merabro/Apertus-ParlTopics-8B with PEFT:
from peft import PeftModel from transformers import AutoModel base_model = AutoModel.from_pretrained("models/apertus-1.5-8b-text") model = PeftModel.from_pretrained(base_model, "merabro/Apertus-ParlTopics-8B") - Notebooks
- Google Colab
- Kaggle
Apertus-ParlTopics-8B: Apertus 1.5 8B as a decision model for parliamentary topics
Apertus-ParlTopics-8B is a LoRA adapter and a yes/no head for the text part of Apertus 1.5 8B. Given the text of a Swiss parliamentary affair and one or more topic cards (a name, a definition and a list of what belongs to the topic), it returns one probability per card in a single pass. It is the decision model behind the stored corpus results of Parlamentsthemen.
Hugging Face: https://huggingface.co/merabro/Apertus-ParlTopics-8B
The Hugging Face repository holds the adapter, the head, the adapter and training configurations and the training metrics. It does not include the Apertus tokenizer or weights: accept the terms of swiss-ai/Apertus-v1.5-8B, convert its text part with python -m parltopics.convert_text, and copy its tokenizer files into the folder before serving.
Files and checksums
| File | Size | SHA-256 |
|---|---|---|
adapter_model.safetensors |
159 MB | 61df7d434bc3662f6dadea5eb63ea213a617b343e1d06fcaad04b39894d975a0 |
head.pt |
8.4 MB | cb93496bcf2ada57f00e133944b4b4eac5e8daa3b6d9908d616d3ac8eda0747f |
The checksums were computed on 19 October 2026 on the local copy and on the copy that the running server loads (the GPU server's run folder on the GPU server); both match. The adapter configuration, the training configuration and the training metrics are in this folder (adapter_config.json, training_config.json, training_metrics.json).
Model
| Item | Value |
|---|---|
| Base model | swiss-ai/Apertus-v1.5-8B, text part only |
| Conversion | python -m parltopics.convert_text keeps the language-model weights of the multimodal checkpoint and writes them as an ApertusForCausalLM checkpoint; the base weights are not changed |
| Training and serving code | Kev (https://github.com/jaredpalmer/kev, Apache-2.0) at upstream commit 1f04cfa, with third_party/kev/apertus.patch (one file, kev/model.py: Apertus special tokens and the beginning-of-sequence token, and LoRA targets limited to the projections that exist in Apertus) |
| Adapter | LoRA rank 16, alpha 32, dropout 0.05, on q_proj, k_proj, v_proj, o_proj, up_proj, down_proj (PEFT 0.21.0) |
| Head | Kev's pointer head (projection dimension 256) on the model's hidden states, trained from scratch; output: probability that the affair is about the card |
| Precision | bf16 weights and training |
Kev is an independent open implementation of the decision-model idea behind TypeSafe's System One models.
Training data
| Item | Value |
|---|---|
| Records in the training file | 6,753 (one affair text with several yes/no questions per record), covering 6,553 distinct federal affairs |
| Records used | 6,728 with 31,837 questions; 25 records were dropped because they exceeded the training context (1,024 state tokens, 1,664 per question branch, 2,688 packed) |
| Affairs | Federal affairs (Curia Vista) dated before 2024; no affair from 2024 on, and none from the development or test samples |
| Questions | 23 of the 28 Curia Vista subject areas, and the 400 most frequent Curia Vista descriptors (thesaurus keywords, assigned 1996 to mid-2014) |
| Never training questions | The subject areas Energie, Landwirtschaft, Kultur, Steuer and Migration; digitalisation; every cantonal and city scheme; APS. Related subjects appear among the descriptors |
| Labels | The Parliamentary Services' assignments in Curia Vista, via the OpenParlData label folder; not an independent gold standard |
| Built with | parltopics.build_train and parltopics.build_extra |
Training configuration
From training_config.json and training_metrics.json:
| Setting | Value |
|---|---|
| Epochs | 1 (841 optimizer steps) |
| Learning rate | 5e-5 for adapter and head (head_lr 0 means the same rate), one-cycle schedule with 10% warm-up |
| Batch | 1 record, gradient accumulation 8 |
| Weight decay | 0.01 |
| Label smoothing | 0.1 |
| Distractor options | p_none 0.1, p_none_distract 0.12, p_distract 0.15, perm_frac 0.3 |
| Maximum state | 1,024 tokens |
| Hardware and time | one RTX A6000 (48 GB), 6,491 s (1.8 h), peak GPU memory 42.8 GB, 7.06 million forward tokens |
| Training seed | 0 (Kev's --seed) |
| Sampling seed | 20261018, for the selection of training affairs, the development and test samples and all evaluation samples |
Intended use
- Assigning topics defined as cards to Swiss parliamentary affairs from federal, cantonal and municipal parliaments, in German, French and Italian: standard schemes (Curia Vista areas, APS chapters and topics, cantonal schemes) and ad-hoc topics written by an operator.
- Ranking and shortlisting for people who read the results, for example a weekly monitoring list. Decisions are suggestions; each stored result carries the card hash, the model revision and, when calibrated, a probability.
- Not intended for decisions about persons, for inferring the political position of an affair or its authors, or for use without human review where a wrong topic has consequences.
Evaluation
All figures are from docs/README_overview.md. Test affairs are from 2024 to 2026, with thresholds fitted on earlier affairs; the same period was also used to choose between training runs.
| Evaluation | Apertus-ParlTopics-8B | For comparison |
|---|---|---|
| Digitalisation, 3,000 affairs, all levels (weighted to the PolitMonitor evaluation universe) | AP 0.46, ROC-AUC 0.97; precision 0.36, recall 0.77, F1 0.49 at the default threshold | untrained Apertus 8B AP 0.43; untrained Apertus 70B 0.41; embedding classifier trained on the labels 0.47 |
| Digitalisation, monitoring threshold | recall 0.97 at precision 0.18; 29 of the 30 DVS-listed affairs | |
| Calibration, digitalisation | calibration error 0.022 | |
| Curia Vista areas, 1,000 federal affairs | macro AP 0.71, micro F1 0.70 | untrained Apertus 8B 0.51; classifiers trained on the labels 0.73 to 0.74 |
| The five withheld areas | macro AP 0.83 | untrained Apertus 8B 0.63 |
| St. Gallen scheme, 868 cantonal affairs (never a training question) | macro AP 0.70 | untrained Apertus 8B 0.57 |
| APS chapters, 1,000 federal affairs, against the Curia Vista mapping | macro AP 0.74, micro F1 0.63 | |
| APS topics, 500 federal affairs, against the frontier-model judge | precision 0.54, recall 0.71, F1 0.61 | |
| 30 descriptors outside training, holdout up to 2014 | macro AP 0.70, macro F1 0.65, micro F1 0.60 | |
| Same 871 federal affairs in German, French, Italian | Curia Vista macro AP 0.71, 0.70, 0.70 | |
| Party groups, 1,000 federal affairs | Curia Vista micro F1 between 0.66 and 0.74; no aggregate over- or under-assignment established | |
| Throughput, one RTX A6000 | 4.9 affairs/s for one card; 0.83 affairs/s for 28 cards |
The frontier-model judge is Claude Opus 5.5 (Claude Sonnet 5.5 for the digitalisation samples), used only as a second reader in the evaluation.
Limitations
- The test period 2024 to 2026 was also used to choose between runs; a later untouched period should confirm the figures.
- Title-only affairs (about 57,600 in the corpus) are often missed at a single threshold; the gap between French- and German-speaking parliaments at the default threshold comes mostly from missing text.
- Individual decisions differ between languages for the same federal affair: of the decisions where at least one language says yes, only 66% say yes in all three.
- On narrow topics, hosted frontier models find more (higher recall), for example on data-protection affairs within digitalisation.
- APS quality rests on the Curia Vista mapping and the judge, because no APS-labelled affairs exist; topic thresholds use a shared default.
- New cards have no calibrated probability and no validated threshold until labelled affairs are available.
- Scores vary slightly with the request. Scoring the same cards again in the same grouping changed scores by at most 0.13 on the logit scale on two affairs, without changing a decision. Scoring a card alone instead of together with the other corpus cards in one request can move a score enough to cross a threshold: for one title-only affair (334249), the stored digitalisation score is 1.76 and the score of the card alone 1.86, on either side of the threshold 1.81.
- No Romansh test set exists. Party bias was checked on federal affairs only.
Licence
- The adapter and the head (this model): Apache-2.0, copyright 2026 Invincibles.
- The base model Apertus 1.5 8B: Apache-2.0, with the Apertus Acceptable Use Policy (https://github.com/swiss-ai/apertus-legal/blob/main/apertus_1.5/USAGE_POLICY.pdf), which users accept when they download the gated base model and which applies to its use with this adapter.
- Kev and the patch to it: Apache-2.0.
- Training labels: Curia Vista data of the Parliamentary Services of the Federal Assembly, via OpenParlData.ch (CC BY 4.0, "Source: OpenParlData.ch").
How to serve it
Kev's server loads the base model, the adapter and the head and answers POST /v1/systemone. On our GPU server:
scripts/gpu/serve_model.sh 1 8350
which runs, inside a Kev checkout at 1f04cfa with apertus.patch applied,
CUDA_VISIBLE_DEVICES=1 HF_HUB_OFFLINE=1 KEV_TRUNCATE_STATES=1 python -m kev.serve --run <folder with this adapter> --port 8350
and waits until GET /v1/models answers. The folder holds adapter_config.json, adapter_model.safetensors, head.pt, the tokenizer files and training_config.json, whose base entry points to the converted text model. Requests are built with parltopics.systemone_multi.build_request(text, {card_id: card}, compact=True); the answer answers[card_id]["noul"] is the probability, and logit of it is the score that the calibration files in models/ map to a calibrated probability and a decision. Set PARLTOPICS_DECISION_URL to the server's address so that the API and the nightly job use it.
- Downloads last month
- 33
Model tree for merabro/Apertus-ParlTopics-8B
Base model
swiss-ai/Apertus-v1.5-8B