Introduction
In the field of software engineering, automated testing is essential for identifying bugs and ensuring system reliability. For Natural Language Processing (NLP) models, these tools typically function by mutating an existing input—such as changing "I love this movie" to "I hate this movie"—to see if the model's prediction remains consistent with the expected label. However, this process is frequently flawed. Research indicates that a significant portion of these generated cases are "broken," either because they inadvertently flip the semantic meaning of the sentence or because they produce linguistically nonsensical output.
These low-quality test cases lead to a staggering false alarm rate of approximately 44%, where a model is flagged for a failure that is actually a defect in the test case itself. To address this, we present AEON, a framework designed to automatically evaluate and filter NLP test cases by scoring their semantic consistency and linguistic naturalness.
The Quality Crisis in NLP Testing
Current state-of-the-art (SOTA) testing techniques, such as GA, BAE, PSO, and Checklist, often suffer from two primary quality issues:
- Inconsistent Issues: The mutation alters the core meaning of the sentence such that the original label is no longer valid. For example, changing a "positive" review word from "powerful" to "terrible" makes the original label incorrect.
- Unnatural Issues: The mutation introduces grammatical errors or bizarre word combinations that do not occur in natural human language.
The authors found that only 15% of generated test cases are truly high-quality. Traditional metrics like BLEU or SBERT often fail to detect these issues because of the "Vanish Effect": since most words in a mutated sentence remain identical to the original, the high overlap "washes out" the impact of a single, meaning-altering word change in the final score.
The AEON Framework
AEON introduces two specialized modules to identify and filter these problematic cases:
1. SemEval (Semantic Evaluator)
Unlike standard semantic metrics that look at the sentence as a whole, SemEval focuses on the specific area of change. It utilizes Levenshtein distance to pinpoint the exact location of the mutation. It then extracts a small "patch" of text surrounding the change and uses a Pre-trained Language Model (PLM) to compare the semantic similarity of that patch within its specific context. This approach allows AEON to capture polysemy—where a word's meaning changes based on its surroundings—more effectively than simple word-level lookups.
2. SynEval (Syntactic Evaluator)
To assess linguistic naturalness, SynEval employs the concept of perplexity. By masking tokens in the generated sentence and tasking a PLM with predicting them, SynEval calculates the likelihood of the generated text. If the model is highly "surprised" by the text (resulting in low probability), the sentence is flagged as unnatural or ungrammatical.
Experimental Evaluation
The researchers evaluated AEON across three core NLP tasks: Sentiment Analysis (SA), Natural Language Inference (NLI), and Semantic Equivalence (SE). They utilized five datasets (Rotten Tomatoes, Yelp, SNLI, MNLI, and QQP) and tested against four popular testing tools.
Key Results and Insights
AEON demonstrated superior performance across several dimensions compared to 10 baselines, including BERTScore and Neuron Coverage:
- Human Alignment: AEON achieved an Average Precision (AP) of 0.688 for detecting inconsistent cases, outperforming the best baseline by 10%.
- Naturalness Detection: The framework surpassed existing baselines by more than 15% in identifying unnatural test cases.
- False Alarm Reduction: By filtering out low-quality cases, AEON reduced the false alarm rate from 44% down to 26.2%.
- Model Robustness: The study found that using AEON to prioritize high-quality cases for adversarial training led to more robust models. Conversely, training on "noisy" or low-quality test cases actually degraded model performance, proving that test case quality is as important as quantity.
Conclusion and Future Work
AEON provides a robust solution for the "noise" problem in automated NLP testing. By focusing on local semantic patches and linguistic perplexity, it offers a more nuanced evaluation than traditional global metrics. While currently limited to metamorphic testing scenarios (where an original sentence is available for comparison), AEON sets the stage for future work in automatically repairing, rather than just detecting, faulty test cases to preserve both semantics and naturalness.
Summary updated