Introduction
While state-of-the-art natural language processing (NLP) models achieve human-level performance on benchmarks like GLUE, these models are typically trained on "clean" text from sources like Wikipedia. In real-world applications, however, input is often noisy, containing grammatical errors from non-native speakers or casual communication. This study investigates the robustness of popular language encoders—BERT, RoBERTa, and ELMo—against natural grammatical errors, exploring how these errors disrupt internal representations and downstream task performance.
Methodology
To simulate realistic noise, the researchers utilized the NUS Corpus of Learner English (NUCLE) to identify common human error patterns. They developed "confusion sets" for eight primary error types, including preposition swaps, verb form changes, and subject-verb agreement (SVA) issues.
The study employed two main evaluative techniques:
- Adversarial Attacks: Using black-box search algorithms (Greedy, Beam, and Genetic), the authors identified specific grammatical perturbations that maximized performance drops across tasks like sentiment analysis (SST-2) and paraphrase detection (MRPC).
- Linguistic Probing: To determine if models "understand" grammar, a small classifier was trained on top of frozen encoder layers to test their ability to detect and locate errors within a sentence.
Comparative Robustness and Performance
A primary finding is that RoBERTa consistently outperforms BERT and ELMo in terms of robustness. This is likely due to its more extensive pre-training regime. Under adversarial conditions, models showed varying degrees of vulnerability. For instance, ELMo's performance on the MRPC task dropped significantly, with attack success rates reaching over 80%.
Internal Representations and Layer Specialization
Probing experiments revealed that "grammaticality" is a property learned through context rather than simple vocabulary. Contextual layers significantly outperformed static embedding layers (Layer 0) at identifying errors. In BERT, middle layers (7-9) were most effective at detecting the presence of an error, while higher layers were better at locating errors involving long-range dependencies, such as subject-verb agreement.
Key Insights
- The Harm Hierarchy: Not all errors impact models equally. Word Choice (Wchoice) and Subject-Verb Agreement (SVA) cause the most significant degradation in downstream performance, whereas errors in articles or prepositions are often handled gracefully.
- Local Impact: Cloze test analysis using BERT’s Masked Language Model objective showed that grammatical errors primarily disrupt the prediction of immediate neighbors, typically within a 2-3 token radius.
- Effective Defense: The study found that adversarial training—augmenting the training set with simulated grammatical errors—is highly effective. For BERT on the MRPC task, this strategy recovered accuracy from 46% to 82% on noisy data without sacrificing performance on clean datasets.
Conclusion
While modern language encoders possess a degree of inherent robustness, natural grammatical errors remain a significant challenge for reliable NLP deployment. The research highlights that robustness is largely a product of contextual learning and can be significantly bolstered through targeted data augmentation. Future work should expand this analysis to morphologically rich languages and generative decoder-only models.
Summary updated