itzune/gector-eus-v2
GECToR v2 — Multi-task Basque Grammatical Error Correction
A multi-task GECToR (Tag, Not Rewrite) model for Basque grammatical error correction, fine-tuned on **horkonpon-corpus** (208K EBE-grounded error pairs). This is the successor to `gector-eus` (v1), with three key improvements:
- Multi-task architecture — a third "type" head classifies each edited token into one of 8 error categories (spelling, morphology, punctuation, capitalization, zalantza, propernoun, wordlevel, calque), enabling explainable corrections for linting/UI use.
- EBE-grounded training data — horkonpon-corpus covers 8+ error categories (not just morphology like v1), including real-word errors (zalantza) and calques from Spanish/French.
- Commercial license — training data is CC-BY-SA / CC-BY / public-domain, so the weights carry no NonCommercial restriction (unlike v1).
Model details
Evaluation results
Evaluated on the horkonpon-corpus held-out eval split (1,037 errorful + 1,037 clean sentences), min_error_prob=0.5, 5 iterations.
Correction
¹ v1 on horkonpon eval (domain shift — v1 was trained on Elhuyar morphology only, so it misses spelling/calque/zalantza errors). v1 scores F0.5=90.2 on its own Elhuyar Dem eval set.
Trade-off: The multi-task type head adds a small cost to correction (-1.2 F0.5 vs the single-task v2's 78.8) but enables per-token error-type classification. GECToR wins decisively on clean FP rate (1.8% vs Gemma 4's 8.6%) and is lightweight enough for in-browser ONNX deployment (~80MB).
The base Gemma 4 ablation (F0.5=2.2, 97.2% clean FP) confirms that fine-tuning is essential — the base LLM has linguistic knowledge but no minimal-edit discipline. See `itzune/gemma-4-e4b-horkonpon` for the full ablation report.
Error-type classification (new capability)
High precision across all categories — when the model flags a type, it's almost always correct. Recall is lower for calque and proper_noun because the detection head often doesn't flag them as errors in the first place (the type head only fires on detected edits).
Usage
This is a GECToR-format model (custom architecture, not standard AutoModel). Use with the gotutiyan/gector package (MIT) or the multi-task fork in `gector-eus-v2/gector_multitask`.
import torch
from transformers import AutoTokenizer
from gector import GECToR
from gector.predict import predict, load_verb_dict
# Load model + tokenizer
model = GECToR.from_pretrained("itzune/gector-eus-v2")
model.eval()
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
tokenizer = AutoTokenizer.from_pretrained("itzune/gector-eus-v2", add_prefix_space=True)
tokenizer.add_special_tokens({"additional_special_tokens": ["$START"]})
# Verb-form dictionary (for morphological reinflection)
# Download from gector-eus-v2 repo: data/verb-form-vocab.txt
encode, decode = load_verb_dict("verb-form-vocab.txt")
# Correct a sentence (pre-tokenized: punctuation split from words)
sentences = ["Ni uste hiru hilabetez ohean egoteak eragin zidala ."]
pred_lines, pred_types = predict(
model, tokenizer, sentences, encode, decode,
min_error_prob=0.5, batch_size=128, n_iteration=5,
return_types=True, # enable error-type head
)
print(pred_lines[0])
# → "Nik uste hiru hilabetez ohean egoteak eragin zidala ."
print(pred_types[0])
# → ['none', 'morphology', 'none', ...] (per-source-word type labels)In-browser deployment (ONNX)
Export to int4 ONNX (~80MB) for Transformers.js / WASM deployment:
PYTHONPATH=src python scripts/export_onnx.py \
--model_dir itzune/gector-eus-v2 --out_dir onnxThe ONNX model exposes three outputs: logits (edit labels), logits_d (detection), and logits_t (error types) — enabling explainable in-browser GEC with error-type annotations.
Training details
Training data composition (horkonpon-corpus, error + clean natures): 161,670 pairs including 10,605 mined morphology records. Categories: morphology (synthetic + mined), spelling, capitalization, punctuation, zalantza (real-word errors), wordlevel (h-dropping, sibilant confusion), calque, propernoun.
Limitations
- Calque recall is low (28.7%) — literal translations from Spanish/French require semantic understanding that the encoder struggles with.
- Proper noun recall is low (38.7%) — the model can't know correct forms of place names, person names, etc. without world knowledge.
- Punctuation recall is moderate (70.7%) — missing commas require clause-boundary understanding.
- Domain-specific — trained on Basque web text (Berria, Wikipedia, EBE examples). Performance may vary on other text domains.
- Pre-tokenization required — input must be pre-tokenized (punctuation split from words) for the model to work correctly.
Ethics
This model corrects grammatical errors in Basque text. It should not be used to penalize or shame language learners, dialect speakers, or writers using regional Basque variants. The model follows Euskaltzaindiaren Euskara Baturaren Eskuliburua (EBE) as the sole normative authority.
Citation
@misc{ezpeleta2026gectoreusv2,
author = {Ezpeleta, Xabi},
title = {GECToR v2: Multi-task Basque Grammatical Error Correction},
year = {2026},
howpublished = {Hugging Face model},
url = {https://huggingface.co/itzune/gector-eus-v2}
}Base model
@misc{artetxe2022euscrawl,
title = {Does corpus quality really matter for low-resource languages?},
author = {Artetxe, Mikel and Aldabe, Itziar and Agerri, Rodrigo and
Perez-de-Viñaspre, Olatz and Soroa, Aitor},
year = {2022}, eprint = {2203.08111},
archivePrefix = {arXiv}, primaryClass = {cs.CL}
}Architecture
@inproceedings{omelianchuk2020gector,
title = {GECToR--Grammatical Error Correction: Tag, Not Rewrite},
author = {Omelianchuk, Kostiantyn and Atrasevych, Vitaly and
Chernodub, Artem and Skurzhanskyi, Oleksandr},
booktitle = {Proceedings of the Fifteenth Workshop on Innovative Use of
NLP for Building Educational Applications}, year = {2020}
}Related
- horkonpon-corpus — training data
- gector-eus (v1) — predecessor (Elhuyar, NC license)
- gemma-4-e4b-horkonpon — LLM-based Basque GEC (F0.5=80.8)
- gotutiyan/gector — PyTorch GECToR implementation (MIT)
- Euskaltzaindia EBE — normative authority
