Increasing Diversity While Maintaining Accuracy: Text Data Generation with Large Language Models and Human Interventions (2023)

Abstract: Large language models (LLMs) can be used to generate text data for training and evaluating other models. However, creating high-quality datasets with LLMs can be challenging. In this work, we explore human-AI partnerships to facilitate high diversity and accuracy in LLM-based text data generation. We first examine two approaches to diversify text generation: 1) logit suppression, which minimizes the generation of languages that have already been frequently generated, and 2) temperature sampling, which flattens the token sampling probability. We found that diversification approaches can increase data diversity but often at the cost of data accuracy (i.e., text and labels being appropriate for the target domain). To address this issue, we examined two human interventions, 1) label replacement (LR), correcting misaligned labels, and 2) out-of-scope filtering (OOSF), removing instances that are out of the user’s domain of interest or to which no considered label applies. With oracle studies, we found that LR increases the absolute accuracy of models trained with diversified datasets by 14.4%. Moreover, we found that some models trained with data generated with LR interventions outperformed LLM-based few-shot classification. In contrast, OOSF was not effective in increasing model accuracy, implying the need for future work in human-in-the-loop text data generation.

## introduction training custom natural language classification models has become easier with many tools (e.g., huggingface 1 ). however, data collection remains a costly part of model building. for example, existing open-source datasets may not be usable if they do not match the distribution of a model builder's target domain or do not contain desired labels. in such cases, the model builder may need to collect and label new data which could be costly (e.g., in 1 https://huggingface.co/ terms of the time and resources to scrape data or pay people to generate or annotate new data). advances in generative large language models (llms), such as gpt-3 @xcite , present a novel approach for creating training data for classification models @xcite @xcite . model builders can prompt an llm with the domain of texts and labels of interest and the llm can quickly generate text data for the model builder's needs. this approach allows model builders to acquire a large amount of data even when they initially have no or few data instances. with the generated data, the model builder can train a separate affordable model (e.g., bert @xcite ) to perform the specific task. while llms can directly support this classification task with few-shot learning, it might not be the best option for every model builder-some might not have enough resources (e.g., gpus) or budget (e.g., credit for gpt-3) to run expensive models. others might be concerned about privacy or security issues when they use llms from external apis (e.g., openai api). in such cases, generating data from llms and training custom models could be a more viable approach. moreover, if we share generated datasets within the community, we can also benefit those who do not have access to llms. lastly, we can also use generated datasets to test models. with these benefits of generating new text datasets with llms, the practical concern is how to generate high-quality datasets. in this work, we investigate human-ai partnerships to efficiently create high-quality datasets with llm-based text generation. high-quality datasets should have high diversity and coverage, informing the extent of data that the model may encounter. at the same time, the generated text should have high accuracy, being relevant to the model's target task while having accurate accompanying labels. to these ends, we first study two technical approaches to diversify text generation (section 3): 1) logit suppression, which diversifies the generated texts by decreasing the probability of sampling tokens that have already appeared frequently in the previous generation, and 2) temperature sampling, which flattens the probability distribution of sampled tokens to pick less likely texts. from an experiment on eight classification tasks with gpt-3 as a text generator (section 4), we found that diversification approaches can have mixed results. while increasing data diversity, these approaches can hurt accuracy in generation and similarity to the original datasets for the task. we demonstrate that human interventions (section 5) are the key to resolving these issues in text generation diversification. we examine human interventions of replacing inaccurate labels with accurate ones (label replacement) and filtering outof-scope data (out-of-scope data filtering). with oracle studies (section 6), we found that replacing all incorrect labels increased model accuracy by 14.4% when we used both logit suppression and high temperature. this performance increase brings in practical benefits-without label replacement, the average accuracy of models trained with gpt-3-generated data was lower than that of gpt-3 classification with few-shot learning, but with 180 instances label-replaced, the models trained with generated data started to outperform gpt-3 fewshot classification. out-of-scope data filtering had limited utility in increasing model accuracy, possibly due to the negative impact of removing training instances. we discuss how human interventions can further facilitate the diversity and accuracy of text data generation. our contributions are: ## diversified text data generation we lay out the desired characteristics of the datasets for model building. then, we introduce approaches to generate diversified datasets with llms. ## experiment1: diversified text data generation we evaluated how diversification approaches impact the diversity of the generated data and the accuracy of models trained with the dataset. ## human interventions to fix inaccurate text generation the first study shows that diversifying approaches can have mixed effects, hurting the accuracy in generation. we propose two human interventions to improve the generated data, based on issues that we found from qualitatively analyzing the generated data. the first is label replacement (lr), switching the misaligned label to the correct one. the second is out-of-scope data filtering (oosf), which removes instances that are outside the domain of interest and do not match any labels (oos instances). while lr and oosf might facilitate accurate generation with diversifying approaches, inspecting all data points can require a lot of effort. hence, we propose a simple way to scale the effort of the model builder, which is training a proxy model. with this approach, model builders will first label a small number of data points. then, with those labels, they will train binary classifiers as proxy models, where each learns about a single label (i.e., a label class from labels of interest or if the instance is out of scope). for unlabeled data points, proxy models can make inferences on behalf of the model builder. we introduced the specific implementation of this approach in section 6. ## experiment2: human interventions we evaluated lr and oosf. except for adding lr and oosf, we used the same tasks, datasets, training methods, and metrics as in section 4. in this section, we focus on reporting results for two temperature values, 0.3 and 1.3. we present the results with the rest of the temperatures in appendix e. also, in this section, when reporting, we merged conditions with and without example seeding. ## conclusion in this work, we investigate approaches to harness llms and human efforts to generate text classification datasets with high accuracy and diversity. we study two text generation diversification approaches, 1) logit suppression, which restrains generating already frequently generated tokens, and 2) high temperature, which flattens the sampling probability of tokens. we found that they diversify text generation but hurt the accuracy in aligning specified labels with the generated data. we experiment with two human intervention approaches, 1) replacing misaligned labels with more adequate ones, and 2) filtering out-of-scope instances. we found that replacing labels makes diversification approaches more beneficial by increasing the accuracy of models trained with the generated dataset. on the other hand, efficient filtering of out-of-scope instances did not have a positive impact on the model accuracy.