RE2: improving Chinese grammatical error correction via retrieving appropriate examples with explanation

Baoxin Wang, Yumeng Luo, Yixuan Wang, Dayong Wu, Wanxiang Che, Shijin Wang

Abstract

Grammatical Error Correction (GEC) for Chinese is a complex task, particularly for native-level errors where structural nuances are critical. While Large Language Models (LLMs) benefit from in-context learning, traditional retrieval methods based on text similarity often select examples that share vocabulary but differ in error type. We propose RE$^2$ (Retrieving Examples with Explanation), a method that retrieves reference examples by matching the semantic similarity of grammatical error explanations. Our approach involves training a specialized explainer model to generate detailed error descriptions, which are then used to retrieve structurally similar examples from a curated dataset. Experimental results on the FCGEC and NaCGEC benchmarks demonstrate that RE$^2$ significantly outperforms existing state-of-the-art models and standard few-shot prompting techniques.

Introduction

The effectiveness of Large Language Models (LLMs) in Grammatical Error Correction (GEC) is heavily influenced by the quality of the reference examples provided in their prompts. In-context learning (ICL) typically relies on retrieving examples similar to the input sentence. However, standard retrieval methods use surface-level text similarity (e.g., BM25 or dense embeddings of the raw text). This creates a fundamental mismatch: two sentences may share identical vocabulary but contain entirely different grammatical errors. For instance, a sentence about "green mountains" might have a word order error, while another similar sentence might have a missing subject. Providing the wrong type of error as a reference limits the LLM's ability to generalize the correct structural fix.

The RE$^2$ Framework

To address this, we introduce RE$^2$ (Retrieving Examples with Explanation). The core idea is to shift the retrieval space from raw text to natural language explanations of the errors themselves.

The RE2 framework consists of three main steps: Explanation Generation, Example Selection via explanation retrieval, and final Grammatical Error Correction.

The process follows three primary steps:

  1. Explanation Generation: We fine-tune an LLM (Qwen2-7B-Instruct) to serve as a "Grammatical Error Explainer." This model is trained on our newly created FCGEE dataset to provide detailed, natural language explanations of grammatical faults.
  2. Example Selection: For a given input sentence, the Explainer generates a predicted error explanation. We then use TF-IDF cosine similarity to retrieve the top-$k$ examples from a reference datastore whose ground-truth explanations most closely match the predicted one. Interestingly, the authors found that classic TF-IDF outperformed modern dense neural retrievers for matching explanations, as dense embeddings often capture broad semantic topics rather than specific structural nuances.
  3. Grammatical Error Correction: The retrieved examples (source, target, and explanation) are concatenated into a prompt for the final correction LLM. This provides the model with structurally relevant templates for fixing the specific error type encountered.

Datasets and Methodology

A key contribution of this work is the FCGEE (Fine-grained Chinese Grammatical Error Explanation) dataset. To build this, we utilized 19,758 sentences from native-speaker exams. While zero-shot GPT-4o struggled with these complex errors (71% accuracy), providing "rough" official exam explanations as guidance improved its accuracy to 97%. This allowed us to generate a high-quality dataset of detailed explanations. We evaluate our method on FCGEC and NaCGEC, which focus on challenging errors made by native Chinese speakers.

Results

Our evaluation shows that RE$^2$ consistently improves performance across different LLM backbones and settings.

Comparison of RE2 against various baselines on the FCGEC-test set. RE2 significantly boosts the performance of both GPT-4o and Qwen2-7B.

As shown in the results table, a Qwen2-7B model fine-tuned with RE$^2$ achieved an $F_{0.5}$ score of 59.76, setting a new state-of-the-art on the FCGEC benchmark. Notably, for GPT-4o in a few-shot setting, switching from text-similarity retrieval (TextSim) to RE$^2$ resulted in a nearly 10-point jump in $F_{0.5}$ (from 37.49 to 47.41). This confirms that matching the "why" of an error is far more effective than matching the "what" of the vocabulary. Furthermore, the Explainer model's ability to generate "hypothetical" explanations for correct sentences helps prevent over-correction by retrieving relevant reference examples for valid text structures.

Conclusion

RE$^2$ demonstrates that structural and grammatical similarity is a superior metric for example retrieval in GEC tasks compared to surface-level text similarity. By leveraging detailed natural language explanations, we provide LLMs with the necessary context to handle complex, native-level grammatical errors. While the two-step inference process introduces some latency, the significant gains in accuracy make it a robust solution for high-stakes grammar correction tasks.

Summary updated

BibTeX
@article{wang2025re,
  author = {Baoxin Wang and Yumeng Luo and Yixuan Wang and Dayong Wu and Wanxiang Che and Shijin Wang},
  title = {{RE2: improving Chinese grammatical error correction via retrieving appropriate examples with explanation}},
  journal = {Frontiers of Computer Science},
  year = {2025},
  doi = {10.1007/s11704-025-41399-w},
}
Figure