Enhancing Text Editing for Grammatical Error Correction: Arabic as a Case Study

Bashar Alhafni, Nizar Habash

Abstract

Grammatical Error Correction (GEC) for morphologically rich languages like Arabic presents unique challenges for traditional Sequence-to-Sequence (Seq2Seq) models due to high computational costs and linguistic complexity. This paper introduces SWEET (Subword Edit Error Tagger), a data-driven text-editing framework that treats GEC as a sequence tagging task. By utilizing automated edit extraction, compression, and pruning, SWEET achieves state-of-the-art results on multiple Arabic benchmarks while being over six times faster and significantly more parameter-efficient than existing models.

Introduction

Grammatical Error Correction has traditionally been dominated by Seq2Seq models that treat correction as a translation task from "erroneous" to "correct" language. While effective, this approach is computationally expensive because the model must regenerate the entire sentence word-for-word, even for minor punctuation changes.

Text editing is a more efficient alternative where models tag tokens with specific operations (e.g., keep, delete, replace). However, most frameworks require manual, language-specific tag design—a daunting task for Arabic due to its rich morphology and the coexistence of Modern Standard Arabic (MSA) and regional dialects. This study addresses these challenges by proposing a fully data-driven tagging pipeline.

Methodology: The SWEET Framework

The researchers developed SWEET (Subword Edit Error Tagger) to automate the creation of edit tags. The pipeline consists of several key stages:

  1. Edit Extraction: A weighted Levenshtein distance algorithm aligns erroneous and corrected sentences to identify character-level edits automatically.
  2. Edit Compression: To manage vocabulary size, common patterns are represented using generalized notation (e.g., K* for multiple "keeps"), balancing expressiveness with efficiency.
  3. Subword Tagging: Edits are projected onto subwords (using AraBERTv02) to ensure compatibility with modern Transformer architectures.
  4. Edit Pruning: Rare edit tags are removed to reduce model complexity and improve robustness against noise.
Figure 1: The SWEET pipeline illustrating the transition from word-level edits to compressed subword tags for an Arabic sentence.

For MSA, the authors also implemented Edit Segregation, training separate models for punctuation and grammar to prevent the high frequency of punctuation errors from overshadowing complex linguistic structures.

Datasets and Evaluation

The approach was evaluated across four major benchmarks:

  • QALB-2014 & 2015: MSA comments from Aljazeera.
  • ZAEBUC: Academic essays by university students.
  • MADAR CODA: Dialectal Arabic (DA) from five cities normalized to a standard orthography.

Results and Discussion

SWEET demonstrated significant improvements in both speed and efficiency. The models are over 6x faster than existing state-of-the-art systems and roughly 4x smaller in parameter count (135M vs. 502M) while maintaining competitive $F_{0.5}$ scores.

The Impact of Pruning

A critical finding was the effect of pruning the "long tail" of unique edits. In morphologically rich languages, thousands of unique edits can exist, but many are infrequent. As shown in the table below, pruning tags that appear fewer than 10–30 times significantly reduces the edit vocabulary and Out-of-Vocabulary (OOV) rates without a substantial loss in $F_{0.5}$ performance.

Table 1: Impact of edit compression and pruning on the number of unique edits, OOV percentage, and F0.5 performance across different subsets.

Performance Highlights

  • State-of-the-Art (SOTA): SWEET achieved new SOTA results on QALB-2014 and MADAR CODA.
  • Ensemble Gains: Combining SWEET with Large Language Models like GPT-4o via a majority-vote system provided the best overall precision across all datasets.

Conclusion

By framing GEC as a sequence tagging problem and employing data-driven edit extraction, the SWEET framework offers a lean, fast, and effective solution for Arabic GEC. The study proves that for morphologically complex languages, pruning rare edits and separating punctuation from grammar are vital strategies for building robust correction systems. Future work will explore the generalizability of this approach to other languages and its application in generating synthetic training data.

Summary updated

BibTeX
@inproceedings{alhafni2025enhancing,
  author = {Bashar Alhafni and Nizar Habash},
  title = {{Enhancing Text Editing for Grammatical Error Correction: Arabic as a Case Study}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure