RAIR: Retrieval-Augmented Iterative Refinement for Chinese Spelling Correction

Junhong Liang, Yu Zhou

TL;DR

RAIR (Retrieval-Augmented Iterative Refinement) is a new framework that significantly improves how Large Language Models (LLMs) handle Chinese Spelling Correction. By combining domain-specific retrieval with a "multi-turn length reflection" loop, it solves two major LLM weaknesses: the struggle with specialized terminology and the tendency to accidentally change sentence length during correction.

What Problem Does This Paper Address?

Chinese Spelling Correction (CSC) is the task of detecting and fixing typos. While traditional methods use specialized Pretrained Language Models (PLMs) like BERT, the industry is shifting toward Large Language Models (LLMs). However, LLMs face three major hurdles in this domain:

  1. Domain Sensitivity: LLMs often lack the niche vocabulary required for legal, medical, or technical documents, leading to "hallucinated" corrections or missed errors.
  2. The Length Constraint: Standard CSC requires the output to be the same length as the input. Because LLMs are auto-regressive (generating text token-by-token), they often struggle to maintain strict character counts.
  3. Variable-Length Scenarios: Real-world errors aren't always one-for-one swaps. Automatic Speech Recognition (ASR) errors or "splitting errors" (where one character is accidentally typed as two) require the model to intelligently change the sentence length—a task traditional CSC models aren't designed for.

Methods

The RAIR framework introduces a "plug-and-play" pipeline consisting of three main components:

  • Adaptive Retrieval Corpus: Instead of a static database, RAIR builds a retrieval corpus from three sources: domain-specific dictionaries (like THUOCL), existing training sets, and "expanded" data where an LLM (GPT-4o) generates background paragraphs for training sentences to provide richer context.
  • Error-Tolerant Retriever: Standard semantic search often fails when the search query itself contains a typo. The authors fine-tuned a retriever ($M_{Ret}$) using a contrastive learning loss, training it specifically to link "noisy" (typo-ridden) inputs to their correct counterparts.
  • Multi-turn Length Reflection (MLR): This is the "Iterative Refinement" part. If the LLM produces a correction that violates length constraints (e.g., it's too long for a standard CSC task), the system generates a "length report." This report is fed back into the LLM as a prompt (e.g., "Your output has 12 characters, but the source has 11. Please try again."), allowing the model to "rethink" and fix its own formatting error.
  • Adaptive Selection (AdSe): A logic gate that prioritizes retrieval-based correction when domain data is available but falls back to direct LLM correction when it isn't, ensuring robustness across different datasets.

Datasets

The authors evaluated RAIR across a wide variety of benchmarks to test domain generalizability:

  • ECSpell: Specialized domains including Law, Medical, and Official Documents.
  • LEMON: A real-world dataset spanning seven domains (e.g., Car, Game, Novel).
  • Aishell-1: Used for ASR N-best correction (speech-to-text error fixing).
  • CSEC: A dataset specifically for "splitting errors" (OCR/typing errors where characters are broken apart).

Key Insights and Ideas

  • LLMs are "Length-Blind": One of the most interesting findings is that even powerful models like DeepSeek-V3 or Qwen2.5 frequently fail simple length constraints. The MLR module proves that LLMs can fix these errors if they are explicitly told they made a counting mistake.
  • Retrieval as a "Knowledge Anchor": In specialized fields like law or medicine, the retriever acts as a safety net. By pulling in the correct terminology before the LLM generates a response, the framework prevents the model from "correcting" a rare technical term into a common but incorrect word.
  • Efficiency of Reflection: You might think iterative calls would be slow and expensive. However, the data shows that over 80% of length-related errors are corrected in just one additional reflection round, making the overhead manageable for production environments.

Key Results

The RAIR framework consistently outperformed both traditional PLMs and vanilla LLMs:

  • State-of-the-Art Performance: DeepSeek-V3 combined with RAIR achieved an $F_1$ score of 92.0 on the ECSpell 'odw' (official documents) set, significantly beating the previous best specialized model, ReLM (83.6).
  • ASR Improvement: On the Aishell-1 speech dataset, RAIR reduced the Character Error Rate (CER) by 28.9% relative to the raw ASR output.
  • Variable Length Mastery: In "splitting error" tasks (CSEC), RAIR helped DeepSeek-V3 jump from an $F_1$ of 54.2 to 66.1, proving its effectiveness in scenarios where the character count must change.

Limitations and Future Work

  • Inference Cost: While most errors are fixed in one round, the iterative nature still requires multiple API calls or model passes, which increases latency and cost compared to single-pass models.
  • Phonetic/Glyph Integration: The current retriever is purely semantic. The authors suggest that future versions could incorporate "sound-alike" (phonetic) and "look-alike" (glyph) features to catch errors that are semantically distant but visually or auditorily similar.
  • Prompt Sensitivity: The system relies heavily on the quality of the "length report" prompts; further optimization of these templates could yield even higher accuracy.

Summary updated

Abstract

Chinese Spelling Correction (CSC) aims to detect and correct erroneous tokens in sentences. Traditional CSC focuses on equal length correction and uses pretrained language models (PLMs). While Large Language Models (LLMs) have shown remarkable success in identifying and rectifying potential errors, they often struggle with adapting to domain-specific corrections, especially when encountering terminologies in specialized domains. To address domain adaptation, we propose a \textbf{R}etrieval-\textbf{A}ugmented \textbf{I}terative \textbf{R}efinement (RAIR) framework. Our approach constructs a retrieval corpus adaptively from domain-specific training data and dictionaries, employing a fine-tuned retriever to ensure that the retriever catches the error correction pattern. We also extend equal-length into variable-length correction scenarios. Extensive experiments demonstrate that our framework outperforms current approaches in domain spelling correction and significantly improves the performance of LLMs in variable-length scenarios.
BibTeX
@misc{liang2025rair,
  author = {Junhong Liang and Yu Zhou},
  title = {{RAIR: Retrieval-Augmented Iterative Refinement for Chinese Spelling Correction}},
  year = {2025},
  eprint = {2504.18938},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.18938},
}
Figure