Introduction
Modern writing assistants rely on Transformer-based models for Grammatical Error Correction (GEC). While these models provide high accuracy, their real-time performance is often hampered by the autoregressive decoding bottleneck. In standard Transformer architectures, the decoder generates tokens sequentially, preventing parallelization and causing noticeable latency during online inference. Researchers from Peking University and Microsoft address this with Shallow Aggressive Decoding (SAD), a framework designed to make GEC instantaneous.
Methodology: Shallow Aggressive Decoding
The SAD framework introduces two primary architectural and procedural innovations to bypass the sequential bottleneck.
Aggressive Decoding Strategy
GEC is fundamentally a "low-edit" task; the output sentence typically shares a high degree of similarity with the input. SAD exploits this by employing an aggressive "copy-and-verify" strategy. Instead of generating one token at a time, the model assumes the input is largely correct and attempts to decode multiple tokens in parallel.
As shown in the figure above, the process involves:
- Parallel Prediction: The model predicts multiple tokens simultaneously.
- Bifurcation: If a predicted token differs from the input (e.g., changing "inform" to "give"), a bifurcation occurs. The model accepts the correct tokens up to that point and reverts to standard one-by-one decoding.
- Suffix Matching: Once the sequential decoding aligns back with the original input (a "suffix match"), the system switches back to parallel aggressive decoding.
Asymmetrical Architecture: The Shallow Decoder
Traditional Transformers use balanced architectures (e.g., 6 encoder and 6 decoder layers). However, while encoder computations are parallelizable on GPUs, decoder computations are sequential. SAD optimizes this by shifting the computational load to the encoder. By using a 9-layer encoder and a 3-layer decoder (9+3), the model maintains its parameter count while significantly reducing the time spent in the non-parallelizable decoding phase.
Experimental Setup and Datasets
The SAD model was evaluated on standard English benchmarks, including CoNLL-2014 and BEA-2019, as well as the Chinese NLPCC-2018 shared task. Training utilized a combination of public datasets (Lang-8, NUCLE, FCE) and a massive 300M sentence-pair synthetic dataset for pre-training to reach state-of-the-art performance.
Key Results and Analysis
SAD achieves a significant performance leap in inference speed without compromising correction quality.
Speed and Efficiency
The approach delivers up to a 10× speedup over standard Transformer-big models on GPUs and a 7x–8x speedup on standard CPUs. Crucially, aggressive decoding is mathematically guaranteed to produce the exact same output as standard greedy decoding, ensuring zero loss in quality. The model achieved state-of-the-art results on English benchmarks, scoring 66.4 $F_{0.5}$ on CoNLL-14 and 72.9 $F_{0.5}$ on BEA-19.
As illustrated in the figure above, the speedup is closely tied to the edit ratio. Sentences requiring fewer changes—typical in GEC—benefit the most from parallelization, with speedups occasionally exceeding 20x for very clean inputs. Conversely, highly garbled sentences that require total rewrites see lower speed gains as the model frequently hits bifurcation points.
Conclusion
Shallow Aggressive Decoding redefines the efficiency limits of GEC. By leveraging the inherent similarity between input and output in correction tasks and rebalancing the Transformer architecture, SAD enables high-quality, real-time writing assistance. This data-driven, language-independent approach holds promise for other low-edit tasks such as text simplification and style transfer.
Summary updated