TL;DR
ForestLLM introduces a novel framework that uses Large Language Models (LLMs) as "offline architects" to design robust Random Forests for few-shot tabular learning. By confining the LLM entirely to the training phase, the method injects semantic and causal reasoning into tree structures while maintaining the speed, interpretability, and zero-cost inference of classical machine learning.
What Problem Does This Paper Address?
Tabular data dominates high-stakes domains like healthcare, finance, and public policy. However, training reliable models on tabular data when labeled examples are scarce (the "few-shot" regime) remains a major challenge.
Traditional tree-based models (like Random Forests or XGBoost) struggle here because their splitting criteria rely on statistical metrics like Gini impurity or information gain. With only a few samples, these metrics become highly unstable, leading to noisy splits and severe overfitting. Conversely, directly deploying LLMs by serializing tabular rows into text strings is computationally expensive, slow at inference time, and discards the structural, hierarchical advantages of tree models.
ForestLLM bridges this gap by using an LLM during training to guide tree construction, completely removing the LLM at test time.
Methods
The ForestLLM framework operates in three distinct steps:
- Semi-Supervised Semantic Tree Induction: Instead of using statistical purity metrics to split nodes, ForestLLM prompts an LLM to evaluate candidate splits. The prompt combines serialized labeled examples, a "Feature Summary" of the marginal distribution of unlabeled data, and structural metadata (node depth and path history). The LLM performs causal feature probing and evidential split synthesis to score candidate splits based on semantic plausibility.
- In-Context Leaf Label Inference: Once the tree structure is drawn, traditional empirical averaging at the leaf nodes is highly volatile due to data sparsity. ForestLLM translates each root-to-leaf decision path into a natural language rule. It prompts the LLM with this rule and a retrieved support set of examples to generate a stable, deterministic leaf prediction.
- LLM-Free Prediction: At test time, the LLM is discarded. The model functions as a standard, lightweight Random Forest ensemble, aggregating predictions via majority voting (classification) or arithmetic averaging (regression).
Datasets
The authors evaluated ForestLLM across a diverse suite of 13 classification and 10 regression benchmarks, including well-known datasets like Adult, Bank, Credit-g, NHANES, CDC Diabetes, and Myocardial.
To rigorously test the model against data contamination (the risk that the LLM already memorized the datasets during pre-training), they included two benchmarks released after the GPT-4o training cutoff date (October 2023):
- Gallstone (for classification)
- Infrared Thermography Temperature (for regression)
Key Insights and Ideas
- LLMs as Architects, Not Oracles: Most tabular LLM approaches use the language model as an online predictor. ForestLLM shifts the LLM's role to a design-time optimizer, capturing its rich contextual knowledge into a lightweight symbolic model.
- Capitalizing on Unlabeled Data: By summarizing unlabeled data distributions textually for the LLM, ForestLLM naturally respects the "cluster assumption" of semi-supervised learning—favoring splits that pass through low-density regions of the data manifold.
- Causal vs. Statistical Splits: Traditional Random Forests select features based purely on statistical correlations, which often surface downstream biomarkers of disease severity rather than root causes. ForestLLM leverages the LLM's semantic priors to prioritize upstream, causally relevant features (e.g., prioritizing hepatic fat accumulation over C-reactive protein in gallstone prediction), dramatically improving model interpretability.
Key Results
ForestLLM consistently achieved state-of-the-art or second-best performance across both classification and regression tasks under 4-, 8-, 16-, 32-, and 48-shot settings.
- Classification: On average, ForestLLM achieved an AUC of 0.786 in the ultra-sparse 4-shot setting, substantially outperforming classical Random Forests (0.616) and specialized tabular learners like TabPFN (0.656).
- Regression: It maintained a clear edge in normalized root mean squared error (NRMSE), mitigating the typical struggles LLMs face with precise numerical estimation by wrapping the predictions in a structured ensemble framework.
- Out-of-Distribution Generalization: The model retained its strong performance on the post-cutoff Gallstone and Infrared Thermography datasets, proving its capability to generalize beyond memorized training data.
Limitations and Future Work
The primary bottleneck of ForestLLM is its training-time computational cost. Because it recursively queries an LLM via API calls for every candidate split evaluation and leaf node stabilization across an entire forest ensemble, the initial training phase can be expensive and time-consuming. Furthermore, the framework's efficacy is inherently bound to the quality of the underlying LLM's domain knowledge.
For future work, the authors suggest exploring how foundation models can be deployed as design-time optimizers for other neuro-symbolic architectures beyond decision trees.
Summary updated