Abstract
Recent years have seen important advances in the building of interpretable models, machine learning models that are designed to be easily understood by humans. In this work, we show that large language models (LLMs) are remarkably good at working with interpretable models, too. In particular, we show that LLMs can describe, interpret, and debug Generalized Additive Models (GAMs). Combining the flexibility of LLMs with the breadth of statistical patterns accurately described by GAMs enables dataset summarization, question answering, and model critique. LLMs can also improve the interaction between domain experts and interpretable models, and generate hypotheses about the underlying phenomenon. We release TalkToEBM as an open-source LLM-GAM interface.
Introduction
Data science often faces a tension between performance and interpretability. While black-box models like deep neural networks are powerful, their opacity makes them difficult for LLMs to "read" or for humans to trust in high-stakes fields like healthcare. Conversely, interpretable models like Generalized Additive Models (GAMs) provide clear visualizations of feature effects but still require human experts to manually inspect and summarize numerous individual graphs.
This paper demonstrates that Large Language Models (LLMs) like GPT-4 can act as "automated data scientists" when paired with these "glass-box" models. By converting GAMs into a textual JSON format, LLMs can accurately describe statistical patterns, detect anomalies, and generate human-like hypotheses about complex datasets. This approach addresses the gap by using GAMs as a compact, structured intermediary that translates complex statistical relationships into a format LLMs can digest and discuss.
The TalkToEBM Pipeline
The researchers developed a pipeline called TalkToEBM to facilitate this interaction. The process works in four main steps:
- Model Training: An Explainable Boosting Machine (EBM), a type of GAM, is trained on a tabular dataset.
- Serialization: The model’s internal graphs, representing the contribution of each feature to the prediction, are converted into text-based JSON objects. These objects contain key-value pairs representing feature intervals and their corresponding "log-odds" contributions.
- Prompting: These JSON representations are fed into GPT-3.5 and GPT-4 along with dataset descriptions and Chain-of-Thought (CoT) prompts.
- Recursive Summarization: To handle large datasets, the LLM describes one graph at a time, which are then aggregated into a final, high-level summary of the entire model.
Evaluation and Results
The approach was evaluated using public benchmarks (e.g., California Housing, Titanic) and a "hidden" pneumonia dataset to ensure the LLM was interpreting the provided model rather than relying on training data.
Key results include:
- Reading Accuracy: GPT-4 correctly read 85% of values from JSON graphs, significantly outperforming GPT-3.5.
- Trend Identification: GPT-4 identified 11 out of 12 monotone graphs and successfully found the "largest jump" in 27 out of 31 cases.
- Model Critique: GPT-4 proved capable of anomaly detection. In the pneumonia dataset, it correctly hypothesized that a counterintuitive drop in risk for high-creatinine patients might be due to "aggressive care"—a known phenomenon in medical data science.
- Grounding: To test for hallucinations, the authors used "counterfactual" models with inverted data. GPT-4 successfully updated its descriptions, proving its responses were grounded in the provided model.
Discussion and Future Work
The core insight is that interpretable models serve as a form of "textual compression." While a full dataset is too large for an LLM's context window, individual feature graphs are compact enough for modern models.
However, limitations remain: LLM performance may degrade as graph complexity (e.g., interaction terms) increases, and generated hypotheses still require verification by human experts. Future work will focus on increasing graph complexity and developing more robust methods to ensure the LLM's responses are 100% grounded in the statistical evidence.
Summary updated