Abstract
Neural approaches to Natural Language Generation (NLG) have been promising for goal-oriented dialogue. One of the challenges of productionizing these approaches, however, is the ability to control response quality, and ensure that generated responses are acceptable. We propose the use of a generate, filter, and rank framework, in which candidate responses are first filtered to eliminate unacceptable responses, and then ranked to select the best response. While acceptability includes grammatical correctness and semantic correctness, we focus only on grammaticality classification in this paper, and show that existing datasets for grammatical error correction don't correctly capture the distribution of errors that data-driven generators are likely to make. We release a grammatical classification and semantic correctness classification dataset for the weather domain that consists of responses generated by 3 data-driven NLG systems. We then explore two supervised learning approaches (CNNs and GBDTs) for classifying grammaticality. Our experiments show that grammaticality classification is very sensitive to the distribution of errors in the data, and that these distributions vary significantly with both the source of the response as well as the domain. We show that it's possible to achieve high precision with reasonable recall on our dataset.
Introduction: The Need for a Safety Net
While neural networks have revolutionized how we generate dialogue, they lack a "safety net." In a production environment—like a virtual assistant—showing a user a sentence that is garbled or factually wrong (e.g., "It is 3 celsius with cloudy skies with snow") is a dealbreaker.
The industry standard has been the Generate & Rank framework: generate several candidates and use a statistical ranker to pick the "best" one. However, the authors argue this is insufficient. Rankers often conflate naturalness (how human it sounds) with acceptability (is it actually correct?). Furthermore, existing datasets for Grammatical Error Correction (GEC) are based on human learners, but neural models don't make "human" mistakes. They make "model" mistakes, like stuttering or missing specific units of measurement, which standard tools fail to catch.
Methodology: The Filter Step
The authors propose adding an explicit Filter step between generation and ranking. This filter acts as a gatekeeper, discarding any response that doesn't meet a high bar for grammaticality.
They explored two primary supervised learning approaches for this filter:
- CNN-based Classifier: A Convolutional Neural Network designed for sentence classification. They also tested a version that includes a "source" feature (identifying which model generated the text).
- LM-GBDT: They trained a 7-gram Language Model (LM) on clean, human-written weather responses. They then extracted statistical features from this LM (like geometric mean of n-gram probabilities) and fed them into Gradient Boosted Decision Trees (GBDT).
To ensure the models focused on sentence structure rather than specific facts, they used delexicalization—replacing specific entities like "London" or "73 degrees" with placeholders like __location__ and __num__.
Dataset and the "Model Error" Signature
The paper introduces a significant new resource: a Weather Domain NLG Dataset consisting of 33,000 model-generated responses from four different systems: two types of Semantically Conditioned LSTMs (SC-LSTM), a vanilla LSTM (GenLSTM), and a Retrieval-based system (IR). Each response was human-annotated for both grammaticality and semantic correctness.
A key insight is that neural models have unique failure modes. While humans might struggle with verb tense, models are more likely to repeat words or produce "ungrammatical n-grams" that a human would never write.
Comparing this to the NUCLE (CoNLL-2014) corpus—the gold standard for human grammatical errors—showed that model errors and human errors do not overlap significantly. State-of-the-art GEC models trained on general human text performed poorly on this dataset because they weren't looking for the types of "stuttering" and "missing context" errors that neural generators produce.
Experimental Results
In production, the cost of a "False Positive" (letting a bad sentence through) is much higher than a "False Negative" (rejecting a good sentence). The authors optimized their filters for 98% precision, accepting lower recall to ensure user-facing quality.
The CNN-based filter achieved a 72.8% recall at 98% precision when incorporating "source awareness." In a traditional "Ranker" setup, an ungrammatical response was picked as the top choice 29.4% of the time. With the "Filter + Ranker" framework, this dropped to just 2.4%. Interestingly, filtering for grammar also improved semantic correctness (dropping errors from 8.2% to 0.75%), suggesting that when a model's grammar breaks down, its logic usually does too.
Conclusion
Grammaticality classification is very sensitive to the distribution of errors in the data, which vary significantly with both the source of the response as well as the domain. While the proposed framework significantly improves production safety, challenges remain. If the filter rejects all generated candidates (which happened in 12% of scenarios), the system needs a "safe fallback," like a hard-coded template. Future work will focus on detecting semantic "hallucinations" and generalizing these findings across more diverse conversational topics.
Summary updated