Elamur Research

VSEC: Transformer-based Model for Vietnamese Spelling Correction

Paper · 2021 · Dinh-Truong Do, Ha Thanh Nguyen, Thang Ngoc Bui et al.

Summary

A Vietnamese spelling mistake can leave behind a perfectly valid syllable. A dictionary may accept it, even when it makes little sense in the sentence. The clue to the intended spelling often lies in the surrounding text, but that clue can be lost when neighboring syllables are also wrong. VSEC addresses this problem by reading the input sentence and generating a corrected version. It applies a Transformer, an architecture that uses attention to draw information from different positions in a sequence.

The system works with pieces of syllables learned through byte pair encoding, a form of subword tokenization. This gives it a way to represent a suspect spelling even when the complete syllable is unfamiliar. To form the training pairs, the authors match each of 5 million sentences drawn from a Vietnamese news corpus with a copy into which they have inserted artificial errors. The changes include replacements that imitate typing and spelling confusions, as well as deletions and duplications. For testing, the authors assemble a separate collection from educational documents. Its 9,341 sentences contain 11,202 human-made spelling errors.

On this test set, VSEC reaches 86.8% detection F1 and 81.5% correction F1. F1 combines precision, which measures the reliability of the system’s flags, with recall, which measures how much of the reference set it finds or fixes. The rebuilt N-gram baseline reaches 81.2% detection F1 and 79.3% correction F1. The baseline has the highest correction precision, while VSEC achieves a stronger balance between precision and recall. VSEC’s correction recall exceeds 76%. Its 81.5% correction F1 therefore describes overall performance across both measures.

The paper shows an instance in which VSEC repairs neighboring errors that the N-gram system only partly fixes. It also finds errors introduced by VSEC itself. The system sometimes rewrites acronyms or foreign words that should have been preserved, and it can replace a valid technical term with a more familiar expression. The benchmark therefore tests both whether the system can use broader context and whether it can recognize when the original wording is already appropriate.

Deep dive: VSEC: Transformer-based Model for Vietnamese Spelling Correction

VSEC uses a subword Transformer to correct Vietnamese spelling and compares its detection and correction with an N-gram system on human errors. · about 31 minutes to read

The problem and its context

Why a valid syllable can still be wrong

Spelling correction asks a system to identify errors and recover the intended text. Finding an error and fixing it are separate achievements. A system can identify a suspicious syllable while proposing the wrong replacement. It can also change an acceptable syllable and thereby introduce an error in otherwise usable text. These distinctions matter in the applications the paper discusses, including search queries, message filtering and text produced by optical character recognition, or OCR. The downstream system sees whatever wording remains after correction.

In the paper’s treatment of Vietnamese, a space-separated unit is a syllable. Several such units can belong to a single word or expression. This matters because a space identifies the boundaries of a syllable without establishing that the syllable is appropriate there. A dictionary can verify that a particular form exists. The relation between that form and the surrounding syllables can still make it an unlikely reading. A corrector consequently has to judge how the pieces of a sentence fit together as well as whether the pieces are individually recognizable.

The authors distinguish errors made while typing from errors that reflect a writer’s mistaken belief about a spelling. Accidentally pressing a nearby key is an example of the first kind. The result may be absent from the dictionary, which gives a dictionary-based check a direct signal. It may instead be a genuine entry that happens to be wrong at that position. In the latter case, the system needs contextual evidence to distinguish a typing slip from a legitimate use of the same syllable.

The second kind includes forms that a writer believes are acceptable, possibly because of regional pronunciation or uncertainty about how to write a difficult word. The authors note that such errors can require knowledge of the standard written form alongside an understanding of the sentence. A method that only considers likely keyboard slips would cover some of the causes discussed in the paper. VSEC is designed for a broader correction task that includes both accidental typing errors and misspellings of this kind.

Adjacent errors make that task harder. Suppose a system tries to judge a syllable by looking at the units immediately around it. If a neighboring syllable is also wrong, the system is judging the first error with evidence altered by the second. When the two belong to the same expression, recovering one part may still leave an implausible combination. Context elsewhere in the sentence can help identify the expression even when its parts no longer provide reliable clues about each other.

How earlier systems chose corrections

The paper describes several Vietnamese approaches that identify questionable syllables and rank possible corrections. In the method by Phuong H. Nguyen and colleagues, pairs of part-of-speech categories help flag suspicious positions. A part of speech describes a unit’s grammatical role, such as noun or verb. A bigram is a sequence of adjacent units, so a part-of-speech bigram describes the local order of these grammatical categories. For the correction stage, the authors describe the use of minimum edit distance, which compares forms by the changes needed to get from one to the other, and SoundEx, which supplies another way to find similar candidates. Heuristics then help order the suggestions. Part-of-speech tagging

The N-gram approach by Huong and colleagues uses counts collected from text without error labels. It generates a candidate set by altering syllables in ways that reflect likely spelling confusions, including typing and consonant errors. It then scores each candidate using frequencies at different spans. A unigram provides evidence from a syllable on its own. Bigrams and trigrams provide evidence from successively longer sequences of adjacent syllables. When a candidate earns a higher score than the observed syllable, that score can support treating the original as an error.

That division of labor gives the N-gram system two ways to succeed. Its candidate rules can put a plausible replacement within reach, and its frequency estimates can distinguish that replacement from the other possibilities. The same design creates two places where a mistake can slip through. A valid correction may be missing from the candidate set, or the nearby context may give the correct candidate a weak score. A frequent combination is useful evidence when the immediate neighborhood is intact. When that neighborhood contains other mistakes, the counts concern a different combination from the one the writer intended.

Other systems described in the paper narrow the problem to a particular source or kind of error. Nguyen Hong Vu and colleagues normalize Vietnamese tweets, using a dictionary to detect suspect forms and drawing on properties of Vietnamese vocabulary as well as statistical scores to correct them. Quoc-Dung Nguyen and colleagues address Vietnamese OCR errors. Their approach uses dictionaries of local sequences for detection and generates suggestions by inserting, deleting or substituting characters. It scores the suggestions with features that include syllable similarity, sequence frequencies and the probability of an edit.

The paper also discusses a neural approach by Nguyen Ha Thanh and colleagues for consonant misspellings. It encodes the direction of a misspelling and uses stacked bidirectional long short-term memory, or LSTM, to find and repair affected positions. A bidirectional recurrent architecture can build a representation from information on both sides of a position. The problem it was designed for, however, is a specific class of Vietnamese errors. VSEC takes up a different question by asking a single system to handle a range of errors in sentences drawn from general text.

Why treat correction as translation?

The authors draw on a line of work that treats spelling correction as machine translation. The input and output in this case are both Vietnamese. What changes is the condition of the sentence. The source version may contain errors, and the target version represents the intended spelling. Earlier work discussed in the paper had applied neural translation techniques to spelling correction in languages including English and Chinese.

This formulation changes the role of context. A sequence-to-sequence corrector takes the full input sequence and produces an output sequence. A local corrector typically starts with a suspect position and asks which candidate fits its surroundings. In sequence-to-sequence correction, the system builds a representation of the source and uses it to produce the next part of the corrected sentence. Changes at different positions can therefore be supported by evidence that extends past the immediate neighborhood of each error.

The translation analogy also exposes a problem with vocabulary. A system that assigns a distinct entry to every familiar syllable can learn a useful representation for entries it sees often. A strange spelling, however, is especially likely to fall outside that inventory, even though its written form may contain useful clues. Representing the input as individual characters preserves those clues at the cost of making sequences longer. The paper adopts a middle ground in which frequent pieces can be represented together and unfamiliar forms can be assembled from smaller units.

The method, step by step

Building a corrected sentence from an imperfect one

VSEC combines preprocessing, segmentation and sentence generation. Preprocessing normalizes some surface forms before they reach the neural component. Segmentation divides the resulting text into the units that component can read and produce. The encoder then represents the source sequence, and the decoder builds the corrected sequence from those representations and the output it has produced so far. In training, the expected output comes from the clean version of the source sentence.

How VSEC processes a sentence

The steps in order.

How VSEC processes a sentenceStep 1: Remove noise and normalize case and marks1. Remove noise and normalize case and marksStep 2: Repair merged and separated syllables2. Repair merged and separated syllablesStep 3: Segment syllables into learned subword tokens3. Segment syllables into learned subword tokensStep 4: Encode the source tokens with self-attention4. Encode the source tokens with self-attentionStep 5: Attend to the source while generating target tokens5. Attend to the source while generating target tokens

The authors initially state the task in terms of syllables. Each input sentence has a corresponding reference sentence whose syllables express the intended wording. The notation allows the source and target sequences to have different lengths. That flexibility matters because a change can involve more than replacing a syllable. A duplicated syllable has to disappear, for instance, and one removed from an otherwise complete sentence has to be recovered. When the architecture operates on sub-words, replacing a single syllable can also change the number of tokens.

X = {xⁱ}, xⁱ = (xⁱ₁, xⁱ₂, …, xⁱₙ)

X is the collection of source sequences. The braces indicate that it contains the sequences indexed by i. The superscript i identifies a sentence pair and is an index, not an exponent. The parentheses list the syllables of that input in order. The subscripts identify positions from the beginning of the sentence through n, its source length. The ellipsis stands for the intervening positions.

Y = {yⁱ}, yⁱ = (yⁱ₁, yⁱ₂, …, yⁱₘ)

Y is the collection of reference sequences. The superscript i identifies the same pair as in X. Each y with a subscript is the reference syllable at that position, and m is the reference length. The braces collect the sequences, the parentheses give their internal order, and the ellipsis again stands for the intervening syllables. The separate length symbols allow a source and its target to differ in length.

f: X → Y, with f(xⁱ) = yⁱ

The letter f represents the desired correction function. The arrow gives its direction, from the input collection X to the target collection Y. The expression inside the parentheses identifies the input to the function. The equality describes what successful correction would produce for pair i. Training is the process of learning a system that approximates this desired mapping on sentences it encounters.

Normalizing the written input

The first preprocessing operation removes characters that the authors consider unhelpful for learning sentence context. They give emojis and line breaks as examples. This makes the input closer to the sentence sequences used for training. The next operation converts upper-case text to lower-case. Normalizing the case lets examples written with different capitalization contribute to the same patterns in the data. For a reader following the pipeline, the important consequence is that the neural component receives text that has already undergone these transformations.

The system also standardizes the placement of Vietnamese marks. To do so, it converts a syllable to its Telex typing form and looks up the corresponding standardized spelling. Telex supplies a typed representation that the system can use as a lookup key. In the example, cuả yields the Telex form cuar, which the mapping turns into của. The operation resolves the placement of the mark through an explicit mapping before the sentence enters the learned correction architecture.

A further operation separates syllables that were accidentally joined. The authors use Peter Norvig’s word segmentation algorithm for this step. Its role is to use probabilities to judge how a joined string should be divided. The authors explain that when Vietnamese syllables are merged, the behavior of Vietnamese typing tools can leave the resulting string in Telex form. They therefore convert candidate Telex syllables to standard Vietnamese when calculating the probabilities used for segmentation. A probability associated with a familiar written syllable can then inform the decision even when the joined input uses the typing form.

The reverse problem arises when spaces appear inside a single syllable. Here the system needs to combine pieces already separated in the input. The authors use a trie, a tree-shaped data structure that can traverse shared prefixes. As successive characters are considered, a trie makes it possible to follow their beginning through a stored set of forms. This gives preprocessing a way to recognize candidate syllables that have been broken apart by erroneous spaces.

These operations concern different kinds of evidence. The mark mapping uses a known correspondence between representations. Splitting joined text uses probabilities over candidate segments. Joining separated pieces uses the ability to look for prefixes efficiently. The resulting sentence is what the sub-word tokenizer sees. As a consequence, the learned component can spend its capacity on the remaining choice of wording and spelling after these pre-defined transformations have been applied.

Learning an inventory of subwords

The paper’s example of nghành illustrates why token boundaries matter for correction. The full form is not a Vietnamese syllable, but it can be represented by the pieces ngh and ành. Giving the decoder and encoder access to those pieces preserves information about the written form. A representation based on complete syllables would need a way to handle the unfamiliar item as a whole. A character representation would preserve all the letters but require the system to process each of them separately.

Byte pair encoding, or BPE, learns which sequences of characters are common enough to treat as units. The authors describe starting with the characters of the corpus and appending /w to each syllable to mark its end. At that stage, the units within a syllable are individual characters together with the boundary marker. The marker tells the procedure where that syllable ends.

The algorithm counts adjacent token pairs in the current representation of the corpus. It replaces occurrences of the most frequent pair with a new token and adds that token to its inventory. The result of a merge can take part in a subsequent merge, since the next frequency count is taken over the updated tokenization. The vocabulary thus grows from individual symbols to include longer pieces that repeatedly occur together. The merge budget determines how much the vocabulary grows from its starting inventory.

BPE learns these pieces without examples labeled as errors and without a grammatical analysis of the sentences. Its information about what to merge comes from the frequency of adjacent units. The method can learn a piece that frequently appears inside a syllable, and it can also learn longer combinations for common forms. The paper uses this frequency-based segmentation to preserve detail about unfamiliar spellings without making every input as long as its character sequence.

The distinction between the syllable and the token persists through the rest of the method. The problem is posed in terms of syllables because that is the level at which the spelling decisions are evaluated. Inside the Transformer, positions refer to BPE tokens. A syllable broken into pieces therefore occupies several encoder positions, while another syllable can occupy a single position. When the decoder produces a corrected form, its decisions concern these pieces. The experiment ultimately evaluates whether the resulting syllable matches the reference.

The vocabulary is learned from the Vietnamese news corpus and has a size of 30,000 in the final setting. The authors use the BPE implementation in Hugging Face’s tokenization library and keep its other tokenizer settings at their defaults. The vocabulary size controls which distinctions can be represented by a single learned entry. It does not specify how many syllables the system knows, since vocabulary entries include pieces that can be reused in different syllables.

Encoding the source and generating the target

The system starts by mapping each source token to an embedding. An embedding is a vector, a list of numerical features that the network can work with. The same token has a vocabulary index and a corresponding entry in the embedding matrix. At this point, a token’s entry identifies the token. The encoder’s job is to build a representation that also reflects its use in this particular sentence.

E ∈ ℝᵈˣ|V|

E denotes an embedding matrix. The membership sign ∈ says that it belongs to the space of matrices with real-valued entries, denoted by ℝ. The dimensions are d by |V|. The letter d gives the number of features in an embedding, the multiplication sign separates the matrix dimensions, and |V| gives the size of the vocabulary V. The matrix holds an embedding for each vocabulary entry.

The encoder consists of a stack of L blocks, where L denotes the depth of the stack. Each block uses multi-head self-attention and a feed-forward network. Self-attention lets the representation at a position draw information from other positions in the same source. With several attention heads, the block can form several such combinations of information. The feed-forward network transforms the features that the block has computed. Repeating these operations produces source representations whose content can vary according to the sentence around each token.

hˢʳᶜ[1…n] = encoder(Eˢʳᶜ[x[1…n]])

Here x is the sequence of source token indices. The bracketed range from 1 through n selects all source positions, with n now denoting the length in tokens. Eˢʳᶜ is the source embedding matrix, and indexing it by those token indices retrieves the corresponding vectors. The superscript src identifies source-side quantities. The function encoder applies the stack of encoder blocks. Its output, hˢʳᶜ[1…n], is the sequence of contextual hidden states, meaning the internal vectors that represent the source at its different positions.

The decoder also uses a stack of L blocks. It has self-attention over the preceding target tokens and an additional layer that attends to the source states. The source attention gives the decoder access to the input sentence when choosing a correction. Attention over the target prefix gives it access to what has already been generated. When it produces part of an expression, it can use both the evidence from the source and the corrected wording it has begun to construct.

hₜ = decoder(Eᵗʳᵍ[y[1…t−1]], hˢʳᶜ[1…n])

The index t is the position of the next target token. The sequence y[1…t−1] contains the target token indices preceding it, with t−1 marking the final position of that prefix. Eᵗʳᵍ is the target embedding matrix, and trg identifies the target side. Indexing this matrix by the prefix retrieves those tokens’ vectors. The comma separates the inputs to decoder, which are the embedded target prefix and the source states hˢʳᶜ[1…n]. The resulting hₜ is the decoder’s hidden state for predicting the token at position t.

A final dense layer turns this state into a score for every target vocabulary entry. A dense layer uses a learned weight matrix to combine the features of its input. Softmax transforms the scores into probabilities whose total is 1.0. The paper writes the result using Pₜ(w). Showing the vocabulary lookup explicitly makes clear which part of the output vector corresponds to an individual token.

Pₜ(w) = [softmax(Wᵀ hₜ)]w

Pₜ(w) is the probability assigned to candidate token w at output position t. W is the learned weight matrix of the output layer. The superscript T means transposition, and the juxtaposition of Wᵀ and hₜ denotes matrix multiplication. The vector hₜ is the current decoder state. The function softmax normalizes the resulting vocabulary scores, and the final w selects the entry for that token from the probability vector.

This setup gives the correction system a way to respond to adjacent errors. Representations for the affected source positions can draw on the rest of the sentence. The decoder then uses those representations as it generates the corrected expression. Because its prediction also depends on the target prefix, the corrected part already generated can inform what follows. These are mechanisms through which a repair can remain coherent across several syllables. The architecture still has to learn from examples when those mechanisms should support a change and when they should support preserving the source.

Creating supervised examples from news text

Training requires pairs that show both the mistake and the intended wording. The authors start with 5 million sentences extracted from a Vietnamese news corpus collected from several websites. They use these sentences as clean targets for an artificial error generator. The generator creates source versions by altering syllables while retaining the original sentence as the output to learn. A clean corpus can in this way supply examples even though it did not arrive with corresponding erroneous versions.

One component of the generator is a table that associates each syllable with possible alternatives. The paper calls it a fusion table. Its candidates represent common confusions, including mistyping and consonant mistakes. When a selected syllable is to be replaced, the table supplies alternative spellings connected with that syllable. The point of this design is to expose the system to plausible substitutions, since an arbitrary replacement would frequently give it a different learning problem from a realistic spelling confusion.

The generator selects 8% of the syllables at random for corruption. Of the syllables selected for a change, 90% are replaced, 5% are removed and 5% are duplicated. Those operation percentages describe the selected syllables. Removal produces an input with a gap relative to its clean target, while duplication produces an extra occurrence. The authors include these operations to represent mistakes associated with copying and pasting. Together with replacement, they give the training procedure examples whose source and target can differ both in identity and in length.

The resulting sentences are tokenized for the Transformer. During training, cross-entropy measures how well the predicted probability distribution supports the reference token. A low probability for that token contributes a larger penalty, so the objective encourages the system to raise its probability in comparable contexts. The authors use Adam to update the learned parameters on the basis of that objective. The task faced by the optimizer is to produce the clean sequence, which requires it to reproduce the material that was already correct as well as to undo the generated changes.

Experiments and results

Testing on human mistakes

The training corpus and the test collection serve different purposes. The news sentences supply clean targets from which the authors can generate a large collection of paired examples. The test data instead come from 618 documents sampled at Tailieu, an educational materials website. The authors select lower-quality documents so that the collection will contain enough mistakes to test a corrector. As a consequence, the test asks whether patterns learned from synthetic errors are useful for errors present in actual text.

Three people work on three phases of labeling to correct the sampled material. The final test collection comprises 9,341 sentences with 11,202 spelling errors in 4,582 different types. The sentence count gives the size of the set of contexts, the error count gives the number of occurrences, and the count of different types describes the variety of errors in the collection. The authors make the human-error benchmark available through the VSEC project repository.

The source of the test set is important when interpreting the scores. Educational documents can contain expressions that are uncommon in news, even though both collections are written in Vietnamese. The test therefore combines a shift from synthetic to human-made errors with a shift in the kind of text being corrected. A system has to apply what it learned from one source while recognizing forms and uses that may occur more frequently in the other.

The authors rebuild the N-gram system as their principal comparison with earlier Vietnamese spelling correction. Its candidate scoring is based on local frequencies, which makes it the comparison most directly tied to the paper’s hypothesis about context. The experiments also include an attention-equipped bidirectional LSTM in a sequence-to-sequence setup and Transformer variants that use different token units. These variants follow the same training and testing process, with the news corpus used in building the baselines.

The authors give separate reasons for leaving specialized earlier methods out of the direct comparison. Tweet normalization and OCR correction address particular sources of erroneous text. Consonant correction targets a restricted error class. The test in this paper covers multiple kinds of errors in educational documents. Scores from specialized systems evaluated on their own tasks cannot establish how those systems would compare on the VSEC collection.

What detection and correction measure

The experiment counts outcomes at the syllable level. A successful detection identifies an actual spelling error. A successful correction goes further and supplies the reference repair. Precision measures how frequently an error flag leads to the outcome in question. Recall measures how much of the set of actual errors the system finds or fixes. The authors report precision, recall and F1 separately for detection and for correction.

