Proofbird Grammar — Italian
gector-bert-it · on-device Italian grammar correction
A GECToR-style sequence tagger for Italian grammatical error correction, exported to ONNX (fp32) to run on the CPU. It is the on-device grammar model of Proofbird, a writing assistant for Windows, and it is published here so anyone can inspect what runs on their machine.
GECToR does not rewrite text. For each token it predicts one edit tag (keep, delete, replace with a word, append a word, change case, change a verb form), and the edits are applied and the sentence re-tagged up to five times. The tagger only proposes local edits; it never paraphrases.
Quick start
No API key, no GPU. One file, quickstart.py, downloads the model and runs it with ONNX Runtime.
pip install onnxruntime tokenizers huggingface_hub
import importlib.util
from huggingface_hub import hf_hub_download
spec = importlib.util.spec_from_file_location("quickstart", hf_hub_download("proofbird/gector-bert-it", "quickstart.py"))
quickstart = importlib.util.module_from_spec(spec)
spec.loader.exec_module(quickstart)
model = quickstart.Gector("proofbird/gector-bert-it")
corrected, suggestions = model.correct("La ragazza sono molto stanco.")
print(corrected)
print(suggestions)
La ragazza è molto stanca.
[{"start": 11, "length": 4, "original": "sono", "replacement": "è"}, {"start": 22, "length": 6, "original": "stanco", "replacement": "stanca"}]
Each suggestion gives the character position in your text (start, length), what is there now (original) and what to put instead (replacement), so you can underline it and offer the fix. From the command line: python quickstart.py --model proofbird/gector-bert-it "La ragazza sono molto stanco." prints every step below.
What it corrects
Gender and number agreement (articles, adjectives, participles, including across a clause), subject-verb agreement,
articulated prepositions (di il → del), elision (lo amico → l'amico), accents (perche → perché, e → è
where the sentence requires it), plurals of -co/-go/-ca/-ga words, doubled words, capitalisation at the start of a
sentence, and everyday-register errors in questions, imperatives and the first and second person.
How it was trained
- Base encoder:
dbmdz/bert-base-italian-xxl-cased(MIT). A tagging head (5 000 edit labels) and an error-detection head sit on top. - Data: synthetic only. 3 000 000 sentences from Italian Wikipedia
(
wikimedia/wikipedia,20231101.it) and 250 000 sentences from Tatoeba were corrupted by hand-written Italian error rules; about 10% stay clean, so the model learns to leave correct text alone. 210 000 additional template sentences teach patterns Wikipedia rarely contains (first and second person, imperatives, long-distance agreement). - No learner corpora and no non-commercial data of any kind. No user text was used.
- One epoch (114 348 steps, batch 64, learning rate 3e-5) on one NVIDIA L4. Run id
2026-10-24-0450.
How it was measured
| Check | Result |
|---|---|
| Gold set (672 hand-written sentences: 512 with one error each, 160 correct) | 512 fixed, 160 left alone, 0 missed, 0 made worse |
| False alarms on 4 000 everyday Tatoeba sentences (held out from training) | 4 changed (0.10%) |
| False alarms on 2 000 Wikipedia sentences left untouched by human editors | 11 changed (0.55%) |
| Stability: the gold re-run with one extra token in front of each sentence | 3 sentences change result |
The gold score is with the apply-side guards in gector-guards.json (below). The model was trained for precision: a
missed error costs less than a wrong correction. Real learner essays are its weakest case: on the
MERLIN Italian essays it fixes about 5% of the annotated errors, and a blind review of
120 of its changes there judged 52% correct, 13% harmless and 34% wrong. Heavy spelling noise and accents that depend
on meaning (si/sì, e/è in garbled sentences) are outside what a local tagger can decide.
Files
| File | What it is |
|---|---|
model.onnx |
The tagger (fp32, opset 17). Inputs input_ids, attention_mask; outputs logits_labels [1, T, 5000] and logits_d [1, T, 2]. |
config.json |
The edit-label vocabulary (id2label). |
vocab.txt, tokenizer.json, tokenizer_config.json |
The base encoder's WordPiece tokenizer. |
gector-meta.json |
Export facts: encoder, tokenizer family, decoding defaults, run id. |
gector-guards.json |
Apply-side guards: rules that hold back an edit the model gets wrong in a known way (for example a verb-number change with no subject in view). Part of the measured result. |
language-rules.json |
Language facts the runtime needs (sentence-final punctuation handling, elision articles). |
verb-form-vocab.txt |
Verb-form table for the verb-transform tags. |
grammar-messages.json |
Short explanations shown with each correction. |
quickstart.py |
A complete Python runner: download, tokenize, run, decode, apply, suggestions. See Quick start. |
quickstart.ipynb |
The same, as a notebook (the Open in Colab button). |
The Proofbird app runs the same algorithm in C# with ONNX Runtime; the files are standard, so any GECToR-style decoder can use them.
How it works, step by step
The model never sees letters and never writes text. It reads numbers (token ids) and answers, for every word, which edit to make: one of 5 000 tags such as $KEEP, $DELETE, $APPEND_the, $REPLACE_were or $TRANSFORM_VERB_VB_VBZ (change a verb's form). quickstart.py does everything around it. This is the real run of the example above.
1. Prepare the text. language-rules.json says the final full stop comes off before the model sees the sentence (it goes back on at the end): La ragazza sono molto stanco.
2. The request. The words are looked up in the model's dictionary (vocab.txt). A rare word is split into pieces; the edit is read at its first piece. [CLS] stands for a dummy first word, $START, so an edit on it can add a word at the very beginning; [SEP] marks the end.
words $START La ragazza sono molto stanco
tokens [CLS] La ragazza sono molto stanco [SEP]
input_ids [102, 309, 2393, 288, 617, 14408, 103]
attention_mask [1, 1, 1, 1, 1, 1, 1]
Two inputs, both whole numbers (int64), shape [1, 7]: one sentence of 7 tokens.
3. The response. Two outputs (float32): logits_labels [1, 7, 5000], a score for each of the 5 000 edits at every token, and logits_d [1, 7, 2], a score for "this word is correct" and "this word is wrong". A softmax turns each row into probabilities; the most probable edit at each word's first token is the one applied.
4. Pass by pass. The corrected sentence goes back in, until a pass changes nothing (at most five passes). Connected errors are fixed one after the other.
Pass 1: La ragazza sono molto stanco
| Word | Wrong | Chosen edit | Probability |
|---|---|---|---|
| $START | 0.0% | $KEEP | 100.0% |
| La | 0.0% | $KEEP | 100.0% |
| ragazza | 0.0% | $KEEP | 100.0% |
| sono | 99.6% | $TRANSFORM_VERB_P3P_P3S | 99.9% |
| molto | 0.0% | $KEEP | 100.0% |
| stanco | 1.1% | $KEEP | 97.8% |
→ La ragazza è molto stanco
Pass 2: La ragazza è molto stanco
| Word | Wrong | Chosen edit | Probability |
|---|---|---|---|
| $START | 0.0% | $KEEP | 100.0% |
| La | 0.0% | $KEEP | 100.0% |
| ragazza | 0.0% | $KEEP | 100.0% |
| è | 0.0% | $KEEP | 100.0% |
| molto | 0.0% | $KEEP | 100.0% |
| stanco | 100.0% | $TRANSFORM_SUF_o_a | 100.0% |
→ La ragazza è molto stanca
Pass 3: La ragazza è molto stanca
| Word | Wrong | Chosen edit | Probability |
|---|---|---|---|
| $START | 0.0% | $KEEP | 100.0% |
| La | 0.0% | $KEEP | 100.0% |
| ragazza | 0.0% | $KEEP | 100.0% |
| è | 0.0% | $KEEP | 100.0% |
| molto | 0.0% | $KEEP | 100.0% |
| stanca | 0.0% | $KEEP | 100.0% |
→ La ragazza è molto stanca — no change, so it stops.
5. The suggestions. The original and the final words are compared, and each changed stretch becomes one suggestion with its position in the original text (unchanged text keeps its own spacing), as in the Quick start output above.
6. Settings. Gector(repo, keep_confidence=0.0, min_error_prob=0.0) takes the two GECToR precision knobs (the Proofbird app runs with both at 0, and at most five passes):
keep_confidenceadds a bonus to$KEEPbefore choosing: higher means fewer, safer edits.min_error_probignores an edit the model is less sure of, and leaves the whole sentence alone when no word is at least that likely to be wrong. Withmin_error_prob=0.9the example is still corrected (La ragazza è molto stanca.): the model is 99.6% sure one word is wrong.
What Proofbird adds
quickstart.py is the model on its own. The Proofbird app runs the same algorithm in C# and adds:
- Guards (
gector-guards.json, in this repository): per-language rules that hold back edits we measured as wrong in a known shape. The scores under How it was measured are with the guards. - Spelling, checked separately by the operating system's spell checker; the guards use it so a grammar edit is not made on a word that is misspelled.
- A card for each change that names the error ("Subject–verb agreement") and, on request, explains it.
Licence and attribution
The model weights and the files in this repository are released under the Apache License 2.0. If you redistribute the model or a model built from it, keep the NOTICE file with it (Apache-2.0, section 4(d)).
The training data carries its own terms. Wikipedia text is © Wikipedia contributors,
CC BY-SA 4.0. Tatoeba sentences are from
tatoeba.org, CC BY 2.0 FR. The base
encoder is dbmdz/bert-base-italian-xxl-cased by the MDZ Digital Library team (dbmdz) at the Bavarian State
Library, MIT licence. The tagging scheme follows GECToR (Omelianchuk et al., 2020, GECToR – Grammatical Error
Correction: Tag, Not Rewrite); the Italian verb-form table was built for this model.
How to cite
If you use or build on this model, please cite it:
@misc{hartnett2026gectorit,
author = {Hartnett, Patrick Andrew},
title = {Proofbird GECToR grammar model (Italian)},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/proofbird/gector-bert-it}},
note = {Proofbird, https://proofbird.app}
}
If you build on this model, a link back to this page is appreciated.
Contact
Published by Patrick Andrew Hartnett as personal work. Questions and reports: open a discussion on this repository.
- Downloads last month
- 31
Model tree for proofbird/gector-bert-it
Base model
dbmdz/bert-base-italian-xxl-cased