Explanation-Guided Evolution of LLM-driven Feature Engineering
Analyze & explore related research in Conceptio
Connect this record directly into your research workflow or AI agent. Explore citations across open repositories, query full text, and export structured proof bundles.
Explanation-Guided Evolution of LLM-driven Feature Engineering⋆
arXiv:2611.41572v1 [cs.NE] 30 Nov 2026
Jiahuizi Luo[0009−0007−4341−0164] , Thomas Bäck, and Niki van Stein[0000−0002−0013−7969] LIACS, Leiden University, Leiden, The Netherlands luoj5@vuw.leidenuniv.nl, T.H.W.Baeck@liacs.leidenuniv.nl, n.van.stein@liacs.leidenuniv.nl
Abstract. Large language models are increasingly used as evolutionary variation operators to write feature-engineering programs for tabular data. The state-of-the-art method, LLM-FE, shows the LLM only the code and score of earlier programs, so the search never learns which of the generated features the downstream model actually uses. We present SHAPEvo-FE, a (µ+λ) evolution strategy in which TreeSHAP attributions of the fitted model are turned into a short feedback report that labels each generated feature “keep”, “refine” or “replace”, which is used in the next mutation prompt. We compare the two methods under a controlled protocol, with the same LLM backbone, budget, cross-validation splits, completion limit and evaluation code, on 22 datasets and three different backbones. With a capable backbone, SHAP guidance makes the search significantly cheaper. With DeepSeek-V4-Flash and ClaudeHaiku-5.5, SHAPEvo-FE reaches LLM-FE’s final validation level with 38 and 62 programs on the median dataset, against about 180 for LLM-FE, in a third to a half of the wall-clock time and with about a third of the LLM tokens, and its normalised area under the best-so-far curve is larger on 20 and 17 of 22 datasets respectively (Wilcoxon p < 0.001 (DeepSeek) and p = 0.003 (Haiku)). The same loop without the SHAP report needs about twice as many programs. With GPT-3.5, which ignores the report, LLM-FE searches faster. SHAP feedback helps when the backbone follows it and makes no difference when the backbone ignores it. Keywords: Automated feature engineering · Large language models · Evolution strategies · Feature attribution · Tabular data
1
Introduction
Feature engineering still determines much of the accuracy of tabular models [4]. Gradient-boosted trees on well-designed features rival or beat deep models [5]. Several recent methods let a large language model (LLM) write the Python programs that transform the raw columns and wrap this generation in an evolutionary loop [7,13,1]. The strongest of them, LLM-FE [1], evolves such programs ⋆
Preprint of a paper under review. The supplementary material submitted with the paper is included as an appendix.
2
J. Luo et al.
with an island-model experience buffer in the style of FunSearch [14] and reports the best results on a broad benchmark of classification and regression datasets. In LLM-FE the LLM sees the code and the validation score of a few earlier programs. It does not see which of the generated features the downstream model actually uses, although the fitted model already holds this information and TreeSHAP can extract it at a small extra cost. A program that adds five features of which one matters looks, in the prompt, exactly like a program whose five features all contribute. We hypothesize that feeding model explanations back into the prompt can let the LLM edit more deliberately, and therefore search more effectively. It could keep the features that work, rewrite the ones that do not, and build on inputs the model already treats as interacting. SHAPEvo-FE (Fig. 1) implements this idea. SHAPEvo-FE uses a (µ+λ) evolution strategy [2] building on the open source LLaMEA [15], an LLMdriven evolutionary framework first proposed for automatic metaheuristic design. LLaMEA’s mutation prompt carries the parent’s error trace and metrics. In feature engineering the counterpart of that feedback is the explanation of the fitted model, which the evaluation already produces. After each evaluation, TreeSHAP values [12,11] of the XGBoost model [3] trained on the transformed data are summarised in a SHAP report, which goes into the prompt of the next iteration. Published comparisons of LLM-based feature engineering often differ in backbone, budget, split protocol and leakage regime, for example CAAFE [7] reports GPT-4 with TabPFN over ten proposals while LLM-FE [1] reports GPT-3.5 with XGBoost over 200 programs, so a reported gain cannot be attributed to the search algorithm. We define a benchmarking protocol in which both methods share the backbone, the budget, the outer cross-validation splits and LLM-FE’s own evaluation script, and ran it with three backbones on 22 datasets. We find the following. – SHAP guidance makes the search cheaper with a capable backbone. With DeepSeek and Haiku, SHAPEvo-FE reaches LLM-FE’s final validation level with 38 and 62 programs on the median dataset, compared to about 180 for LLM-FE, in a third to a half of the wall-clock time and with about a third of the LLM tokens. Its normalised area under the bestso-far curve is larger on 20 and 17 of 22 datasets (Wilcoxon p < 0.001 and p = 0.003). With GPT-3.5 it trails (Sect. 5.2). – The SHAP report works when the backbone follows it. The same loop without the report needs about twice as many programs with DeepSeek and Haiku. The saved prompts show why. DeepSeek and Haiku create again far more of the parent features the report marks keep than of those it marks replace, GPT-3.5 creates both again at the same rate, and without the report all three backbones treat every label alike, so the difference is caused by the report (Sect. 5.3). – A matched comparison with parity on held-out data. With the search algorithm as the only difference, SHAPEvo-FE is on par with LLM-FE on held-out accuracy with all three backbones (Sect. 5.1).
Explanation-Guided Evolution of LLM-driven Feature Engineering Population (µ=5)
Mutation prompt
p1 f = 0.865
Task, features, examples
p2 f = 0.841 p3 f = 0.837
Parent code + score Fitness of population
Variation
3
Evaluation
program T
4-fold inner CV
modify_features
XGBoost → fitness
LLM
TreeSHAP of the fitted model
SHAP report p4 f = 0.837
keep · refine · replace
p5 f = 0.837
Interaction hints Redundancy flags
SHAP report
(µ+λ) selection
Row-wise, numeric output
keep/refine/replace top-5 interaction pairs redundancy flags (r > 0.9)
T = 0.8
best 5, no duplicates program + score + SHAP report
all programs LLM-Evolutionary Strategy SHAP feedback (new) keep
refine
replace
B = 200 programs per fold µ = λ = 5, one child each
SHAP report, excerpt (heart) cp_chol_product hr_deficit_x_oldpeak angina_x_oldpeak flat_slope_high_oldpeak
KEEP 0.089 KEEP 0.070 0.045 REFINE 0.001 REPLACE
Held-out evaluation outer 5-fold CV top-3 programs per fold vote / mean ensemble
Hint: combine Cholesterol and MaxHR Flag: male_risk has r = 1.00 with Sex
Fig. 1. SHAPEvo-FE. Grey blocks are parts of the (µ + λ) evolution strategy, purple blocks are the newly proposed SHAP-based report. TreeSHAP of the fitted XGBoost model produces a keep/refine/replace report with interaction hints and redundancy flags, which enters the next mutation prompt. The inset shows an excerpt of such a report.
With a capable backbone, SHAP guidance reaches a similar or better solution with significantly fewer evaluations, tokens and time. With a backbone that ignores the report it is harmless, and on no backbone is LLM-FE the better method on held-out data.
2
Related Work
Automated feature engineering. Classical approaches enumerate or search a fixed space of transformations, such as deep feature synthesis [9], iterative subsampling in autofeat [8], reinforcement learning over transformation graphs [10] and feature boosting with pruning in OpenFE [17]. They have no access to domain knowledge and cannot express arbitrary code. LLM-based feature engineering. CAAFE [7] prompts an LLM with the dataset description to propose features one at a time and keeps those that improve validation accuracy. FeatLLM [6] extracts rules as binary features for few-shot learning, and OCTree [13] uses decision-tree reasoning to guide iterative refinement. LLM-FE [1] casts the problem as evolutionary program search. Its experience buffer of programs is partitioned into islands, prompts are built from the best programs of one island, three programs are sampled per prompt, and the reported numbers are an ensemble of the best program of each island. None of these methods feeds feature-level attributions back to the LLM.
4
J. Luo et al.
LLMs as evolutionary optimizers. FunSearch [14] and LLaMEA [15] showed that an LLM inside an evolutionary loop can discover programs that outperform hand-designed ones. LLaMEA uses a compact (µ+λ) strategy with textual feedback and a self-debugging step, and a recent extension, LLaMEA-SAGE, turns explanations of a surrogate model over syntax-tree features of the generated code into natural-language mutation instructions [16]. We move the idea from code features to data features, since our guidance comes from attributions of the trained model on the engineered columns. Explanations in the loop. SHAP [12,11] is widely used for post-hoc interpretation and feature selection but rarely as an online search signal. To our knowledge this is the first work to turn per-feature and interaction attributions into natural-language mutation guidance for an LLM feature-engineering search and to evaluate the effect under a fully matched protocol.
3
Method
Problem Setting Given a tabular dataset D = {(xi , yi )}N i=1 with p named columns and a short natural-language description M, we search for a program T implementing modify_features(df) that maps a data frame to an augmented data frame, such that a fixed learner f (XGBoost with default hyper-parameters) trained on T (Dtrain ) performs best on unseen rows. During the search, fitness is the mean 4-fold inner cross-validation score of f on the training portion of an outer fold. The held-out outer fold is used only for the final evaluation. (µ+λ) Evolution Strategy SHAPEvo-FE maintains µ = 5 programs and produces λ = 5 offspring per generation until a budget of B = 200 evaluations is spent (Algorithm 1). The population is initialised with the identity program and µ − 1 programs obtained by prompting the LLM with the task description. Each generation, every survivor is the parent of exactly one offspring, so there is no parent selection step. All selection pressure comes from the survivor step, which keeps the best µ of parents and offspring after removing identical code. The LLM is sampled at temperature 0.8 with the completion limit shared with LLM-FE, 1024 or 2048 tokens depending on the backbone (Sect. 4). Offspring that fail to execute or produce non-finite values are discarded. The failure and its error message are logged, and the most recent failures are shown in later prompts. SHAP Feedback Report After a candidate is evaluated, the XGBoost model of the last inner fold is explained with TreeSHAP. Mean absolute SHAP values are normalised to sum to one over all columns and every generated feature is labelled keep if its share is at least 0.05, refine if it is at least 0.01 and below 0.05, and replace if it is below 0.01. Because the shares sum to one, a program with many columns pushes more of its features below the thresholds, so
Explanation-Guided Evolution of LLM-driven Feature Engineering
5
Algorithm 1 SHAPEvo-FE Require: description M, training rows Dtr , LLM π, budget B, µ, λ 1: P ← {identity} ∪ {π(M)}1..µ−1 ; evaluate each p ∈ P and build its SHAP report Rp 2: while evaluations < B do 3: for each parent p ∈ P (one offspring per survivor) do 4: cp ← π(Prompt(M, p, Rp , scores of P )) 5: evaluate cp by inner CV; TreeSHAP of the fitted model → Rcp 6: end for 7: P ← best µ of P ∪ {cp } with distinct code 8: end while 9: return all evaluated programs with fitness (top-3 are ensembled for reporting)
large programs receive more refine and replace labels than small ones. The SHAP report has two additional parts: TreeSHAP also measures how strongly two features act together. The five strongest pairs, prioritizing those involving original columns, are included in the report as interaction hints, prompting the LLM to construct features that combine the two variables in each pair. A generated feature whose Pearson correlation with an original column is above 0.9 is little more than a renamed copy of that column, so the report flags it as redundant. In the prompt the report is a list of short lines, one per generated feature, such as “bp_hr_ratio: SHAP importance = 0.0040 [LOW - REPLACE]”, followed by one sentence of instructions for each label, each interaction hint and each redundancy flag. Figure 4 in Sect. 5.3 shows a complete report from one run. The rest of the prompt contains the standard elements: the task description, the parent’s code and fitness, the fitness of five population members, and a row-wise constraint prohibiting group-by statistics, ranks, frequencies, and other cross-row operations (Sect. 5.1).
4
Experimental Setup
4.1
Datasets and Backbones
We use 21 of the 22 datasets of the LLM-FE benchmark for which data and task descriptions were released, 16 classification and 5 regression tasks with 625 to 48,842 rows (Table S2 lists sizes). We leave out forest-fires, on which the published LLM-FE score could not be reproduced because 48% of its targets are zero and a few extreme values dominate the RMSE under any split (Table S1). We add one synthetic binary-classification dataset generated for this study, ensuring it was unseen by LLMs during pretraining. Since its rows are grouped, all its splits keep a group’s rows together with scikitlearn’s StratifiedGroupKFold: the 5 outer folds, which are also the folds of the final evaluation, and the 4 inner folds of both searches. We test both methods with three backbones, gpt-3.5-turbo-0125, the backbone of the original LLM-FE paper, deepseek-v4-flash, a low-cost open-weight model, and
6
J. Luo et al.
claude-haiku-5.5, a recent efficient model from Anthropic. All models are accessed through OpenRouter with reasoning disabled. Both methods use the same token limits: 1024 for GPT-3.5 and 2048 for DeepSeek and Haiku, which generate longer programs. Each backbone requires 22,000 program evaluations per method (22 datasets × 5 folds × 200 programs). 4.2
Protocol
Table 1 summarises both methods. Every experiment uses 5-fold outer crossvalidation with seed 42. Both methods receive exactly the same training rows in every fold and the same budget of 200 program evaluations per fold, the setting of the LLM-FE paper. Inside a fold, both methods score candidates by 4-fold inner cross-validation of XGBoost with fixed seed (42), using accuracy or negative RMSE for regression. Every LLM call is charged one budget unit in both methods, whether or not it yields a program that runs. LLM-FE runs from the authors’ public code through OpenRouter, with its completion limit raised from the authors’ default of 512 tokens to the shared limit of Sect. 4.1, and both extractors repair replies cut off before the return statement in the same way, so that neither method loses programs to truncation. The remaining extractor details, which concern program handling and not the search, are in Appendix S2. LLM-FE samples at the API’s default temperature of 1.0, as in the authors’ code, SHAPEvo-FE at 0.8. To separate the contribution of the explanation signal from that of the evolution strategy we also run a no-SHAP control, which is the same SHAPEvo-FE code, splits, budget and completion limit, but with the SHAP report, interaction hints and redundancy flags removed from the prompt and SHAP not computed, so the LLM sees only code and scores as in LLM-FE. Final scores are computed with LLM-FE’s official evaluation script. The three highest-scoring programs of a fold are applied to the held-out rows, one XGBoost model with seed 42 is trained per program, and the predictions are ensembled by majority vote over the predicted labels for classification and by their mean for regression. We apply the same script to SHAPEvo-FE’s three best programs. Regression is reported as N-RMSE = RMSE/mean(y). All LLM-FE numbers in this paper are from our re-run of the authors’ code under the shared protocol. The re-run matches the published table to a median absolute difference of 0.004 (Table S1), and the evaluator details that affect fairness are documented in Appendix S2. Since a single seed is used per backbone, a difference counts as a win only if |∆| > 0.01, which is well inside the fold-to-fold standard deviation of either method.
5
Results
5.1
Held-Out Performance
The per-dataset held-out scores are in Table S11 and their wins, ties and losses in Table 3. SHAPEvo-FE achieves comparable held-out performance to LLMFE with GPT-3.5 and a modest advantage with DeepSeek and Haiku. Most
Explanation-Guided Evolution of LLM-driven Feature Engineering
7
Table 1. Search settings of the two methods. Shared settings are given in the text.
Search Selection
LLM-FE
SHAPEvo-FE
island buffer (3 islands), 2 examples/prompt, 3 samples/prompt cluster-softmax sampling of prompt examples
(µ+λ)-ES, µ = λ = 5, 1 sample/prompt
Feedback in code + score of examples prompt LLM sampling Allowed operators
API default temperature; ≤ 1024 completion tokens (GPT-3.5), ≤ 2048 (DeepSeek, Haiku) row-wise and cross-row (group-by, rank, frequency)
every survivor mutated once per generation; elitist (µ+λ) survivors code + score + SHAP report (keep/refine/replace, interactions, redundancy) T = 0.8; same completion limits
row-wise only
datasets are ties under the chosen threshold. Improvements on vehicle and housing recur with both DeepSeek and Haiku, where the generated programs use ratios of silhouette measurements and per-room or per-household quantities. The advantage is not universal, however. LLM-FE performs better on cmc with both backbones, and the methods tie on synthetic with all three. Some of the largest gains arise from failures in LLM-FE’s generated programs. On car and bike, group-by statistics change when computed separately on training and test rows, causing poor predictions on some held-out folds. With Haiku, an index-alignment error on one tic-tac-toe fold corrupts the generated features after the program removes the original columns. On the Haiku tic-tac-toe and car folds the collapse depends on how the official scorer breaks ties between programs with the same inner-CV score (Appendix S10). These failures account for part of the observed advantage and should be distinguished from improvements in feature quality. SHAPEvo-FE’s row-wise restriction avoids the cross-row failure, but also narrows the available transformations. A separate audit on six categorical datasets found little average benefit from computing statistics jointly on training and test rows, so leakage does not explain LLMFE’s scores. With GPT-3.5, LLM-FE’s prompt for communities exceeds the context window and only one fold completes, while SHAPEvo-FE uses fewer example rows for wide datasets and completes all folds, so we exclude communities from the GPT-3.5 comparisons. Both methods complete all folds with DeepSeek and Haiku. At the full budget both searches approach a plateau on the inner objective for most datasets, so the main differences concern how quickly they reach com-
normalised best-so-far (inner CV)
8
J. Luo et al.
1.0
(a) GPT-3.5-Turbo
(b) DeepSeek-V4-Flash
(c) Claude-Haiku-5.5
0.8 0.6 0.4
SHAPEvo-FE does not reach the LLM-FE level
0.2 0.0
n=21 datasets
0
50
100
150
evaluations
LLM-FE
200 0
50
3.8× faster
3.3× faster
n=22 datasets
n=22 datasets
100
150
evaluations
SHAPEvo-FE
200 0
50
100
150
evaluations
200
SHAPEvo-FE (no SHAP)
Fig. 2. Search speed with GPT-3.5-Turbo (a), DeepSeek-V4-Flash (b) and ClaudeHaiku-5.5 (c), all datasets. Mean rescaled best-so-far inner-CV score over datasets with a 95% confidence band, for LLM-FE, SHAPEvo-FE and SHAPEvo-FE with the SHAP report removed from the prompt (Sect. 5.3). The dotted line is LLM-FE’s level at the end of its budget, the dots mark where each mean curve reaches it, and the arrow gives the ratio of the two positions. The speed-up at equal level along the whole budget is in Supplementary Fig. S1.
parable validation scores and whether the backbone uses the SHAP feedback, as examined in Sects. 5.2 and 5.3. 5.2
Search Speed Depends on the Backbone
Held-out parity leaves open how each method spends its budget. Both searches log the best inner-CV score after every evaluation on the same inner folds, so the curves are directly comparable. Figure 2 shows them together with the no-SHAP control of Sect. 5.3. For every dataset the best-so-far inner-CV score is averaged over the five folds and rescaled to [0, 1] between the worst starting score and the best final score of its nine curves (three methods, three backbones), so the three panels share one scale. The rescaling gives every dataset the same weight, so the gap between the curves ranks the methods and does not measure an accuracy difference. The x-axis counts evaluated programs, that is, LLM calls. Table 3 reads the same curves without any rescaling. For every dataset it takes the point at which the fold-mean curve of each method first reaches LLMFE’s final fold-mean level on that dataset, in programs, in wall-clock minutes and in LLM tokens, and reports the median over datasets. DeepSeek provides the strongest evidence for SHAPEvo-FE. Its mean curve stays above LLM-FE’s for 99% of the budget range, and on the median dataset SHAPEvo-FE reaches LLM-FE’s final level with 38 programs where LLM-FE needs 180, in 24 instead of 66 minutes and with 332k instead of 950k tokens. It gets there first on 20 of 22 datasets. Haiku repeats the picture with 62 instead of 186 programs, 9 instead of 20 minutes and 257k instead of 785k tokens, first on 19 of 22 datasets. The
Explanation-Guided Evolution of LLM-driven Feature Engineering
9
Table 2. Normalised area under the best-so-far inner-CV curve over 200 evaluations, mean over the five folds, rescaled per dataset and backbone between the worst start and the best final value of the three arms (LLM-FE, SHAPEvo-FE, no-SHAP control of Sect. 5.3). ∆ > 0 favours SHAPEvo-FE. Bold marks the larger area. p is the twosided Wilcoxon signed-rank test over the paired per-dataset values. With GPT-3.5 communities is left out because LLM-FE completed one fold only. R marks regression. Dataset
GPT-3.5-Turbo LLM-FE SHAPEvo-FE
DeepSeek-V4-Flash ∆ LLM-FE SHAPEvo-FE
adult balance-scale bank blood breast-w car cmc communities credit-g eucalyptus heart junglechess myocardial pc1 synthetic tic-tac-toe vehicle bikeR crabR housingR insuranceR wineR
0.837 0.958 0.825 0.799 0.868 0.860 0.805 – 0.774 0.834 0.785 0.957 0.831 0.919 0.795 0.851 0.889 0.537 0.883 0.827 0.797 0.915
mean SHAPEvo-FE higher on, Wilcoxon p no-SHAP control, mean Wilcoxon p, SHAPEvo-FE vs control, control vs LLM-FE
0.836 0.679 -0.157 2 of 21, p < 0.001 0.687 p = 0.812, p < 0.001
0.762 -0.075 0.897 -0.061 0.759 -0.066 0.527 -0.272 0.754 -0.114 0.656 -0.204 0.564 -0.241 – – 0.845 +0.071 0.623 -0.211 0.624 -0.161 0.609 -0.348 0.651 -0.180 0.313 -0.606 0.752 -0.042 0.737 -0.114 0.597 -0.292 0.876 +0.339 0.655 -0.228 0.612 -0.215 0.639 -0.158 0.805 -0.111
0.529 0.992 0.733 0.666 0.725 0.616 0.537 0.680 0.598 0.568 0.556 0.965 0.677 0.623 0.649 0.427 0.607 0.720 0.830 0.871 0.702 0.637
Claude-Haiku-5.5 ∆ LLM-FE SHAPEvo-FE
0.493 -0.037 0.995 +0.003 0.902 +0.169 0.782 +0.116 0.852 +0.126 0.957 +0.341 0.737 +0.200 0.837 +0.157 0.791 +0.193 0.836 +0.268 0.858 +0.302 0.990 +0.025 0.814 +0.137 0.812 +0.188 0.842 +0.194 0.827 +0.400 0.842 +0.235 0.702 -0.018 0.880 +0.050 0.933 +0.062 0.895 +0.192 0.858 +0.220
0.678 0.838 +0.160 20 of 22, p < 0.001 0.747 p = 0.005, p = 0.007
0.913 0.995 0.422 0.620 0.776 0.812 0.777 0.806 0.645 0.493 0.754 0.951 0.490 0.747 0.658 0.446 0.509 0.740 0.882 0.873 0.632 0.719
∆
0.819 -0.095 0.995 +0.000 0.797 +0.375 0.836 +0.216 0.829 +0.053 0.902 +0.091 0.741 -0.036 0.803 -0.003 0.769 +0.124 0.858 +0.365 0.748 -0.006 0.957 +0.006 0.873 +0.383 0.856 +0.110 0.829 +0.172 0.837 +0.391 0.797 +0.288 0.785 +0.045 0.673 -0.209 0.924 +0.051 0.832 +0.200 0.874 +0.155
0.712 0.833 +0.122 17 of 22, p = 0.003 0.759 p = 0.017, p = 0.033
token advantage is smaller than the program advantage because a SHAPEvoFE prompt carries the SHAP report and is longer, 9.1k against 6.3k tokens per call with DeepSeek, and the time advantage is smaller because every SHAPEvoFE evaluation also computes TreeSHAP. The advantage is not due to a bigger portion of valid programs, since the median number of scored programs per fold differs by at most 6% between the two methods with DeepSeek and Haiku (Table S8). Table 2 summarises every curve by its normalised area, the mean of the rescaled best-so-far curve over the 200 evaluations, so that 1 would mean sitting at the best final level from the first evaluation on. SHAPEvo-FE has the larger area on 20 of 22 datasets with DeepSeek and 17 of 22 with Haiku (two-sided Wilcoxon signed-rank test over the paired datasets, p < 0.001 and p = 0.003) and the smaller one on 19 of 21 with GPT-3.5 (p < 0.001). GPT-3.5 shows the opposite pattern. LLM-FE leads for 99% of the budget range and SHAPEvo-FE reaches its final level on one dataset only. Removing the SHAP report does not change this (Sect. 5.3), so the difference comes from the search strategy. LLM-FE shows GPT-3.5 two strong programs and asks it to write a third, while SHAPEvo-FE provides one parent and a SHAP report, and GPT-3.5 appears to benefit more from combining programs than from feature feedback. With every backbone the final gaps on the search objective are small, a mean accuracy gap of 0.006 on the classification datasets in favour of SHAPEvoFE with DeepSeek and of LLM-FE with GPT-3.5, consistent with the held-out ties.
10
J. Luo et al.
Table 3. Cost of reaching LLM-FE’s final inner-CV level. For each dataset the target is LLM-FE’s fold-mean score after 200 programs. The table gives how much each method spends before its own fold-mean curve first reaches that target, as SHAPEvo-FE / LLMFE: programs, wall-clock minutes and thousands of LLM tokens (prompt and reply, one tokenizer for both methods, Appendix S4). LLM-FE reaches its own final level on every dataset, SHAPEvo-FE does not. The bracket counts the datasets on which it does, and its entries are medians over those datasets. LLM-FE’s entries are medians over all datasets. With GPT-3.5 SHAPEvo-FE reaches the target on one dataset only, marked by a dash. The last column counts the datasets on which SHAPEvo-FE needs fewer programs than LLM-FE. W/T/L are the held-out wins, ties and losses of Sect. 5.1 (Table S11). held-out
to LLM-FE’s final level, SHAPEvo-FE / LLM-FE
faster on
Backbone
W/T/L
programs
minutes
k tokens
datasets
GPT-3.5-Turbo DeepSeek-V4-Flash Claude-Haiku-5.5
2/18/2 6/13/3 6/15/1
– / 184 (1 of 21) 38 / 180 (20 of 22) 62 / 186 (20 of 22)
– / 21 24 / 66 9 / 20
– / 475 332 / 950 257 / 785
1 of 21 20 of 22 19 of 22
5.3
Explanation or Strategy? The No-SHAP Control
To analyse the contribution to the convergence speed advantage of Sect. 5.2 to either the (µ+λ) strategy or the SHAP report we ran a no-SHAP control (Sect. 4.2). It runs the same code, splits and budget with the SHAP report, interaction hints and redundancy flags removed from the prompt, so the LLM sees only code and scores as in LLM-FE. Figure 2 compares the three arms on the three backbones. With DeepSeek both ingredients contribute, the SHAP report more. The control alone is above LLM-FE over the whole budget and reaches LLM-FE’s final level on the mean curve after 97 programs instead of 200, a gain that comes from the elitist (µ+λ) loop with the parent’s code, score and errors in the prompt. The SHAP report brings this to 53 programs. The full method is above the control on 97% of the budget and reaches the common score first on 18 of 22 datasets, with a median speed-up of 2.4×. Held-out accuracy moves as well. Full and control differ by more than 0.01 on six datasets, four in favour of the SHAP report and two against, and the control alone is on par with LLMFE. Haiku repeats this picture. The control needs 131 programs and the full method 61, the full method is above the control on 98% of the budget and first on 16 of 22 datasets, and on held-out data the SHAP report wins five datasets and loses two. The last rows of Table 2 test this over datasets. With DeepSeek and Haiku the area under the control’s curve lies between the two methods, significantly above LLM-FE (p = 0.007 and p = 0.033) and significantly below the full method (p = 0.005 and p = 0.017). With GPT-3.5 the SHAP report makes no difference. Full method and control reach the common score first on 10 and 11 datasets, their areas do not differ (p = 0.81), neither reaches LLM-FE’s final level, and held-out accuracy does not favour the report either, with 1 win and 3 losses. Per-dataset held-out scores of all three arms are in Tables S4 to S6. The saved prompts show why (Fig. 3). For every mutation prompt that carried a SHAP report we read the label of each of the parent’s generated features
Explanation-Guided Evolution of LLM-driven Feature Engineering
11
and checked whether the child program creates that feature again. Over the 20,100 DeepSeek prompts the child creates again 96% of the features labelled keep, 74% of those labelled refine and 32% of those labelled replace, and it realises 63% of the interaction hints. Over the 20,200 Haiku prompts the three rates are 68%, 45% and 3.5%, with 54% of the hints realised, so Haiku drops almost every feature the report marks replace. Over the 18,800 GPT-3.5 prompts the three rates are 39%, 35% and 36%, and 26% of the hints are realised, so the label makes no difference to what GPT-3.5 keeps. Fig. 3(c) shows the same comparison dataset by dataset, with the fraction of keep features kept on the x-axis and the fraction of replace features kept on the y-axis. Every GPT-3.5 dataset lies on the diagonal, where keep and replace features are kept at the same rate, and every DeepSeek and Haiku dataset lies far below it. Figure 4 shows what following the report looks like in one call. The parent has ten generated features, the report labels four keep, three refine and three replace, and it asks for three interactions. The child keeps the four keep features line for line, omits the three replace features, keeps the three refine features and adds one product feature for each of the two hinted pairs it did not have yet. Its inner-CV accuracy rises from 0.866 to 0.873. The two new features are the only part of the program the LLM had to invent, and the report told it which columns to combine. A strong backbone might keep high-SHAP features simply because they look useful, label or no label. The control runs rule this out. For every mutation prompt of the control runs we recomputed the parent’s SHAP report post hoc with the search evaluator, which reproduces the parent’s printed score in every case, and scored the child in the same way. The LLM never saw these labels. Without the report DeepSeek creates again 82% of the features that would have been labelled keep and 79% of those that would have been labelled replace, Haiku 81% and 79%, and GPT-3.5 48% and 53% (hatched bars and hollow points in Fig. 3). All three backbones treat the labels alike when they cannot see them, so the gap between keep and replace in the full runs is caused by the report. The report changes what DeepSeek and Haiku keep, and these are the backbones on which it halves the number of programs needed. GPT-3.5 ignores it, and with GPT-3.5 it has no effect. 5.4
How Many Features the Programs Add
Table 4 counts the new feature columns that the best program of each fold adds, as the median over folds, and how many of them the fitted model still uses. The number added depends mostly on the backbone. With GPT-3.5 both methods add about 3 features. With DeepSeek, LLM-FE adds 18 and SHAPEvo-FE 46, and with Haiku 14 and 10. This difference in program size is already there before the first SHAP report exists. The initial programs DeepSeek writes for SHAPEvo-FE, which are generated before any program has been evaluated, add a median of 40 features and the best program at the end adds 45 (medians over all folds), whereas GPT-3.5 starts at 1 and ends at 3, so the report does not make the programs grow.
J. Luo et al.
KEEP
REFINE REPLACE flagged redundant
label given by the SHAP report GPT-3.5-Turbo (18,802 calls) DeepSeek-V4-Flash (20,075 calls) Claude-Haiku-5.5 (20,196 calls)
1.0 0.8 0.6 0.4
(c) per dataset no labe dif l m fer ak en es ce
1.0 0.8 0.6 0.4 0.2 0.0
REPLACE features kept
1.0 0.8 0.6 0.4 0.2 0.0
(b) hints
G De PT-3 ep .5 Se Ha ek iku
(a) what the child keeps
fraction of hints implemented
fraction of parent features the child keeps
12
0.2 0.0
0.0
0.5
1.0
KEEP features kept
GPT-3.5-Turbo, no-SHAP control (18,693 calls) DeepSeek-V4-Flash, no-SHAP control (19,995 calls) Claude-Haiku-5.5, no-SHAP control (20,076 calls)
Fig. 3. Reading the SHAP report: what the child program keeps of the parent’s features. Parsed from every mutation prompt that carried a report and the program returned for it (18,802 GPT-3.5 calls, 20,075 DeepSeek calls, 20,196 Haiku calls). (a) Fraction of the parent’s generated features that the child program creates again, grouped by the label the report gave them (keep, refine, replace) and for features the report flagged as redundant. Bars are means over calls, dots are datasets. (b) Fraction of the report’s interaction hints that the child implements by putting both named columns into one new feature. (c) One point per dataset, with the fraction of keep features kept on the x-axis and the fraction of replace features kept on the y-axis. The dotted diagonal is where the two fractions are equal. Hatched bars and hollow points show the no-SHAP control runs, for which the labels were recomputed after the fact with the search evaluator and never shown to the LLM.
The SHAP labels push in opposite directions on the two backbones. With GPT-3.5 the SHAPEvo-FE program is smaller than the LLM-FE program on 13 of the 21 datasets, the same size on 6 and larger on 2, so the labels mainly remove features. With Haiku it is smaller on 14 of 21, the same size on 2 and larger on 5. With DeepSeek, which follows the refine and interaction hints, the SHAPEvo-FE program is larger on 20 of 21 datasets, and these larger programs are the ones with the faster inner-CV progress of Sect. 5.2. Yet the absolute threshold retains a median of only 1 to 4 added features. Removing the rest changes the held-out score by at most 0.01 on at least 15 of the 21 datasets for every combination of method and backbone (Table 4). This threshold favours smaller programs because attribution shares sum to one across all columns. The rank-based criterion instead retains the fewest added features covering 80% of their combined attribution. With GPT-3.5, both methods retain a median of 2 added features. With DeepSeek, the medians are 8 for LLM-FE and 17.5 for SHAPEvo-FE. After rank-based pruning, the held-out score changes by at most 0.01 on at least 18 of the 21 datasets for every combination of method and backbone. The backbones differ in how many idle features a program carries, not
Explanation-Guided Evolution of LLM-driven Feature Engineering
13
=== Feature Impact Report === (parent score 0.866) Generated features (by your function): hr_deficit_x_oldpeak: SHAP importance = 0.0695 [HIGH - KEEP] ecg_x_slope: SHAP importance = 0.0644 [HIGH - KEEP] chol_slope_score: SHAP importance = 0.0526 [HIGH - KEEP] cp_chol_product: SHAP importance = 0.0893 [HIGH - KEEP] oldpeak_x_slope: SHAP importance = 0.0070 [LOW - REPLACE] angina_x_oldpeak: SHAP importance = 0.0448 [MEDIUM - REFINE] slope_x_hr_deficit: SHAP importance = 0.0146 [MEDIUM - REFINE] ecg_slope_oldpeak: SHAP importance = 0.0242 [MEDIUM - REFINE] flat_slope_high_oldpeak: SHAP importance = 0.0011 [LOW - REPLACE] high_chol_angina: SHAP importance = 0.0016 [LOW - REPLACE] Try to capture the interaction between Cholesterol and MaxHR Try to capture the interaction between ST_Slope and hr_deficit_x_oldpeak Try to capture the interaction between Sex and ST_Slope === Child program === (child score 0.873) hr_deficit_x_oldpeak = (220 - Age - MaxHR) * Oldpeak ecg_x_slope = RestingECG * (2 - ST_Slope) chol_slope_score = Cholesterol * (2 - ST_Slope) / 100 cp_chol_product = ChestPainType * Cholesterol / 100 chol_x_maxhr_norm = Cholesterol * MaxHR / 10000 slope_x_hr_deficit = (2 - ST_Slope) * hr_deficit_x_oldpeak sex_x_slope = Sex * (2 - ST_Slope) ecg_slope_oldpeak = RestingECG * (2 - ST_Slope) * Oldpeak angina_x_oldpeak = ExerciseAngina * Oldpeak
kept kept kept kept new, hint 1 refined, hint 2 new, hint 3 refined refined
Fig. 4. One SHAP report and the program it produced, from prompt 150 on heart, fold 2, with Claude-Haiku-5.5. The top block is the report as it appears in the prompt, with the three interaction hints of the guidance section (the five original columns still contributing and the instruction sentences are omitted). The bottom block lists the assignments of the child program in the order written, with the original column names in place of the df_input[...] syntax. The child creates the four keep features unchanged, omits the three replace features, keeps the three refine features, one of which is already the pair of the second hint, and adds one new feature for each of the other two hints. Scores are inner-CV accuracy.
in how many the model uses, and neither a small nor a large program is clearly better on held-out data.
6
Discussion and Limitations
Our reading of the three backbones is that a model has to act on a recommendation for it to matter. GPT-3.5 keeps a feature at the same rate whether the SHAP report says keep or replace, whereas DeepSeek keeps three times as many of the keep features as of the replace features and Haiku nineteen times as many (68% against 3.5%), and the no-SHAP control shows that this selectivity is a response to the report and not a property of the model. The benchmark itself limits what the speed-up can show. Scoring the same runs after 25, 50, 75 or 100 programs per fold changes the median held-out score by less than 0.002 for either method, so the held-out score is saturated within the first 25 programs while the search objective keeps rising. Faster progress therefore saves programs,
14
J. Luo et al.
Table 4. Feature counts of each fold’s best program, medians over folds and datasets. The per-dataset counts are in Table S9. Added counts all new features. Kept counts those with a TreeSHAP share ≥ 0.05 after refitting XGBoost. Rank-based pruning retains the smallest set of top-ranked added features covering at least 80% of the total attribution to added features. For each pruning rule, the rows below report the mean change in single-program held-out score across datasets, positive when pruning improves performance, and the number of datasets with |∆| ≤ 0.01. Details are in Table S7. GPT-3.5-Turbo LLM-FE SHAPEvo-FE added kept added kept median
3
1.5
3
1
DeepSeek-V4-Flash LLM-FE SHAPEvo-FE added kept added kept 18
3
46
3
Claude-Haiku-5.5 LLM-FE SHAPEvo-FE added kept added kept 14
3
10
∆ held-out, kept only datasets with |∆| ≤ 0.01
+0.0008 20/21
+0.0003 20/21
−0.0039 15/21
−0.0009 16/21
−0.0018 17/21
−0.0047 17/21
kept, rank-based (median) ∆ held-out, rank-based kept only datasets with |∆| ≤ 0.01
2 +0.0005 21/21
2 +0.0000 21/21
8 +0.0001 20/21
17.5 +0.0004 19/21
7 −0.0006 19/21
5 −0.0022 18/21
4
time and tokens without changing accuracy here, and its practical value lies in harder tasks and short budgets. Limitations. Parent selection is uniform, since every survivor is mutated once per generation, and we did not vary selection pressure. The two methods also sample at different temperatures, the API default of 1.0 for LLM-FE, as in the authors’ code, and 0.8 for SHAPEvo-FE, and we did not test whether matching them changes the picture. Each backbone was run with a single seed, and confidence intervals across seeds are the first item of future work. The ensemble reported for both methods is a post-hoc selection of the three best programs. Neither search optimises for ensemble diversity, and LLM-FE’s islands give it a natural advantage here. The learner is fixed to XGBoost with default hyperparameters, as in LLM-FE. The report labels use absolute share thresholds, which favour small programs, and a rank-based rule that labels the features carrying a fixed share of the attribution would make the report independent of program size. An LLM call that returns no usable program is charged to the budget in both methods. Such calls, including an 18-minute gateway outage, took under 1% of the budget and at most 14 evaluations of a fold, 30 on one. The synthetic dataset is not publicly available.
7
Conclusion
We introduced SHAPEvo-FE, an LLM-driven (µ+λ) evolution strategy for feature engineering, including a TreeSHAP report that tells the LLM which generated features to keep, refine or replace. Under a matched protocol on 22 datasets with three backbones, our main finding is that with SHAP guidance and a capable backbone the search needs significantly fewer evaluations, tokens and time to reach a similar or better solution. With DeepSeek and Haiku SHAPEvo-FE reaches LLM-FE’s final validation level with a fifth to a third of the programs (evaluations), a third to a half of the time and about a third of the tokens, its
Explanation-Guided Evolution of LLM-driven Feature Engineering
15
area under the best-so-far curve is significantly larger, and the larger part of that gain comes from the SHAP report. The final held-out accuracy is on par with LLM-FE or slightly better. With GPT-3.5, which ignores the report’s labels, LLM-FE is slightly faster. SHAP feedback helps when the backbone follows it and makes no difference when the backbone ignores it. Code, the LLM-FE reproduction, all prompts, the raw logs and the supplementary material are available at https://doi.org/10.5281/zenodo.23750423.
16
J. Luo et al.
References 1. Abhyankar, N., Shojaee, P., Reddy, C.K.: LLM-FE: Automated feature engineering for tabular data with LLMs as evolutionary optimizers. Transactions on Machine Learning Research (2026), arXiv:2503.14434 2. Beyer, H.G., Schwefel, H.P.: Evolution strategies – a comprehensive introduction. Natural Computing 1(1), 3–52 (2002) 3. Chen, T., Guestrin, C.: XGBoost: A scalable tree boosting system. In: ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. pp. 785–794 (2016) 4. Domingos, P.: A few useful things to know about machine learning. Communications of the ACM 55(10), 78–87 (2012) 5. Grinsztajn, L., Oyallon, E., Varoquaux, G.: Why do tree-based models still outperform deep learning on typical tabular data? In: Advances in Neural Information Processing Systems. vol. 35 (2022) 6. Han, S., Yoon, J., Arik, S.O., Pfister, T.: Large language models can automatically engineer features for few-shot tabular learning. In: International Conference on Machine Learning (2024) 7. Hollmann, N., Müller, S., Hutter, F.: Large language models for automated data science: Introducing CAAFE for context-aware automated feature engineering. In: Advances in Neural Information Processing Systems. vol. 36 (2023) 8. Horn, F., Pack, R., Rieger, M.: The autofeat Python library for automated feature engineering and selection. In: Machine Learning and Knowledge Discovery in Databases: ECML PKDD 2019 Workshops. pp. 111–120. Springer (2020) 9. Kanter, J.M., Veeramachaneni, K.: Deep feature synthesis: Towards automating data science endeavors. In: IEEE International Conference on Data Science and Advanced Analytics (2015) 10. Khurana, U., Samulowitz, H., Turaga, D.: Feature engineering for predictive modeling using reinforcement learning. In: AAAI Conference on Artificial Intelligence (2018) 11. Lundberg, S.M., Erion, G., Chen, H., DeGrave, A., Prutkin, J.M., Nair, B., Katz, R., Himmelfarb, J., Bansal, N., Lee, S.I.: From local explanations to global understanding with explainable AI for trees. Nature Machine Intelligence 2(1), 56–67 (2020) 12. Lundberg, S.M., Lee, S.I.: A unified approach to interpreting model predictions. In: Advances in Neural Information Processing Systems. vol. 30 (2017) 13. Nam, J., Kim, K., Oh, S., Tack, J., Kim, J., Shin, J.: Optimized feature generation for tabular data via LLMs with decision tree reasoning. In: Advances in Neural Information Processing Systems. vol. 37 (2024) 14. Romera-Paredes, B., Barekatain, M., Novikov, A., Balog, M., Kumar, M.P., Dupont, E., Ruiz, F.J.R., Ellenberg, J.S., Wang, P., Fawzi, O., Kohli, P., Fawzi, A.: Mathematical discoveries from program search with large language models. Nature 625, 468–475 (2024) 15. van Stein, N., Bäck, T.: LLaMEA: A large language model evolutionary algorithm for automatically generating metaheuristics. IEEE Transactions on Evolutionary Computation (2025), arXiv:2405.20132 16. van Stein, N., Kononova, A.V., Kotthoff, L., Bäck, T.: LLaMEA-SAGE: Guiding automated algorithm design with structural feedback from explainable AI. arXiv preprint arXiv:2601.21511 (2026)
Explanation-Guided Evolution of LLM-driven Feature Engineering
17
17. Zhang, T., Zhang, Z., Fan, Z., Luo, H., Liu, F., Liu, Q., Cao, W., Li, J.: OpenFE: Automated feature generation with expert-level performance. In: International Conference on Machine Learning (2023)
Appendix: Supplementary Material This appendix reproduces the supplementary material submitted with the paper. Its sections, tables, figures and listings are numbered with the prefix S.
S1
Reproduction of the Published LLM-FE Results
Table S1. LLM-FE as published in Tables 2 and 3 of its paper (gpt-3.5-turbo, top-3 island ensemble, mean ± std over five splits) against our re-run of the authors’ code with gpt-3.5-turbo-0125 through OpenRouter, seed 42 and 1024 completion tokens, scored with the authors’ evaluator. This re-run is the one used in the main paper, and the table only shows that the baseline was reproduced faithfully. The differences come from the stochastic LLM sampling of a single run and possibly from a different model snapshot, since re-scoring the authors’ released logs with our evaluator reproduces the published numbers exactly. Dataset
Metric
published
our re-run
diff. note
adult Acc. 0.874±0.003 0.872±0.004 -0.002 arrhythmia Acc. 0.659±0.018 – – authors’ code crashes on this dataset balance-scale Acc. 0.990±0.013 1.000±0.000 +0.010 bank Acc. 0.907±0.002 0.907±0.003 -0.000 blood Acc. 0.751±0.036 0.741±0.030 -0.010 breast-w Acc. 0.970±0.009 0.957±0.010 -0.013 car Acc. 0.999±0.001 1.000±0.000 +0.001 cdc-diabetes Acc. 0.849±0.001 – – authors’ code crashes on this dataset cmc Acc. 0.531±0.015 0.515±0.015 -0.016 communities Acc. 0.711±0.012 0.709±0.000 -0.002 one fold only (context overflow, see main text) covtype Acc. 0.882±0.003 – – data not released credit-g Acc. 0.766±0.015 0.758±0.017 -0.008 eucalyptus Acc. 0.668±0.027 0.663±0.028 -0.005 heart Acc. 0.866±0.021 0.862±0.020 -0.004 junglechess Acc. 0.969±0.004 0.980±0.004 +0.011 myocardial Acc. 0.789±0.023 0.790±0.027 +0.001 pc1 Acc. 0.935±0.006 0.940±0.017 +0.005 tic-tac-toe Acc. 0.998±0.005 0.998±0.005 -0.000 vehicle Acc. 0.761±0.027 0.759±0.021 -0.002 airfoil_self_noise N-RMSE 0.011±0.001 – – data not released bike N-RMSE 0.207±0.006 0.224±0.037 +0.017 cpu_small N-RMSE 0.033±0.003 – – data not released crab N-RMSE 0.223±0.013 0.222±0.014 -0.001 diamonds N-RMSE 0.134±0.002 – – data not released forest-fires N-RMSE 1.417±0.083 4.907±2.551 +3.490 not reproduced (48% zero targets); excluded from the paper housing N-RMSE 0.218±0.009 0.228±0.030 +0.010 insurance N-RMSE 0.381±0.028 0.384±0.028 +0.003 plasma_retinol N-RMSE 0.388±0.033 – – data not released wine N-RMSE 0.105±0.001 0.105±0.001 +0.000 21 datasets re-run: median |diff.| = 0.004, max = 0.017, 14 of 21 within 0.01 (forest-fires excluded)
18
J. Luo et al.
S2
Harness Details
LLM-FE runs from the authors’ public code with three changes. We use OpenRouter instead of the OpenAI endpoint, increase the completion limit from the default 512 tokens to the limits of Table 1 of the main text, and add to its extractor a repair already used by SHAPEvo-FE: if a reply is cut off before the return statement, the last assigned variable is returned instead of discarding the reply. SHAPEvo-FE’s extractor also removes incomplete final statements and ignores attempts to drop nonexistent columns, a common GPT-3.5 error. The official scorer uses the same source rewrites as the search evaluator: redirecting df_input reads to df_output after its creation and adding errors="ignore" to .drop() calls. The Haiku runs use an updated SHAPEvo-FE extractor that preserves indented helper functions and comments, retains complete functions in truncated replies, and fixes the input-column rewrite. The scorer applies this last fix to all backbones. It affects 33 of the 21,831 GPT-3.5 programs and 50 of the 21,849 no-SHAP programs (22,000 evaluations each, less the calls that returned no program), one DeepSeek program and none for Haiku. All affected programs failed during search, so the reported results remain unchanged. We exclude one OpenRouter provider because its coding style is incompatible with both program extractors. The LLM-FE paper does not state its N-RMSE normaliser. We recovered mean(y) by reverse-solving its published baseline column, which 5 of 6 regression datasets match to within 0.003. forest-fires is the exception, and its published LLM-FE score could not be reproduced either (Table S1), because 48% of its targets are zero and a few extreme values dominate the RMSE under any split. For this reason it is left out of every table, figure and count in the paper, and only its published and re-run scores are kept in Table S1. One detail of the evaluator affects fairness. It reads data with nullable pandas types, whereas both searches see missing values filled with zero, and programs that crash on pd.NA are silently dropped. We re-try such programs on zero-filled input, which changes nothing for programs that already ran and recovers folds that were discarded. For GPT-3.5 this turned one apparent LLM-FE win, housing, into a tie. The first two backbones, including both methods, the control, a pilot and three aborted SHAPEvo-FE runs, cost about 250 US dollars in API credits. The Haiku runs, including both methods and the control, cost another 85 US dollars. Tokens and cost per method are in Sect. S9.
S3
Datasets
The table below lists the 22 datasets with their number of rows, number of input columns and task type. The 21 public ones are the datasets of the LLMFE benchmark for which data and task descriptions were released, without forest-fires (Sect. S2).
Explanation-Guided Evolution of LLM-driven Feature Engineering
19
Table S2. Datasets, with n rows and p input columns. synthetic is a dataset generated for this study, unseen by any LLM during pretraining and not publicly available. All others are the public LLM-FE benchmark tasks. Dataset
n
p Task
adult 48,842 14 classification balance-scale 625 4 classification bank 45,211 16 classification bike 17,379 12 regression blood 748 4 classification breast-w 699 9 classification car 1,728 6 classification cmc 1,473 9 classification communities 1,994 102 classification crab 3,893 8 regression credit-g 1,000 20 classification eucalyptus 736 19 classification heart 918 11 classification housing 20,640 9 regression insurance 1,338 6 regression junglechess 44,819 6 classification myocardial 686 91 classification pc1 1,109 21 classification synthetic (grouped CV) 21,208 19 classification tic-tac-toe 958 9 classification vehicle 846 18 classification wine 6,497 12 regression
S4
Convergence
This section shows the search-speed comparison of Sect. 5.2 of the main paper in more detail: the speed-up at equal level along the whole budget, how the LLM tokens of Table 3 are counted, and for every dataset the score of every evaluated program against the number of evaluations, the best-so-far score against wallclock time, and the wall-clock time each method needs to reach 95% of its own final gain. Table 3 of the main text counts LLM tokens with one tokenizer (tiktoken, cl100k_base) on the prompt and reply text of every call, for both methods, because the LLM-FE code records no token usage. For SHAPEvo-FE the saved prompts and replies are counted directly. For LLM-FE the prompt is reconstructed as its code builds it, from the role and instruction block, the task sentence, one description line per column, ten example rows, the two sampled parent programs (taken as the mean program length of that fold) and the header of the function to complete, and the reply is the stored program. The counts approximate what the provider bills (the providers’ own tokenizers split the same text differently: on heart, fold 1, our count divided by the prompt tokens the provider billed is 1.00 for GPT-3.5, 0.92 for DeepSeek and 0.64 for Haiku), but the same tokenizer is used for both methods of a backbone, so the ratio is fair. Wall-clock minutes in Table 3 come from the same runs, which for a given backbone were executed through the same gateway in the same week.
speed-up vs. LLM-FE (log)
20
J. Luo et al.
(a) GPT-3.5-Turbo
(b) DeepSeek-V4-Flash
2
lower bound
4 3 2
1 0.5 n=21 datasets
0
100
evaluations
200
0.5
4 3 2
lower bound
1
1
0.2
(c) Claude-Haiku-5.5
n=22 datasets
0
100
evaluations
200
0.5
n=22 datasets
0
100
200
evaluations
Fig. S1. Speed-up at equal level, from the curves of Fig. 2 of the main text: for the level SHAPEvo-FE has after a given number of programs, how many times more programs LLM-FE needs to reach the same level. Values above 1 mean SHAPEvo-FE gets there with fewer programs. Where the curve is dashed, SHAPEvo-FE is above the final level of LLM-FE, which never reaches it within its budget of 200. The plotted value is then 200/n, a lower bound on the true speed-up, which is why the dashed part falls to 1 at n = 200.
Table S3. Wall-clock time in minutes to reach 95% of a method’s own final gain (t95 ) and total run time per fold, median over folds, per backbone. Both methods were run through the same API gateway in the same week. SHAPEvo-FE’s longer run times with DeepSeek come from its longer replies, a median of 46 features per program, and from the SHAP computation after every evaluation. GPT-3.5-Turbo Dataset
DeepSeek-V4-Flash
LLM-FE SHAPEvo-FE t95 (min) total (min) t95 (min) total (min)
adult balance-scale bank bike blood breast-w car cmc communities crab credit-g eucalyptus heart housing insurance junglechess myocardial pc1 synthetic tic-tac-toe vehicle wine
9.6 2.2 8.7 3.1 5.6 5.0 9.5 8.8 5.7 4.4 10.3 11.4 6.9 16.6 10.0 7.5 10.9 8.6 11.1 11.3 8.0 6.0
median
8.6
20.9 14.0 18.9 16.6 11.5 12.4 12.0 13.8 7.8 17.0 15.6 18.5 12.5 20.8 11.4 30.1 21.9 13.1 21.5 19.2 21.0 19.8
14.2 3.0 34.2 11.9 2.2 3.2 9.6 11.0 47.1 7.9 3.7 0.9 2.7 19.5 6.9 30.1 9.0 5.5 9.3 9.7 3.0 22.7 9.1
27.4 15.3 35.7 32.7 12.0 15.0 16.3 24.4 86.0 23.5 23.3 28.2 17.6 32.9 16.6 61.2 28.3 17.8 37.0 16.0 22.7 27.3
Dataset
Claude-Haiku-5.5
LLM-FE SHAPEvo-FE t95 (min) total (min) t95 (min) total (min)
adult balance-scale bank bike blood breast-w car cmc communities crab credit-g eucalyptus heart housing insurance junglechess myocardial pc1 synthetic tic-tac-toe vehicle wine
11.8 0.4 11.0 38.3 15.9 16.6 15.1 8.0 35.2 31.5 16.2 30.1 23.2 22.1 28.0 3.6 22.3 15.3 21.5 30.4 13.9 41.6
median
19.0
48.4 38.7 41.3 51.4 46.7 42.0 50.1 45.6 75.6 60.4 39.6 47.5 44.8 54.5 46.7 89.4 63.9 40.5 63.0 53.1 52.3 49.9
27.6 0.4 50.3 81.7 63.1 37.5 21.4 79.5 108.1 77.0 57.3 82.6 50.8 54.6 55.3 1.5 55.2 61.3 89.0 19.8 70.7 94.5 56.3
130.6 75.9 132.6 143.3 83.2 78.9 91.9 126.4 224.9 131.3 94.8 107.8 87.9 145.0 101.8 213.1 101.0 89.2 134.0 84.6 102.4 126.5
Dataset
LLM-FE SHAPEvo-FE t95 (min) total (min) t95 (min) total (min)
adult balance-scale bank bike blood breast-w car cmc communities crab credit-g eucalyptus heart housing insurance junglechess myocardial pc1 synthetic tic-tac-toe vehicle wine
2.7 0.2 21.7 19.2 8.4 9.6 3.5 6.4 12.9 13.1 9.2 19.8 8.2 19.8 14.1 4.5 17.5 7.4 20.2 2.0 18.9 24.7
median
11.3
31.4 12.1 33.2 27.9 15.1 18.6 16.6 19.6 50.1 27.9 18.5 26.3 21.4 35.2 17.3 48.1 26.3 20.3 38.9 19.9 23.6 30.5
29.6 0.1 27.9 13.7 10.8 9.4 13.2 26.8 113.1 17.4 17.7 21.9 8.4 38.5 6.0 10.4 5.7 15.0 31.6 5.5 19.1 16.7 15.9
45.7 8.4 52.2 52.4 20.8 15.4 27.0 41.9 150.7 40.5 22.7 48.1 17.4 63.2 28.9 126.5 41.6 20.5 59.4 17.3 38.0 53.4
Explanation-Guided Evolution of LLM-driven Feature Engineering
21
GPT-3.5-Turbo: inner-validation score vs. number of evaluations (dots: every evaluation, line: best-so-far, mean over folds, band: ±1 std)
accuracy
synthetic
adult
0.870
0.873
0.868
0.872
0.866
0.98
0.907 0.906
0.94 0.92
0.870
0.862 0.860 50
75
100
bike
125
150
175
200
50
75
100
blood
125
150
175
200
25
42.0
0.740 0.735
41.5
0.730
41.0 50
75
100
cmc
125
150
175
0.720
200
50
75
100
crab
125
150
175
RMSE (lower = better)
0.52 0.51
150
175
200
0.990
0.960
0.985
25
50
75
100
heart
125
150
175
50
75
100
credit-g
125
150
175
200
2.28
0.84 0.83 25
50
75
100
125
myocardial
150
175
200
50
75
100
housing
125
150
175
200
accuracy
48500 48000 47500 47000
0.77 25
50
75
25
50
75
100
125
150
175
200
100
125
150
175
200
wine
75
100
125
insurance
150
175
200
25
50
75
100
125
150
175
200
25
50
75
100
125
150
175
200
25
50
75
100
pc1
125
150
175
25
50
75
100
125
150
175
200
100
25
50
75
100
125
150
175
200
0.86 50
75
125
150
175
200
100
125
tic-tac-toe
150
175
200
0.84 0.80 0.79
0.990
0.78
0.985
0.77
0.980
0.76
0.970
75
0.88
0.995
0.975 50
0.90
1.000
0.92
25
0.92
25
0.93
junglechess
0.94
5000
200
0.63
0.96
5100
4800
eucalyptus
0.98
5200
46000
0.94
0.78
50
5300
4900
0.95
0.79
200
0.64 25
46500
0.96
0.80
175
0.65
5400
0.97
0.81
150
0.66
0.73
RMSE (lower = better)
RMSE (lower = better)
accuracy
0.85
125
car
0.67
0.74
2.30
49000
0.86
100
0.68
0.75
2.32
25
0.87
75
0.69
0.76
2.34
200
50
0.980 25
2.26 0.50
25
0.995
0.965
200
2.36
0.53
breast-w
125
0.950 25
2.38
0.54
100
0.955
0.725 25
75
0.970
0.750 0.745
50
0.975
0.755
42.5
0.903
0.86
0.760
43.0
0.904
0.88
25
43.5
0.905
0.90
0.869
SHAPEvo-FE (5 folds) LLM-FE (5 folds)
25
RMSE (lower = better)
bank 0.908
0.96
0.871
0.864
accuracy
balance-scale 1.00
vehicle
0.75 25
50
75
100
125
150
175
200
RMSE (lower = better)
0.665 0.660 0.655 0.650 0.645
# evaluations
Fig. S2. Score against the number of evaluations for every dataset with the GPT-3.5Turbo backbone. Each dot is the inner-CV score of one evaluated program, pooled over the five outer folds. The lines are the best-so-far score, mean over folds, with a band of one standard deviation. Regression datasets are drawn as RMSE, lower is better. The y-axis covers the lines and the central 90% of the dots, so a few programs with extreme scores fall outside the panel. communities is omitted because LLM-FE completed one fold.
22
J. Luo et al.
DeepSeek-V4-Flash: inner-validation score vs. number of evaluations (dots: every evaluation, line: best-so-far, mean over folds, band: ±1 std) adult
balance-scale
bank
0.873
1.025
0.908
0.874
0.872
0.872
1.000
0.906
0.871
0.975
0.870
0.950
0.869
0.925
0.868
0.900
0.867
0.875
0.866
0.850
0.870 0.868 0.866 0.864 0.862
SHAPEvo-FE (5 folds) LLM-FE (5 folds)
0.860 25
50
75
100
bike
125
150
175
200
25
100
blood
125
150
175
200
41.5 41.0
50
75
100
cmc
125
150
175
100
breast-w
125
150
175
200
0.965
0.74
0.960
50
75
25
50
75
25
50
75
25
50
75
25
50
75
100
125
150
175
200
100
125
150
175
200
100
125
150
175
200
100
125
150
175
200
100
125
150
175
200
car
0.99 0.98 0.97 0.96 0.95
0.955 50
75
100
125
communities
150
175
200
0.94 25
0.720 0.710 0.705 0.700
0.52
0.695 0.690
0.51
0.685 0.50 25
50
75
100
125
eucalyptus
150
175
0.680
200
25
50
75
100
heart
125
150
175
0.85 0.84 0.83
0.64 50
75
100
125
junglechess
150
175
200
175
200 0.78
25
50
75
100
125
myocardial
150
175
200
0.76
2.26
0.75
2.24
0.74 0.73
2.22
0.72 50
75
100
housing
125
150
175
200
47000 46500 46000
5200 5100 5000 4900
25
50
75
100
pc1
125
150
175
200
4800
1.00
0.82
0.950
0.98
0.81
0.945
0.80
0.940
0.990
0.935
0.985
0.96 0.94
0.79
0.92 0.90
0.78
0.88
0.77 25
50
75
0.84
100
vehicle
125
150
175
200
50
75
25
50
75
100
125
150
175
200
100
125
150
175
200
wine
0.925
0.995
0.980 0.975 25
50
75
100
125
150
175
200
0.665 RMSE (lower = better)
0.82 0.80 0.78 0.76
0.660 0.655 0.650 0.645
25
50
75
100
125
# evaluations
150
175
200
# evaluations
tic-tac-toe
1.000
0.930 25
insurance
5300
47500
45000
credit-g
0.77
45500
0.82 25
150
2.28
25
RMSE (lower = better)
0.86
0.66
crab
125
48000
0.87
0.68
100
2.30
200
0.88 0.70
75
2.20
0.89
0.72
50
2.32
0.715
0.53
0.86
25 1.00
0.970
25
0.54
accuracy
0.894 75
0.975
0.75
200
0.55
accuracy
0.896
50
0.950 25
accuracy
0.898
0.980
0.73
40.5
0.900
0.985
0.76
42.0
0.902
25
0.77
42.5
0.904
RMSE (lower = better)
RMSE (lower = better)
75
0.78
43.0
accuracy
50
RMSE (lower = better)
accuracy
synthetic 0.876
Fig. S3. As the previous figure, DeepSeek-V4-Flash backbone.
Explanation-Guided Evolution of LLM-driven Feature Engineering
23
Claude-Haiku-5.5: inner-validation score vs. number of evaluations (dots: every evaluation, line: best-so-far, mean over folds, band: ±1 std) adult
balance-scale
0.874
0.872
0.873
0.870
0.872
0.868
0.871
0.94
0.870
0.92
0.869
0.90
0.866 0.864 0.862 0.860 25
50
75
RMSE (lower = better)
43.5
100
bike
125
150
175
0.867
200
43.0
0.77
42.5
0.76
42.0
0.75
41.5
0.74
41.0 40.5 25
50
75
100
cmc
125
150
175
accuracy
75
100
blood
125
150
175
200
125
eucalyptus
150
175
200
150
175
0.898
200
50
75
100
125
communities
150
175
75
100
heart
125
175
75
100
crab
125
150
175
200
0.77
2.30
0.76
2.28
0.75
2.26
0.74
2.24 50
75
100
housing
125
150
175
200
0.85
0.66
0.84 0.64 50
1.00
75
100
125
junglechess
150
175
200
25
accuracy
75
100
125
myocardial
150
175
200
100
vehicle
125
150
175
200
0.82
75
25
50
75
RMSE (lower = better)
0.80 0.79 0.78 0.77 0.76 0.75 50
75
100
125
# evaluations
150
175
200
200
100
125
150
175
200
100
125
150
175
200
100
125
150
175
200
insurance
5200 5100 5000
25
50
75
100
pc1
125
150
175
200
tic-tac-toe
1.000 0.995
0.985 0.980 0.975
0.925 25
50
75
25
50
75
100
125
150
175
200
100
125
150
175
200
wine
25
50
75
100
125
150
175
200
0.660 0.655 0.650 0.645
25
175
5300
0.665
0.81
0.74
45000
0.930
0.77 75
50
150
0.990
0.78
50
45500
0.935
0.79
25
46000
0.940
0.80
0.80
46500
0.945
0.81
0.90 0.85
accuracy
50
0.82
0.95
25
125
4900
0.83 25
75
100
credit-g
5400 RMSE (lower = better)
RMSE (lower = better)
accuracy
0.86
50
200
0.73 25
47000
0.87
0.68
25
175
0.78
0.88 0.70
75
150
0.93 50
2.32
200
50
125
car
0.94 25
2.36
150
25
100
0.97
2.22 50
75
0.98
2.34
25
50
0.99
0.95
200
25
1.00
0.96
0.950
0.685 100
breast-w
125
0.960 0.955
0.690
75
100
0.965
0.72
0.695
50
75
0.970
0.700
25
50
0.975
0.705
0.51
0.900 25
0.980
0.710
0.52
0.50
50
0.715
0.53
0.902
0.86 25
0.720
0.54
0.904
0.88
25
0.55
0.906
0.96
0.73 200
0.908
0.98
0.868
SHAPEvo-FE (5 folds) LLM-FE (5 folds)
bank
1.00
RMSE (lower = better)
accuracy
synthetic 0.874
# evaluations
Fig. S4. As the previous figure, Claude-Haiku-5.5 backbone.
24
J. Luo et al.
GPT-3.5-Turbo: best-so-far inner-validation score (mean over folds; dot = 95% of final gain)
0.8720 accuracy
0.8715 0.8710 0.8705
0
20
40 60 wall-clock (min)
80
0
10
20 30 40 wall-clock (min)
42.50 42.25 42.00 41.75 41.50 41.25 41.00 40.75
bank 0.9070 0.9065 0.9060 0.9055 0.9050
0
10
20 30 wall-clock (min)
40
0
breast-w
0.9725
accuracy
0.750 0.745
0.9675 0.9650 0.9625 0.9600
0.740
0.9575 40 60 wall-clock (min)
80
0
10
20 30 wall-clock (min)
40
RMSE (lower = better)
0.700 0.695 0.690
50
60
0
50
eucalyptus
100 wall-clock (min)
RMSE (lower = better)
accuracy
0.8575 0.8550 0.8525
50
60
0
junglechess
0.98 0.96
accuracy
0.94 0.92 0.90 0.88 0
20
40 60 80 wall-clock (min)
10
0
10
vehicle
RMSE (lower = better) 0
10
20 30 40 wall-clock (min)
20 30 40 wall-clock (min)
50
60
20 30 40 wall-clock (min)
50
60
wine
0.790 0.785 0.780 0.775 0.770 0.765 0.760 50
0.7525 0.7500 0.7450
10
20 30 40 wall-clock (min)
50
0
10
20 30 wall-clock (min)
40
20 30 wall-clock (min)
40
20 30 wall-clock (min)
40
insurance
5200
48000 47500 47000 46500 46000
40
0
myocardial
0.8025 0.8000 0.7975 0.7950 0.7925 0.7900 0.7875 0.7850
100 120
20 30 wall-clock (min)
accuracy
20 30 40 wall-clock (min)
50
0.7550
48500
0.8600
20 30 40 wall-clock (min)
credit-g
housing
0.8625
10
10
0.7475 0
0.8650
0
0
0.7575
heart
0.680 0.675 0.670 0.665 0.660 0.655 0.650
60
car
0.7600
2.31 2.30 2.29 2.28 2.27 2.26 2.25
150
20 40 wall-clock (min)
0.996 0.994 0.992 0.990 0.988 0.986 0.984
40
RMSE (lower = better)
20 30 40 wall-clock (min)
20 30 wall-clock (min)
crab
0.705
10
10
accuracy
0.5375 0.5350 0.5325 0.5300 0.5275 0.5250 0.5225 0
0
communities
20
40 60 wall-clock (min)
5150 5100 5050 5000
80
0
10
pc1
0.9475 0.9450 0.9425 0.9400 0.9375 0.9350 0.9325 0.9300
tic-tac-toe
0.996 0.994 accuracy
20
accuracy
accuracy
balance-scale
0.9700
cmc
accuracy
60
0.755
0
accuracy
50
blood
accuracy
RMSE (lower = better)
bike
accuracy
LLM-FE 1.00 0.98 0.96 0.94 0.92 0.90 0.88 0.86
accuracy
0.8685 0.8680 0.8675 0.8670 0.8665 0.8660 0.8655
SHAPEvo-FE
accuracy
adult
accuracy
accuracy
synthetic
0.992 0.990 0.988
0
10
20 30 wall-clock (min)
40
0
10
0.656 0.654 0.652 0.650 0.648 0
10
Fig. S5. Best-so-far inner-CV score against wall-clock time for every dataset with the GPT-3.5-Turbo backbone, mean over the five outer folds. The dot marks the time at which a method reaches 95% of its own final gain, the t95 of Table S3. Both methods were run through the same API gateway in the same week.
Explanation-Guided Evolution of LLM-driven Feature Engineering
25
adult
200
accuracy 0
50
41.0 40.5 50
0.980
0.760
0.975
0.755 0.750 0.745
100 150 wall-clock (min)
200
25
0.525
0
0
50
100 150 wall-clock (min)
0.705 0.700
200
0
50
50 100 wall-clock (min)
150
0.880 0.875 0.870 0.865 0.860 0.855 0.850
0
25
junglechess
1.00 0.98 0.96 0.94 0.92 0.90 0.88
50 75 100 wall-clock (min)
125
accuracy
accuracy
0.800 0.795 0.790 0.785
100 150 200 wall-clock (min)
250
0
vehicle
RMSE (lower = better)
0.83 0.82 0.81 0.80 0.79 0.78 0.77 0.76 0
25
50 75 100 125 150 wall-clock (min)
50 100 wall-clock (min)
150
100 150 wall-clock (min)
200
wine
0.6575 0.6550 0.6525 0.6500 0.6475 0.6450 0.6425 0
50
100 120
0
200
25
50 75 100 wall-clock (min)
125
50 75 100 wall-clock (min)
125
50 100 wall-clock (min)
150
credit-g
0.770 0.765
2.28
0.760
2.26 2.24
0.755 0.750
2.22
48500 48000 47500 47000 46500 46000 45500 45000
100 150 wall-clock (min)
car
0.745 0
50
100 150 wall-clock (min)
200
0
25
insurance
0
50
100 150 wall-clock (min)
5200 5150 5100 5050 5000 4950 4900
200
0
pc1
0.805
50
50
1.0000 0.9975 0.9950 0.9925 0.9900 0.9875 0.9850
crab
myocardial
0.810
0
0
housing
RMSE (lower = better)
accuracy 0
40 60 80 wall-clock (min)
heart
0.71 0.70 0.69 0.68 0.67 0.66 0.65
0.9055
2.30
2.20
100 150 200 250 300 wall-clock (min)
eucalyptus
20
2.32
0.695
0.520
accuracy
125
0.9060
100
0.965
RMSE (lower = better)
accuracy
0.530
accuracy
50 75 100 wall-clock (min)
0.710
0.535
80
0.970
communities
0.540
40 60 wall-clock (min)
0.960 0
cmc
0.545
accuracy
0.765
0.740 0
20
accuracy
41.5
0.9065
0.9050 0
breast-w
accuracy
42.0
40.0
accuracy
200
blood
accuracy
RMSE (lower = better)
bike
100 150 wall-clock (min)
bank 0.9070
accuracy
100 150 wall-clock (min)
balance-scale
RMSE (lower = better)
50
0.87150 0.87125 0.87100 0.87075 0.87050 0.87025 0.87000
LLM-FE 1.00 0.98 0.96 0.94 0.92 0.90 0.88 0.86
tic-tac-toe
0.9450 0.9425 0.9400 0.9375 0.9350 0.9325 0.9300
0.996 accuracy
0
SHAPEvo-FE
accuracy
synthetic
0.873 0.872 0.871 0.870 0.869 0.868 0.867 0.866
accuracy
accuracy
DeepSeek-V4-Flash: best-so-far inner-validation score (mean over folds; dot = 95% of final gain)
0.994 0.992 0.990 0.988
0
25
50 75 100 wall-clock (min)
125
0
20
40 60 80 100 120 wall-clock (min)
Fig. S6. As the previous figure, DeepSeek-V4-Flash backbone.
26
J. Luo et al.
Claude-Haiku-5.5: best-so-far inner-validation score (mean over folds; dot = 95% of final gain)
0.8720
0.869 0.868 0.867 0.866
0.8715 0.8710
40 60 wall-clock (min)
80
0
10
0.975
0.755
0.970
0.750 0.745
60
5
0.530
20
0.695
0.520
0.690
50
eucalyptus
0
50
0.67 0.66
0.860 0.855 0.850
0.65 0
10
20 30 40 wall-clock (min)
50
0
5
junglechess
10 15 wall-clock (min)
accuracy
accuracy 200
0.800 0.795 0.785
0
10
vehicle
RMSE (lower = better)
0.80 0.79 0.78 0.77 0.76 0
10
20 30 wall-clock (min)
20 30 wall-clock (min)
40
20 30 40 wall-clock (min)
50
50
wine
0.81
40
10 20 wall-clock (min)
30
0.760
2.26 2.24
0.755 0.750
2.22
0.745 10
20 30 wall-clock (min)
40
0
insurance
48500 48000 47500 47000 46500 46000 45500 45000 20
40 60 wall-clock (min)
80
5200 5150 5100 5050 5000 4950 4900
0
tic-tac-toe
0.942 0.940 0.938 0.936 0.934 0.932 0.930 0
5
10 15 20 wall-clock (min)
25
0.998 0.996 0.994 0.992 0.990 0.988 0
5
0.6575 0.6550 0.6525 0.6500 0.6475 0.6450 0
10
30
credit-g
pc1
0.790 100 150 wall-clock (min)
30
5
0.770
0
0.805
50
0
0.765
20
0.810
0
20
2.28
myocardial
0.98 0.96 0.94 0.92 0.90 0.88
10 15 wall-clock (min)
housing
RMSE (lower = better)
accuracy
0.68
10 20 wall-clock (min)
0.9875
crab
0
0.865
0.69
25
0.9900 0.9850
5
heart
0.870
0.70
10 15 20 wall-clock (min)
0.9925
2.30
200
60
0.9950
2.32
100 150 wall-clock (min)
20 40 wall-clock (min)
0.9975
0
0.700
0.525 20 30 40 wall-clock (min)
10 15 wall-clock (min)
RMSE (lower = better)
0.705
accuracy
0.710
0
car
0.965
communities
0.535
12
0.960 0
0.540
10
4 6 8 10 wall-clock (min)
accuracy
0.760
0.740
40.5
0
2
accuracy
41.0
20 40 wall-clock (min)
0
RMSE (lower = better)
41.5
bank 0.9075 0.9070 0.9065 0.9060 0.9055 0.9050 0.9045
breast-w
accuracy
accuracy
RMSE (lower = better)
50
0.765
42.0
cmc
accuracy
40
balance-scale
blood
42.5
0
accuracy
20 30 wall-clock (min)
1.00 0.98 0.96 0.94 0.92 0.90 0.88 0.86
accuracy
20
bike
accuracy
LLM-FE
0.8705 0
accuracy
SHAPEvo-FE
accuracy
0.870
adult
accuracy
0.8725
accuracy
accuracy
synthetic 0.871
60
Fig. S7. As the previous figure, Claude-Haiku-5.5 backbone.
10 15 wall-clock (min)
20
Explanation-Guided Evolution of LLM-driven Feature Engineering
S5
27
Held-Out Scores of the No-SHAP Control
Tables S4 to S6 give the held-out scores of the no-SHAP control of Sect. 4.2 of the main paper next to those of LLM-FE and the full SHAPEvo-FE, per dataset and backbone, with the same evaluator, splits and ensemble as Table S11. The last two columns are the differences between the full method and the control and between the control and LLM-FE, signed so that a positive value favours the first of the two. With GPT-3.5 the control and the full method are on par, with DeepSeek and Haiku the full method is ahead of the control on more datasets than it trails, and on every backbone the control alone is on par with LLM-FE. The LLM-FE wins of the control on car and bike with DeepSeek and on car, bike and tic-tac-toe with Haiku are the collapsed LLM-FE folds discussed in Sect. 5.1 of the main paper.
28
J. Luo et al.
Table S4. No-SHAP control with GPT-3.5-Turbo, held-out top-3 ensemble scores (mean ± std over folds), communities excluded as in the main paper. Bold marks |∆| > 0.01. Dataset
Metric
LLM-FE SHAPEvo-FE SHAPEvo-FE (no SHAP) ∆(full−noSHAP)
adult Acc. ↑ 0.872±0.004 balance-scale Acc. ↑ 1.000±0.000 bank Acc. ↑ 0.907±0.003 blood Acc. ↑ 0.741±0.030 breast-w Acc. ↑ 0.957±0.010 car Acc. ↑ 1.000±0.000 cmc Acc. ↑ 0.515±0.015 credit-g Acc. ↑ 0.758±0.017 eucalyptus Acc. ↑ 0.663±0.028 heart Acc. ↑ 0.862±0.020 junglechess Acc. ↑ 0.980±0.004 myocardial Acc. ↑ 0.790±0.027 pc1 Acc. ↑ 0.940±0.017 synthetic Acc. ↑ 0.872±0.003 tic-tac-toe Acc. ↑ 0.998±0.005 vehicle Acc. ↑ 0.759±0.021 bike N-RMSE ↓ 0.224±0.037 crab N-RMSE ↓ 0.222±0.014 housing N-RMSE ↓ 0.228±0.030 insurance N-RMSE ↓ 0.384±0.028 wine N-RMSE ↓ 0.105±0.001
0.872±0.002 1.000±0.000 0.906±0.003 0.735±0.029 0.959±0.003 0.999±0.003 0.521±0.010 0.749±0.018 0.673±0.029 0.857±0.023 0.954±0.026 0.776±0.031 0.931±0.005 0.865±0.007 0.990±0.010 0.766±0.030 0.211±0.006 0.232±0.015 0.218±0.008 0.385±0.023 0.108±0.001
0.874±0.002 1.000±0.000 0.906±0.002 0.745±0.028 0.963±0.009 0.998±0.003 0.521±0.019 0.762±0.039 0.675±0.031 0.856±0.024 0.972±0.005 0.787±0.024 0.930±0.009 0.869±0.004 0.997±0.005 0.759±0.026 0.213±0.007 0.231±0.014 0.228±0.010 0.388±0.024 0.109±0.001
∆(noSHAP−LLM-FE)
-0.002 +0.000 -0.000 -0.009 -0.004 +0.001 -0.000 -0.013 -0.003 +0.001 -0.018 -0.012 +0.002 -0.004 -0.007 +0.007 +0.001 -0.001 +0.010 +0.003 +0.001
+0.002 +0.000 -0.001 +0.004 +0.006 -0.002 +0.006 +0.004 +0.012 -0.005 -0.008 -0.003 -0.011 -0.002 -0.001 -0.000 +0.012 -0.009 +0.000 -0.004 -0.004
full vs. no-SHAP: full better 1 / no-SHAP better 3 / tie 17; no-SHAP vs. LLM-FE: no-SHAP better 2 / LLM-FE better 1 / tie 18 (|∆| > 0.01)
Table S5. As the previous table, DeepSeek-V4-Flash backbone. Dataset
Metric
LLM-FE SHAPEvo-FE SHAPEvo-FE (no SHAP) ∆(full−noSHAP)
adult Acc. ↑ 0.868±0.010 balance-scale Acc. ↑ 1.000±0.000 bank Acc. ↑ 0.907±0.004 blood Acc. ↑ 0.749±0.030 breast-w Acc. ↑ 0.971±0.011 car Acc. ↑ 0.908±0.174 cmc Acc. ↑ 0.526±0.027 communities Acc. ↑ 0.706±0.016 credit-g Acc. ↑ 0.758±0.019 eucalyptus Acc. ↑ 0.667±0.034 heart Acc. ↑ 0.852±0.024 junglechess Acc. ↑ 0.997±0.001 myocardial Acc. ↑ 0.796±0.019 pc1 Acc. ↑ 0.931±0.002 synthetic Acc. ↑ 0.867±0.007 tic-tac-toe Acc. ↑ 0.987±0.011 vehicle Acc. ↑ 0.775±0.018 bike N-RMSE ↓ 0.297±0.116 crab N-RMSE ↓ 0.218±0.015 housing N-RMSE ↓ 0.245±0.017 insurance N-RMSE ↓ 0.396±0.047 wine N-RMSE ↓ 0.105±0.001
0.873±0.002 1.000±0.000 0.907±0.002 0.755±0.026 0.967±0.004 1.000±0.000 0.511±0.017 0.694±0.015 0.740±0.010 0.674±0.018 0.854±0.031 0.997±0.001 0.789±0.015 0.938±0.010 0.871±0.005 0.998±0.005 0.801±0.033 0.204±0.004 0.224±0.013 0.211±0.005 0.380±0.034 0.106±0.003
0.872±0.002 1.000±0.000 0.905±0.003 0.738±0.026 0.964±0.009 0.998±0.003 0.534±0.014 0.700±0.015 0.752±0.016 0.644±0.021 0.854±0.029 0.997±0.001 0.783±0.031 0.936±0.007 0.867±0.004 0.996±0.007 0.786±0.020 0.204±0.005 0.228±0.015 0.222±0.018 0.384±0.014 0.108±0.001
∆(noSHAP−LLM-FE)
+0.001 +0.000 +0.002 +0.017 +0.003 +0.002 -0.023 -0.006 -0.012 +0.030 +0.000 +0.000 +0.006 +0.002 +0.004 +0.002 +0.015 +0.001 +0.004 +0.011 +0.004 +0.002
+0.004 +0.000 -0.002 -0.011 -0.007 +0.090 +0.008 -0.006 -0.006 -0.023 +0.002 +0.000 -0.013 +0.005 +0.000 +0.008 +0.011 +0.093 -0.010 +0.023 +0.012 -0.003
full vs. no-SHAP: full better 4 / no-SHAP better 2 / tie 16; no-SHAP vs. LLM-FE: no-SHAP better 5 / LLM-FE better 4 / tie 13 (|∆| > 0.01)
Table S6. As the previous table, Claude-Haiku-5.5 backbone. Dataset
Metric
LLM-FE SHAPEvo-FE SHAPEvo-FE (no SHAP) ∆(full−noSHAP)
adult Acc. ↑ 0.874±0.003 balance-scale Acc. ↑ 1.000±0.000 bank Acc. ↑ 0.894±0.019 blood Acc. ↑ 0.751±0.020 breast-w Acc. ↑ 0.966±0.009 car Acc. ↑ 0.957±0.093 cmc Acc. ↑ 0.521±0.022 communities Acc. ↑ 0.706±0.022 credit-g Acc. ↑ 0.741±0.021 eucalyptus Acc. ↑ 0.671±0.039 heart Acc. ↑ 0.855±0.023 junglechess Acc. ↑ 0.992±0.002 myocardial Acc. ↑ 0.780±0.033 pc1 Acc. ↑ 0.932±0.013 synthetic Acc. ↑ 0.868±0.008 tic-tac-toe Acc. ↑ 0.903±0.194 vehicle Acc. ↑ 0.772±0.026 bike N-RMSE ↓ 0.244±0.061 crab N-RMSE ↓ 0.220±0.013 housing N-RMSE ↓ 0.235±0.024 insurance N-RMSE ↓ 0.387±0.030 wine N-RMSE ↓ 0.105±0.002
0.874±0.003 1.000±0.000 0.909±0.005 0.759±0.033 0.961±0.012 0.998±0.004 0.495±0.021 0.708±0.022 0.740±0.017 0.679±0.021 0.861±0.026 0.993±0.001 0.778±0.026 0.931±0.017 0.871±0.004 0.999±0.002 0.790±0.017 0.202±0.006 0.220±0.015 0.214±0.011 0.381±0.021 0.106±0.002
0.874±0.003 1.000±0.000 0.907±0.003 0.747±0.026 0.966±0.012 0.998±0.003 0.531±0.016 0.703±0.018 0.748±0.021 0.659±0.038 0.846±0.014 0.995±0.002 0.794±0.021 0.935±0.007 0.867±0.008 0.994±0.011 0.775±0.039 0.208±0.006 0.228±0.010 0.225±0.017 0.385±0.021 0.107±0.002
-0.000 +0.000 +0.002 +0.012 -0.004 -0.000 -0.036 +0.005 -0.008 +0.020 +0.014 -0.001 -0.016 -0.005 +0.004 +0.005 +0.014 +0.006 +0.007 +0.011 +0.004 +0.001
∆(noSHAP−LLM-FE) +0.000 +0.000 +0.013 -0.004 -0.000 +0.041 +0.009 -0.003 +0.007 -0.012 -0.009 +0.002 +0.015 +0.003 -0.001 +0.091 +0.004 +0.036 -0.007 +0.010 +0.002 -0.002
full vs. no-SHAP: full better 5 / no-SHAP better 2 / tie 15; no-SHAP vs. LLM-FE: no-SHAP better 6 / LLM-FE better 1 / tie 15 (|∆| > 0.01)
Explanation-Guided Evolution of LLM-driven Feature Engineering
S6
29
Post-hoc Pruning of the Best Programs
With DeepSeek the best SHAPEvo-FE program of a fold adds a median of 46 features and the best LLM-FE program 18 (Table 4 of the main paper). To see how many of them the model needs, we took the best program of every fold, applied it to the training and held-out rows of that fold, trained one XGBoost model with seed 42 and scored it on the held-out rows, as in the official evaluation but with a single program instead of the top-3 ensemble. We then explained the model with TreeSHAP on the training rows, turned the mean absolute SHAP values into shares that sum to one, and retrained after dropping every added feature below a share threshold. Original columns are always kept. The two thresholds are the ones the SHAP report uses, 0.05 for keep and 0.01 for keep plus refine. A fourth variant keeps the fewest added features whose shares together cover 80% of the attribution of all added features, a rank-based rule that does not depend on the thresholds. Table S7 gives the median number of added features and the mean change of the held-out score, averaged over folds and then over datasets. Positive values mean that the pruned model scores better. A best program that fails outside the search harness is skipped, which happened on 7 of the 315 LLM-FE folds and on no SHAPEvo-FE fold, besides the four GPT-3.5 communities folds that returned no program. Keeping only the keep features leaves 1 to 4 added features per program for every backbone and method, and the held-out score moves by less than 0.01 on 15 to 20 of the 21 datasets. The largest drops are junglechess (−0.039) and vehicle (−0.017) for SHAPEvo-FE with DeepSeek and car and heart (both −0.024) for LLM-FE with DeepSeek. The largest gains are credit-g (+0.033) and cmc (+0.018) for SHAPEvo-FE with DeepSeek. With Claude-Haiku-5.5 the picture is the same at a smaller program size. LLM-FE adds 14 features and SHAPEvo-FE 11, of which 3 to 4 carry a keep share, and the largest drop after keeping only those is again junglechess, −0.068 for SHAPEvo-FE and −0.029 for LLM-FE. Keeping the keep and refine features changes the score by less than 0.01 on 20 or 21 of the 21 datasets in every row. The rank-based rule keeps 2 added features with GPT-3.5, 8.6 and 17.2 with DeepSeek and 7.0 and 5.8 with Haiku for LLM-FE and SHAPEvo-FE (Table 4 of the main text, which takes medians instead of means over folds, gives 8 and 17.5 and 7 and 5), and the score moves by less than 0.01 on 18 to 21 of the 21 datasets, the largest drop being eucalyptus, −0.020 for LLM-FE and −0.019 for SHAPEvo-FE with Haiku. Dropping all added features costs 0.008 to 0.014 on average in five of the six rows. Most of the features a DeepSeek program adds are therefore idle. The model leans on a handful of them and the rest neither help nor hurt. Neither search penalises program size, which is why the programs grow.
30
J. Luo et al.
Table S7. Post-hoc TreeSHAP pruning of the best program of each fold. Added features are medians over datasets of the per-dataset mean over folds. ∆ is the change of the single-program held-out score after pruning, mean over 21 datasets, positive when the pruned model is better, and the count gives the datasets on which |∆| ≤ 0.01. The last column drops every added feature. The top 80% variant keeps the fewest added features whose shares together cover 80% of the attribution all added features receive. Backbone
Method
Added features (median) full keep keep + refine top 80%
GPT-3.5-Turbo LLM-FE 3.4 GPT-3.5-Turbo SHAPEvo-FE 2.8 DeepSeek-V4-Flash LLM-FE 20.0 DeepSeek-V4-Flash SHAPEvo-FE 44.8 Claude-Haiku-5.5 LLM-FE 14.2 Claude-Haiku-5.5 SHAPEvo-FE 10.6
S7
1.6 1.4 3.2 2.8 3.4 4.0
2.6 2.4 12.4 23.0 10.4 8.6
2.2 2.0 8.6 17.2 7.0 5.8
∆ keep only
∆ keep + refine
∆ top 80%
∆ originals only
mean
|∆| ≤ 0.01
mean
|∆| ≤ 0.01
mean
|∆| ≤ 0.01
mean
|∆| ≤ 0.01
+0.0008 +0.0003 −0.0039 −0.0009 −0.0018 −0.0047
20/21 20/21 15/21 16/21 17/21 17/21
+0.0001 +0.0006 +0.0001 −0.0010 +0.0009 −0.0006
21/21 21/21 20/21 21/21 20/21 20/21
+0.0005 +0.0000 +0.0001 +0.0004 −0.0006 −0.0022
21/21 21/21 20/21 19/21 19/21 18/21
−0.0099 −0.0103 −0.0006 −0.0144 −0.0083 −0.0135
14/21 15/21 7/21 11/21 11/21 13/21
Scored Programs per Fold
Both methods have a budget of 200 programs per fold, but not every budget unit yields a scored program. An LLM call can fail or return no code, a returned program can crash, and with LLM-FE the authors’ extractor also discards replies in which the function text cannot be parsed. Table S8 reports, per backbone, the median number of scored programs per fold and the datasets with the lowest yield, computed by the script analysis/audit_programs.py of the released code. Since both pipelines complete a reply that was cut at the completion limit with a return statement (main paper, Sect. 4.2), the yields of the two methods are close. The median is 167 scored programs per fold for LLM-FE and 189 for SHAPEvo-FE with GPT-3.5, 185 and 195 with DeepSeek, and 195 and 200 with Claude-Haiku-5.5. The remaining gap on the LLM-FE side consists of replies without a function body, which with GPT-3.5 are about 9% of the samples and contain only a docstring, and of programs that reference columns their own code did not create. On SHAPEvo-FE’s side the failing programs are mostly of the latter kind, 8% of the evaluations with GPT-3.5 and 2% with DeepSeek. In an earlier version of this study LLM-FE’s pipeline did not complete cut replies, which with DeepSeek halved its yield to a median of 86 and inflated the speed advantage of SHAPEvo-FE to 4.4×. The numbers in the main paper are measured with both pipelines repairing cut replies. Before the scorer was aligned with the search evaluator (Sect. S2), 14 ensemble members with GPT3.5 and one with DeepSeek failed at scoring time on a column read or drop that the evaluator tolerates and were left out of their ensembles. With the aligned scorer no member fails, no win or loss changes and the mean ∆ of either backbone moves by less than 0.001. All held-out and search-speed numbers are reported as run.
Explanation-Guided Evolution of LLM-driven Feature Engineering
31
Table S8. Scored programs per fold with a budget of 200 for both methods. “All folds” is the median over every fold of the backbone. “Three lowest datasets” lists the three datasets whose median over their folds is lowest, each with that median. LLM-FE Backbone
all folds
GPT-3.5-Turbo DeepSeek-V4-Flash Claude-Haiku-5.5
167 185 195
SHAPEvo-FE
three lowest datasets
all folds
tic-tac-toe 138, myocardial 145, crab 149 tic-tac-toe 143, junglechess 152, myocardial 160 myocardial 177, heart 188, housing 188
189 195 200
three lowest datasets balance-scale 149, vehicle 171, bank 176 blood 190, tic-tac-toe 191, cmc 192 bike 198, crab 198, synthetic 199
Table S9. Per-dataset version of Table 4 of the main text: features added by the best program of each fold and features kept at a TreeSHAP share of at least 0.05, medians over five folds. GPT-3.5-Turbo LLM-FE SHAPEvo-FE added kept added kept
Dataset adult balance-scale bank blood breast-w car cmc communities credit-g eucalyptus heart junglechess myocardial pc1 tic-tac-toe vehicle bike crab housing insurance wine median
3 5 3 2.5 3.5 3 2 2 3 3 3 8 3 2 8 3 3 4 12.5 8 3
0 1 1 2 3 2 2 0 2 1 1 3 1.5 1 4 1 1 2 3 2 1
3
1.5
2 1 3 1 4 5 2 1 3 3 3 5 1 1 4 1 2 2.5 4.5 4 3
0 1 1 1 3 4 2 0 1 1 1 3 0 1 0 1 2 2 3 3 0
3
1
DeepSeek-V4-Flash LLM-FE SHAPEvo-FE added kept added kept 9 18 13 16 10 19 15 25 16 15 16 45 31.5 30 36 18 34 42 35 14 28
1 2 2 7 5 4 6 1 3 2 5 4 1.5 4 5 2 5 3 4 3 2
18
3
49 34 48 54 28 45 45 50 55 36 31 54 36 46 29 34 46 55 46 35 50
2 2 2 3 4 4 0 1 1 3 3 2 0 4 3 4 4 3 4 3 2
46
3
Claude-Haiku-5.5 LLM-FE SHAPEvo-FE added kept added kept 7 8 14 9 9 10 10 11 15 16 11 20 24 22 8 15 18 23 32 13 18
2 2 3 6 5 4 4 0 3 3 2 5 1 5 3 3 4 3 4 2 2
14
3
5 6 7 13 15 10 10 9 12 18 8 26 7 11 19 12 10 8 17 12 9
2 2 3 9 5 5 7 2 3 5 4 4 3 4 4 4 4 3 3 4 3
10
4
∆ held-out, kept only datasets with |∆| ≤ 0.01
+0.0008 20/21
+0.0003 20/21
−0.0039 15/21
−0.0009 16/21
−0.0018 17/21
−0.0047 17/21
kept, rank-based (median) ∆ held-out, rank-based kept only datasets with |∆| ≤ 0.01
2 +0.0005 21/21
2 +0.0000 21/21
8 +0.0001 20/21
17.5 +0.0004 19/21
7 −0.0006 19/21
5 −0.0022 18/21
S8
A Complete SHAPEvo-FE Prompt
Listing S1 is one prompt exactly as sent to the LLM, and Listing S2 the reply. It is the second mutation prompt of the second generation on heart, outer fold 1 of the seed-42 split, with DeepSeek-V4-Flash through OpenRouter, reasoning disabled and a 2048-token completion limit, taken from the reported run. Every prompt and reply of the reported runs is stored with the released logs. The prompt contains, in this order, the role and instructions, which are shared with LLM-FE up to the row-wise and numeric-output constraints, the task, the feature descriptions, the example rows, the fitness and feature names of the five population members, the selected parent with its code (abbreviated here), the SHAP feedback report of the parent with the keep/refine/replace labels, the original columns that still carry SHAP mass and the redundancy flags, the three interaction hints, the guidance derived from the SHAP report, and the output instruction. The reply is cut at the 2048-token limit in the middle of an assignment. The extractor drops that statement and appends return df_output, and
32
J. Luo et al.
the repaired program obtained an inner-CV accuracy of 0.831, where the parent had 0.837, the best member of the population 0.865, and the fold ended at 0.876. Typographic characters in the templates, such as the curly apostrophe, the em dash, ± and ×, are shown as ASCII. Listing S1. The prompt (parent code abbreviated). ### <Role> You are a data scientist expert in the field of the given dataset. Your role is to apply your domain expertise to identify and create, and refine the most ,→ informative features that solve the <Task> effectively. ### <Instructions> - You are provided with the task description, a list of existing features, and data ,→ examples. - Use your domain knowledge to derive features that capture meaningful patterns, trends, ,→ or relationships inherent in the data. - Prioritize features that have high potential to enhance the model’s ability to solve ,→ the <Task>, considering both relevance and predictive power. - **All operations must be row-wise.** Each output value must depend ONLY on values in ,→ the SAME row. Do NOT use df.groupby(), .transform(), .mean(), .std(), .median(), . ,→ rank(), .quantile(), .value_counts(), **pd.cut(), pd.qcut(), np.digitize(), np. ,→ histogram_bin_edges()** (their bin edges are derived from the input distribution ,→ and therefore differ between train and test folds), or any cross-row aggregate. ,→ The function is applied independently to train and test splits, so cross-row ,→ statistics leak split-specific information. For binning, use fixed numeric ,→ thresholds, e.g. ‘(df[’x’] > 5.0).astype(int)‘. - **All output columns must be numeric (int / float).** Do NOT cast to string and ,→ concatenate (XGBoost silently drops object-dtype columns). Combine categorical/ ,→ integer columns numerically, e.g. ‘df[’a’] * 100 + df[’b’]‘. - For each derived feature, provide: - A clear explanation of how it was derived and justification of its relevance for ,→ solving the <Task>. - Ensure your approach remains grounded in the context of the dataset and the <Task>, ,→ and aim for features that are interpretable and actionable. Please generate as many new features as possible using the information from the task, ,→ feature descriptions, examples, and your domain understanding of the dataset. Remove any irrelevant, redundant, or less informative features to enhance overall ,→ performance. First, describe your new feature transformation and the main steps in a concise, one,→ sentence docstring. Then, implement it in Python as a function that adheres to the given specifications. **Hard constraint 1 (row-wise):** the function MUST be pure row-wise. Do NOT use df. ,→ groupby(), df.transform(), df[’x’].mean()/.std()/.median()/.rank()/.quantile(), . ,→ value_counts(), frequency counts, **pd.cut(), pd.qcut(), np.digitize(), np. ,→ histogram_bin_edges()** (their bin edges are derived from the input column’s ,→ distribution and therefore DIFFER between train and test folds, leaking split ,→ information), or any operation whose output for a row depends on other rows. For ,→ binning, ONLY use fixed numeric thresholds, e.g. ‘(df[’x’] > 5.0).astype(int)‘. **Hard constraint 2 (numeric output):** every column written into df_output must be ,→ numeric (int / float). Do NOT cast to string and concatenate -- XGBoost will ,→ silently drop object-dtype columns. Use numeric encoding instead, e.g. ‘df[’a’] * ,→ 100 + df[’b’]‘. Avoid providing any further explanations or additional descriptions. ### <Task> Does the coronary angiography of this patient show a heart disease? Yes or no? ### <Features>
Explanation-Guided Evolution of LLM-driven Feature Engineering
33
- Age: age of the patient (numerical variable within range [28, 77]) - Sex: sex of the patient (categorical variable with categories [1, 0]) - ChestPainType: chest pain type (categorical variable with categories [1, 0, 2, 3]) - RestingBP: resting blood pressure [mm Hg] (numerical variable within range [0, 200]) - Cholesterol: serum cholesterol [mm/dl] (numerical variable within range [0, 603]) - FastingBS: fasting blood sugar [1: if FastingBS > 120 mg/dl, 0: otherwise] (categorical ,→ variable with categories [0, 1]) - RestingECG: resting electrocardiogram results (categorical variable with categories [1, ,→ 2, 0]) - MaxHR: maximum heart rate achieved (numerical variable within range [60, 202]) - ExerciseAngina: exercise-induced angina (categorical variable with categories [0, 1]) - Oldpeak: oldpeak = ST [Numeric value measured in depression] (numerical variable within ,→ range [-2.6, 6.2]) - ST_Slope: the slope of the peak exercise ST segment (categorical variable with ,→ categories [2, 1, 0]) ### <Examples> If Age is 43, Sex is 0, ChestPainType is 0, RestingBP is 132, Cholesterol is 341, ,→ FastingBS is 1, RestingECG is 0, MaxHR is 136, ExerciseAngina is 1, Oldpeak is ,→ 3.0, ST_Slope is 1, Then Result is 1. If Age is 55, Sex is 1, ChestPainType is 0, RestingBP is 122, Cholesterol is 223, ,→ FastingBS is 1, RestingECG is 2, MaxHR is 100, ExerciseAngina is 0, Oldpeak is ,→ 0.0, ST_Slope is 1, Then Result is 1. If Age is 52, Sex is 1, ChestPainType is 0, RestingBP is 128, Cholesterol is 255, ,→ FastingBS is 0, RestingECG is 1, MaxHR is 161, ExerciseAngina is 1, Oldpeak is ,→ 0.0, ST_Slope is 2, Then Result is 1. If Age is 68, Sex is 1, ChestPainType is 2, RestingBP is 134, Cholesterol is 254, ,→ FastingBS is 1, RestingECG is 1, MaxHR is 151, ExerciseAngina is 1, Oldpeak is ,→ 0.0, ST_Slope is 2, Then Result is 0. If Age is 64, Sex is 1, ChestPainType is 0, RestingBP is 141, Cholesterol is 244, ,→ FastingBS is 1, RestingECG is 2, MaxHR is 116, ExerciseAngina is 1, Oldpeak is ,→ 1.5, ST_Slope is 1, Then Result is 1. If Age is 54, Sex is 1, ChestPainType is 0, RestingBP is 130, Cholesterol is 242, ,→ FastingBS is 0, RestingECG is 1, MaxHR is 91, ExerciseAngina is 1, Oldpeak is 1.0, ,→ ST_Slope is 1, Then Result is 1. If Age is 62, Sex is 1, ChestPainType is 2, RestingBP is 120, Cholesterol is 220, ,→ FastingBS is 0, RestingECG is 0, MaxHR is 86, ExerciseAngina is 0, Oldpeak is 0.0, ,→ ST_Slope is 2, Then Result is 0. If Age is 61, Sex is 1, ChestPainType is 0, RestingBP is 105, Cholesterol is 0, FastingBS ,→ is 1, RestingECG is 1, MaxHR is 110, ExerciseAngina is 1, Oldpeak is 1.5, ST_Slope ,→ is 2, Then Result is 1. If Age is 49, Sex is 1, ChestPainType is 2, RestingBP is 118, Cholesterol is 149, ,→ FastingBS is 0, RestingECG is 0, MaxHR is 126, ExerciseAngina is 0, Oldpeak is ,→ 0.8, ST_Slope is 2, Then Result is 1. If Age is 60, Sex is 1, ChestPainType is 0, RestingBP is 160, Cholesterol is 0, FastingBS ,→ is 1, RestingECG is 1, MaxHR is 149, ExerciseAngina is 0, Oldpeak is 0.4, ST_Slope ,→ is 1, Then Result is 1. === Population Summary === [1] 0.8652 +/- 0.0276: st_hr_ratio, chol_age_ratio, age_risk, cp_asymptomatic, bp_high, ,→ chol_high, low_maxhr, st_depression_risk, st_downsloping, major_risk_count, ,→ slope_risk_interaction, slope_risk_sq, cp_slope_combo, cp_slope_risk, ,→ chol_slope_product, chol_slope_ratio, high_chol_downslope, high_chol_flat, age_sq, ,→ bp_sq, chol_sq, maxhr_sq, oldpeak_cubed, bp_age_product, maxhr_age_product, ,→ oldpeak_maxhr_product, chol_maxhr_ratio, bp_maxhr_ratio, oldpeak_chol_ratio, ,→ age_sex_interaction, bp_sex_interaction, chol_sex_interaction, ,→ maxhr_sex_interaction, fbs_age_interaction, fbs_bp_interaction, ,→ fbs_chol_interaction, fbs_maxhr_interaction, angina_age_interaction, ,→ angina_bp_interaction, angina_chol_interaction, angina_maxhr_interaction, ,→ angina_oldpeak_interaction, cp_angina_age, slope_oldpeak_product, ,→ slope_oldpeak_abs, oldpeak_slope_risk, oldpeak_slope_severe, ecg_slope_combo, ,→ ecg_oldpeak_risk, ecg_maxhr_interaction, cardio_risk_index [2] 0.8406 +/- 0.0244: age_squared, age_over_60, hr_deficit, hr_deficit_positive, ,→ hr_reserve, hr_reserve_low, maxhr_age_ratio, bp_chol_ratio, bp_chol_interaction, ,→ chol_high, bp_high, bp_chol_combined_risk, fbs_risk, fbs_chol_ratio, ,→ fbs_age_interaction, fbs_bp_interaction, slope_risk, oldpeak_slope_combo, ,→ cp_slope_interaction, oldpeak_slope_ratio, slope_oldpeak_product, cp_asymptomatic,
34
J. Luo et al. ,→ cp_nonanginal, cp_anginal, cp_other, angina_risk, angina_age_interaction, ,→ angina_maxhr_interaction, ecg_abnormal, ecg_oldpeak_combo, ecg_slope_interaction, ,→ age_oldpeak_ratio, oldpeak_age_product, oldpeak_high, oldpeak_moderate, sex_age, ,→ sex_bp, sex_chol, major_risk_count, risk_score, cp_oldpeak_interaction, ,→ slope_age_oldpeak, hr_deficit_slope, oldpeak_angina_slope [3] 0.8366 +/- 0.0380: age_risk, male_risk, cp_asymptomatic, cp_nonanginal, cp_anginal, ,→ cp_other, bp_normal, bp_high, bp_low, chol_high, chol_very_high, chol_zero, ,→ fbs_risk, ecg_abnormal, ecg_normal, low_maxhr, maxhr_deficit, ,→ maxhr_deficit_positive, hr_reserve, hr_reserve_abnormal, hr_reserve_pct, ,→ hr_over_150, angina_risk, st_depression_risk, st_severe_depression, ,→ oldpeak_positive, oldpeak_abs, oldpeak_squared, st_flat, st_downsloping, st_up, ,→ total_risk_score, age_hr_ratio, predicted_hr, bp_age_ratio, chol_age_ratio, ,→ chol_bp_product, chol_bp_ratio, age_chol_product, bp_chol_product, bp_chol_ratio, ,→ chol_per_hr, bp_per_hr, maxhr_age_ratio, maxhr_chol_ratio, maxhr_oldpeak_ratio, ,→ st_hr_ratio, st_hr_ratio_scaled, oldpeak_slope_risk, oldpeak_slope_combo, ,→ oldpeak_st_flat, oldpeak_st_up, st_slope_oldpeak, st_depression_flat, ,→ st_depression_down, cp_chol_product, cp_chol_ratio, cp_asymptomatic_chol, ,→ cp_nonanginal_chol, cp_anginal_chol, cp_other_chol [4] 0.8365 +/- 0.0370: age_risk, male_risk, cp_asymptomatic, bp_normal, bp_high, bp_low, ,→ chol_high, chol_very_high, chol_zero, fbs_risk, ecg_abnormal, low_maxhr, ,→ maxhr_deficit, angina_risk, st_depression_risk, st_severe_depression, ,→ st_downsloping, st_flat, total_risk_score, age_hr_ratio, predicted_hr, hr_reserve, ,→ hr_reserve_abnormal, cp_angina_combo, st_hr_ratio, st_hr_ratio_scaled, ,→ bp_age_ratio, chol_age_ratio, chol_bp_product, chol_bp_ratio, age_chol_product, ,→ bp_low_risk, st_slope_oldpeak, maxhr_deficit_sq, oldpeak_sq, angina_st_depression, ,→ asymptomatic_oldpeak, age_45_55, age_above_60, ecg_slope_abnormal, ,→ major_risk_count, hr_reserve_pct, oldpeak_age_ratio, risk_product, multi_risk [5] 0.8365 +/- 0.0199: Age_squared, Age_over_50, BP_over_130, Chol_over_240, ,→ BP_Chol_product, BP_Chol_ratio, HR_deficit, HR_deficit_positive, HR_over_150, ,→ Oldpeak_positive, Oldpeak_abs, Oldpeak_squared, FBS_Chol_interaction, ,→ FBS_BP_interaction, Angina_slope_risk, Slope_down, Slope_flat, Slope_up, ,→ CPT_asymptomatic, CPT_nonanginal, CPT_anginal, CPT_other, Sex_Age, Sex_BP, ,→ Sex_Chol, Risk_score, HR_reserve, HR_reserve_negative, ECG_abnormal, ECG_normal, ,→ Chol_per_HR, BP_per_HR, BP_age_ratio, Chol_age_ratio, Oldpeak_slope_risk, ,→ High_risk_flag, FBS_Age, FBS_Age_over_60, HR_too_low
=== Selected Parent === Score: 0.8365 +/- 0.0370 def modify_features(df_input) -> pd.DataFrame: """ Creates domain-specific cardiovascular risk features using row-wise operations only: combines risk factors, computes physiological ratios, and encodes clinical thresholds with fixed cutoffs to enhance heart disease classification. """ df_output = df_input.copy() # Age risk factor: increasing age raises cardiovascular risk df_output[’age_risk’] = np.where(df_input[’Age’] > 55, 1, 0) # Sex risk encoding: male gender is a known risk factor df_output[’male_risk’] = df_input[’Sex’] # Chest pain type risk: type 0 (asymptomatic) is most dangerous df_output[’cp_asymptomatic’] = (df_input[’ChestPainType’] == 0).astype(int) [... 65 further feature assignments omitted here; the full program is the entry of the population summary above with the same score ...] return df_output === Feature Impact Report === Generated features (by your function): age_risk: SHAP importance = 0.0000 [LOW - REPLACE] male_risk: SHAP importance = 0.0000 [LOW - REPLACE] cp_asymptomatic: SHAP importance = 0.0000 [LOW - REPLACE] bp_normal: SHAP importance = 0.0000 [LOW - REPLACE] bp_high: SHAP importance = 0.0000 [LOW - REPLACE]
Explanation-Guided Evolution of LLM-driven Feature Engineering bp_low: SHAP importance = 0.0000 [LOW - REPLACE] chol_high: SHAP importance = 0.0000 [LOW - REPLACE] chol_very_high: SHAP importance = 0.0000 [LOW - REPLACE] chol_zero: SHAP importance = 0.0000 [LOW - REPLACE] fbs_risk: SHAP importance = 0.0000 [LOW - REPLACE] ecg_abnormal: SHAP importance = 0.0000 [LOW - REPLACE] low_maxhr: SHAP importance = 0.0000 [LOW - REPLACE] maxhr_deficit: SHAP importance = 0.0000 [LOW - REPLACE] angina_risk: SHAP importance = 0.0000 [LOW - REPLACE] st_depression_risk: SHAP importance = 0.0000 [LOW - REPLACE] st_severe_depression: SHAP importance = 0.0000 [LOW - REPLACE] st_downsloping: SHAP importance = 0.0000 [LOW - REPLACE] st_flat: SHAP importance = 0.0438 [MEDIUM - REFINE] total_risk_score: SHAP importance = 0.0317 [MEDIUM - REFINE] age_hr_ratio: SHAP importance = 0.0297 [MEDIUM - REFINE] predicted_hr: SHAP importance = 0.0000 [LOW - REPLACE] hr_reserve: SHAP importance = 0.0105 [MEDIUM - REFINE] hr_reserve_abnormal: SHAP importance = 0.0000 [LOW - REPLACE] cp_angina_combo: SHAP importance = 0.0097 [LOW - REPLACE] st_hr_ratio: SHAP importance = 0.0611 [HIGH - KEEP] st_hr_ratio_scaled: SHAP importance = 0.0000 [LOW - REPLACE] bp_age_ratio: SHAP importance = 0.0202 [MEDIUM - REFINE] chol_age_ratio: SHAP importance = 0.0711 [HIGH - KEEP] chol_bp_product: SHAP importance = 0.0324 [MEDIUM - REFINE] chol_bp_ratio: SHAP importance = 0.0334 [MEDIUM - REFINE] age_chol_product: SHAP importance = 0.0289 [MEDIUM - REFINE] bp_low_risk: SHAP importance = 0.0000 [LOW - REPLACE] st_slope_oldpeak: SHAP importance = 0.0276 [MEDIUM - REFINE] maxhr_deficit_sq: SHAP importance = 0.0000 [LOW - REPLACE] oldpeak_sq: SHAP importance = 0.0034 [LOW - REPLACE] angina_st_depression: SHAP importance = 0.0039 [LOW - REPLACE] asymptomatic_oldpeak: SHAP importance = 0.0365 [MEDIUM - REFINE] age_45_55: SHAP importance = 0.0033 [LOW - REPLACE] age_above_60: SHAP importance = 0.0000 [LOW - REPLACE] ecg_slope_abnormal: SHAP importance = 0.0077 [LOW - REPLACE] major_risk_count: SHAP importance = 0.1195 [HIGH - KEEP] hr_reserve_pct: SHAP importance = 0.0092 [LOW - REPLACE] oldpeak_age_ratio: SHAP importance = 0.0222 [MEDIUM - REFINE] risk_product: SHAP importance = 0.0000 [LOW - REPLACE] multi_risk: SHAP importance = 0.0000 [LOW - REPLACE] Original features still contributing: ST_Slope: SHAP importance = 0.1732 ChestPainType: SHAP importance = 0.0544 RestingBP: SHAP importance = 0.0329 MaxHR: SHAP importance = 0.0298 RestingECG: SHAP importance = 0.0252 Top feature interactions (uncaptured synergies): ST_Slope ? major_risk_count: interaction = 0.1284 ChestPainType ? ST_Slope: interaction = 0.1179 Cholesterol ? ST_Slope: interaction = 0.1145 ST_Slope ? st_slope_oldpeak: interaction = 0.1045 ST_Slope ? st_hr_ratio: interaction = 0.0984 Redundancy detected: male_risk is 1.00 correlated with Sex (consider replacing) chol_zero is 0.90 correlated with Cholesterol (consider replacing) fbs_risk is 1.00 correlated with FastingBS (consider replacing) maxhr_deficit is 1.00 correlated with MaxHR (consider replacing) angina_risk is 1.00 correlated with ExerciseAngina (consider replacing) predicted_hr is 1.00 correlated with Age (consider replacing) hr_reserve is 0.94 correlated with MaxHR (consider replacing) cp_angina_combo is 1.00 correlated with ChestPainType (consider replacing) st_hr_ratio is 0.96 correlated with Oldpeak (consider replacing) st_hr_ratio_scaled is 0.96 correlated with Oldpeak (consider replacing) chol_age_ratio is 0.92 correlated with Cholesterol (consider replacing) chol_bp_product is 0.96 correlated with Cholesterol (consider replacing)
35
36
J. Luo et al. chol_bp_ratio is 0.96 correlated with Cholesterol (consider replacing) age_chol_product is 0.94 correlated with Cholesterol (consider replacing) maxhr_deficit_sq is 0.96 correlated with MaxHR (consider replacing) oldpeak_sq is 0.92 correlated with Oldpeak (consider replacing) hr_reserve_pct is 0.96 correlated with MaxHR (consider replacing) oldpeak_age_ratio is 0.97 correlated with Oldpeak (consider replacing)
=== Guidance === KEEP these high-value features: st_hr_ratio, chol_age_ratio, major_risk_count REPLACE these low-value features with better alternatives: age_risk, male_risk, ,→ cp_asymptomatic, bp_normal, bp_high, bp_low, chol_high, chol_very_high, chol_zero, ,→ fbs_risk, ecg_abnormal, low_maxhr, maxhr_deficit, angina_risk, st_depression_risk ,→ , st_severe_depression, st_downsloping, predicted_hr, hr_reserve_abnormal, ,→ cp_angina_combo, st_hr_ratio_scaled, bp_low_risk, maxhr_deficit_sq, oldpeak_sq, ,→ angina_st_depression, age_45_55, age_above_60, ecg_slope_abnormal, hr_reserve_pct, ,→ risk_product, multi_risk To replace a feature, simply do not create it in your function. Never call .drop() on a ,→ feature name from the report: df_input holds only the original columns, and your ,→ function creates every new column itself. Try to capture the interaction between ST_Slope and major_risk_count (interaction strength ,→ : 0.1284) Try to capture the interaction between ChestPainType and ST_Slope (interaction strength: ,→ 0.1179) Try to capture the interaction between Cholesterol and ST_Slope (interaction strength: ,→ 0.1145) Feature ’male_risk’ is redundant (corr=1.00 with ’Sex’). Replace it with something that ,→ captures new information. Feature ’chol_zero’ is redundant (corr=0.90 with ’Cholesterol’). Replace it with something ,→ that captures new information. Feature ’fbs_risk’ is redundant (corr=1.00 with ’FastingBS’). Replace it with something ,→ that captures new information. Feature ’maxhr_deficit’ is redundant (corr=1.00 with ’MaxHR’). Replace it with something ,→ that captures new information. Feature ’angina_risk’ is redundant (corr=1.00 with ’ExerciseAngina’). Replace it with ,→ something that captures new information. Feature ’predicted_hr’ is redundant (corr=1.00 with ’Age’). Replace it with something that ,→ captures new information. Feature ’hr_reserve’ is redundant (corr=0.94 with ’MaxHR’). Replace it with something that ,→ captures new information. Feature ’cp_angina_combo’ is redundant (corr=1.00 with ’ChestPainType’). Replace it with ,→ something that captures new information. Feature ’st_hr_ratio’ is redundant (corr=0.96 with ’Oldpeak’). Replace it with something ,→ that captures new information. Feature ’st_hr_ratio_scaled’ is redundant (corr=0.96 with ’Oldpeak’). Replace it with ,→ something that captures new information. Feature ’chol_age_ratio’ is redundant (corr=0.92 with ’Cholesterol’). Replace it with ,→ something that captures new information. Feature ’chol_bp_product’ is redundant (corr=0.96 with ’Cholesterol’). Replace it with ,→ something that captures new information. Feature ’chol_bp_ratio’ is redundant (corr=0.96 with ’Cholesterol’). Replace it with ,→ something that captures new information. Feature ’age_chol_product’ is redundant (corr=0.94 with ’Cholesterol’). Replace it with ,→ something that captures new information. Feature ’maxhr_deficit_sq’ is redundant (corr=0.96 with ’MaxHR’). Replace it with ,→ something that captures new information. Feature ’oldpeak_sq’ is redundant (corr=0.92 with ’Oldpeak’). Replace it with something ,→ that captures new information. Feature ’hr_reserve_pct’ is redundant (corr=0.96 with ’MaxHR’). Replace it with something ,→ that captures new information. Feature ’oldpeak_age_ratio’ is redundant (corr=0.97 with ’Oldpeak’). Replace it with ,→ something that captures new information. IMPORTANT: Respond ONLY with Python code. No explanations outside the code. Write the complete function below. Start with the docstring, then the implementation. Your function body MUST end with ‘return df_output‘ -- do not forget this line. For row-wise conditionals on a column, use ‘np.where(df[’x’] > c, a, b)‘ (NOT ‘if df[’x’] ,→ > c:‘ -- pandas Series has no truth value and will raise).
Explanation-Guided Evolution of LLM-driven Feature Engineering
37
READ/WRITE RULE: read ORIGINAL columns from ‘df_input‘; read NEWLY-CREATED columns (those ,→ you just assigned) from ‘df_output‘. ‘df_input‘ is the raw dataframe at function ,→ entry -- it does NOT contain features you create later in this function. Reading ‘ ,→ df_input[’<name_you_created>’]‘ raises KeyError. Concrete example of the correct pattern: df_output = df_input.copy() df_output[’ratio_a_b’] = df_input[’a’] / (df_input[’b’] + 1e-8) # read existing -> ,→ df_input df_output[’log_ratio’] = np.log1p(df_output[’ratio_a_b’]) # read NEW -> ,→ df_output return df_output The function must return a pandas DataFrame. def modify_features(df_input) -> pd.DataFrame: """
Listing S2. The LLM’s reply to Listing S1, cut at the completion limit. ‘‘‘python def modify_features(df_input) -> pd.DataFrame: """ Creates domain-specific cardiovascular risk features using row-wise operations only, focusing on capturing ST_Slope interactions with major risk factors, ChestPainType, and Cholesterol, while avoiding redundant linear transforms of original columns. """ df_output = df_input.copy() # --- Core risk factors (non-redundant encodings) --df_output[’age_risk’] = (df_input[’Age’] > 55).astype(int) df_output[’male_risk’] = df_input[’Sex’] df_output[’cp_asymptomatic’] = (df_input[’ChestPainType’] == 0).astype(int) df_output[’cp_nonanginal’] = (df_input[’ChestPainType’] == 1).astype(int) df_output[’cp_anginal’] = (df_input[’ChestPainType’] == 2).astype(int) df_output[’cp_other’] = (df_input[’ChestPainType’] == 3).astype(int) df_output[’bp_high’] = (df_input[’RestingBP’] > 140).astype(int) df_output[’bp_low’] = (df_input[’RestingBP’] < 90).astype(int) df_output[’bp_normal’] = ((df_input[’RestingBP’] >= 90) & (df_input[’RestingBP’] <= ,→ 140)).astype(int) df_output[’chol_high’] = (df_input[’Cholesterol’] > 200).astype(int) df_output[’chol_very_high’] = (df_input[’Cholesterol’] > 240).astype(int) df_output[’chol_zero’] = (df_input[’Cholesterol’] == 0).astype(int) df_output[’fbs_risk’] = df_input[’FastingBS’] df_output[’ecg_abnormal’] = (df_input[’RestingECG’] == 2).astype(int) df_output[’ecg_normal’] = (df_input[’RestingECG’] == 0).astype(int) df_output[’low_maxhr’] = (df_input[’MaxHR’] < 120).astype(int) df_output[’maxhr_deficit’] = np.maximum(0, 190 - df_input[’MaxHR’]) df_output[’angina_risk’] = df_input[’ExerciseAngina’] df_output[’st_depression_risk’] = (df_input[’Oldpeak’] > 1.0).astype(int) df_output[’st_severe_depression’] = (df_input[’Oldpeak’] > 2.5).astype(int) df_output[’st_downsloping’] = (df_input[’ST_Slope’] == 0).astype(int) df_output[’st_flat’] = (df_input[’ST_Slope’] == 1).astype(int) df_output[’st_up’] = (df_input[’ST_Slope’] == 2).astype(int) # --- High-value kept features --df_output[’st_hr_ratio’] = df_input[’Oldpeak’] / (df_input[’MaxHR’] + 1e-8) df_output[’chol_age_ratio’] = df_input[’Cholesterol’] / (df_input[’Age’] + 1e-8) # --- Major risk count (high SHAP) --df_output[’major_risk_count’] = ( (df_input[’Age’] > 60).astype(int) + df_input[’Sex’] + df_output[’cp_asymptomatic’] +
38
J. Luo et al. df_output[’bp_high’] + df_output[’chol_very_high’] + df_input[’FastingBS’] + df_input[’ExerciseAngina’] + df_output[’st_severe_depression’] ) # --- ST_Slope ? major_risk_count interaction (strength 0.1284) --df_output[’slope_major_risk’] = df_input[’ST_Slope’] * df_output[’major_risk_count’] df_output[’slope_major_risk_ratio’] = df_output[’major_risk_count’] / (df_input[’ ,→ ST_Slope’] + 1e-8) df_output[’slope_major_risk_sq’] = (df_input[’ST_Slope’] + 1) * (df_output[’ ,→ major_risk_count’] ** 2) df_output[’slope_major_risk_interaction’] = np.where( (df_input[’ST_Slope’] == 0) & (df_output[’major_risk_count’] >= 4), 1, 0 ) # --- ChestPainType ? ST_Slope interaction (strength 0.1179) --df_output[’cp_slope_combo’] = df_input[’ChestPainType’] * 10 + df_input[’ST_Slope’] df_output[’cp_slope_risk’] = df_output[’cp_asymptomatic’] * (df_input[’ST_Slope’] == ,→ 0).astype(int) df_output[’cp_slope_interaction’] = df_input[’ChestPainType’] * df_input[’ST_Slope’] df_output[’cp_slope_ratio’] = df_input[’ChestPainType’] / (df_input[’ST_Slope’] + 1e ,→ -8) df_output[’cp_slope_abs_diff’] = np.abs(df_input[’ChestPainType’] - df_input[’ST_Slope ,→ ’]) # --- Cholesterol ? ST_Slope interaction (strength 0.1145) --df_output[’chol_slope_product’] = df_input[’Cholesterol’] * df_input[’ST_Slope’] df_output[’chol_slope_ratio’] = df_input[’Cholesterol’] / (df_input[’ST_Slope’] + 1e ,→ -8) df_output[’high_chol_downslope’] = df_output[’chol_very_high’] * df_output[’ ,→ st_downsloping’] df_output[’high_chol_flat’] = df_output[’chol_high’] * df_output[’st_flat’] df_output[’chol_slope_normalized’] = df_input[’Cholesterol’] / (df_input[’ST_Slope’] * ,→ 100 + 1e-8) # --- Physiological ratios and products (non-redundant with originals) --df_output[’age_hr_ratio’] = df_input[’Age’] / (df_input[’MaxHR’] + 1e-8) df_output[’bp_age_ratio’] = df_input[’RestingBP’] / (df_input[’Age’] + 1e-8) df_output[’bp_chol_ratio’] = df_input[’RestingBP’] / (df_input[’Cholesterol’] + 1e-8) df_output[’chol_bp_product’] = df_input[’Cholesterol’] * df_input[’RestingBP’] df_output[’chol_bp_ratio’] = df_input[’Cholesterol’] / (df_input[’RestingBP’] + 1e-8) df_output[’age_chol_product’] = df_input[’Age’] * df_input[’Cholesterol’] df_output[’bp_chol_interaction’] = df_input[’RestingBP’] * (df_input[’Cholesterol’] > ,→ 200).astype(int) # --- Heart rate related (non-redundant) --df_output[’hr_reserve’] = (220 - df_input[’Age’]) - df_input[’MaxHR’] df_output[’hr_reserve_low’] = (df_output[’hr_reserve’] > 40).astype(int) df_output[’hr_deficit’] = np.maximum(0, 190 - df_input[’MaxHR’]) df_output[’hr_deficit_positive’] = (df_output[’hr_deficit’] > 0).astype(int) df_output[’hr_over_150’] = (df_input[’MaxHR’] > 150).astype(int) df_output[’maxhr_age_ratio’] = df_input[’MaxHR’] / (df_input[’Age’] + 1e-8) df_output[’maxhr_chol_ratio’] = df_input[’MaxHR’] / (df_input[’Cholesterol’] + 1e-8) df_output[’maxhr_oldpeak_ratio’] = df_input[’MaxHR’] / (df_input[’Oldpeak’] + 1e-8) df_output[’chol_per_hr’] = df_input[’Cholesterol’] / (df_input[’MaxHR’] + 1e-8) df_output[’bp_per_hr’] = df_input[’RestingBP’] / (df_input[’MaxHR’] + 1e-8) # --- Oldpeak interactions with slope --df_output[’oldpeak_slope_risk’] = df_input[’Oldpeak’] * (df_input[’ST_Slope’] == 0). ,→ astype(int) df_output[’oldpeak_slope_combo’] = df_input[’Oldpeak’] * df_input[’ST_Slope’] df_output[’oldpeak_slope_ratio’] = df_input[’Oldpeak’] / (df_input[’ST_Slope’] + 1e
Three variants of this prompt occur in the runs. First, the role and instruction block alternates between two templates, as in LLM-FE. Listing S1 shows
Explanation-Guided Evolution of LLM-driven Feature Engineering
39
the domain template. In every third generation, including the initialisation, the operations template is used instead. It adds an <Operators> list of allowed rowwise operations (absolute value, logarithm, square root, square, sigmoid, rounding, reciprocal, the four arithmetic operations, minimum, maximum, products and ratios, numeric combination of two categorical columns, fixed-threshold indicators and np.where conditionals). LLM-FE draws its operations template at random with probability 1/3 per call, so both methods use it for about a third of their calls. Its list contains the cross-row operators Frequency, GroupByThen* and Combine that Sect. 5.1 of the main text discusses, and ours replaces them with the row-wise operations above. Second, the initialisation prompt has no population summary and no report. Its parent block is titled “Starting Template” and holds the identity function, and its guidance is the single generic line “Improve the selected solution by creating new domain-relevant features, or redesign with a completely new feature engineering strategy.” Third, in the noSHAP control the feature impact report is absent and the guidance block is that same generic line in every prompt, while the population summary, the parent’s code and score and the failed-attempts block below remain. The prompt in Listing S1 has no failed-attempts block because nothing had failed on that fold by then. Listing S3 shows the block as it appears when a failure is on record, taken from the Claude-Haiku-5.5 run on heart, outer fold 2, prompt 62. The program generated by prompt 61 read a feature of the parent, slope_hr_depr, from df_input, which holds only the original columns, and raised a KeyError. The block is inserted between the SHAP feedback report and the guidance. It shows the most recent failures of the fold, at most two, the code cut at 600 characters and the error at 250. The record is not cleared, so a failure stays visible until two newer failures replace it. Haiku failed rarely on this fold, and this block was repeated unchanged in every mutation prompt from 62 to 117, and from prompt 118 on a newer failure took its place. Listing S3. The failed-attempts block of prompt 62 on heart, fold 2, with ClaudeHaiku-5.5. === Recent Failed Attempts (do NOT repeat these specific mistakes) === Each block shows code that was just generated and the error it produced. Diagnose the precise mistake and avoid it in your new function. --- Attempt 1 --Code that failed: ‘‘‘python """Creates row-wise ST_Slope interaction features with Oldpeak, Age, and slope_hr_depr, ,→ plus a non-redundant ChestPainType x exercise-angina synergy, using fixed numeric ,→ scales to capture ischemic risk combinations.""" df_output = df_input.copy() # ST_Slope x Oldpeak: flat/downsloping ST with depression is a strong ischemia marker df_output[’slope_x_oldpeak’] = (2.0 - df_input[’ST_Slope’]) * df_input[’Oldpeak’] # ST_Slope x Age: ischemic ST changes carry greater risk with advancing age df_output[’slope_x_age’] = (2.0 - df_input[’ST_Slope’]) * df_input[’Age’] / 100.0 # ST_Slope x slope_hr_de # ...<truncated> ‘‘‘ Error: Execution error: ’slope_hr_depr’
40
J. Luo et al.
S9
LLM Tokens and API Cost
Table S10 gives the input and output tokens and the API cost of every arm over the whole benchmark, that is 22 datasets, five folds and 200 budget units per fold, or 21 datasets with GPT-3.5, where communities is excluded. For the two SHAPEvo-FE arms the numbers are the tokens billed by the provider, which every call records. The LLM-FE code records no usage, so its prompt is reconstructed as described for Table 3 of the main paper in the convergence section, counted with cl100k and divided by the ratio of the cl100k count to the billed count over all SHAPEvo-FE calls of the same backbone, which is 1.00 for GPT-3.5, 0.93 for DeepSeek and 0.66 for Haiku input and 0.61 for Haiku output. The cost is the token total at the OpenRouter list price of the day of the runs. A SHAPEvo-FE prompt is longer than an LLM-FE prompt because it carries the SHAP report, by about 800 tokens with GPT-3.5 and 2,500 with DeepSeek, and its reply is shorter with GPT-3.5 and Haiku. One arm of the benchmark costs between 21 and 43 US dollars, and the three arms of a backbone are within a factor of 1.5 of each other. The sums over the table, 126 US dollars for GPT-3.5, 80 for DeepSeek and 83 for Haiku, agree with the bills of Sect. S2 once the pilot and the aborted runs are added. Table S10. Input and output tokens and API cost per method and backbone over the whole benchmark (all datasets and folds, 200 budget units per fold). For the SHAPEvoFE arms the tokens are those billed by the provider. For LLM-FE the reconstructed prompt and the stored reply are counted with cl100k and calibrated to the billed count of the same backbone. Cost at the OpenRouter list price of the day of the runs, in US dollars per million input and output tokens 0.5 and 1.5 for GPT-3.5-Turbo, 0.018 and 0.64 for DeepSeek-V4-Flash, 0.1 and 0.5 for Claude-Haiku-5.5. Backbone
Method
Tokens per call Total (M) in
GPT-3.5-Turbo
LLM-FE 2,856 SHAPEvo-FE 3,639 no-SHAP control 3,336 DeepSeek-V4-Flash LLM-FE 5,541 SHAPEvo-FE 8,026 no-SHAP control 6,611 Claude-Haiku-5.5 LLM-FE 6,609 SHAPEvo-FE 6,933 no-SHAP control 6,729
S10
out
Cost
in out (USD)
356 60.6 7.6 170 76.0 3.6 190 69.7 4.0 1,297 123.1 28.8 1,852 175.7 40.5 2,006 144.7 43.9 1,341 146.8 29.8 817 151.8 17.9 1,351 147.3 29.6
41.62 43.35 40.81 20.67 29.10 30.71 29.58 24.12 29.52
Held-Out Head-to-Head Scores
Table S11 gives the per-dataset held-out scores behind the wins, ties and losses of Table 3 of the main text, discussed in Sect. 5.1 there.
Explanation-Guided Evolution of LLM-driven Feature Engineering
41
Table S11. Held-out head-to-head results with 5-fold outer CV (seed 42), 200 evaluations per fold and the top-3 ensemble scored by LLM-FE’s official evaluator, mean ± std over folds. R marks regression, reported as N-RMSE (lower is better). Bold marks the winner when |∆| > 0.01, where ∆ > 0 favours SHAPEvo-FE. The rule is applied to the unrounded scores, so a displayed ±0.010 can fall on either side of it: GPT-3.5 housing (+0.0104) and DeepSeek tic-tac-toe (+0.0104) count as wins, GPT-3.5 eucalyptus (+0.0095) and crab (−0.0096) as ties. With GPT-3.5 the LLMFE mean of communities is over one fold (context overflow, Sect. 5.1 of the main text). With DeepSeek and Haiku the car and bike means of LLM-FE, and with Haiku its tic-tac-toe mean, include folds on which its ensemble collapsed. Dataset adult balance-scale bank blood breast-w car cmc communities credit-g eucalyptus heart junglechess myocardial pc1 synthetic tic-tac-toe vehicle bikeR crabR housingR insuranceR wineR SHAPEvo-FE wins / ties / losses
GPT-3.5-Turbo LLM-FE SHAPEvo-FE
∆
DeepSeek-V4-Flash LLM-FE SHAPEvo-FE
∆
Claude-Haiku-5.5 LLM-FE SHAPEvo-FE
∆
0.872±0.004 0.872±0.002 +0.000 0.868±0.010 0.873±0.002 +0.005 0.874±0.003 0.874±0.003 +0.000 1.000±0.000 1.000±0.000 +0.000 1.000±0.000 1.000±0.000 +0.000 1.000±0.000 1.000±0.000 +0.000 0.907±0.003 0.906±0.003 -0.001 0.907±0.004 0.907±0.002 -0.000 0.894±0.019 0.909±0.005 +0.015 0.741±0.030 0.735±0.029 -0.005 0.749±0.030 0.755±0.026 +0.007 0.751±0.020 0.759±0.033 +0.008 0.957±0.010 0.959±0.003 +0.001 0.971±0.011 0.967±0.004 -0.004 0.966±0.009 0.961±0.012 -0.004 1.000±0.000 0.999±0.003 -0.001 0.908±0.174 1.000±0.000 +0.092 0.957±0.093 0.998±0.004 +0.041 0.515±0.015 0.521±0.010 +0.006 0.526±0.027 0.511±0.017 -0.015 0.521±0.022 0.495±0.021 -0.027 0.709±0.000 0.707±0.017 -0.003 0.706±0.016 0.694±0.015 -0.012 0.706±0.022 0.708±0.022 +0.002 0.758±0.017 0.749±0.018 -0.009 0.758±0.019 0.740±0.010 -0.018 0.741±0.021 0.740±0.017 -0.001 0.663±0.028 0.673±0.029 +0.010 0.667±0.034 0.674±0.018 +0.007 0.671±0.039 0.679±0.021 +0.008 0.862±0.020 0.857±0.023 -0.004 0.852±0.024 0.854±0.031 +0.002 0.855±0.023 0.861±0.026 +0.005 0.980±0.004 0.954±0.026 -0.026 0.997±0.001 0.997±0.001 +0.000 0.992±0.002 0.993±0.001 +0.001 0.790±0.027 0.776±0.031 -0.015 0.796±0.019 0.789±0.015 -0.007 0.780±0.033 0.778±0.026 -0.001 0.940±0.017 0.931±0.005 -0.009 0.931±0.002 0.938±0.010 +0.006 0.932±0.013 0.931±0.017 -0.002 0.872±0.003 0.865±0.007 -0.007 0.867±0.007 0.871±0.005 +0.004 0.868±0.008 0.871±0.004 +0.003 0.998±0.005 0.990±0.010 -0.008 0.987±0.011 0.998±0.005 +0.010 0.903±0.194 0.999±0.002 +0.096 0.759±0.021 0.766±0.030 +0.007 0.775±0.018 0.801±0.033 +0.026 0.772±0.026 0.790±0.017 +0.018 0.224±0.037 0.211±0.006 +0.013 0.297±0.116 0.204±0.004 +0.094 0.244±0.061 0.202±0.006 +0.042 0.222±0.014 0.232±0.015 -0.010 0.218±0.015 0.224±0.013 -0.006 0.220±0.013 0.220±0.015 +0.000 0.228±0.030 0.218±0.008 +0.010 0.245±0.017 0.211±0.005 +0.034 0.235±0.024 0.214±0.011 +0.021 0.384±0.028 0.385±0.023 -0.001 0.396±0.047 0.380±0.034 +0.016 0.387±0.030 0.381±0.021 +0.006 0.105±0.001 0.108±0.001 -0.003 0.105±0.001 0.106±0.003 -0.001 0.105±0.002 0.106±0.002 -0.001 W 2 / T 18 / L 2
W 6 / T 13 / L 3
W 6 / T 15 / L 1
Which programs form the Haiku LLM-FE ensemble on the tic-tac-toe and car folds that collapse is partly a matter of chance. Several programs tie for the best inner-CV score on these folds and the official scorer breaks ties by file order. Choosing the earliest generated programs among the tied ones instead avoids both collapses and turns these two wins into ties. We keep the official behaviour, since every LLM-FE number in this paper comes from it.
Related documents
- BRAPO: Alternating Belief Refinement and Program Optimization for Sample-Efficient LLM-Guided Program Search#1819611
- LLM Genetic Feature Engineering#1762912
- TabDAG: Structured Evolutionary Search for Tabular Feature Engineering#1699303
- AdaExploreBench: Benchmarking LLM Agents for Proactive Exploration and Test-time Adaptation in Evolving Environments#1401138
- Strategy Accumulation and Guided Execution for Automated LLM Fine-Tuning#1036940
Retrieved via Conceptio: every document is proof-bundled with source, license, and retrieval metadata.
Read the Docs → · View CLI source on GitHub · Conceptio Open Knowledge Archive