Language Models are Realistic Tabular Data Generators

Vadim Borisov, Kathrin Sessler, Tobias Leemann, Martin Pawelczyk, Gjergji Kasneci

Introduction

Tabular data is the backbone of many industries, yet generating high-fidelity synthetic tabular data remains notoriously difficult. While generative models from the computer vision domain—such as Variational Autoencoders (VAEs) and Generative Adversarial Networks (GANs)—have been adapted for this purpose, they often fall short.

To address these limitations, researchers propose GReaT (Generation of Realistic Tabular data), a novel approach that leverages pretrained Large Language Models (LLMs) to produce highly realistic synthetic tabular data. By encoding table rows as natural language sentences, GReaT bypasses traditional, lossy preprocessing and enables "arbitrary conditioning." This allows users to generate data or impute missing values based on any subset of features without needing to retrain the model.

The Challenge of Tabular Data

Traditional generative models face three major hurdles when dealing with tabular datasets:

  1. Lossy Preprocessing: Most models require categorical data to be one-hot encoded and numerical data to be scaled. This often introduces artifacts or destroys subtle relationships between variables.
  2. Contextual Knowledge: Standard models treat features as abstract numbers. They lack the semantic understanding that, for instance, a person cannot have a PhD at age 10, or that certain occupations correlate with specific income brackets.
  3. Rigid Conditioning: Most generators are designed to produce data from scratch. If a user wants to fill in missing values (imputation) or generate "what-if" scenarios (counterfactuals), they typically have to retrain the model for that specific task.

The GReaT Approach: Treating Tables as Text

The authors propose a paradigm shift: treating tabular data as text. The GReaT pipeline consists of three main steps:

  • Textual Encoding: Each row in a table is converted into a descriptive sentence. For example, a row from the Adult Income dataset becomes: "Age is 39, Education is Bachelors, Occupation is Adm-clerical..."
  • Feature Order Permutation: During training, the order of these "feature-value" pairs is randomly shuffled. This prevents the model from learning a fixed sequence and acts as the "secret sauce" that enables arbitrary conditioning later.
  • LLM Fine-tuning: A pretrained transformer-decoder (such as GPT-2) is fine-tuned on these permuted sentences.

To generate new data, users simply prompt the model. Because it was trained on shuffled features, a prompt can start with any feature (e.g., "Education is PhD, Age is..."), and the model will auto-regressively complete the "sentence," effectively sampling from the conditional distribution.

Key Insights

  • Pretraining Matters: One of the most striking findings is that LLMs bring "common sense" to tabular data. Because they are pretrained on massive text corpora, they already understand semantic relationships between words, helping them maintain logical consistency in synthetic rows.
  • The Power of Textual Representation: By using text, GReaT handles mixed data types (numerical and categorical) naturally. It avoids the "curse of dimensionality" that plagues one-hot encoding schemes when dealing with high-cardinality categorical variables.
  • Arbitrary Conditioning for Free: The random permutation trick turns a standard generator into a versatile tool. The same model used for data augmentation can be used for missing value imputation or generating counterfactual explanations without any architectural changes.

Experimental Results

The study evaluated GReaT across a diverse set of benchmarks, including real-world datasets (like California Housing, Adult Income, and HELOC) and synthetic datasets designed to test probability distribution capture. GReaT was compared against state-of-the-art baselines like CTGAN, TVAE, and CopulaGAN.

  • Machine Learning Efficiency (MLE): Measuring how well a model performs when trained on synthetic data versus real data, GReaT consistently outperformed baselines, often achieving results nearly identical to the original data.
  • Discriminator Measure: A "detective" model (Random Forest) trained to distinguish real samples from synthetic ones found GReaT-generated data significantly harder to detect, improving indistinguishability by an average of 16.2% over competitors.
  • Distributional Fidelity: Qualitative plots demonstrate GReaT's superior ability to capture complex data distributions. For example, in the California Housing dataset, GReaT accurately captured complex geographical boundaries (the shape of California) that GAN-based models failed to represent correctly.
Original California Housing Distribution
GReaT Generated Distribution

Limitations and Future Work

While highly effective, GReaT has a few limitations:

  • Computational Overhead: Fine-tuning and sampling from an LLM is computationally expensive. For instance, GReaT took over 9 hours to fine-tune on a large dataset where TVAE took less than a minute.
  • Syntax Errors: Though rare (less than 1%), the model occasionally generates sentences that do not follow the expected format or hallucinate invalid category names. A simple validation function can filter these out.
  • Numerical Precision: Representing numbers as text works surprisingly well, but exploring specialized numerical encodings within the LLM framework could further improve precision for highly sensitive scientific data.

Summary updated

BibTeX
@inproceedings{borisov2023language,
  author = {Vadim Borisov and Kathrin Sessler and Tobias Leemann and Martin Pawelczyk and Gjergji Kasneci},
  title = {{Language Models are Realistic Tabular Data Generators}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=cEygmQNOeI},
}
Figure