LREC-COLING 2024Chinese spelling correction · Retrieval

Error-Robust Retrieval for Chinese Spelling Check

Xunjian Yin, Xinyu Hu, Jin Jiang, Xiaojun Wan

Peking University · State Key Laboratory of Media Convergence Production Technology and Systems

A misspelled character is a poor retrieval query. RERIC combines pronunciation, shape, and surrounding context to find useful training examples without retraining the correction model.

Result
SIGHAN15 sentence-level correction F1: RERIC 80.0 vs 78.5 for ECOPO, the strongest baseline, and 77.8 for its unretrained base model, REALISE.
New vs prior
kNN-LM (Khandelwal et al., 2019) keys a datastore on context representations and stores single next tokens; RERIC keys on pronunciation, glyph shape, and weighted context, and stores corrected 3-grams for reranking.
Limitation
On SIGHAN13 RERIC only matches ECOPO (correction F1 85.2 vs 85.1), and F1 declines once more than about 16 neighbors are retrieved.
Scroll sideways to read the figure. ReRiC's pipeline: a base spelling-check model fuses phonetic, semantic, and morphologic features into contextual keys, stores training tokens as key-value n-grams in a datastore, then retrieves the nearest neighbors of each test token and reranks candidate corrections by distance. Original Figure 1 from the paper. Full size ↗

The erroneous character should not dominate the search

Chinese Spelling Check (CSC) corrects misspelled characters, which are usually confused with characters of similar sound or shape. In CSC, part of the retrieval query is wrong: a key that encodes the mistaken character can retrieve fluent uses of that character and reinforce the error.

Strong correctors also underuse their training data: in Table 1, REALISE, a multimodal CSC model, leaves 设 (set) uncorrected where 这 (this) is meant, although that error appears in similar contexts in the training set. RERIC turns the training set into a datastore that the corrector consults at inference.

Closest prior work

Multimodal Chinese Spelling Check (CSC) models such as SpellGCN, PLOME, and REALISE build phonetic and glyph information into the corrector during training. Retrieval methods such as kNN-LM and kNN-MT (Khandelwal et al., 2019, 2020) instead attach a datastore of training examples to a trained model and interpolate its predictions at inference. RERIC, which the authors describe as the first retrieval-augmented CSC method, adapts that pattern to queries that may contain the error: keys combine pronunciation, glyph shape, and distance-weighted context, and candidates are reranked by 3-gram overlap.

Dense retrieval finds candidates; local overlap corrects their ranking

Each key concatenates the target character's phonetic and glyph representations from REALISE with a Gaussian-weighted average of the fused semantic, phonetic, and glyph representations of nearby tokens, so it reflects the surrounding characters rather than only the target's possibly wrong meaning. Queries are built the same way, and every training token is stored, correct or not.

Equation 11 · Figure 1 candidates

Should matching the wrong character count?

RERIC reranks retrieved 3-grams by their positional overlap with the input window: α sums the weights of the matching positions, and the retrieval distance is multiplied by 1 − α (Equation 11). By default α is divided by the sum of the weights, so that a full match gives α = 1; switch to the printed normalization (÷ n = 3) to see what the equation gives with the Table 3 weights. Move the weights and set your own distances.

Input window 这以个from “这以个重大发…”, Figure 1; 以 is a misspelling, corrected as in 这一个 (“this one”)

α = Σi 1[v(i) = g(i)] · wi / Σi wi = 4.04; d′ = (1 − α) · d; w = (1.68, 0.68, 1.68)

Rank · retrieved 3-gramDistance dOverlap αAdjusted d′ ↓
1这一个this one0.3000.8320.050
2这以后after this0.2000.5840.083
3这几个these few0.5000.8320.084

Adapted · Figure 1 input and candidates. Adapted · Equation 11 α divided by Σw, so a full match gives α = 1. Adapted · Table 3 weights w = (1.68, 0.68, 1.68), n = 3. Illustrative l2 distances in Figure 1’s retrieval order; the paper does not print them.

Nearest candidate: 这一个. Matching both correct neighbors outweighs matching the uncertain center. This is Figure 1’s ranking: 这一个 (“this one”) is the most probable correction.

Adapted: the input window and the three candidates from Figure 1, and w = (1.68, 0.68, 1.68) with n = 3 from Table 3. Normalization: Equation 11 is printed with ÷ n; with the Table 3 weights this gives α = 1.12 when both neighbors match, so 1 − α is negative and a larger distance ranks higher. Dividing by Σw = 4.04 is our reading; it keeps α between 0 and 1 and reproduces Figure 1’s ranking with the default distances. Illustrative: the l2 distances, which the paper does not print; the defaults keep Figure 1’s retrieval order. Figure 1 lists the scores 0.93, 0.89 and 0.84 beside the candidates without defining them, so they are not used as distances. Computed: α, adjusted distances and ranks. The softmax (T = 50) and interpolation with the base model (λ = 0.4) in Equations 12–13 are not simulated. This is not a live spelling corrector.Paper (LREC-COLING 2024) ↗

Each value is the corrected 3-gram around the target. Dense retrieval alone can rank 这以后 first for the input 这以个 because it shares the wrong character 以; reranking rewards positional overlap with the input window and downweights a match at the center. The reranked distribution is interpolated with REALISE's own prediction, without retraining REALISE.

  1. 01

    Represent errors robustly

    Build retrieval keys from a character’s phonetic and morphological features plus surrounding context, reducing dependence on its potentially incorrect meaning.

  2. 02

    Retrieve and rerank

    Retrieve nearest neighbors from training data, then rerank them using overlap between their surrounding n-grams and the input.

  3. 03

    Combine correction probabilities

    Interpolate the retrieval distribution with the base model’s predictions to choose corrected characters, without additional model training.

Much of the gain comes from avoiding unnecessary corrections

On SIGHAN15, the 2015 test set of the SIGHAN Chinese spelling-check shared tasks, nearly all of the gain over REALISE comes from precision (Table 4): RERIC makes fewer wrong corrections rather than finding more errors. In the case study, REALISE changes a correct 带 (take) to 戴 (wear); RERIC, with many correct uses of 带 in its datastore, does not.

The key design, not retrieval itself, carries the gain: replacing the key's context part with the token's semantic representation falls below no retrieval (Table 5). Retrieval adds about 6% inference time and a 1.3 GB datastore; adding about one million error-free Chinese Wikipedia articles to the datastore raises SIGHAN15 correction F1 from 80.0 to 80.9 without retraining (Table 7).

Table 4 (selected columns), SIGHAN15 test set. Sentence-level detection F1, and correction accuracy, precision, recall and F1; higher is better. REALISE is the base CSC model used to build RERIC's datastore; RERIC adds retrieval at inference without retraining it. Source ↗

ModelDetection F1Correction AccuracyCorrection PrecisionCorrection RecallCorrection F1
FASpell63.573.766.659.162.6
SpellGCN77.7-72.177.775.9
PLOME79.4-75.379.377.2
ECOPO80.084.276.181.278.5
REALISE79.384.075.979.977.8
RERIC81.285.679.980.180.0

Method proposed in the paper

Scope. RERIC is tested only on top of REALISE, on the SIGHAN13–15 test sets converted to Simplified Chinese; retrieval hyperparameters are tuned by grid search on a held-out 10% of the training data. Read the study ↗

Further reading in the paperPaper · Figure 1, Equations 8–13, Tables 4–5 ↗RERIC implementation ↗
Read the abstract

Chinese Spelling Check (CSC) aims to detect and correct error tokens in Chinese contexts, which has a wide range of applications. However, it is confronted with the challenges of insufficient annotated data and the issue that previous methods may actually not fully leverage the existing datasets. In this paper, we introduce our plug-and-play retrieval method with error-robust information for Chinese Spelling Check (RERIC), which can be directly applied to existing CSC models. The datastore for retrieval is built completely based on the training data, with elaborate designs according to the characteristics of CSC. Specifically, we employ multimodal representations that fuse phonetic, morphologic, and contextual information in the calculation of query and key during retrieval to enhance robustness against potential errors. Furthermore, in order to better judge the retrieved candidates, the n-gram surrounding the token to be checked is regarded as the value and utilized for specific reranking. The experiment results on the SIGHAN benchmarks demonstrate that our proposed method achieves substantial improvements over existing work.

Full paper ↗
Citation BibTeX
@inproceedings{yin-etal-2024-error,
  title = {Error-Robust Retrieval for Chinese Spelling Check},
  author = {Yin, Xunjian and Hu, Xinyu and Jiang, Jin and Wan, Xiaojun},
  booktitle = {Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)},
  year = {2024},
  pages = {6257--6267},
  url = {https://aclanthology.org/2024.lrec-main.553/}
}