Abstract
We introduce Statsformer, a principled framework for integrating large language model (LLM)-derived knowledge into supervised statistical learning. Existing approaches are limited in adaptability and scope: they either inject LLM guidance as an unvalidated heuristic, which is sensitive to LLM hallucination, or embed semantic information within a single fixed learner. Statsformer overcomes both limitations through a guardrailed ensemble architecture. We embed LLM-derived feature priors within an ensemble of linear and nonlinear learners, adaptively calibrating their influence via cross-validation. This design yields a flexible system with an oracle-style guarantee that it performs no worse than any convex combination of its in-library base learners, up to statistical error. Empirically, informative priors yield consistent performance improvements, while uninformative or misspecified LLM guidance is automatically downweighted, mitigating the impact of hallucinations across a diverse range of prediction tasks. An open-source implementation of Statsformer is available at https://github.com/pilancilab/statsformer.
Introduction
Large Language Models (LLMs) possess vast world knowledge that can identify relevant features in structured datasets. For instance, when predicting medical outcomes, an LLM can distinguish between clinically significant indicators like "blood pressure" and noise like "favorite color." However, the propensity for LLMs to hallucinate presents a significant risk: blindly trusting an LLM to filter features can degrade model performance.
Statsformer addresses this by answering a fundamental question: How can we use LLM knowledge as a "hint" for supervised learning while mathematically guaranteeing that incorrect hints will not degrade performance?
The Statsformer Framework
Statsformer utilizes a principle called validated prior integration, which decouples the injection of LLM knowledge from its validation. The process follows three primary stages:
- Prior Elicitation: The system queries an LLM to generate a "semantic prior"—a set of importance scores for every feature in the dataset based on their names and descriptions.
- Prior Injection: These scores are integrated into a diverse library of base learners, including Lasso, XGBoost, Random Forests, and Kernel SVMs. Statsformer applies these scores via monotone transformations. For example, in Lasso, features identified as important receive smaller penalty weights; in XGBoost, they are sampled more frequently during tree construction. Models are trained across varying "prior strengths," including a baseline of zero strength that ignores the LLM entirely.
- Out-of-Fold Stacking (The Guardrail): A meta-learner is trained on the out-of-fold predictions of all base models. Because the ensemble always includes models that ignored the LLM, the meta-learner can assign zero weight to LLM-influenced models if their advice contradicts the empirical data.
Empirical Evaluation
Statsformer was evaluated on eight tabular benchmark datasets spanning genomics (Breast Cancer, Lung Cancer, ETP), finance (German Credit, Bank Marketing), and physics (Superconductivity). These datasets were selected to highlight high-dimensional, low-sample regimes where external prior knowledge is most critical.
Key Results
Statsformer consistently outperformed standard baselines such as XGBoost, Lasso, and LightGBM, as well as comprehensive AutoML systems like AutoGluon.
- Low-Data Regime Gains: The framework showed massive improvements in "underdetermined" regimes. On the ETP leukemia dataset, Statsformer achieved a 45.4% AUROC improvement over baselines without LLM priors. Similarly, the Lung Cancer dataset saw a 12.2% AUROC boost.
- Adversarial Robustness: When deliberately fed inverted (incorrect) LLM scores, the system's guardrails functioned as intended. The meta-learner down-weighted the erroneous advice, and performance reverted to the standard data-driven baseline.
- Model Agnostic Performance: The framework demonstrated robustness across various LLMs, including OpenAI's o-series, Anthropic's Claude, and open-source models like DeepSeek-R1.
Conclusion and Future Work
Statsformer provides a "no-worse-than-null" guarantee: up to statistical error, the framework will perform no worse than the best standard model in its library. By framing LLM integration as a statistical calibration problem, it effectively mitigates the risks of hallucination.
Current limitations include a reliance on semantic feature names, making it unsuitable for fully anonymized data. Future research will explore extending the framework to more complex semantic priors and inferring feature semantics from dataset structures when explicit names are unavailable.
Summary updated