A text classifier can judge about 90% of its standard test correctly and still fail half of a set of simple targeted tests. TestAug, a framework I led and published at COLING 2022, the International Conference on Computational Linguistics, uses GPT-3 to write those targeted tests. For sentiment analysis, people wrote 29 test templates and the finished suite held 1,470, so about 98% of the templates needed no manual writing.
HateModerate, a follow-up study led by Jiangrui Zheng that I co-authored, applies the same idea to content moderation. It tests hate speech detectors against the 41 hate speech guidelines that Facebook had published by November 2022. HateModerate appeared in Findings of NAACL 2024, a peer-reviewed volume of the North American conference of the Association for Computational Linguistics (ACL). It received an Outstanding Paper Award at WOAH 2024, the Workshop on Online Abuse and Harms. Together, the two studies form the second step of my dissertation, where a language model moves from reading software documents to writing tests.

In this post
Why One Accuracy Score Is Not Enough
How TestAug Writes Tests
What TestAug Found
3.1 About 98% of the Templates Needed No Manual Writing
3.2 The Generated Tests Exposed More Failures
3.3 The Generated Tests Were More Varied
HateModerate: Testing Detectors Against a Written Rulebook
4.1 How the Test Set Was Built
4.2 Detectors Missed More Than Half the Hate Under Tiers 3 and 4
4.3 Training on Rule-Matched Examples Cut Failures
4.4 The Work Received an Outstanding Paper Award
Where the Results Stop
What It Means for Your Team
Questions Readers Ask
Read and Cite the Papers
1. Why One Accuracy Score Is Not Enough
Teams usually judge a text model by one number, such as its accuracy on a held-out test set. The number says how often the model is right on average. It does not say which kinds of input the model gets wrong. CheckList, the best overall paper at the ACL 2020 annual meeting, proposed adding targeted tests. Each targeted test is a small set of inputs that checks one skill, such as reading “not” correctly. For example, a sentiment model should label “No one loves the food.” as negative.
TestAug measured how far the two views differ. The study tested 10 public models on three tasks:
Sentiment analysis: is a movie review positive or negative?
Duplicate-question detection: do two questions from Quora ask the same thing?
Natural language inference: does one sentence follow from another?
The models were wrong on 5.7% to 12.6% of their standard test sets. On targeted tests, the same models failed 14.2% to 49.8% of cases, 2.2 to 4.8 times as often. For both numbers, lower is better.