DP = true detections ÷ detected errors

DP is detection precision. True detections count flags that identify actual spelling errors. Detected errors in the denominator count all the system’s error flags, including flags on acceptable forms. The division sign gives the share of flags that identify real errors.

DR = true detections ÷ actual errors

DR is detection recall. The numerator again counts true detections. Actual errors in the denominator are the errors in the reference data, including any that the system misses. The quotient gives the share of the reference errors that the system identifies.

DF = (2 × DR × DP) ÷ (DR + DP)

DF is detection F1. DR denotes detection recall, and DP denotes detection precision. The numerator multiplies those measures and scales the product by the constant 2. The denominator adds the same measures. The parentheses group the terms for the division. This is the harmonic mean, which gives a system a high F1 only when its precision and recall are both strong.

CP = true corrections ÷ detected errors

CP is correction precision. True corrections count successful repairs against the reference. Detected errors again count all the system’s error flags. The quotient therefore asks how often a flagged item ends in a correct repair. Flagging a genuine error and then supplying the wrong repair earns credit for detection while leaving the correction numerator unchanged.

CR = true corrections ÷ actual errors

CR is correction recall. True corrections again count successful repairs against the reference. Actual errors include all the reference errors, whether the system detected them or missed them. The quotient is the measure that directly answers what share of the test errors the system fixes.

CF = (2 × CR × CP) ÷ (CR + CP)

CF is correction F1. CR denotes correction recall, and CP denotes correction precision. The grouped numerator multiplies them and scales the result by 2. The grouped denominator adds them. Their quotient is the harmonic mean for the more demanding task of supplying the right repair.

The shared denominators make the two stages easy to distinguish. For precision, the starting population is the set of system flags. For recall, it is the set of reference errors. Within each measure, moving from detection to correction changes what earns credit in the numerator. The system has to give the right replacement in addition to locating the problem. This is also why a score combining precision and recall should be read differently from a statement about the fraction of mistakes fixed.

How the systems compare

On the human-error test set, VSEC records 86.8% detection F1. The rebuilt N-gram baseline records 81.2% detection F1. This comparison concerns the balance between flagging genuine errors and reaching enough of the errors in the reference. The authors report that the sub-word Transformer also performs better than the recurrent sequence-to-sequence baseline and the Transformer variants with other input units.

Detection F1 on the VSEC human-error test set

VSEC achieves a higher detection F1 than the rebuilt N-gram system.

Detection F1 on the VSEC human-error test setN-gram: 81.2N-gram81.2VSEC (this paper): 86.8VSEC (this paper)86.8
The numbers
System or settingF1 %
N-gram81.2
VSEC (this paper)86.8

For correction, VSEC reaches 81.5% F1 and the N-gram baseline reaches 79.3% F1 on the same test sentences. The paper separately reports that VSEC’s correction recall is greater than 76%. That recall statement concerns the share of reference errors successfully repaired. The F1 score combines that ability with how reliably the system’s flags lead to correct repairs.

Correction F1 on the VSEC human-error test set

VSEC leads the rebuilt N-gram system on the balance of correction precision and recall.

Correction F1 on the VSEC human-error test setN-gram: 79.3N-gram79.3VSEC (this paper): 81.5VSEC (this paper)81.5
The numbers
System or settingF1 %
N-gram79.3
VSEC (this paper)81.5

The N-gram system achieves the highest correction precision. The authors attribute this to a threshold, named error_threshold, that helps suppress false corrections. They report precision above 89% for that baseline in detection and in correction. The threshold makes a system more selective about acting on a candidate. When a system declines to flag doubtful cases, the remaining flags can be more reliable, while some actual errors go untouched. In the reported comparison, VSEC’s precision and recall are closer to one another.

That distinction matters when reading the paper’s overall result. F1 rewards a balance between avoiding bad changes and recovering enough actual errors. A precision result answers a narrower question about the flags the system does make. In this experiment the best correction precision and the best correction F1 belong to different systems. A reader can therefore use the two measures to see how the systems behave, instead of treating the F1 ordering as a ranking on every possible error cost.

The earlier N-gram study is described as achieving approximately 94% F1 on its own experimental data. The appropriate N-gram figures for assessing VSEC are the ones measured after the authors rebuild that approach and run it on the human-error test set. The earlier score comes from a different set of sentences. The rebuilt comparison puts both systems in front of the same errors and uses the same reference corrections to judge them.

What the ablations show

The unit of representation affects the outcome

The paper compares Transformer systems that use syllables, characters and BPE sub-words. These settings address a specific design choice within the sequence-to-sequence approach. A syllable-level vocabulary preserves short input sequences and assigns an entry to the whole written syllable. A character vocabulary keeps the spelling visible even for unfamiliar forms, but it expands the sequence that the system has to process. BPE uses frequent pieces to retain some of the advantages of each representation.

The sub-word setting performs best among these variants. The authors interpret its advantage over the syllable setting as evidence that smaller units help with out-of-vocabulary spellings. An unusual syllable can still be represented by learned pieces. They also find the sub-word setting more effective than the character setting, where every syllable is decomposed into the smallest units used in that comparison. Taken together, the rankings support the choice of BPE on this benchmark.

