Abstract
Imbalanced datasets—where one class significantly outweighs another—often lead to biased machine learning models in critical domains like healthcare and fraud detection. We introduce ImbLLM, a novel oversampling framework that leverages Large Language Models (LLMs) to generate diverse, high-quality synthetic minority samples. By optimizing prompt structures and fine-tuning strategies, ImbLLM significantly outperforms traditional methods like SMOTE and existing LLM-based generators.
Introduction
In real-world tabular data, the "interesting" class is often the rarest. Standard classifiers trained on such imbalanced data tend to ignore the minority class. To mitigate this, researchers use oversampling to create synthetic minority samples. Traditional methods like SMOTE require converting text and categories into numerical vectors, which often loses context and introduces artifacts. Recent LLM-based methods treat tabular rows as text, preserving these relationships. However, these methods suffer from a "diversity crisis," generating repetitive samples due to simplistic prompting. Furthermore, decoder-only LLMs use causal attention masks; if the target label is shuffled to the end of a sequence during training, it cannot influence the features that precede it.
Methodology
ImbLLM introduces three specific innovations to boost synthetic data diversity and quality:
- Label-Feature Conditioning (
condition_yx): Instead of just prompting the LLM with the minority label, ImbLLM randomly selects a feature and its value from the existing minority set and appends it to the prompt (e.g., "Income is >200K, Education is PhD"). This forces the LLM to explore different "neighborhoods" of the data distribution, increasing the total entropy of the generative process. - Fixed-Label Permutation (
fix_y): While shuffling feature order helps LLMs learn relationships, ImbLLM ensures the target label always stays at the beginning of the sequence. This ensures the label acts as an "attentional anchor," influencing the generation of every subsequent feature in the causal decoder. - Minority Interpolation Fine-tuning: To prevent majority-class bias, the model is fine-tuned exclusively on minority samples. To expand the limited minority pool, a simple interpolation technique for continuous variables is used before feeding the data to the LLM, helping the model learn a smoother representation of the minority class manifold.
Experimental Results
The researchers evaluated ImbLLM on 10 diverse tabular datasets (e.g., Adult, German Credit, Bank) varying in size and feature composition.
Classification Performance
ImbLLM achieved the highest F1-score on 5 out of 10 datasets and ranked second on 3 others. On average, ImbLLM reached an F1-score of 0.8002, coming remarkably close to the "Original" performance (0.8238) achieved by using the full, balanced dataset. For context, the imbalanced baseline was only 0.7238.
Quality and Coverage
Using metrics like AUC, Close Probability, and Coverage, the authors demonstrated that ImbLLM's samples are not only more diverse but also more realistic than those produced by state-of-the-art generators like CTGAN or GReaT. Distance to Closest Record (DCR) plots further confirmed that ImbLLM’s synthetic samples were centered closer to real unseen samples than competing methods.
Conclusion
ImbLLM addresses the diversity and causal attention challenges inherent in using LLMs for tabular data augmentation. By anchoring the label and conditioning on existing feature values, it generates high-fidelity synthetic data that significantly improves classification performance on imbalanced tasks. Future work will focus on reducing computational overhead and developing text-aware interpolation for categorical variables.
Summary updated