---
title: "Detection-Correction Structure via General Language Model for"
description: "DeCoGLM finds likely grammatical errors before filling in local corrections, preserving the rest of the sentence and reducing unnecessary edits."
canonical: "https://research.elamur.ai/free/en/papers/li-2024-detection-correction-structure-general-language/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/li-2024-detection-correction-structure-general-language/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2024](https://md.research.elamur.ai/free/en/papers/2024/) / Detection-Correction Structure via General Language Model for Grammatical Error Correction

# Detection-Correction Structure via General Language Model for Grammatical Error Correction

Paper · 2024 · Wei Li and Houfeng Wang

**Authors:** [Wei Li](https://md.research.elamur.ai/free/en/authors/wei-li/) and [Houfeng Wang](https://md.research.elamur.ai/free/en/authors/houfeng-wang/) · **Year:** 2024 · **Venue:** Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

[Cited by **16** papers in our library of more than 163,000 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/li-2024-detection-correction-structure-general-language/cited-by/) · Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/2024.acl-long.96/)
- [PDF](https://aclanthology.org/2024.acl-long.96.pdf)
- [DOI 10.18653/v1/2024.acl-long.96](https://doi.org/10.18653/v1/2024.acl-long.96)
- [arXiv 2405.17804](https://arxiv.org/abs/2405.17804)

## Summary

A sentence can need a grammatical correction even when nearly all of its wording is worth keeping. In [grammatical error correction](https://md.research.elamur.ai/free/en/topics/grammatical-error-correction/), the aim is to repair the errors with as little disturbance as possible. A system that generates an entire revised sentence has the freedom to make difficult repairs, but that freedom also lets it change acceptable wording. The authors propose DeCoGLM, a system that first decides where a sentence might need attention and then generates text for those places. It uses one [General Language Model (GLM)](https://md.research.elamur.ai/free/en/papers/du-2022-glm-general-language-model-pretraining/) for both jobs.

The detector assigns each input token a label. KEEP preserves the token, ERROR marks existing text for possible replacement or removal, and INSERT identifies a place where text may be missing. The labels produce a template in which suspect spans become blanks and potential insertions get blanks of their own. The corrector sees the original sentence as well as the template and generates the contents of each blank, one token at a time. It can put the original words back when a span was wrongly flagged, or leave an insertion blank empty. The system copies the portions outside the blanks into the result directly.

The authors train the two tasks together using a weighted objective and restrict which parts of the training input each prediction can see. The detector learns from labels derived by aligning original and corrected sentences. The corrector first learns from blanks placed using those alignments, then practices on templates that also contain some of the detector’s false alarms. At inference time, the authors can adjust how readily the detector proposes an edit. Thresholds selected on the BEA-19 development set gave an F₀.₅ of 63.5 there and 74.43 on the BEA-19 test set. This metric rewards both making the right edits and finding enough of the required ones, with more weight on the former.

Across English and Chinese benchmarks, DeCoGLM surpassed the earlier detection–correction systems in the paper’s comparison and reached the highest or second-highest F₀.₅ on three datasets. A separate experiment found that a small detector could help a larger corrector, with gains driven chiefly by higher edit precision. On English data, adding a detector’s suggestions to GPT-4 prompts produced a similar pattern. The labels themselves require no language-specific edit inventory, and the paper tests the architecture in English and Chinese. Applying the integrated design at larger scales remains open. The authors used lightweight adaptation for the larger open systems they studied as correctors, without full-parameter fine-tuning, and did not include an open corrector above 13B in that adaptation study.

## Deep dive: Detection-Correction Structure via General Language Model for Grammatical Error Correction

DeCoGLM finds likely grammatical errors before filling in local corrections, preserving the rest of the sentence and reducing unnecessary edits. · about 34 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### What a correction is supposed to preserve

For a reader revising a sentence, finding an error and deciding how to fix it are distinguishable judgments. A missing word can be apparent from the surrounding sentence before the reader settles on what to supply. An existing phrase can sound wrong even though several replacements might work. There is also a judgment about what to leave alone. A sentence may admit a smoother rewrite while already being acceptable in the respects that a grammatical correction system is supposed to check.

That last judgment matters in the applications the authors describe. In language learning, a correction can indicate where the learner’s own text needs attention. The paper also points to improving speech recognition output and assisting with the labeling of text data. In these settings, the result may need to preserve wording that has nothing to do with the error. A method that repairs a local defect while keeping the surrounding text makes a different kind of intervention from a method that produces a new version of the sentence.

The benchmarks discussed in the paper reinforce this distinction by favoring minimal edits. They evaluate proposed changes against reference corrections. A system can produce a fluent sentence and still lose credit for altering words the reference leaves untouched. Conversely, a system that rarely changes anything may make mostly sound edits while leaving many reference errors unresolved. The architectural question is how to give the system enough freedom to generate appropriate repairs while controlling which parts of the sentence it can revise.

#### Generating a sentence or predicting edits

In the paper’s account, sequence-to-sequence correction, abbreviated Seq2Seq, treats the source and the corrected sentence as sequences of tokens. The system reads the source and produces the corrected sequence. This formulation accommodates many kinds of changes because the generator can choose the next token from its vocabulary and continue for as long as the output requires. It can replace a word, supply missing material, or express a correction that changes several tokens. Training typically uses paired examples of erroneous and corrected text.

The authors describe previous work that improved this approach through synthetic training examples, changes in the training schedule, and reranking, which scores proposed outputs again to choose among them. The paper places [BART](https://md.research.elamur.ai/free/en/papers/lewis-2020-bart-denoising-sequence-sequence-pre/) and [T5](https://md.research.elamur.ai/free/en/papers/raffel-2019-exploring-limits-transfer-learning-unified/) in this line of work. It also discusses systems that supply additional information to the generator, such as a description of the sentence’s syntactic structure. These changes can improve what the generator chooses to produce. In a full-sentence system, it still has to produce the unchanged words as part of its output.

The authors identify a computational cost in that last requirement. When generation proceeds token by token, copying an acceptable stretch of the input consumes decoding steps. The longer the unchanged stretch, the more of the computation goes towards producing material the system already has. The authors also see a problem with letting a generator decide again on every word. Prior assessments of GPT systems, including [the study of ChatGPT’s fluency in grammatical correction](https://md.research.elamur.ai/free/en/papers/fang-2023-chatgpt-highly-fluent-grammatical-error/) and [the evaluation of GPT-3.5 and GPT-4](https://md.research.elamur.ai/free/en/papers/coyne-2023-analyzing-performance-gpt-3-5/), found unnecessary changes to be a problem for benchmark performance. The paper refers to this behavior as over-correction.

Sequence-to-edit methods, or Seq2Edit, instead describe the output by specifying operations on the input. A tag can say to keep a token or alter it, so the system can preserve parts of the source without generating them again. The paper traces token-level editing from [LaserTagger](https://md.research.elamur.ai/free/en/papers/malmi-2019-encode-tag-realize-high-precision/) through approaches such as [PIE](https://md.research.elamur.ai/free/en/papers/awasthi-2019-parallel-iterative-edit-models-local/) and [GECToR](https://md.research.elamur.ai/free/en/papers/omelianchuk-2020-gector-grammatical-error-correction-tag/). It also discusses [Seq2Edits](https://md.research.elamur.ai/free/en/papers/stahlberg-2020-seq2edits-sequence-transduction-using-span/), which works with edits over spans of text.

The editing approach makes the scope of a proposed change explicit and can give high precision. The drawback identified in the paper is the effort needed to design useful edits and grammatical transformations. An inventory that expresses how to change particular word forms can depend on the language. It also places part of the burden of correction on the inventory itself. A tagger needs a way to express the required change, whether that means selecting an operation, choosing its argument, or making a series of edits. DeCoGLM’s detector has a smaller responsibility. It identifies a location and says whether the operation can affect existing text or should open space for new text. A separate prediction within the same system determines the wording.

#### Using detection to define the correction

Earlier work already treated grammatical error detection as a task in its own right. The paper cites [sequence labeling for error detection in learner writing](https://md.research.elamur.ai/free/en/papers/rei-2016-compositional-sequence-labeling-models-error/), where the output attaches judgments to positions in the sentence. Other work provided such judgments to a correction system as extra evidence. A generator could use the indications when composing the revised sentence, while retaining the ability to regenerate material elsewhere. In TemplateGEC, for example, the detector’s output supplements the input to the generator.

A different approach uses mask placeholders to indicate where new text should appear. The authors describe earlier systems that draw on the masked prediction approach associated with [BERT](https://md.research.elamur.ai/free/en/papers/devlin-2019-bert-pre-training-deep-bidirectional/). In the methods they discuss, the available masks constrain how much text the corrector can produce. That makes choosing the number of placeholders consequential when the system is still deciding what the repair should be. SpanDC comes closer to the arrangement the authors pursue. It finds suspect spans and uses a separate generator to correct them, allowing flexible local edits and reducing the work of producing a full sentence.

GLM offers a way to model a blank as the location of a text piece, with the contents generated sequentially. A detector can therefore expose a span without having to predict the length of the repair. A blank for a suspect span can represent a replacement of a different length or a deletion, and an insertion blank can receive a phrase. The shared structure in DeCoGLM adds a separate question to this design. If the same backbone learns both where to look and what to write there, can it handle each task better than dedicated systems trained on the same material? The paper addresses that question separately from whether local generation is an efficient way to assemble a corrected sentence.

### The method, step by step

#### From a sentence to a set of blanks

Think of the detection output as instructions for making a template. A detector reads the complete source, so it can judge a token in the context of the other tokens. KEEP leaves text in place. A contiguous run of ERROR labels becomes a single `MASK`, even if the run covers several tokens. INSERT adds a `MASK` at the indicated position while preserving the existing text there. If every prediction is KEEP, the system returns the input directly. Otherwise it gives the original sentence and the template to the corrector, whose generated pieces are placed back into the blanks.

The paper’s architecture illustration uses an abstract sequence to show why a mask is a place to write instead of a prediction about output length. One region in the source consists of two consecutive tokens. A single token takes their place in the target. Later in the sentence, a pair of tokens is added between stretches of preserved source text. The detector’s template gives each of these changes a blank. The difference in lengths comes from what the corrector generates for those blanks, so the detector needs neither a tag for shortening a span by a particular amount nor a tag for inserting a phrase of a particular length.

How DeCoGLM corrects an input sentence The steps in order.

A mask also gives the second stage room to reconsider. If the detector replaces an acceptable span with a blank, the corrector can recover the original words because it receives the source. If an insertion is unnecessary, the corrector can supply an empty piece. An empty piece has a different effect at an ERROR span, where it removes the material the blank replaced. The meaning of an empty output thus comes from the template. It can either decline an insertion or complete a deletion.

This gives rise to an asymmetry. A false alarm can, in principle, be undone during infilling. A required edit that has no corresponding blank generally remains inaccessible because the preserved intervals are copied as they are. The authors use this asymmetry to justify what they call aggressive detection. The detector is trained to pay special attention to finding ERROR and INSERT cases, taking advantage of the corrector’s opportunity to leave a flagged location unchanged. Whether the corrector takes that opportunity is a learned behavior addressed by the training procedure.

#### From source tokens to detection probabilities

The starting point is a tokenized source sentence. [Tokenization](https://md.research.elamur.ai/free/en/concepts/tokenization/) divides the input into the units the system reads and predicts. The paper writes the sequence as follows.

```
𝐱ₛ = xₛ¹ xₛ² … xₛⁿ
```

Here `𝐱ₛ` is the source sequence and the subscript `s` marks it as coming from the source. Each `xₛ` with a superscript is the token at the indicated position. The sequence starts at position `1`, ends at position `n`, and `…` stands for the intervening tokens. Juxtaposition places tokens in sequence.

An input position receives one detection label. The desired sequence of labels comes from aligning the original sentence with its reference correction.

```
𝐝 = d₁ d₂ … dₙ,   dᵢ ∈ L = {K, E, I}
```

The vector `𝐝` holds the detection labels. Each `dᵢ` is the label at source position `i`, and the labels run from the first token through `n`, the length of the source. The membership symbol `∈` means that each label belongs to the set `L`. The braces enumerate its members. `K` stands for KEEP, `E` for ERROR, and `I` for INSERT. The ellipsis represents the labels between the endpoints.

The backbone turns the source tokens into contextual representations, which are numerical descriptions of the tokens informed by the rest of the input. The detector uses these descriptions to make its judgments at individual positions.

```
𝐡ₛ = hₛ¹ hₛ² … hₛⁿ = GLM(𝐱ₛ)
```

`GLM(𝐱ₛ)` is the backbone applied to the source sequence `𝐱ₛ`. Its output `𝐡ₛ` consists of one hidden representation per source token. A term such as `hₛ¹` denotes the hidden representation at the indicated source position, `n` is the final source index, and `…` covers the intervening positions.

A prediction head is the part of the system that converts a hidden representation into scores for a particular task. In this setup, the detection head uses a feed-forward network whose sole hidden layer has the same dimensionality as GLM’s hidden representations. A softmax takes its scores and returns a probability distribution over the labels.

```
p(d̂ᵢ = l | 𝐱ₛ) = Softmax(FN(hₛⁱ))[l],   l ∈ L
```

`p` denotes a probability. `d̂ᵢ` is the predicted label at position `i` and `l` is a candidate from the label set `L`. The vertical bar means that the probability is conditioned on the source `𝐱ₛ`. `FN` is the feed-forward network acting on the hidden representation `hₛⁱ`. `Softmax` converts the network’s scores into label probabilities, and `[l]` selects the probability for label `l`. The paper’s prediction equation refers to the whole output distribution on its right-hand side. The selection notation makes explicit which entry corresponds to the label on the left.

#### Turning labels into the input for infilling

The template records the locations that can change and retains the intervening source text. In the notation below, the subscript after `s` identifies a preserved interval rather than a single source position.

```
𝐱ₘ = 𝐱ₛ₁ m₁ 𝐱ₛ₂ m₂ … mₖ 𝐱ₛ₍ₖ₊₁₎
```

`𝐱ₘ` denotes the complete masked template. Each `𝐱ₛᵢ` is a preserved part of the source and `mᵢ` is the `MASK` at the corresponding blank. `k` is the number of blanks, so the sequence ends with the interval indexed by `k + 1` after the last blank. The ellipsis stands for intervening masks and preserved intervals. Juxtaposition indicates concatenation in sentence order.

During training on aligned pairs, the same segmentation describes the desired correction. Each piece of reference text associated with a blank will become a target for the generator. The completed sentence has this form.

```
𝐲 = 𝐱ₛ₁ 𝐜₁ 𝐱ₛ₂ 𝐜₂ … 𝐜ₖ 𝐱ₛ₍ₖ₊₁₎
```

`𝐲` is the corrected target sentence. `𝐜ᵢ` is the desired text piece for blank `i`. Each `𝐱ₛᵢ` is a segment to copy from the source, `k` counts the blanks, and `k + 1` indexes the final preserved interval. The ellipsis represents the middle of the alternating sequence. A text piece can be empty, in which case placing it in the template contributes no tokens.

These equations separate the parts of the output that are copied from the parts that must be predicted. In the paper’s illustrated replacement, the blank covers more source tokens than the corrected piece contains. The source tokens covered by the blank remain available as evidence in `𝐱ₛ`. They cease to be compulsory output. For the illustrated insertion, the two sides of the blank come straight from the source and the corrector supplies only the new phrase. By representing both examples with the same alternation of preserved text and generated pieces, the design gives the generator a consistent job across edit types.

#### Predicting the contents of a blank

GLM was pretrained to generate the contents of blanks autoregressively. Within a piece, this means it predicts the next token using the preceding tokens. DeCoGLM adapts that capability to correction. It adds the original sentence to the conditioning information, alongside the masked template. The original helps the system recognize what was there before the template was made. The template identifies which material it should produce and where that material belongs.

```
p(ĉᵢ,ⱼ = w | 𝐱ₛ, 𝐱ₘ, 𝐜₍<ᵢ₎, 𝐜ᵢ⁽<ʲ⁾)
  = GLMH(𝐱ₛ, 𝐱ₘ, 𝐜₍<ᵢ₎, 𝐜ᵢ⁽<ʲ⁾)[w],   w ∈ V
```

`p` denotes a probability and `ĉᵢ,ⱼ` is the predicted token at position `j` in piece `i`. `w` is a candidate token belonging to the vocabulary `V`. The conditioning inputs after the vertical bar are the source `𝐱ₛ`, the template `𝐱ₘ`, the pieces `𝐜₍<ᵢ₎` preceding piece `i`, and the prefix `𝐜ᵢ⁽<ʲ⁾` comprising positions earlier than `j` in the current piece. The less-than signs give these index ranges. `GLMH` is GLM with its original token prediction head, and `[w]` selects the vocabulary entry for `w` from its distribution. As with the detection equation, the bracket notation identifies the entry that corresponds to the event on the left.

An earlier generated piece can therefore inform a later one. Local generation describes the portions of the sentence that can change, while the prediction for each portion can use context beyond that location. The paper’s architecture illustration also retains GLM’s position IDs and block position IDs. These distinguish a piece’s original location in the sentence from the order of the tokens within that piece. The first kind of position information associates the generated material with its blank. The second distinguishes successive positions as the system writes that material.

#### Preventing the detector from seeing the answers

In joint training, GLM receives the original sentence, the masked template, and the correction pieces in the same organized input. The two heads read from the positions relevant to their respective tasks. The detection head needs source representations and the generation head needs representations for predicting correction tokens. Giving everything to the same backbone makes sharing possible, but the source representations must be computed with a crucial restriction.

An attention mask determines which positions may contribute information to a token’s representation. If source positions could use the template during training, the detector could see where the reference-derived blanks had already been placed. If they could read the answer pieces, they would have access to still stronger clues about what to mark. At inference time the detector must act before those pieces or even the template exist. The paper modifies the visibility pattern so detection depends on the source alone. The correction predictions can use the source and template and the parts of the generated sequence that precede them, following GLM’s autoregressive ordering for the pieces.

The attention illustration gives a way to read these restrictions. A colored cell shows that the token at the row position can use the token at the column position. The paper marks the connections removed from the original GLM attention pattern. The diagram concerns information flow during computation, whereas `MASK` in the template is an input token that reserves a place for generated text. The design needs both. A blank tells the corrector where to write, and the attention mask governs what evidence the detector and corrector may use when producing their predictions.

This is also how the paper reconciles joint training with an ordered procedure at inference. When training examples already have their templates and answer pieces, both objectives can be computed from a shared input with the appropriate visibility restrictions. At inference the necessary template depends on predictions, so the system first reads the source for detection. It then uses the source and the newly constructed template for generation. The shared parameters serve both passes.

#### Giving detection and correction their own objectives

Most source positions carry KEEP. If learning were dominated by ordinary, easy KEEP decisions, the detector could devote too little attention to the less frequent labels needed to open blanks. The authors use Focal Loss to reduce the influence of already confident predictions and use class weights to give additional emphasis to ERROR and INSERT.

```
ℓᴅ = −𝛂ᴅ (1 − pθ(𝐝 | 𝐱ₛ))ᵞ log(pθ(𝐝 | 𝐱ₛ))
```

`ℓᴅ` is the detection loss. `𝛂ᴅ` contains the weights associated with the target labels `𝐝`. The term `pθ(𝐝 | 𝐱ₛ)` represents the probabilities the system with parameters `θ` assigns to the reference detection labels when given the source `𝐱ₛ`. The notation is compact for the token-level classification objective. `log` denotes the logarithm, and the minus sign makes the penalty increase as the assigned probability falls. The factor formed from `1` minus the probability, raised to the power `γ`, downweights examples whose target label already receives high probability. The authors set `γ` to 2, the KEEP weight `αₖ` to 1, and the shared ERROR and INSERT weight `αₑᵢ` to 2.

The class weight and the focusing factor do different things. A difficult KEEP prediction can still matter because the focusing factor depends on confidence. An ERROR or INSERT target gets the higher class weight because of its label. In combination, the two choices make the training objective less responsive to easy KEEP examples and assign more weight to recognizing edit locations.

The correction objective is cross-entropy for the next token. It penalizes the system for assigning low probability to the reference token at each prediction position in a correction piece.

```
ℓᴄ = −∑ᵢ,ⱼ log(pθ(cᵢ,ⱼ | 𝐱ₛ, 𝐱ₘ, 𝐜₍<ᵢ₎, 𝐜ᵢ⁽<ʲ⁾))
```

`ℓᴄ` is the correction loss. The summation sign `∑` adds the contributions over pieces `i` and within-piece positions `j`. `cᵢ,ⱼ` is the reference token at that position, and `pθ` is the probability assigned by the system with parameters `θ`. The information after the vertical bar consists of the source `𝐱ₛ`, the masked version `𝐱ₘ`, reference pieces earlier than `i` in `𝐜₍<ᵢ₎` and the reference tokens earlier than `j` in `𝐜ᵢ⁽<ʲ⁾`. The logarithm `log` and leading minus sign give a larger loss when the probability of a reference token is smaller.

The joint objective combines the two losses after averaging them at token level.

```
ℓ = ℓ̄ᴄ + wᴅ ℓ̄ᴅ
```

`ℓ` is the loss minimized when training DeCoGLM. `ℓ̄ᴄ` and `ℓ̄ᴅ` are the token-level means for correction and detection. `wᴅ` multiplies the detector’s mean loss before it is added to the corrector’s. Its value is 10 in the authors’ configuration. This multiplier balances the scales of the two tasks. The class weights inside the detection loss still govern the weight given to different kinds of token decisions.

#### Teaching the corrector to handle false alarms

In the first stage of supervised [fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/), called SFT1, the authors derive detection labels and correction targets from aligned source and target sentences. Pieces that align can provide the preserved intervals. Sites where the two sentences differ supply the operations and the contents of the blanks. This construction gives the detector reference labels and gives the corrector a template based on reference edit locations. It supplies a clear initial task for both heads.

At inference, a detector can mark places where the reference would have made no change. A corrector trained entirely on reference templates would have learned from blanks associated with genuine changes. Restoring acceptable text or declining an insertion is central to the design’s tolerance of false alarms, so the second stage makes those outcomes part of the training data.

For SFT2, the authors run the SFT1 detector on the training set. They incorporate false-positive ERROR and INSERT predictions when constructing new templates and answer pieces. An extra blank that covers acceptable source text gets a target that restores what was removed. A superfluous insertion receives an empty target. The detection targets remain the original alignment-derived labels. Predicted false positives are therefore used to make correction inputs more realistic while the detector continues to learn that the corresponding positions should have been preserved.

This augmentation teaches a response to mistakes the detector actually makes on the training material. It differs from task-specific synthetic pretraining. Synthetic grammatical errors create examples of source sentences that need correction. The added blanks in SFT2 can instead make a correction example look as though it needs an edit at a location where its target sentence calls for preservation. In both cases there is a target sentence to recover. The source of the difficulty changes from an error in the source to an error in the instructions that tell the corrector where to act.

#### Controlling the detector and separating the stages

At inference, the detector exposes label probabilities before the template rule is applied. The authors use these values to adjust the amount of text made eligible for correction. If the probability of KEEP exceeds the threshold `δ`, the prediction is set to KEEP. If the probability `pₑ` of ERROR falls below its lower bound `ϕₑ`, that probability is set to zero for the decision. The same rule applies to the INSERT probability `pᵢ` and its lower bound `ϕᵢ`. These rules can favor preserving tokens that would otherwise be marked for correction. The authors choose settings by a greedy search on a validation set, first settling a KEEP threshold and then searching the lower bounds for the other two labels.

The control acts before generation. Raising the evidential requirements for an edit can remove a potential blank from the template, which protects the corresponding words but also removes the corrector’s chance to repair them. Once a blank is available, the corrector can still produce a successful edit, restore source text, or make an unnecessary change. Changing the thresholds does not retrain its ability to make those choices. It changes the collection of locations on which those choices are made.

The paper also separates the detector and corrector into DeGLM and CoGLM. DeGLM uses the detection objective, while CoGLM uses the correction objective and receives the source and the detector-derived template. This arrangement makes it possible to choose a much larger backbone for generating the repairs while retaining a small detector. The authors use detection-enhanced training for the larger CoGLM, following the idea of the second fine-tuning stage. For adapting these larger correctors under resource constraints they use [LoRA](https://md.research.elamur.ai/free/en/papers/hu-2021-lora-low-rank-adaptation-large/), a parameter-efficient technique that learns a low-rank adaptation. They report that parameter-efficient adaptation was ineffective for bringing the detection task into the integrated architecture, where labeling tokens differs from what GLM was pretrained to do.

### Experiments and results

#### Training data, test sets, and measures

For the base-sized English systems, the authors first train for correction on C4-200M, a synthetic dataset, and fine-tune on cleaned Lang8, called CLang8. This task-specific synthetic training begins with an existing GLM backbone. The English backbone is `glm-roberta-large`. For the larger English CoGLM, the authors use the `glm-10b` backbone and a smaller fine-tuning collection comprising [FCE](https://md.research.elamur.ai/free/en/papers/yannakoudakis-2011-new-dataset-method-automatically-grading/), [NUCLE](https://md.research.elamur.ai/free/en/papers/dahlmeier-2013-building-large-annotated-corpus-learner/), and W&I+LOCNESS. The large configuration skips the extra synthetic correction pretraining stage.

The English evaluations use the CoNLL-14 and BEA-19 test sets. CoNLL-14 is evaluated with the M² Scorer, and BEA-19 with ERRANT. The BEA-19 development set is used for selection. The authors also post-process English predictions to bring their tokenization into closer agreement with the evaluation data. That matters for interpreting a reported score as the product of an entire evaluation procedure, including how the output and references are segmented for the scorer.

For Chinese synthetic pretraining, the authors begin with text from the People’s Daily corpus and introduce rule-based insertions, replacements, and deletions. In the main description of fine-tuning, the route for the MuCGEC evaluation uses Chinese Lang8 and HSK, while the FCGEC route uses the FCGEC training set. The base backbone is `glm-large-chinese`. The larger corrector uses `glm-10b-chinese`, and the large-system recipe uses Chinese Lang8 and FCGEC for the respective settings. The authors evaluate the MuCGEC and FCGEC test sets with ChERRANT. The resulting comparison covers a common correction architecture applied with language-specific backbones, training material, and scoring.

The main outcome is edit-level F₀.₅. Precision describes how much of the system’s proposed editing is credited against the reference. Recall describes how much of the reference editing the system recovers. F₀.₅ combines them with greater emphasis on precision. The ordering of systems by this measure can consequently favor a system that proposes fewer edits when the edits it retains are more reliable. For the paper’s architecture, this is important because a detector can change the number and placement of blanks before the generator starts. An overall score can improve even when some reference errors go uncorrected as a result.

During training the authors also use development measures for early stopping. AD-Accuracy adds the detector’s ERROR recall, its INSERT recall, and the generator’s accuracy at predicting the next token. This gives the difficult edit labels explicit weight in deciding whether training has improved. General-Accuracy uses a geometric mean of the recalls for the detection labels and the next-token prediction accuracy. These are checks on the two component tasks. The benchmark scores describe the assembled sentence after the detector’s decisions and the corrector’s generated pieces have both taken effect.

#### What the systems were compared with

The main comparison concerns individual systems trained on paired source and correction data, without a reranker. GECToR represents editing by tags. Systems based on BART and T5 represent full-sequence generation, and SynGEC supplies syntactic information to a BART-based system. The authors reproduce GECToR and BART results for Chinese using their own data setup. The English BART comparison comes from the SynGEC paper. The other earlier results include systems trained with different data configurations, so the main comparison situates DeCoGLM among existing results instead of holding all aspects of training fixed.

The prior detection–correction systems cover several ways of combining the two tasks. SpanDC uses a span detector followed by a generator. Multi-Encoder supplies error categories as extra encoded information. GEC-DePend uses masked prediction in its correction procedure. TemplateGEC uses detections from GECToR to inform a sequence-to-sequence system. These are relevant because an advantage over a full-sentence generator alone would leave open whether DeCoGLM improved on earlier ways of detecting errors and correcting selected parts of a sentence.

The comparisons at larger scale are organized separately. The authors adapt ChatGLM2, ChatGLM3, and [Llama 2](https://md.research.elamur.ai/free/en/papers/touvron-2023-llama-2-open-foundation-fine/) as full-sentence correctors where applicable, using [Baichuan 2](https://md.research.elamur.ai/free/en/papers/yang-2023-baichuan-2-open-large-scale/) for the Chinese comparison in place of Llama 2. They report that those open comparison systems and CoGLM (10B) use the same task fine-tuning data in their respective settings. GPT-4 is a distinct experiment. The authors prompt it in a zero-shot setting, meaning they evaluate the chosen instruction without task-specific weight updates or demonstration examples, and compare prompting with and without a detector’s masked template. The Chinese prompts are direct translations of the corresponding English ones, and the API version is Preview-0315.

#### Benchmark performance and a selected operating point

DeCoGLM attains the highest or second-highest F₀.₅ on three of the English and Chinese evaluation datasets. In the authors’ comparison it leads the earlier detection–correction systems when backbone parameter count is taken into consideration. The integrated arrangement also achieves higher F₀.₅ in most cases than the pipeline with separate DeGLM and CoGLM backbones, in spite of using half the parameters of that pair. The shared system used in the associated component analysis is 335M, and each of the separate backbones is also 335M. That setup tests the use of a shared backbone against separately training each task at the same backbone size.

For the threshold experiment, the strongest KEEP-only setting on the BEA-19 development set was `δ = 0.38`, with an F₀.₅ of 63.2. The authors fixed that setting and then searched the other thresholds. With `ϕₑ = 0.5` and `ϕᵢ = 0.6`, development F₀.₅ reached 63.5. The same selected configuration scored 74.43 F₀.₅ on the BEA-19 test set. The development numbers compare decision settings on a common split. The test number evaluates the configuration chosen by that search on a separate split.

DeCoGLM detection controls on BEA-19 development F₀.₅ Adding lower bounds for the edit labels improved the score over the best setting using the KEEP threshold alone.

**The numbers**

| System or setting | F₀.₅ |
| --- | --- |
| KEEP threshold alone | 63.2 |
| KEEP threshold with ERROR and INSERT bounds (this paper) | 63.5 |

The paper reports that pairing a small detector with a large local corrector improves performance across the datasets in its open-system comparison. The gains come chiefly from precision, with some loss of recall. This is consistent with the structure taking away opportunities to make unnecessary edits as well as some opportunities to make useful ones. It is also a distinct result from the comparison of integrated and separate base-sized systems. The large-corrector experiment asks what happens when a powerful generator is given local work. The integrated experiment asks what happens when detection and correction share parameters.

When GPT-4 receives detection information in its prompt, the paper reports a similar precision-oriented tendency on the English data. Supplying a template in a prompt gives the system guidance about where the trouble may be. In CoGLM, the template is part of the correction input and the output is constructed from its preserved text and generated pieces. The prompt experiment shows that detector suggestions can be helpful even when passed through a different interface. The result described in the paper is clearest for English.

#### How fast local correction was in the timing test

The timing comparison uses the CoNLL-14 and BEA-19 test sets. The systems in this experiment are trained exclusively on CLang8. They run on an NVIDIA RTX 4090 with inference batch size 1, using beam search and without adjusting inference hyper-parameters for the comparison. Beam search keeps alternative token sequences under consideration during decoding. Under these conditions, the authors describe local correction as `≈3x` as fast as their full-sentence Seq2Seq comparison, with slightly better correction performance in that timing experiment.

The source of the proposed efficiency is visible in the output construction. The detector still takes a pass over the sentence and the corrector uses the original as context. The generation work is concentrated on the contents of the blanks. The timing experiment measures whether the shorter generation workload pays off after accounting for the detection procedure in the tested setting. Its conditions matter because the amount of text preserved, the cost of a detection pass, and the way the system is batched all affect the work involved.

The authors identify GECFramework as the release containing their implementation and associated trained weights. The training described in the paper uses PyTorch and the Trainer in the transformers package. All experiments use the fixed seed 111, and the reported results are from single runs. That experimental choice determines how much evidence the reported directions provide about variability across separate training runs.

### What the ablations show

#### Whether sharing helps both tasks

The authors measure detection and correction separately to find out whether the integrated result is visible in the component tasks. They train the integrated DeCoGLM, a separate detector, and a separate corrector on the same dataset without the second-stage data enhancement. Each uses a 335M backbone. They evaluate overall detection accuracy, recall on ERROR, recall on INSERT, and accuracy at predicting the next token in a local correction piece. This makes it possible to look at the difficult detection categories separately from overall accuracy, which includes the many KEEP positions.

The paper reports stronger detection and correction from the integrated system in this comparison. This goes beyond showing that its final sentence scores are good. With augmentation excluded, the result supports the authors’ interpretation that learning the objectives together helps performance on both tasks. A system with a useful detector alone could still struggle to generate the right replacements. Likewise, a corrector that predicts answer tokens well on prepared examples could still receive poor proposals from a detector. The component measures let the authors examine both parts under the simpler training setup.

Each separate component has a backbone as large as the integrated one, so the pair uses a larger total parameter budget. The authors also identify an equal-total-budget comparison using separate backbones of 167.5M each as a fairer test of parameter allocation. They lacked a suitable GLM backbone near that size. Their expectation that the integrated advantage would grow in that situation remains a hypothesis. The performed comparison supports shared training at the available backbone size.

#### Loss weights and the meaning of a label

The loss-weight study focuses on the supervised fine-tuning stages. In preliminary training on CLang8, the authors observed that the scales of the two losses differed by approximately an order of magnitude. They set `wᴅ` to 10 initially, varied the choice of detection loss and the weight for ERROR and INSERT, and then checked other values for the overall task weight. The comparisons include ordinary cross-entropy for detection and Focal Loss with different class weighting. The authors found that Focal Loss with a moderate increase in emphasis on ERROR and INSERT worked well. Their selected combination was `αₑᵢ = 2` and `wᴅ = 10`.

The order of this search helps clarify what its result means. The within-task study asks how strongly the detector should learn from edit labels relative to KEEP. The between-task study asks how much the detector’s average loss should contribute relative to generation. The selected values worked together in the authors’ preliminary setup. The comparison establishes a suitable configuration for the experiments and provides a reason for giving the detection loss a multiplier in spite of the use of token-level means.

The label comparison changes the interface between the tasks. In the two-label version, KEEP and ERROR suffice to encode insertions if the system replaces an existing token with that same token followed by the new material. The representation is expressive enough to encode the intended output, but it makes preservation of the original token part of the generator’s task. With a distinct INSERT label, the original token stays in the template and the corrector needs to supply only the additional material.

The four-label version gives DELETE its own label. In the tested template this operation removes text directly, so the generator cannot restore a token deleted by mistake. The selected three-label design puts possible deletions inside ERROR. The corrector can complete the deletion by generating an empty piece or choose to supply text at the location. The authors report that the three-label scheme performs better overall in this comparison. Their explanation concerns what each tag commits the system to do. A separate INSERT preserves existing text around missing material, while a common ERROR label keeps a decision about replacement or removal open until the correction stage.

#### Synthetic training and the choice of backbone

The main ablation includes configurations with and without training on large-scale synthetic errors. The authors report a consistent improvement from this training for the English and Chinese systems in the tested configurations. The synthetic data give the backbone practice with the correction problem before supervised adaptation on the chosen fine-tuning data. In Chinese, for example, rule-based corruption supplies pairs in which text has been inserted, replaced, or taken out. That training is evidence that artificial examples can help in this experiment. The gain is measured on the eventual correction benchmarks, where the tests are distinct from the synthetic training material.

The authors also implement the local detection–correction arrangement on BART. They attach the detector to its encoder, which represents the source, and use the decoder to generate the correction pieces. This makes the BART variant relevant to a narrower question than the main comparison with full-sentence BART. Both the tested variant and DeCoGLM detect places to change and decode pieces. The authors report that the GLM-based version consistently performs better in the ablation.

They offer two explanations. GLM is already pretrained to generate missing pieces, making the correction objective familiar to its backbone. Its shared structure may also make the relationship between detection and generation more direct than in the BART variant, where those functions are attached to the encoder and decoder respectively. The experiment changes both the pretraining setup and the way computation is shared. It shows the advantage of the tested GLM configuration while leaving the contributions of those explanations unresolved.

#### Training on imperfect templates and adjusting thresholds

Fine-tuning on reference-derived templates improves performance over the condition trained only on synthetic correction examples. Adding SFT2 then improves F₀.₅ consistently in the ablation comparisons that differ in the second stage. The authors report that this additional improvement mainly comes from higher precision, with recall staying relatively steady. That is consistent with the intended effect of practicing on false alarms. The corrector gains experience declining changes that have been proposed at acceptable locations.

The threshold intervention also improves F₀.₅ in the ablation, using the same trained weights. Its effect on recall is stronger than that of SFT2. Across the GLM configurations with detection control, recall stays below 50% on the CoNLL-14 test set and below 65% on the BEA-19 test set. The thresholds act by preventing some proposed changes from reaching generation at all. Consequently they can improve the mix of edits that are made and also leave some required repairs without a blank. SFT2 instead teaches the generator how to behave when it receives an extra blank. The difference in how the two interventions affect recall is informative about how they reach higher precision.

The development-set search reveals more about that tradeoff. After finding the KEEP threshold, the authors vary the two edit-label bounds and plot the resulting precision and recall. Most tested configurations fall within a region of the plot that the authors interpret as the attainable frontier for their detector control. The selected setting lies close to the point where that boundary meets the favorable F₀.₅ contour. In practical terms, making the detector more permissive can recover more reference edits while also admitting more mistakes, and a stricter setting can do the reverse. The reported choice reflects what the benchmark metric values and what this trained system can achieve under the tested controls.

The frontier figure concerns moving the decision point of a fixed trained system. It complements the training ablation, which asks whether changing the examples improves the corrector itself. Both affect the final number of credited and uncredited edits. The ablations show why a higher F₀.₅ needs to be read alongside precision and recall. Similar gains on the combined metric can come from learning to handle detections better or from admitting fewer detections in the first place.

### Limitations

#### Limits identified by the authors

The paper evaluates an architecture and leaves out several enhancements shown to help earlier Seq2Seq systems. The authors name syntactic information, refinement of the training data, and reranking with an additional system. These would change different parts of the experiment. Syntax could add evidence about the sentence, data refinement could alter what the system learns from, and reranking could change the final choice among generated outputs. The experiments leave open how much those additions would help local correction or change the relative performance of the approaches.

The authors also identify a resource limit at larger scale. Their experiment with a large corrector preserves the separation between detector and generator. They did not fine-tune all parameters of a large backbone to learn both tasks jointly. They attribute the difficulty to the difference between the sequence labeling needed for detection and the generative behavior learned in pretraining. Their large-corrector investigation under task adaptation does not include systems above 13B. GPT-4 is evaluated separately through prompts. The paper therefore provides evidence at larger scale for supplying detection information, while leaving the large-scale integrated architecture to future experiments.

In the ethics statement the authors point out that a localized correction can still alter a fact. They single out changes involving [named entities](https://md.research.elamur.ai/free/en/topics/named-entity-recognition/) as a concern. The template restricts how much text can be rewritten directly. A short replacement in the wrong place can still change who or what a sentence is about. The architecture makes the affected region visible, and the grammatical benchmarks measure the quality of edits against references. Neither property establishes that every generated correction preserves the source’s factual meaning.

#### Limits of the comparisons and measurements

The study evaluates English and Chinese. The detector’s label set avoids named grammatical transformations for a particular language, which makes it possible to describe the same procedure in both. The implementations still depend on language-specific backbone choices and training data, and the authors use different scoring arrangements. The experiments support reuse of the design across the tested languages. They leave open how it behaves with other tokenization schemes, other distributions of errors, or training data with different kinds of aligned corrections.

The main comparisons also mix reproduced baselines with numbers reported by other papers. A benchmark ranking can show how well DeCoGLM performs relative to those published systems, but several factors besides architecture may contribute. In particular, earlier systems can have different synthetic pretraining and fine-tuning data. The separate-task comparison and the ablations offer more control over individual choices. The BART variant still changes both the backbone’s pretraining and the division of work between its parts, so it cannot isolate one of those factors as the cause of the difference.

The experiments use one fixed random seed, so variation across training runs is unmeasured. This matters when comparing close development scores or evaluating the expected stability of the threshold selection. The BEA-19 search finds a good setting for that development split and the authors report its performance on the corresponding test split. The paper does not establish that the same thresholds suit different datasets or applications. A setting that favors precision under F₀.₅ can miss repairs that would be important in an application with greater concern for recall.

There are related limits to what the component measures can establish. Overall detection accuracy includes KEEP, so it can obscure how the system does on the locations that need changes. ERROR recall and INSERT recall address that issue for the detector. Next-token prediction accuracy gives a separate view of the corrector, while the exact quality of an assembled sentence also depends on how multiple token predictions interact and which locations were made editable to begin with. The paper reports component measures and end-to-end edit scores because those are different measurements of the same process.

Timing is similarly tied to the specific experiment. The approximate speed advantage comes from the English test sets under a single-device, batch-size-1 setup using beam search. The study does not measure how the advantage changes as sentences require a larger share of their text to be generated. The architecture implies that the amount of work saved depends partly on how much material can be copied. A separate timing study would be needed to quantify that relationship or to characterize throughput under larger batches.

Finally, the second training stage focuses on false positives for which a corrector can learn to restore or decline an edit. A missed detection gives the corrector no dedicated opportunity to fix that site. If a detector places the blank at an unsuitable boundary, the correction remains limited by the surrounding source that the template preserves. This structural dependence helps explain why improvements in precision and coverage can come apart. The generator’s flexibility is greatest within the regions the detector opens, and the benchmark performance depends on whether those regions give it access to the errors the reference expects it to repair.

### What came after

The citation from [LLMs Know More Than They Show](https://md.research.elamur.ai/free/en/papers/orgad-2024-llms-know-more-than-they/) comes from work on how hallucinations are represented internally. Its subject connects to the distinction between what a system’s representations reveal and what its generated text says. In DeCoGLM, a hidden representation supports a separate prediction about the source, and that prediction is then used to guide generation. The later paper concerns hallucinations, so the connection is at the level of making a judgment about linguistic output separately from producing it. The citation alone does not establish that the authors used DeCoGLM’s labels, its infilling architecture, or its training method.

[CSRP](https://md.research.elamur.ai/free/en/papers/tian-2026-csrp-chain-thought-reasoning-chinese/) cites DeCoGLM in subsequent work on Chinese text correction. It frames correction as a chain-of-thought reasoning task trained with reinforcement learning and uses rewards that account for efficiency. DeCoGLM addresses efficiency by restricting generation to detector-selected spans. CSRP’s stated approach places efficiency in the reward for the reasoning and correction procedure. The citation connects the two approaches to Chinese correction, while leaving open whether CSRP reuses any part of DeCoGLM’s implementation or adopts its explicit detection stage.

## Cite

Cite as Wei Li and Houfeng Wang. 2024. Detection-Correction Structure via General Language Model for Grammatical Error Correction. Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/2024.acl-long.96](https://doi.org/10.18653/v1/2024.acl-long.96) · [arXiv 2405.17804](https://arxiv.org/abs/2405.17804)

```bibtex
@inproceedings{li2024detection,
  title = {{Detection-Correction Structure via General Language Model for Grammatical Error Correction}},
  author = {Wei Li and Houfeng Wang},
  booktitle = {Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
  year = {2024},
  doi = {10.18653/v1/2024.acl-long.96},
  eprint = {2405.17804},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.18653/v1/2024.acl-long.96}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
