Abstract
Standard neural language models (LMs) are typically trained on positive examples—grammatically correct text—often resulting in limited proficiency with complex syntactic structures. This study investigates the impact of incorporating explicit negative examples (ungrammatical sentences) during training. We introduce a novel token-level margin loss that enables LSTMs to achieve near-perfect accuracy on several syntactic benchmarks. However, results also indicate that certain structures, such as object-relative clauses, present a persistent challenge, suggesting architectural limitations in sequential models.
Introduction
While modern language models exhibit high fluency, they often struggle with deep syntactic rules, particularly long-distance dependencies. A prominent failure mode is subject-verb agreement across intervening clauses (e.g., "The author that the guards like laughs"). Standard training objectives, which focus on next-token prediction in valid text, provide a weak signal for learning what constitutes an ungrammatical sequence. This research explores whether explicitly showing models "what not to do" through negative examples can bridge this gap.
Methodology: Learning from Negative Examples
The study evaluates four methods for integrating negative examples (e.g., swapping a singular verb for a plural one in context) into the training process:
- Binary-classification loss: A secondary task where the model predicts if the next verb should be singular or plural.
- Unlikelihood loss: Explicitly penalizing the probability of an incorrect token.
- Sentence-level margin loss: Ensuring the log-likelihood of a correct sentence is higher than its ungrammatical counterpart by a set margin ($\delta$).
- Token-level margin loss: Enforcing a margin specifically between the log-probability of the correct and incorrect tokens at the exact position where the error occurs.
The token-level margin loss emerged as the most effective approach, providing a localized signal that forces the model to distinguish between specific grammatical alternatives.
Experimental Setup
Models were trained on an 80-million-token English Wikipedia corpus. Evaluation utilized the Marvin and Linzen (2018) test set, covering subject-verb agreement, reflexive anaphora, and negative polarity items (NPIs). To specifically address the difficulty of Object Relative Clauses (ORCs), the authors augmented the training data with up to 0.8 million additional ORC examples parsed from Wikipedia.
Results and Discussion
Syntactic Robustness and Perplexity
The token-level margin loss significantly improved performance. On subject-verb agreement tasks, LSTM accuracy rose from the 80-90% range to nearly 100%. Crucially, this improvement came with a minimal increase in perplexity (approximately 1.0 point), indicating that the model's general language modeling capabilities were preserved. As shown in the performance plots, the token-level margin loss provides a more stable and effective learning signal than sentence-level alternatives.
The "Object Relative Clause" Wall
Despite the success on most structures, agreement across ORCs remained difficult. While the margin loss improved baseline scores (from ~50-75% to ~89-94%), performance still lagged behind simpler constructions. Even with an 8x increase in specific ORC training data, a performance ceiling was observed, suggesting a fundamental limitation in how sequential models track state across specific types of nested structures.
Generalization and Challenges
Ablation studies confirmed that the models learn abstract syntactic patterns rather than merely memorizing specific verb pairs. However, polysemous words (e.g., "like" as a verb vs. preposition) remain a hurdle due to their frequent appearance in varied contexts, which complicates the learning signal even with negative examples.
Conclusion
Explicit negative supervision, particularly via token-level margin loss, acts as a powerful catalyst for unlocking the latent syntactic capacity of LSTMs. However, the persistent difficulty of object-relative clauses suggests a fundamental "hard limit" for sequential architectures. Future research should investigate if these limitations extend to other architectures, such as Transformers, or if they reflect a universal challenge in neural sequence processing.
Summary updated