Table of Contents
Fetching ...

Few-shot LLM Synthetic Data with Distribution Matching

Jiyuan Ren, Zhaocheng Du, Zhihao Wen, Qinglin Jia, Sunhao Dai, Chuhan Wu, Zhenhua Dong

TL;DR

The paper addresses the distribution gap between LLM-generated synthetic data and real-world data, which can undermine downstream performance when used for augmentation. It introduces SynAlign, a three-module framework comprising Exploration-aware Sampling (a Gaussian Process-based uncertainty tracker to select diverse demonstrations), Latent Attribute Reasoning (a two-stage attribute extraction and generation process to capture linguistic attributes), and Synthetic Distribution Alignment (an MMD-based post-weighting and resampling procedure in embedding space). By mapping data into embeddings and learning sampling weights $\omega$ via projection matrices $\Theta$, SynAlign minimizes distribution distance between synthetic and real data, improving accuracy and F1 across SST-2, AGNEWS, and Amazon, with additional validation from an online A/B test in a retrieval context. The approach demonstrates practical impact for domain-specific, few-shot data synthesis and supports deployment in real systems with detectable gains in both offline metrics and online performance.

Abstract

As large language models (LLMs) advance, their ability to perform in-context learning and few-shot language generation has improved significantly. This has spurred using LLMs to produce high-quality synthetic data to enhance the performance of smaller models like online retrievers or weak LLMs. However, LLM-generated synthetic data often differs from the real data in key language attributes (e.g., styles, tones, content proportions, etc.). As a result, mixing these synthetic data directly with real data may distort the original data distribution, potentially hindering performance improvements. To solve this, we introduce SynAlign: a synthetic data generation and filtering framework based on key attribute distribution matching. Before generation, SynAlign employs an uncertainty tracker surrogated by the Gaussian Process model to iteratively select data clusters distinct from selected ones as demonstrations for new data synthesis, facilitating the efficient exploration diversity of the real data. Then, a latent attribute reasoning method is employed: the LLM summarizes linguistic attributes of demonstrations and then synthesizes new data based on them. This approach facilitates synthesizing diverse data with linguistic attributes that appear in real data.After generation, the Maximum Mean Discrepancy is used as the objective function to learn the sampling weight of each synthetic data, ensuring distribution matching with the real data. Our experiments on multiple text prediction tasks show significant performance improvements. We also conducted an online A/B test on an online retriever to demonstrate SynAlign's effectiveness.

Few-shot LLM Synthetic Data with Distribution Matching

TL;DR

The paper addresses the distribution gap between LLM-generated synthetic data and real-world data, which can undermine downstream performance when used for augmentation. It introduces SynAlign, a three-module framework comprising Exploration-aware Sampling (a Gaussian Process-based uncertainty tracker to select diverse demonstrations), Latent Attribute Reasoning (a two-stage attribute extraction and generation process to capture linguistic attributes), and Synthetic Distribution Alignment (an MMD-based post-weighting and resampling procedure in embedding space). By mapping data into embeddings and learning sampling weights via projection matrices , SynAlign minimizes distribution distance between synthetic and real data, improving accuracy and F1 across SST-2, AGNEWS, and Amazon, with additional validation from an online A/B test in a retrieval context. The approach demonstrates practical impact for domain-specific, few-shot data synthesis and supports deployment in real systems with detectable gains in both offline metrics and online performance.

Abstract

As large language models (LLMs) advance, their ability to perform in-context learning and few-shot language generation has improved significantly. This has spurred using LLMs to produce high-quality synthetic data to enhance the performance of smaller models like online retrievers or weak LLMs. However, LLM-generated synthetic data often differs from the real data in key language attributes (e.g., styles, tones, content proportions, etc.). As a result, mixing these synthetic data directly with real data may distort the original data distribution, potentially hindering performance improvements. To solve this, we introduce SynAlign: a synthetic data generation and filtering framework based on key attribute distribution matching. Before generation, SynAlign employs an uncertainty tracker surrogated by the Gaussian Process model to iteratively select data clusters distinct from selected ones as demonstrations for new data synthesis, facilitating the efficient exploration diversity of the real data. Then, a latent attribute reasoning method is employed: the LLM summarizes linguistic attributes of demonstrations and then synthesizes new data based on them. This approach facilitates synthesizing diverse data with linguistic attributes that appear in real data.After generation, the Maximum Mean Discrepancy is used as the objective function to learn the sampling weight of each synthetic data, ensuring distribution matching with the real data. Our experiments on multiple text prediction tasks show significant performance improvements. We also conducted an online A/B test on an online retriever to demonstrate SynAlign's effectiveness.

Paper Structure

This paper contains 35 sections, 11 equations, 7 figures, 7 tables, 1 algorithm.

Figures (7)

  • Figure 1: A case on how LLM synthetic samples misalign with human-generated samples.
  • Figure 2: SynAlign comprises three modules for aligning the distribution of synthetic samples. First, the Exploration-aware Sampling Module selects real samples based on uncertainty to provide diverse inputs for the LLM. Next, the Latent Attribute Reasoning Module uses these samples as demonstrations to identify and generalize key language attributes for synthetic data generation. Finally, the Synthetic Distribution Alignment Module assigns sampling weights to synthetic data, which are then resampled accordingly to ensure alignment with the real data distribution.
  • Figure 3: t-SNE visualization of sentence embeddings from SST-2. (a) Comparison between Gold and AttrPrompt; (b) Comparison between Gold and SynAlign (MMD). SynAlign (MMD) achieves better alignment.
  • Figure 4: (a) Convex hull coverage example for SST-2. (b) Coverage rate comparison between Gaussian Process Active Sampling and random sampling on AGNEWS and Amazon. Gaussian Process achieves faster and broader coverage.
  • Figure 5: Coverage rate as a function of RBF kernel length scale $\tau$ for Exploration-aware Sampling across three datasets: SST-2, AGNEWS, and Amazon. Each curve represents the convex hull coverage rate at fixed sampling iterations.
  • ...and 2 more figures