Introduction
In-Context Learning (ICL) has emerged as a cost-effective alternative to fine-tuning for Grammatical Error Correction (GEC). The performance of ICL is highly sensitive to the choice of demonstrations provided to the Large Language Model (LLM). Traditional methods typically employ semantic retrieval (e.g., using SBERT) to find examples similar in meaning to the input. However, grammatical errors are often structural and local, showing little correlation with the overall topic of a sentence. A sentence about "cooking" might share a topic with another "cooking" sentence but contain a completely different grammatical error (e.g., subject-verb agreement vs. article usage). This mismatch limits the effectiveness of semantic-based few-shot learning.
Methodology: Grammatical Error Explanation (GEE) Retrieval
To address the limitations of semantic retrieval, we propose Grammatical Error Explanation (GEE) retrieval. This approach shifts the focus from "what the sentence is about" to "what is wrong with the sentence."
The process consists of two primary phases:
- Database Construction: A "teacher" LLM (e.g., Llama-3.1-8B) is used to generate natural language explanations for errors in a labeled training dataset. These explanations (e.g., "Incorrect verb tense: the present perfect is needed here...") serve as the indexing keys in the demonstration database.
- Explanation-Based Retrieval: For a given test input, a "predictor" LLM generates an initial, zero-shot explanation of potential errors. This predicted explanation is used as a query to retrieve the most similar (Input, Correction) pairs from the database.
Notably, while explanations are used for retrieval, they are excluded from the final prompt. This avoids "Chain of Thought" (CoT) clutter, which empirical results suggest can degrade performance by introducing unnecessary noise during the final generation phase.
Experimental Setup
The effectiveness of GEE retrieval was evaluated across five languages: English (CoNLL-14, BEA-19), Chinese (NLPCC-18), German (Falko-Merlin), Russian (RULEC), and Estonian (Tartu-L1). The method was tested using several state-of-the-art LLMs, including Llama-3.1, Qwen2.5, DeepSeek2.5, and GPT-4o-mini, to ensure model agnosticism.
Results and Discussion
The proposed method consistently outperformed random selection, BM25 keyword matching, and semantic retrieval (SBERT) across all tested languages.
- Performance Gains: On the English CoNLL-14 benchmark, the method achieved an F0.5 score of 59.38 using DeepSeek2.5. For GPT-4o-mini, the approach yielded a 2-point F0.5 improvement over random selection.
- The CoT Paradox: A key finding was that including natural language explanations in the final ICL prompt actually decreased accuracy. The explanations are highly effective for selecting the right examples but detrimental when presented as reasoning steps for the model to follow in the final correction task.
- Robustness: The "zero-shot guessing" mechanism for initial explanations proved robust; even imperfect initial explanations were sufficient to retrieve highly relevant demonstrations from the database.
Conclusion and Future Work
GEE retrieval provides a more principled way to select demonstrations for GEC by aligning examples based on error types rather than semantic topics. This method is model-agnostic and approaches the performance of specialized, fine-tuned models without the associated training costs. Future research will focus on reducing the computational overhead of database construction and refining the explanation formats to further enhance retrieval precision.
Summary updated