Instructions to use RenaissanceLabsEU/swedish-decision-gemma4-e4b-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use RenaissanceLabsEU/swedish-decision-gemma4-e4b-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download RenaissanceLabsEU/swedish-decision-gemma4-e4b-mlx --local-dir swedish-decision-gemma4-e4b-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Swedish & Multilingual Decision Gemma 4 E4B MLX (RenaissanceLabsEU/swedish-decision-gemma4-e4b-mlx)
A 4-bit Apple Silicon MLX LoRA-finetuned Gemma 4 E4B decision specialist trained on Swedish public-administration tasks + multilingual EU/Global decision cases from RenaissanceLabsEU/swedish-public-decisions-v1 and RenaissanceLabsEU/global-decisions-v1.
Standalone, swedish-decision-gemma4-e4b-mlx is our strongest single decision model (63.7% accuracy, 0.931 NLL, 0.065 ECE-10 on swedish-decision-dataset-v1, and 61.4% on the unseen Elsäkerhetsverket holdout — +22.7pp over Qwen3-1.7B LoRA). Combined with our 3-Specialist Hierarchical Decision Router (router/ included in this repo), accuracy reaches 69.5% (0.861 NLL, 0.057 ECE-10, 95.5% selective accuracy at conf ≥ 0.90).
Frozen Holdout Results
All models were evaluated strictly once on the untouched FROZEN.json-verified holdouts using official evaluate.py --split test, with scalar temperatures $T$ fitted strictly on calibration/.
1. Primary Benchmark: swedish-decision-dataset-v1 (n = 532, 22 agency clusters)
| System | Accuracy | Macro-F1 | NLL ↓ | Brier ↓ | ECE-10 ↓ | Selective Acc (conf ≥ 0.70) |
Selective Acc (conf ≥ 0.90) |
|---|---|---|---|---|---|---|---|
Qwen3-1.7B Zero-Shot (cal.) |
34.0% | 0.154 | 1.356 | 0.712 | 0.184 | 76.4% (20.7% cov.) | — |
swedish-decision-qwen3-1.7b-mlx |
53.8% | 0.206 | 1.116 | 0.587 | 0.080 | 78.8% (19.5% cov.) | — |
swedish-decision-saga-v1 (SagaEmbed) |
56.0% | 0.330 | 1.168 | 0.596 | 0.168 | 67.8% (58.5% cov.) | 77.7% (22.7% cov.) |
swedish-decision-gemma4-e4b-mlx (this model, $T=1.829$) |
63.7% (+10.0pp vs Qwen3, CI [+4.5%, +20.2%]) |
0.348 | 0.931 | 0.488 | 0.065 | 78.8% (51.3% cov.) | 89.7% (12.8% cov.) |
3-Specialist Decision Router (Saga + Qwen3 + Gemma4) |
69.5% (+5.8pp vs Gemma4, CI [+2.7%, +14.9%]) |
0.383 | 0.861 | 0.442 | 0.057 | 84.1% (49.6% cov.) | 95.5% (12.6% cov.) |
Per-Decision-Type Breakdown (swedish-decision-dataset-v1, n = 532)
| Decision Type | Qwen3-1.7B LoRA |
SagaEmbed (saga-v1) |
Gemma 4 E4B LoRA |
3-Specialist Router |
|---|---|---|---|---|
relevance |
33.9% | 81.2% | 65.2% | 89.3% |
evidence_sufficiency |
78.1% | 70.5% | 78.1% | 78.1% |
uncertainty |
78.1% | 49.5% | 74.3% | 78.1% |
next_step |
40.0% | 40.0% | 51.4% | 51.4% |
rule_application |
40.0% | 37.1% | 49.5% | 49.5% |
| Overall | 53.8% | 56.0% | 63.7% | 69.5% |
2. Unseen-Agency Holdout: swedish-workflow-training-v1 (Elsäkerhetsverket, n = 88)
| Model | Overall Acc | relevance |
uncertainty |
rule_application |
next_step |
evidence_sufficiency |
|---|---|---|---|---|---|---|
Qwen3-1.7B Zero-Shot (cal.) |
33.0% | — | — | — | — | — |
swedish-decision-qwen3-1.7b-mlx |
38.6% | 56.3% | 55.6% | 11.1% | 16.7% | 55.6% |
swedish-decision-gemma4-e4b-mlx (this model) |
61.4% (+22.7pp) |
87.5% | 66.7% | 61.1% | 55.6% | 38.9% |
Decision Models All the Way Down (router/)
This repository ships the full Hierarchical Decision Router in router/:
- Level 0 (
level0_router.pkl): Calibrated task-type decision model trained strictly oncombined-with-v1.jsonl(trainsplit) predictingP(task_type | state, instructions, criteria). - Level 1 (
routing_policy.json): Maps the Level-0 posterior into calibrated mixture weights acrossSagaEmbed,Qwen3-1.7B, andGemma 4 E4B. - Level 2 (
router.py): Lazy-invokes only active specialists and blends their calibrated posteriors. - Level 3 (
server.py,POST /v1/decide): Applies a calibrated confidence gate (commitvsabstain_escalatefor human review) and returns the fullrouting_trace.
Training Configuration
- Base model:
mlx-community/gemma-4-e4b-it-4bit(Gemma license, 7.46B total / 4B effective parameters) - Adapter: LoRA (
rank=8,num_layers=16, 6.914M trainable params = 0.093%), fused viamlx_lm fuse - Optimizer: Adam,
lr=1e-5(conservative LR is essential for Gemma 4's 256K vocab on single-token supervision;5e-5oscillated aroundval 1.92–2.54),batch_size=1,grad_accumulation_steps=8,max_seq_length=2048,--mask-prompt,--grad-checkpoint - Convergence: Validation cross-entropy dropped monotonically from
14.969→0.211at total iteration 250 (216stratified validation tasks) in ~10 minutes on an Apple M5 (32 GB). - Training mix (3,725 train / 216 valid):
- 2,625 Swedish typed decisions from
combined-with-v1.jsonl(with 2× upweighting onrule_applicationandnext_step) - 700 train-only Swedish agency cases from
RenaissanceLabsEU/swedish-public-decisions-v1 - 400 train-only multilingual EU/Global multiple-choice cases from
RenaissanceLabsEU/global-decisions-v1
- 2,625 Swedish typed decisions from
Known Limitations
- Single-token non-thinking inference: While
Gemma 4 E4Bjumped+9.5pponrule_application(49.5%) and+50.0ppon unseen-agencyrule_application(61.1%), explicit<think>chain-of-thought trained on oracle-verified traces remains the clearest path past 80%+ on symbolic date/numeric rules. - Provisional benchmark labels: Holdout labels in
swedish-decision-dataset-v1andswedish-workflow-training-v1are source-grounded programmatic labels pending independent legal review. - Not legal advice: Intended strictly for research, calibration evaluation, and decision-support prototyping — never automated binding administrative rulings.
- Downloads last month
- -
4-bit
Model tree for RenaissanceLabsEU/swedish-decision-gemma4-e4b-mlx
Base model
google/gemma-4-E4B