TABGEN-ICL: Residual-Aware In-Context Example Selection for Tabular Data Generation

Liancheng Fang, Aiwei Liu, Hengrui Zhang, Henry Peng Zou, Weizhi Zhang, Philip S. Yu

Abstract

Tabular data generation is essential for privacy-preserving data sharing and addressing data scarcity. While Large Language Models (LLMs) possess strong structural priors for tabular data, standard in-context learning (ICL) often fails to align the generated distribution with specific target datasets. We present TabGen-ICL, a training-free framework that employs a "residual-aware" strategy to steer LLMs. By iteratively selecting real-world examples that represent the gaps (residuals) in the current generated distribution, TabGen-ICL enables fixed LLMs to outperform specialized deep generative models, particularly in low-resource scenarios.

Introduction

Generating high-quality synthetic tabular data is a cornerstone of modern data science, used to mitigate privacy risks and handle class imbalances. Traditional approaches, including Generative Adversarial Networks (GANs), Variational Autoencoders (VAEs), and Diffusion models, are effective but often require extensive training data and complex preprocessing for heterogeneous data types.

LLMs offer a flexible alternative due to their inherent understanding of structured data. However, LLMs are often "stubborn"; they rely on internal priors rather than the specific patterns in provided examples. TabGen-ICL addresses this by treating ICL as a distribution alignment problem, using a feedback loop to steer the model toward the target distribution.

Methodology: Residual-Aware In-Context Learning

The core of TabGen-ICL is an iterative loop designed to minimize the divergence between real and synthetic data distributions. The process begins with JSON Serialization, converting tabular rows into a format LLMs handle more robustly than raw CSV strings.

The TabGen-ICL workflow: iteratively identifying residuals between real and generated distributions to select steering examples for the LLM prompt.

The system then computes "residuals"—regions of the data space that are underrepresented in the current synthetic set—using metrics like Jensen-Shannon Divergence (JSD) for categorical data and Kolmogorov-Smirnov Distance (KSD) for numerical data. In each iteration, the LLM is prompted with real examples drawn specifically from these residual regions. This acts as a steering mechanism, forcing the model to fill in missing parts of the distribution. This approach is particularly powerful because these "residual" examples often exhibit simple, discernible patterns that are easier for the LLM to integrate than a random mix of data.

Experimental Results

The framework was evaluated on five diverse datasets, including Adult Income, California Housing, and the large-scale Covertype dataset. TabGen-ICL demonstrated significant fidelity gains, reducing error rates by 3.5% to 42.2% compared to random example selection. The most notable improvement was in Recall (up to 42.2%), indicating that the synthetic data accurately covers the full diversity of the real data.

Comparison of synthetic data distributions generated under different ICL strategies versus the ground truth for the California Housing dataset.

As shown in the visualization of the California Housing dataset, naive ICL or no ICL often results in distributions that fail to capture the geographic clusters present in the ground truth. TabGen-ICL successfully recovers these complex spatial patterns. Furthermore, in "Train-on-Synthetic, Test-on-Real" (TSTR) benchmarks, downstream models like XGBoost achieved AUC scores nearly identical to those trained on real data. Privacy analysis confirmed that the model generates novel, plausible data points rather than merely memorizing training records.

Conclusion

TabGen-ICL demonstrates that with the right steering mechanism, off-the-shelf LLMs can serve as state-of-the-art tabular data generators without any fine-tuning. This approach is especially valuable in low-resource settings where traditional deep generative models struggle. Future work will explore more mathematically principled ways to compute residuals and extend the framework to higher-dimensional tables.

Summary updated

BibTeX
@inproceedings{fang2025tabgen,
  author = {Liancheng Fang and Aiwei Liu and Hengrui Zhang and Henry Peng Zou and Weizhi Zhang and Philip S. Yu},
  title = {{TABGEN-ICL: Residual-Aware In-Context Example Selection for Tabular Data Generation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure