TL;DR
This paper investigates whether large language models (LLMs) can effectively extract information from text entries within tabular datasets to improve prediction accuracy. The authors found that LLM-based text encoding significantly outperforms traditional methods like substring-based approaches, and that larger, more advanced LLMs yield greater improvements.
What Problem Does This Paper Address?
Tabular data, common in many real-world applications, often contains a mix of numerical, categorical, and textual features. While numerical and categorical features are well-handled by standard machine learning techniques, text entries (like names, descriptions, or addresses) pose a challenge. Traditional methods for encoding high-cardinality categorical features, such as one-hot encoding, lead to dimensionality explosion. Character-level approaches based on substrings, while better, can only leverage patterns within the data itself and lack external semantic understanding. This paper aims to explore how LLMs, with their vast pre-trained knowledge, can be leveraged to encode these text features and enhance tabular data prediction.
Methods
The authors propose a pipeline where text features in tabular data are first encoded using LLMs. These LLM-generated embeddings are then concatenated with the other (numerical and categorical) features of the table and fed into a classifier.
For text encoding, they experimented with:
- Sentence-BERT models: Specifically, they used models from the top of the MTEB benchmark, including BAAI's
bge-large-en-v1.5and LLMrails'sember-v1. Embeddings were generated using mean pooling. - OpenAI's embeddings: They also utilized OpenAI's
text-embedding-ada-002model via their API. - Substring-based methods: For comparison, they used Skrub's
MinHashEncoder, a character-level approach.
Numerical and low-cardinality categorical features were processed using the TableVectorizer from the Team package, employing OneHotEncoder and MinHashEncoder for categorical features, and StandardScaler for numerical features. PCA was used to reduce the dimensionality of text embeddings. The primary classifier used was sklearn's GradientBoostingClassifier.
Datasets
The study was conducted on 28 diverse tabular datasets, each containing at least one text column and at least 1500 rows. The paper provides a detailed list of these datasets in Appendix A, covering a wide range of domains such as demographics, product reviews, company information, and scientific journals.
Key Insights and Ideas
- LLMs unlock external knowledge: The core idea is that LLMs bring "background information" from their extensive pre-training, which goes beyond the patterns present solely within the tabular data itself. This is crucial for tasks where semantic understanding is key.
- Not all text columns benefit equally: The paper highlights that the gains from using LLM embeddings are not uniform across all text columns. A simple metric—the number of unique n-grams divided by the number of rows—appears to be a good predictor of which columns will benefit most, with gains typically seen when this ratio exceeds 2.
- Larger models, bigger gains: The study demonstrates a clear correlation between the size and sophistication of the LLM used and the improvement in prediction performance. This suggests that the field can benefit from ongoing advancements in LLM development.
- LLMs excel where substring methods fail: A particularly compelling finding is shown in Figure 4, where predicting city populations across countries with a strict train-test split (preventing countries from appearing in both sets) renders substring methods ineffective. LLMs, however, maintain decent performance, indicating they leverage pre-existing knowledge about country-city relationships.
Key Results
- Significant performance improvement: Across the 28 datasets, using LLM-based text encoding consistently improved predictions compared to no encoding or substring-based methods.
- Outperforming substring methods: Figure 1 shows that LLM embeddings (OpenAI's ada-002 and BAAI's BGE-large-en-v1.5) consistently outperform Skrub's MinHashEncoder across various training sizes, whether text features are used alone or in combination with numerical features.
- Model size matters: Figure 2 illustrates that larger LLMs (with more parameters) lead to greater ROC-AUC gains. For instance, models with 335M parameters showed clear improvements over smaller models.
- Gains vary: While many datasets showed substantial gains, 11 out of 28 datasets showed ROC-AUC gains of less than 1%, and 14 showed gains of less than 3%. The analysis focuses on datasets with gains above 3%.
Limitations and Future Work
- Dataset dependency: The authors acknowledge that LLM benefits are not universal. Some datasets, particularly those from internal enterprise databases, might contain general entities where LLMs may not offer significant advantages.
- Model selection and fine-tuning: While the paper shows that larger models are better, it doesn't deeply explore the optimal model selection strategy or the impact of fine-tuning LLMs specifically for tabular data tasks.
- Future directions: The paper suggests that future work should focus on adapting knowledge representations to specific databases and exploring other model features like training data quantity. Extending this analysis to other model features, such as training and fine-tuning data quantity, is also proposed.
Summary updated