RSpell: Retrieval-Augmented Framework for Domain Adaptive Chinese Spelling Check

Siqi Song, Qi Lv, Lei Geng, Ziqiang Cao, Guohong Fu

Abstract

Chinese Spelling Check (CSC) faces significant challenges when applied to specialized domains such as law or medicine, where technical terminology often falls outside the distribution of general-purpose models. We present RSpell, a retrieval-augmented framework designed to enhance CSC models through domain-specific knowledge injection. By utilizing a pinyin-based fuzzy matching strategy and an iterative correction process, RSpell achieves state-of-the-art performance in both zero-shot and fine-tuning scenarios, effectively bridging the gap between general language understanding and specialized domain expertise.

Introduction

Chinese Spelling Check (CSC) is a critical task in natural language processing, focused on detecting and correcting errors in Chinese text. The majority of these errors are phonologically or visually similar to the intended characters—a byproduct of how Chinese characters are input via pinyin or similar systems.

While existing CSC models perform well on general datasets, their performance degrades sharply in specialized fields like medical reporting or legal documentation. In these contexts, rare technical terms are often misidentified as common words. The traditional solution—collecting massive, labeled datasets for every new domain—is prohibitively expensive and fails to scale. RSpell addresses this by "injecting" domain knowledge on the fly, mimicking a human proofreader who consults a technical glossary while reviewing a specialized manuscript.

The RSpell Framework

RSpell is designed as a modular framework that can be wrapped around any existing CSC model (the "speller"). It introduces three primary innovations to handle the nuances of domain-specific spelling correction:

1. Pinyin-Based Retrieval

Standard text retrieval is often ineffective for spelling tasks because the input sentence contains errors by definition. RSpell bypasses this by converting the input sentence into pinyin (phonetic romanization) and performing fuzzy matching against a domain-specific thesaurus using TF-IDF. This "pinyin pivot" allows the system to locate the correct technical term even if the input characters are incorrect, provided the phonetic representation remains similar.

2. Adaptive Process Controller

External retrieval can introduce noise if the retrieved terms are irrelevant to the context. To mitigate this, RSpell employs an Adaptive Process Controller. During the training phase, this component dynamically evaluates whether retrieved terms overlap with the ground-truth target sentence. If the retrieved information is deemed unhelpful, the model is trained to ignore it, ensuring that the system only relies on external knowledge when it genuinely aids the correction process.

3. Secondary Search Strategy

Sentences containing multiple errors are particularly difficult to correct in a single pass. RSpell utilizes an iterative approach: it performs an initial correction pass, re-retrieves terms based on the improved text, and then executes a second correction pass. This refinement prevents "over-correction," where a model might erroneously replace a rare but correct technical term with a more common, high-frequency word.

Experimental Evaluation

The researchers evaluated RSpell across three distinct specialized domains:

  • Law: 1,960 training and 500 test samples.
  • Medicine: 3,000 training and 500 test samples.
  • Official Document Writing (ODW): 1,728 training and 500 test samples.

The framework was trained on the general-domain SIGHAN dataset and utilized public lexicons from sources like Tsinghua University for its retrieval component.

Key Insights and Results

Performance Gains

RSpell was benchmarked against established models like BERT and ReaLiSe, as well as Large Language Models (LLMs) like ChatGPT. When utilizing ECSpell as the base model, RSpell achieved state-of-the-art (SOTA) results across the tested domains.

  • Zero-Shot Capabilities: Even without domain-specific fine-tuning, the retrieval framework provided a performance boost of at least 1.3%.
  • Fine-Tuning Impact: When fine-tuned on domain data, RSpell demonstrated a significant 3-8% improvement over the base models.
  • Comparison with LLMs: While ChatGPT possesses vast general knowledge, the study found its CSC outputs to be "unstable." RSpell’s specialized architecture proved more reliable for production-level spelling correction tasks.

The Power of RAG in Spelling

This framework represents a successful application of Retrieval-Augmented Generation (RAG) to the niche of spelling correction. It demonstrates that models do not need to internalize all technical vocabulary within their weights; providing a "cheat sheet" of retrieved terms at inference time is a highly effective and more flexible alternative.

Limitations and Future Directions

Despite its success, RSpell's performance is inherently tied to the quality and coverage of the domain-specific thesaurus. Ablation studies confirmed that expanding the dictionary directly correlates with improved accuracy. Furthermore, the current implementation relies on sparse retrieval (TF-IDF). Future iterations may explore dense representation-based retrieval to capture deeper semantic relationships. Finally, the iterative nature of the secondary search strategy introduces additional computational overhead, which may be a consideration for high-latency, real-time applications.

Conclusion

RSpell provides a robust, scalable solution for domain-adaptive Chinese Spelling Check. By leveraging phonetic retrieval and an adaptive control mechanism, it allows general-purpose models to excel in specialized environments without the need for exhaustive data collection, setting a new standard for the field.

Summary updated

BibTeX
@inproceedings{song2023rspell,
  author = {Siqi Song and Qi Lv and Lei Geng and Ziqiang Cao and Guohong Fu},
  title = {{RSpell: Retrieval-Augmented Framework for Domain Adaptive Chinese Spelling Check}},
  booktitle = {NLPCC},
  year = {2023},
  url = {https://openreview.net/forum?id=yo7vhJstDl},
}
Figure