The experiment compares complete systems that use different units. Changing the unit affects vocabulary coverage, the number of input and output positions, and the kinds of patterns represented by individual entries. Consequently, the outcome is evidence for the sub-word configuration as a whole. The comparison leaves open how much of the gain comes from unfamiliar forms, how much comes from sequence length, and how much comes from the interactions between those properties during training.

The authors also compare the sub-word Transformer with an attention-equipped bidirectional LSTM in the same broad sequence-to-sequence formulation. The recurrent baseline performs relatively poorly. This shows that framing correction as translation is compatible with substantially different outcomes under the reported setup. The architecture used to learn the input-to-output mapping matters. The experiment compares these particular recurrent and Transformer configurations, so its evidential scope is the systems that were actually trained and evaluated.

More training examples help within the range tested

The authors vary how much training data VSEC receives. They report the best performance with 5 million sentences, the largest training size described for their procedure. This comparison gives evidence that the system benefits from the larger supply of examples in the experiment. Each additional source sentence can give the generator another context in which the correct spelling is known and an artificial error can be introduced.

The data-size comparison changes the amount of text available to the training procedure. It can therefore change both the variety of clean contexts and the variety of artificially corrupted examples. The paper’s interpretation is that more training data helps. The reported result leaves open how much of that benefit would come from additional examples with the same error patterns, greater diversity in the clean text, or coverage of rarer spelling forms. The comparison supports the data size chosen for the reported system within the conditions studied.

The vocabulary-size comparison asks a different question. As the vocabulary grows, common sequences can be represented by longer units, so fewer syllables need to be divided into multiple tokens. This can shorten the sequence the network processes. It can also change how much experience the network gets with each particular vocabulary entry and how often a substring is shared across different forms. Vocabulary size is consequently a choice about how to distribute information between individual entries and their combinations.

The best reported F1 in that comparison occurs at a vocabulary size of 30,000. Increasing the inventory beyond the selected size does not guarantee improvement in the authors’ experiment. This makes vocabulary size an empirical design choice. The segmentation comparison supports using sub-words in this setup, and the size comparison shows that different granularities within the sub-word approach can still give different results.

Adjacent errors illustrate the context hypothesis

The qualitative discussion returns to the case that motivated VSEC. The authors examine a sentence about getting a contract ready to sign. The intended expression for “ready” is sẵn sàng, but both syllables in the input are wrong. The N-gram system repairs the first syllable and leaves the second unchanged. VSEC supplies both parts of the intended expression.

The authors attribute the difference to the extent of the context available to the systems. The N-gram method uses a local window of two syllables on either side of the target. When one part of the window contains another error, evidence for the intended combination is weakened. The Transformer can use information elsewhere in the source sentence, and it can generate the expression as part of a target sequence. In this example, the sentence-level repair recovers a familiar expression from two individually corrupted parts.

The example establishes that the reported behavior occurs. It does not give a rate for adjacent-error repair or compare it with the rate for isolated errors. The paper makes a qualitative observation about the systems on neighboring mistakes and presents a case that explains why the context hypothesis is plausible. The aggregate detection and correction scores establish the overall advantage on the benchmark. A breakdown by the distance between errors would be needed to determine how much of that advantage comes from the specific case that motivated the architecture.

False detections reveal what the system changes too readily

The authors inspect a sample of 100 false detections from the test set. In this sample, 32% concern foreign words and acronyms, 28% are attributed to gaps in domain knowledge, and 40% have no specific type. These percentages describe the composition of the sampled false detections. They indicate which kinds of mistakes the authors encountered when examining cases where the system flagged acceptable text.

One example involves TH, an abbreviation for a company. VSEC changes it to the Vietnamese syllable Thì. The system has produced an ordinary-looking form, but the context calls for a company identifier. The example shows a requirement that goes beyond recognizing an unusual sequence of characters. The corrector needs evidence about the role of that sequence in the sentence before deciding whether its unusual spelling is a sign of error.

A mathematical example exposes a related problem with familiar syllables. The phrase Đồ thị means “graph” and is correct in a sentence about a quadratic function. VSEC changes it to Đô thị, meaning “city.” Here both forms consist of recognizable material. The information needed to preserve the source is the technical meaning of the expression in context. The authors connect the error to the difference between a test set with scholarly language and training text drawn from news.

These examples qualify the interpretation of the sub-word comparison. Representing an unfamiliar form is useful because it gives the system evidence to work with. The decision to preserve or replace that form still depends on what the system has learned about its use. In the company example, the unusual form is already right. In the mathematical example, a more familiar expression can be less appropriate for the sentence. Sub-word coverage helps the system represent the choices, while the correction task depends on judging between them.

Limitations

Limits identified by the authors

The authors identify foreign words and acronyms as a source of false positives. A system trained to transform unusual spellings into familiar ones can apply that behavior to an identifier or a borrowed form that should remain as written. Their analysis points to the need for evidence that distinguishes special forms from apparent mistakes. The sample gives a view of how often this issue arose among the inspected false detections, while the example shows the nature of the resulting change.

The authors also identify domain knowledge as a limitation. The educational documents contain scholarly usage that receives less coverage in the news corpus. The mathematical example makes the consequence concrete. Both the input and the replacement are spellable Vietnamese expressions, so the decision turns on knowing which one belongs in a discussion of a function. Access to the full sentence gives the system evidence, but its decision still depends on the associations learned from training.

