Tab2Text - A framework for deep learning with tabular data

Tong Lin, Jason Yan, David Jurgens, Sabina Tomkins

Introduction

Deep learning has revolutionized fields like computer vision and natural language processing, yet it has historically struggled with tabular data—the structured rows and columns common in spreadsheets and databases. Tabular data often presents a "messy" mix of categorical and numerical features, making deep learning models prone to overparameterization or extreme sensitivity to hyperparameters. Consequently, simpler models like Logistic Regression or Gradient Boosted Trees frequently outperform complex neural networks in this domain.

The TAB2TEXT framework addresses this challenge by leveraging the vast "world knowledge" contained within Large Language Models (LLMs). For example, an LLM understands that specific occupations or education levels carry socioeconomic implications that a raw numerical code cannot capture. By bridging the gap between structured tables and unstructured text, TAB2TEXT provides a novel way to improve predictive performance on complex social science tasks.

The TAB2TEXT Framework

The core idea of TAB2TEXT is to transform tabular rows into natural language narratives, which are then fused with traditional tabular embeddings to create a richer representation for downstream tasks.

The TAB2TEXT framework architecture, illustrating the transformation of tabular data into descriptive or narrative text and the subsequent fusion of embeddings.

As shown in Figure 1, the framework operates through a multi-step pipeline:

  1. Tabular to Text Transformation: The authors propose two methods:
  2. DESCRIPTIVEGEN: A straightforward approach converting attributes into simple sentences (e.g., "Age: 25" becomes "I am 25 years old").
  3. NARRATIVEGEN: A more sophisticated method using LLMs (like GPT-4 or Claude) to generate "narratives" based on the data. For instance, given a person's demographics, the LLM might write a hypothetical social media post reflecting their likely political stance.
  4. Encoding and Fusion: The framework uses a TabularEncoder for raw data and a TextEncoder (such as RoBERTa, DistilBERT, or PoliBERT) to process the generated text. These representations are fused into a joint embedding space.
  5. Bias Mitigation and Inference: To prevent LLMs from generating biased or stereotypical narratives, the authors introduced a "correction" strategy. They adjusted LLM-generated labels to match the statistical majority in the training data and fine-tuned the LLM on these corrected narratives. A final classification head (MLP) then generates predictions from the fused embedding.

Experimental Evaluation

The framework was evaluated on two prominent social science datasets:

  • ANES (American National Election Studies): 2020 survey data used to predict political affiliation (Democrat vs. Republican) based on demographics and beliefs.
  • Income (1994 U.S. Census): A classic benchmark used to predict whether an individual earns more than $50,000 per year based on 14 demographic features.

Key Results and Insights

TAB2TEXT achieved consistent performance gains, with a modest but statistically significant improvement of approximately 1.5% on average across tasks compared to tabular-only baselines.

Performance comparison on the ANES dataset, showing Macro F1 scores across different text encoders and narrative generation methods.

Key findings from the experiments include:

  • The "Descriptive" Surprise: Simple descriptive text often performed as well as—and sometimes better than—complex LLM-generated narratives. This suggests that the primary benefit comes from the encoder's ability to understand language rather than the LLM's creative output.
  • Fusion is Essential: Models using only text representations performed worse than those using only tabular data. The performance boost comes from the fusion of precise ground-truth tabular data with the contextual "flavor" of text.
  • LLMs are Biased Narrators: Without the correction strategy, LLM narratives tended to lean toward stereotypes. Grounding the narratives in actual dataset statistics was crucial for performance.
  • Tabular Encoders: Interestingly, simple feature concatenation often outperformed more complex specialized tabular architectures like TabNet within this framework.

On the ANES dataset, the best TAB2TEXT configuration reached a Macro F1 score of 0.641, outperforming the deep learning baseline of 0.638. On the Income dataset, the framework improved the Macro F1 from 0.757 to 0.767.

Conclusion and Future Work

TAB2TEXT demonstrates that natural language representations can significantly enhance deep learning for tabular data. While generating narratives via LLMs introduces computational overhead, the framework's flexibility across various text encoders makes it a promising tool for social science research. Future work will explore automated prompt engineering to improve scalability and test the framework in more technical domains such as medical or financial records.

Summary updated

BibTeX
@inproceedings{lin2024tab,
  author = {Tong Lin and Jason Yan and David Jurgens and Sabina Tomkins},
  title = {{Tab2Text - A framework for deep learning with tabular data}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.findings-emnlp.756},
}
Figure