Task Oriented In-Domain Data Augmentation

Xiao Liang, Xinyu Hu, Simiao Zuo, Yeyun Gong, Qiang Lou, Yi Liu, Shao-Lun Huang, Jian Jiao

Abstract

Adapting Large Language Models (LLMs) to specialized domains often faces challenges of data scarcity and task misalignment. This paper introduces TRAIT (Task oRiented in-domAIn data augmenTation), a framework that combines large-scale in-domain data retrieval with a novel synthetic data generation strategy. By producing "enlightened" synthetic passages that include meta-analytical reasoning, TRAIT significantly boosts performance in specialized fields like advertising and mathematics while preserving general reasoning capabilities.

Introduction

Continual Pre-training (CPT) is the standard approach for adapting LLMs to domains such as law, medicine, or finance. However, this process is frequently hindered by two bottlenecks. First, high-quality domain-specific data is often scarce compared to general web corpora. Second, standard CPT relies on task-agnostic raw text, which may not effectively teach the model how to solve specific downstream problems.

To bridge this gap, the researchers developed TRAIT, a two-stage framework designed to harvest relevant data from the web and transform it into highly educational, task-aligned training material.

The TRAIT Framework

The TRAIT framework operates in two primary phases: data selection and synthetic generation.

1. In-Domain Data Selection

To address data scarcity, TRAIT utilizes a FastText classifier to identify relevant in-domain content within massive general web corpora (e.g., FineWeb). This retrieved data undergoes a quality filter to ensure high "educational value." In the advertising domain, this process allowed the researchers to scale their training set from 1 billion to 16 billion tokens, providing a much richer foundation for knowledge acquisition.

2. Task-Oriented Synthetic Passage Generation

The core innovation of TRAIT is the generation of structured synthetic passages using a teacher model (such as GPT-4). Unlike traditional synthetic data that might focus on a single question-answer pair, TRAIT passages are designed to mimic a comprehensive learning curriculum.

Structure of a synthetic passage for the mathematics domain.

As illustrated in Figure 3, each passage includes:

  • Multiple Problems: A variety of tasks from the target domain (e.g., GSM8k and SAT problems for math).
  • Task-Specific Paragraphs: Detailed, step-by-step reasoning and solutions for each specific problem.
  • The Enlightenment Paragraph: A meta-analysis that summarizes shared logic, common techniques, and unique characteristics required to solve the set of problems. This paragraph acts as a powerful alignment signal, helping the model generalize across tasks.

Training Strategy

TRAIT employs a two-stage training process:

  1. Knowledge Acquisition: The model is first trained on the massive retrieved in-domain corpus to master domain-specific vocabulary and concepts.
  2. Task Alignment: The model then trains on the synthetic "enlightened" passages to learn how to apply its acquired knowledge to solve specific downstream tasks.

Experimental Results

The researchers evaluated TRAIT across two distinct domains: Advertising (entity-centered) and Mathematics (knowledge-centered).

Performance Gains

TRAIT consistently outperformed standard baselines like DSIR. In the advertising domain, it improved the Mistral-7B base model by 8% on average across seven tasks. In mathematics, performance increased by 7.5% on average, with a remarkable 15% improvement on the challenging MATH benchmark.

Data Distribution and Alignment

A key reason for TRAIT's success is its ability to align different data distributions. A t-SNE analysis of the embedding space shows how the synthetic data bridges the gap between general knowledge and specific tasks.

t-SNE visualization of data distributions.

As shown in Figure 6, the TRAIT data (green) occupies an intermediate space between general/in-domain data and downstream task data. This positioning facilitates a smoother transition during training, preventing the "catastrophic forgetting" of general reasoning skills often observed in specialized models. Indeed, TRAIT models maintained high scores on general benchmarks like Big-Bench Hard (BBH).

Conclusion

The TRAIT framework demonstrates that domain adaptation is not just about the quantity of data, but its structural alignment with target tasks. By combining large-scale retrieval with "enlightened" synthetic generation, TRAIT provides a robust path for creating specialized LLMs that remain generally capable. Future work will explore scaling this framework to larger models and higher-stakes domains like medicine and finance.

Summary updated

BibTeX
@inproceedings{liang2024task,
  author = {Xiao Liang and Xinyu Hu and Simiao Zuo and Yeyun Gong and Qiang Lou and Yi Liu and Shao-Lun Huang and Jian Jiao},
  title = {{Task Oriented In-Domain Data Augmentation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.1162},
}
Figure