The paper closes by proposing to extend the error generator to cover more kinds of spelling mistakes. This identifies a limitation in the range of synthetic examples used for training. Randomly introducing known confusions, removals and duplications gives the system explicit examples of those operations. Human writers can produce additional patterns outside that procedure. The authors also propose exploring pretrained approaches such as multilingual BERT. That direction is presented as future research, so the reported results concern the system trained for this experiment.

Limits of the experimental evidence

The test set provides direct evidence about human mistakes in documents from one educational source. The deliberate selection of lower-quality documents makes the set suitable for finding enough errors to compare correctors. That selection also sets the scope of the reported precision and recall. In cleaner material, the ratio of acceptable forms to errors would differ, so the effect of incorrect flags on the overall user experience could differ as well. The paper does not report a corresponding evaluation on a broadly sampled collection of Vietnamese text.

The benchmark score also combines the effects of two changes between training and testing. The training errors are introduced artificially, while the test errors were produced by people. At the same time, the source of the underlying language changes from news to educational material. The results demonstrate performance across that combined shift. They leave open how much each shift contributes to successes and failures. A benchmark with news text containing human mistakes, or an educational test set with controlled artificial errors, would address a different part of that question.

The random corruption process is a practical way to create paired training examples. Its description assigns operations to selected syllables and uses a table of plausible alternatives. Human errors can depend on the expression being written and on the writer’s habits, knowledge or pronunciation. The reported experiment does not compare these distributions or establish how well the generator reproduces dependencies between mistakes. The natural-error test shows that the synthetic training transfers to some extent, even though the similarity of the training and test error processes is unmeasured.

The comparisons also leave the contributions of several pipeline choices unresolved. Preprocessing standardizes marks, handles certain spacing problems and normalizes case. The generator includes removal and duplication in addition to replacement. The paper evaluates token units and varies the amount of data and the size of the vocabulary. It does not report separate scores for removing each preprocessing step or each corruption operation. The overall result therefore applies to the pipeline as configured. It cannot establish how much of the improvement comes from a particular normalization rule or added operation.

Similarly, the comparison between the tested Transformer and the rebuilt N-gram system changes more than the span of the accessible context. The Transformer generates a sequence from learned states, while the N-gram method works with local counts, candidate rules and a threshold. The success on the contract sentence is consistent with the broader-context explanation. A controlled comparison that varied the accessible context within the same architecture would be needed to isolate that factor from the other differences between the systems.

The paper’s main scores aggregate syllable decisions. They establish how successfully the systems identify and repair errors under those metrics. A sentence can still contain a conspicuous error after receiving credit for other successful repairs. The reported scores also do not separately show whether the system preserves capitalization, formatting and other properties affected by preprocessing. These are distinctions between the evaluated correction task and the requirements of applications that need a faithful, ready-to-use document.

Finally, the sample of false detections describes the kinds of unexpected changes the authors found among the cases they inspected. The 32% involving foreign words and acronyms, for example, does not give the share of all foreign words and acronyms that VSEC changes incorrectly. That would require a count of such occurrences throughout the test set. Similarly, the 28% attributed to domain knowledge measures the authors’ assessment of sampled failures, instead of a topic-by-topic error rate. The categories support the qualitative diagnosis without supplying prevalence estimates for those forms across the corpus.

What came after

The later citing work in this line is Crossing Linguistic Horizons, published in 2024. Its stated subject is fine-tuning and comprehensive evaluation for Vietnamese. Fine-tuning means adapting a previously trained system by continuing its training for a target language or task. VSEC, by comparison, investigates a specific correction task by pairing artificially corrupted news sentences with clean targets and testing the resulting system on human errors.

The connection established by the citation is to the broader study of how to adapt and evaluate language technology for Vietnamese. VSEC contributes a task-specific case in which the source of training examples and the choice of evaluation data affect what a result can establish. The later paper’s title places its evaluation in a wider setting. The citation alone leaves open whether that work reused VSEC’s error generator, its sub-word configuration or its benchmark, so it does not establish a direct extension of the correction pipeline.

Cite

Cite as Dinh-Truong Do, Ha Thanh Nguyen, Thang Ngoc Bui and Dinh Hieu Vo. 2021. VSEC: Transformer-based Model for Vietnamese Spelling Correction. arXiv:2111.00640.

The paper itself, not this page. BibTeX from the library's record of the work. arXiv 2111.00640

@misc{do2021vsec,
  title = {{VSEC: Transformer-based Model for Vietnamese Spelling Correction}},
  author = {Dinh-Truong Do, Ha Thanh Nguyen, Thang Ngoc Bui and Dinh Hieu Vo},
  year = {2021},
  eprint = {2111.00640},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2111.00640}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/do-2021-vsec-transformer-based-model-vietnamese/

References