CheckList builds its targeted tests from templates. A template is a sentence with blanks, such as “That is not a [positive adjective] [airline noun].”, which a program fills from word lists to produce many test cases. The TestAug paper names two costs of writing templates by hand:
A person must write each template and know both the language rules and the model’s likely weak points. The authors argue this often requires an expert.
The resulting tests vary little. In some CheckList tests, only the person names change from one case to the next.
2. How TestAug Writes Tests
TestAug keeps people in charge of what to test and gives most of the writing to GPT-3. The workflow has five steps:
A person describes the test in one sentence, such as “A negative sentiment sentence with negated positive word”. The person also picks seed examples from an existing CheckList suite, such as “No one appreciates that airline.”
GPT-3 receives the description and three seed examples and writes new cases in the same pattern, such as “No one appreciates that air traffic controller.”
Two annotators label 30 to 50 of GPT-3’s outputs as valid or invalid. If at least 90% are valid, or 80% for natural language inference, the test is used as is. Otherwise the annotators label at least 100 valid and 100 invalid outputs, and a small RoBERTa classifier learns to remove invalid ones automatically.
Template expansion turns the words GPT-3 reused from a seed back into blanks. “No one appreciates that air traffic controller.” becomes the new template “No one [positive verb] that air traffic controller.”, which produces many more cases.
The combined suite runs against the model under test and reports failures for each skill.
![The first four TestAug steps. Step 1: a person describes the test and picks a few examples, such as “No one appreciates that airline.” Step 2: GPT-3 writes new test cases in the same pattern, such as “No one appreciates that air traffic controller.” Step 3: a small classifier removes cases that break the test’s rules. It is needed only where GPT-3 often errs, and it is trained on at least 200 human labels. Step 4: template expansion turns repeated words into blanks, giving “No one [positive verb] that air traffic controller.” For the sentiment task, people wrote 29 templates and the finished suite has 1,470, so about 98% came without manual writing. The first four TestAug steps. Step 1: a person describes the test and picks a few examples, such as “No one appreciates that airline.” Step 2: GPT-3 writes new test cases in the same pattern, such as “No one appreciates that air traffic controller.” Step 3: a small classifier removes cases that break the test’s rules. It is needed only where GPT-3 often errs, and it is trained on at least 200 human labels. Step 4: template expansion turns repeated words into blanks, giving “No one [positive verb] that air traffic controller.” For the sentiment task, people wrote 29 templates and the finished suite has 1,470, so about 98% came without manual writing.](https://substackcdn.com/image/fetch/$s_!gFEK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1730b392-e4fe-4eb1-95b5-c407ea9fdec1_1456x2159.png)
3. What TestAug Found
3.1 About 98% of the Templates Needed No Manual Writing
Starting from a few hundred human-written sentences per task, TestAug produced thousands of new test sentences:
Sentiment: 292 seed sentences and 3,275 new ones. People wrote 29 templates, and template expansion added 1,441.
Duplicate questions: 124 seed sentences and 6,427 new ones. People wrote 17 templates, and template expansion added 1,307.
Natural language inference: 150 seed sentences and 4,976 new ones. Template expansion was not used for this task.
In the sentiment suite, people wrote 29 of the 1,470 templates. The paper reports this as a saving of at least 98.0% of manual effort. The figure counts templates, not hours. It leaves out the labels needed to train the filters, at least 200 for each filtered test.
3.2 The Generated Tests Exposed More Failures
The paper measures bug finding indirectly. It trains one copy of a model on TestAug’s tests and another on CheckList’s tests, then checks both copies on a shared set of targeted tests that neither copy saw. The authors call the result the patched failure rate, the share of shared tests that the trained copy still fails. Lower is better. The authors read a lower rate as evidence that the suite covered more of the model’s weak points. Two annotators labeled the shared tests and agreed on 91% to 97% of their labels, depending on the task.
TestAug’s rate was lower than CheckList’s in all 10 combinations of model and task.
The largest difference was for DistilBERT on duplicate questions, 1.1% against 12.5%.
The smallest difference was for RoBERTa-large on natural language inference, 8.0% against 8.3%.
GPT-3’s new sentences produced most of the gain. Template expansion contributed less.
The paper reports no significance test, and the spread across random data splits overlaps in several settings. TestAug also did not win on every individual skill.
3.3 The Generated Tests Were More Varied
The authors compared how varied the two suites are, using a sample of sentences from each:
Self-BLEU4 measures word overlap among sentences in a suite, on a scale of 0 to 1, where lower means more varied. TestAug scored 0.634 against CheckList’s 0.853 for sentiment and 0.627 against 0.775 for duplicate questions. For natural language inference, the scores were 0.430 against 0.454.
Unique dependency paths count distinct grammatical patterns, such as noun followed by verb followed by noun, where higher means more varied. TestAug found 480 against 84, 418 against 117, and 210 against 116.
4. HateModerate: Testing Detectors Against a Written Rulebook
Social platforms publish rules about what they remove, and automated detectors make most of the first decisions. The HateModerate paper cites a 2023 Facebook report that its automated systems found 95% of unwanted content before a user saw it. HateModerate asks whether a detector follows the platform’s written rules. Existing hate speech test sets are not organized by rule, and rare rules have few examples. For Facebook’s rule against offering therapies that claim to change sexual orientation, annotators found only 3 matching examples across existing datasets.
TestAug had skipped hate speech, because GPT-3 refused to write profanity in 2022. HateModerate used a newer GPT-3 model for part of its data and had people check every example. The rulebook is Facebook’s hate speech Community Standards as of November 2022: 41 guidelines in four tiers. Tier 1 is the most severe, such as dehumanizing speech. Tier 4, which Facebook called additional enforcement, includes the rule on conversion therapy offers.
4.1 How the Test Set Was Built
The hateful examples were collected as follows:
Annotators searched existing hate speech datasets for examples that match each guideline.
Where matches were few, annotators wrote examples or prompted GPT-3 to write them.
Other annotators checked every example. A single “no match” vote removed it.
The non-hateful examples needed to be hard for a detector. They were collected as follows:
An embedding search found non-hateful sentences close in meaning to each guideline’s hateful examples, such as “I hate cauliflower.”
GPT-3 wrote more non-hateful examples of four kinds: supportive text, counter-hate (text that quotes hate to criticize it), neutral text, and insults toward targets the rules do not protect. People wrote the last kind, because GPT-3 struggled with it.
Annotators checked each example for relevance. GPT-4 and one annotator then sorted each example by type and removed any that were actually hateful.
The finished dataset contains:
7,704 examples, of which 4,796 are hateful and 2,908 are non-hateful.
103 to 367 examples per guideline.
1,385 examples, 18% of the total, written by GPT-3 and checked by people.
Labels from 28 graduate students in computer science, with about seven weeks of annotation time spread over seven months.
4.2 Detectors Missed More Than Half the Hate Under Tiers 3 and 4
The study tested four detectors:
Google Jigsaw’s Perspective API
OpenAI’s Moderation API
Facebook’s RoBERTa hate speech model, version R1
Cardiff NLP’s RoBERTa hate speech model
The metric is the failure rate for each guideline, on a scale of 0 to 1, where lower is better. The study measured it separately for hateful examples, where a failure is missed hate, and for non-hateful examples, where a failure is a false alarm.
Every detector failed often. The best, OpenAI’s Moderation API, had an average failure rate of 0.29, about three examples in ten.
Averaged over the four detectors, missed hate was 0.34 for Tiers 1 and 2, 0.59 for Tier 3, and 0.52 for Tier 4.
False alarms went the other way: 0.47 for Tier 1, 0.52 for Tier 2, 0.38 for Tier 3, and 0.36 for Tier 4. The detectors flagged harmless text more often near severe topics.
Counter-hate and insults toward unprotected targets caused the most false alarms. Supportive text caused the fewest.
For Perspective, raising the flagging threshold from 0.5 to 0.7 cut false alarms under Tier 2 from 0.74 to 0.55, but raised missed hate from 0.34 to 0.60.
The hardest rules for most detectors included calls for economic exclusion, conversion therapy offers, comparisons of people to certain objects, and statements that admit intolerance. These four rules had only 3 to 17 matching examples in existing datasets before HateModerate added new ones.

4.3 Training on Rule-Matched Examples Cut Failures
The authors trained a RoBERTa-base detector on Cardiff NLP’s public training data, once without and once with HateModerate’s training half. The failure rates changed as follows, where lower is better:
On HateModerate’s test half, the failure rate fell from 0.423 to 0.275, a 35% reduction.
On HateCheck, an independent set of 29 functional tests for hate speech detectors, it fell from 0.365 to 0.199, a 45% reduction.
On three original benchmarks, the failure rate stayed about the same. It was unchanged on hatEval (0.485) and HTPO (0.090) and fell from 0.221 to 0.201 on HateXplain.
The new, rule-specific examples produced most of the improvement on the hardest rules. Compared with training on reused examples alone, they cut missed hate for economic exclusion from 0.466 to 0.023 and for conversion therapy offers from 0.735 to 0.245.
The study also checked for new bias. A statistical test found no significant increase in false alarms on sentences about protected groups. Two limits remain. Some slices got worse, such as false alarms on HateCheck’s non-hateful examples, which rose from 0.205 to 0.229. A balanced version of the training data removed that increase. OpenAI’s Moderation API also remained much better on HateCheck, at 0.011 against 0.199.
4.4 The Work Received an Outstanding Paper Award
HateModerate received an Outstanding Paper Award at WOAH 2024, the 8th Workshop on Online Abuse and Harms, held with NAACL 2024 in Mexico City. The organizers gave two such awards that year. I could not find a public list of the winners, so the award notice appears below, with email addresses removed.

5. Where the Results Stop
TestAug has these limits:
GPT-3 could not write highly structured tests, such as question-answering cases, or tests that need logic or arithmetic.
The 98% figure counts templates, not hours of work.
The 10-of-10 result has no significance test, and the gains were uneven across skills.
The models tested were BERT-family classifiers from 2018 and 2019. Commercial APIs were not tested, because the method needs to fine-tune the model.
HateModerate has these limits:
The dataset covers one platform’s rules at one point in time, Facebook’s as of November 2022. As of 16 October 2026, Meta publishes the current version as Hateful Conduct.
Rules from another platform would need new human annotation.
Implicit hate, which uses no explicit hateful words, is under-represented. Examples may also over-represent keywords named in the guidelines.
Commercial detectors change over time. Perspective API’s website says the service ends after 2026.
6. What It Means for Your Team
Both studies used GPT-3 and models from before 2023. Their lessons concern how a team organizes testing. The lessons apply to any text model a team ships:
Report failure rates for each skill or each policy, next to the overall accuracy.
Turn each written rule into its own test set, so that each failure points to a rule.
Let a language model draft test cases. People decide what to test and check samples of the output.
Measure how often the generator writes invalid tests before trusting them, and add a filter where it often errs.
After fixing failures with new training data, recheck the original benchmarks and the false-alarm rates.
7. Questions Readers Ask
Why is high accuracy on a test set not enough to trust a text classifier?
One accuracy number does not show which skills fail. In TestAug’s experiments, models that were wrong on 5.7% to 12.6% of their standard test sets failed 14.2% to 49.8% of targeted tests, such as tests of negation.
Can a large language model write test cases for an NLP model?
It can, if a check removes invalid output. In TestAug, GPT-3 wrote new test cases from a one-sentence test description and three examples, and a small trained filter removed invalid cases where needed. About 98% of the final sentiment templates required no manual writing.
Do hate speech detectors follow Facebook’s community standards?
They follow them only in part. HateModerate tested four detectors against Facebook’s 41 hate speech guidelines as of November 2022. The best, OpenAI’s Moderation API, had an average failure rate of 0.29. On average, the detectors missed more than half of the hate under the Tier 3 and Tier 4 rules.
Is there a hate speech dataset organized by platform policy?
HateModerate is one such dataset. It has 7,704 examples matched to 41 guidelines, each verified by people. The dataset is on GitHub.
Are the code and data available?
Both are public. TestAug’s code is on GitHub, and HateModerate’s code and data are on GitHub.
8. Read and Cite the Papers
Guanqun Yang, Mirazul Haque, Qiaochu Song, Wei Yang, and Xueqing Liu. “TestAug: A Framework for Augmenting Capability-based NLP Tests.” In Proceedings of the 29th International Conference on Computational Linguistics (COLING 2022), pages 3480 to 3495. Paper, arXiv, code, talk video.
Jiangrui Zheng, Xueqing Liu, Guanqun Yang, Mirazul Haque, Xing Qian, Ravishka Rathnasuriya, Wei Yang, and Girish Budhrani. “HateModerate: Testing Hate Speech Detectors against Content Moderation Policies.” In Findings of the Association for Computational Linguistics: NAACL 2024, pages 2691 to 2710. Outstanding Paper Award, WOAH 2024. Paper, arXiv, code and data.
Both studies form the second of four steps in my dissertation. The overview post explains how the steps fit together, and the FewVuln post covers the first step.
To cite the papers:
@inproceedings{yang-etal-2022-testaug,
author = {Guanqun Yang and Mirazul Haque and Qiaochu Song and Wei Yang and Xueqing Liu},
title = {TestAug: A Framework for Augmenting Capability-based NLP Tests},
booktitle = {Proceedings of the 29th International Conference on Computational Linguistics (COLING 2022)},
pages = {3480--3495},
publisher = {International Committee on Computational Linguistics},
address = {Gyeongju, Republic of Korea},
year = {2022},
url = {https://aclanthology.org/2022.coling-1.307/}
}
@inproceedings{zheng-etal-2024-hatemoderate,
author = {Jiangrui Zheng and Xueqing Liu and Guanqun Yang and Mirazul Haque and Xing Qian and Ravishka Rathnasuriya and Wei Yang and Girish Budhrani},
title = {HateModerate: Testing Hate Speech Detectors against Content Moderation Policies},
booktitle = {Findings of the Association for Computational Linguistics: NAACL 2024},
pages = {2691--2710},
publisher = {Association for Computational Linguistics},
address = {Mexico City, Mexico},
year = {2024},
doi = {10.18653/v1/2024.findings-naacl.172}
}
Guanqun Yang, LLM Researcher. More work at guanqun-yang.com and on Google Scholar.

