Introduction
Tabular data remains the backbone of modern data science. While numerical and categorical data are well-handled by standard algorithms like Gradient Boosting Decision Trees (GBDTs), "messy" string entries—such as job titles, product descriptions, or city names—present a significant challenge. Traditionally, practitioners have relied on lightweight substring models (e.g., TF-IDF or MinHash). However, the rise of Large Language Models (LLMs) offers a new alternative: rich semantic embeddings. This paper investigates the trade-offs between these approaches, providing a roadmap for when the computational cost of LLMs is justified by downstream performance gains.
Methodology
The researchers evaluated a pipeline consisting of string vectorization followed by dimensionality reduction using PCA (reduced to 30 components). These embeddings were then used for two primary tasks:
- Analytics: Vectors were concatenated with numerical features and processed by a GBDT (specifically
HistGradientBoostingClassifier). - Fuzzy Joining: A 1-Nearest Neighbor approach was applied to the embeddings to link imperfectly aligned entity names across tables.
The study compared over 30 embedding methods, including classic n-gram models, massive 7B parameter models (Mistral, LLaMA), and models specifically fine-tuned for embeddings (e.g., OpenAI’s text-embedding-ada-002, BAAI’s bge, and Microsoft’s e5).
The Diversity Threshold
A central finding of the research is that the superiority of LLM embeddings depends on the diversity of the string entries. The authors propose a metric: the number of unique n-grams per 1,000 rows.
As shown in Figure 4, there is a clear "regime change" at approximately 3,000 unique n-grams. Below this threshold (referred to as "Dirty Categories"), strings are sufficiently repetitive that simple substring models like MinHash perform comparably to LLMs. Above this threshold ("Diverse Entries"), LLMs provide substantial performance improvements by leveraging semantic understanding.
Model Selection: Size vs. Fine-tuning
The study also reveals that model size is not the sole determinant of performance. Fine-tuned embedding models often outperform significantly larger general-purpose LLMs.
Figure 6 illustrates that models like e5-large-v2 (335M parameters) can match or exceed the performance of 7B parameter models. This suggests that for tabular data tasks, specialized fine-tuning for sentence similarity is more impactful than raw parameter count. Furthermore, LLMs bring "world knowledge" to the task, enabling them to infer relationships (e.g., geographic properties) that are invisible to purely syntactic models.
Conclusion
For data practitioners, the choice of vectorizer should be guided by the nature of the data. For low-diversity, repetitive string columns, lightweight models like MinHash are efficient and effective. However, when dealing with high-diversity text where semantic meaning and external knowledge are required, fine-tuned embedding models offer a clear advantage. The use of PCA to reduce embedding dimensions further ensures that these powerful models can be integrated into GBDT pipelines without prohibitive computational overhead.
Reference: Grinsztajn, L., Kim, M. J., Oyallon, E., & Varoquaux, G. (2023). Vectorizing string entries for data processing on tables: when are larger language models better? arXiv:2312.09634.
Summary updated