25 references, from the paper's own bibliography.

  1. Ahmad, F., Kondrak, G.: Learning a spelling error model from search query logs. In: Proceedings of Human Language Technology Conference and Conference on Empirical Methods in Natural Language Processing. pp. 955–962 (2005) OpenAlex ↗ · Scholar ↗
  2. Büyük, O.: Context-dependent sequence-to-sequence turkish spelling correction. ACM Transactions on Asian and Low-Resource Language Information Processing (TALLIP) 19(4), 1–16 (2020) OpenAlex ↗ · Scholar ↗
  3. Choudhary, H., Pathak, A.K., Saha, R.R., Kumaraguru, P.: Neural machine translation for english-tamil. In: Proceedings of the third conference on machine translation: shared task papers. pp. 770–775 (2018) OpenAlex ↗ · Scholar ↗
  4. Church, K.W., Gale, W.A.: Probability scoring for spelling correction. Statistics and Computing 1(2), 93–103 (1991) OpenAlex ↗ · Scholar ↗
  5. Devlin, J., Chang, M.W., Lee, K., Toutanova, K.: Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805 (2018) our card
  6. Gao, J., Quirk, C., et al.: A large scale ranker-based system for search query spelling correction (2010) OpenAlex ↗ · Scholar ↗
  7. Gong, H., Li, Y., Bhat, S., Viswanath, P.: Context-sensitive malicious spelling error correction. In: The World Wide Web Conference. pp. 2771–2777 (2019) OpenAlex ↗ · Scholar ↗
  8. Gu, S., Lang, F.: A chinese text corrector based on seq2seq model. In: 2017 International Conference on Cyber-Enabled Distributed Computing and Knowledge Discovery (CyberC). pp. 322–325. IEEE (2017) OpenAlex ↗ · Scholar ↗
  9. Huong, N.T.X., Dang, T.T., Le, A.C., et al.: Using large n-gram for vietnamese spell checking. In: Knowledge and Systems Engineering, pp. 617–627. Springer (2015) OpenAlex ↗ · Scholar ↗
  10. Li, M., Zhu, M., Zhang, Y., Zhou, M.: Exploring distributional similarity based models for query spelling correction. In: Proceedings of the 21st International Conference on Computational Linguistics and 44th Annual Meeting of the Association for Computational Linguistics. pp. 1025–1032 (2006) OpenAlex ↗ · Scholar ↗
  11. Nguyen, H.T., Dang, T.B., et al.: Deep learning approach for vietnamese consonant misspell correction. In: International Conference of the Pacific Association for Computational Linguistics. pp. 497–504. Springer (2019) OpenAlex ↗ · Scholar ↗
  12. Nguyen, P.H., Ngo, T.D., Phan, D.A., Dinh, T.P., Huynh, T.Q.: Vietnamese spelling detection and correction using bi-gram, minimum edit distance, soundex algorithms with some additional heuristics. In: 2008 IEEE International Conference on Research, Innovation and Vision for the Future in Computing and Communication Technologies. pp. 96–102. IEEE (2008) OpenAlex ↗ · Scholar ↗
  13. Nguyen, Q.D., Le, D.A., Zelinka, I.: Ocr error correction for unconstrained vietnamese handwritten text. In: Proceedings of the Tenth International Symposium on Information and Communication Technology. pp. 132–138 (2019) OpenAlex ↗ · Scholar ↗
  14. Nguyen, V.H., Nguyen, H.T., Snasel, V.: Normalization of vietnamese tweets on twitter. In: Intelligent Data Analysis and Applications, pp. 179–189. Springer (2015) OpenAlex ↗ · Scholar ↗
  15. Norvig, P.: Natural language corpus data. Beautiful data pp. 219–242 (2009) OpenAlex ↗ · Scholar ↗
  16. Reynaert, M.W.: Character confusion versus focus word-based correction of spelling and ocr variants in corpora. International Journal on Document Analysis and Recognition (IJDAR) 14(2), 173–187 (2011) OpenAlex ↗ · Scholar ↗
  17. Sennrich, R., Haddow, B., Birch, A.: Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909 (2015) our card
  18. Tacorda, A.J., Ignacio, M.J., Oco, N., Roxas, R.E.: Controlling byte pair encoding for neural machine translation. In: 2017 International Conference on Asian Language Processing (IALP). pp. 168–171. IEEE (2017) OpenAlex ↗ · Scholar ↗
  19. Taghva, K., Stofsky, E.: Ocrspell: an interactive spelling correction system for ocr errors in text. International Journal on Document Analysis and Recognition 3(3), 125–137 (2001) OpenAlex ↗ · Scholar ↗
  20. Takahashi, H., Itoh, N., Amano, T., Yamashita, A.: A spelling correction method and its application to an ocr system. Pattern Recognition 23(3-4), 363–377 (1990) OpenAlex ↗ · Scholar ↗
  21. Thue, A.: Uber die gegenseitige lage gleicher teile gewisser zeichenreihen. Kra. Vidensk. Selsk. Skrifer, I. Mat. Nat. Kl. pp. 1–67 (1912) OpenAlex ↗ · Scholar ↗
  22. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A.N., Kaiser, Ł., Polosukhin, I.: Attention is all you need. In: Advances in neural information processing systems. pp. 5998–6008 (2017) our card
  23. Wint, Z.Z., Ducros, T., Aritsugi, M.: Spell corrector to social media datasets in message filtering systems. In: 2017 Twelfth International Conference on Digital Information Management (ICDIM). pp. 209–215. IEEE (2017) OpenAlex ↗ · Scholar ↗
  24. Wint, Z.Z., Ducros, T., Aritsugi, M.: Non-words spell corrector of social media data in message filtering systems. Journal of Digital Information Management 16(2) (2018) OpenAlex ↗ · Scholar ↗
  25. Zhou, Y., Porwal, U., Konow, R.: Spelling correction as a foreign language. arXiv preprint arXiv:1705.07371 (2017) OpenAlex ↗ · Scholar ↗