Swedish grammatical correctness scorer

This model scores Swedish text on a scale from 0 to 1, with higher scores indicating better grammatical correctness. It was developed for a Swedish grammaticality scoring assignment.

Training

I fine-tuned AI Sweden’s ModernBERT-base for one epoch on 35,523 prepared DaLAJ-GED training sentences using binary correctness labels. I then froze the encoder and fitted a support vector regressor (SVR) on sentence embeddings from 382 graded examples provided with the assignment. The other 96 examples were held out for validation. Related originals and corrupted variants stayed in the same split.

Base model · Original DaLAJ-GED release · Prepared dataset

Usage

The full scorer uses the encoder and tokenizer in this repository together with graded-svr.joblib. Use the project’s predict.py to run both stages. The input is JSONL with id and text fields. The output preserves each id and adds a score.

python predict.py --input test.jsonl --output scores.jsonl

Prediction code and reproduction instructions

Results

The public evaluation used 120 examples. Timing was measured on a MacBook Air M2 CPU and includes model loading.

Model Spearman ROC-AUC Time
Starter baseline 0.528 0.783 11.3 s
DaLAJ-trained ModernBERT-base + graded SVR 0.645 0.805 6.0 s

Limitations

The scorer uses the first 256 tokens of each input and can assign high scores to text with clear errors. For example, it scored “Tåget har gick.” at 0.705 against a public reference score of 0.35.

Downloads last month
30
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for vfagerstrom/swedish-correctness-modernbert-base

Finetuned
(12)
this model