Privately generating tabular data using language models

Alexandre Sablayrolles, Yue Wang, Brian KarrerarXiv 2023

Abstract

Privately generating synthetic data from a table is an important brick of a privacy-first world. We propose and investigate a simple approach of treating each row in a table as a sentence and training a language model with differential privacy. We show this approach obtains competitive results in modelling tabular data across multiple datasets, even at small scales that favor alternative methods based on marginal distributions.

Introduction

In modern data science, privacy regulations often prevent direct access to raw datasets. Synthetic data—artificially generated data that preserves the statistical properties of the original without exposing individual records—has emerged as a critical solution. Traditionally, the gold standard for this task has been the "select-measure-update" paradigm, such as the AIM algorithm, which relies on $k$-way marginals. However, these methods suffer from the "curse of dimensionality," where the complexity of the model grows exponentially with the number of columns and unique values.

Researchers from Meta AI have introduced SynLM, a method that reframes tabular data generation as a language modeling task. By treating rows as sentences, SynLM leverages the scalability of Transformers and Differential Privacy (DP) to outperform state-of-the-art marginal-based models on complex datasets.

Methodology: Rows as Sentences

The core innovation of SynLM is the conversion of SQL-style table rows into sequences of tokens. Each attribute is wrapped in specific "BEGIN" and "END" tags to maintain structural integrity and context.

SynLM tokenizes tabular rows into sequences for Transformer processing.

Architecture and Training

SynLM utilizes a GPT-style Transformer architecture trained to predict the next token in a row, effectively learning the joint distribution of the entire table. To ensure privacy, the model is trained using Differentially Private Stochastic Gradient Descent (DP-SGD). This process involves clipping gradients and adding mathematical noise during training, which prevents the model from memorizing specific individual rows.

Structural Constraints

To prevent "hallucinations"—the generation of invalid values like an age of 1000—SynLM employs two key techniques:

  1. Trie-Guiding: A prefix tree (trie) constrains the model's output during both training and generation, ensuring it only selects from valid existing values.
  2. Level Tokenization: To avoid confusion between identical strings in different columns (e.g., the number "40" appearing in both 'Age' and 'Price'), SynLM assigns unique internal IDs based on the column context.

Experimental Evaluation

The authors evaluated SynLM against seven diverse datasets, ranging from the small car dataset (1,728 rows) to the massive covtype dataset (581,012 rows). These datasets vary significantly in complexity, with column counts ranging from 6 to 55.

Key Results

SynLM demonstrates superior scalability compared to marginal-based methods. While traditional methods scale exponentially with table width, SynLM scales linearly, making it far more effective for the "wide" tables common in industrial applications.

Comparison of SynLM and AIM performance across various datasets.

As shown in the results, SynLM achieved a better (lower) negative log-likelihood than the state-of-the-art AIM on 5 out of 7 datasets. The performance gap was most pronounced on complex datasets like shopping and covtype. While AIM remains highly precise for simple 1-way or 2-way marginal statistics, SynLM is more effective at capturing the overall likelihood and complex dependencies of the data.

Conclusion

SynLM represents a shift toward more scalable, flexible synthetic data generation. By leveraging the power of Transformers and DP-SGD, it overcomes the dimensionality hurdles of traditional marginal-based approaches. Future work may involve privately fine-tuning large pre-trained models to further leverage existing knowledge of data structures.

Summary updated

BibTeX
@misc{sablayrolles2023privately,
  author = {Alexandre Sablayrolles and Yue Wang and Brian Karrer},
  title = {{Privately generating tabular data using language models}},
  year = {2023},
  eprint = {2306.04803},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.04803},
}
Figure