ASET, Amity University Noida · shubham.kumar59@s.amity.edu
Machine learning models for Formula 1 race strategy are typically evaluated with random train/test splits over lap-level data, which lets adjacent laps from the same race leak between train and test. We quantify this directly on lap time and pit-stop prediction using 2023 FastF1 telemetry (22 races, 20,447 laps). Removing this leakage collapses a naively evaluated XGBoost lap-time model's R² from 0.994 to −2.26 on unseen circuits once track-identity features are also removed, showing that absolute lap time is dominated by track identity rather than the race-condition features (tyre life, stint, weather) typically used to justify these models. A track-aware evaluation (holding out drivers rather than circuits) restores an honest R²=0.991 (MAE=0.54s, vs. a persistence baseline's R²=0.949, MAE=0.61s). The same corrected pipeline yields a pit-stop-next-lap classifier (F1=0.303, ROC-AUC=0.888, vs. a logistic regression baseline's ROC-AUC=0.669) that trails current published deep-learning approaches on a closely related task (Sasikumar et al. 2025: F1=0.81), which we report as a limitation rather than a contribution. Applying the lap-time model without retraining to 2024 data shows a substantial generalization gap (R² 0.991 to 0.172; pit-stop ROC-AUC 0.888 to 0.721), suggesting season-over-season performance changes are not captured by the current feature set. We release code, corrected metrics, and a leakage decomposition to support more reproducible evaluation in this domain.
Formula 1 teams make pit-stop and tyre-management decisions under significant time pressure, and a growing body of applied machine learning work uses lap-level telemetry (much of it sourced from the open FastF1 API) to model lap time degradation and pit-stop timing. A recurring methodological pattern in this literature, including in an earlier version of the pipeline this paper corrects, is to evaluate these models with a row-wise random train/test split over individual laps. Because laps from the same race and the same driver's stint are highly autocorrelated, this split lets information leak between train and test: a model can effectively interpolate within a race it has already partially seen, rather than generalize to conditions it has not.
This paper is a leakage audit, not primarily a new modeling technique. Its central contribution is a decomposition that isolates exactly how much of a plausible-looking result is attributable to (a) the row-wise split itself and (b) one-hot encoding driver and circuit identity as model features. We show that these two choices, independently or combined, are sufficient to reproduce a near-perfect lap-time R² that has essentially nothing to do with modeling tyre degradation. We then propose and validate an honest evaluation protocol: grouped cross-validation, with an explicit distinction between generalizing to an unseen circuit (track-agnostic) versus an unseen driver on a known circuit (track-aware).
We do not claim state-of-the-art predictive performance. On the pit-stop classification task specifically, our corrected classifier trails several recently published results (Section 2), and we report this plainly in Section 5 rather than around it. The contribution we do make is a methodology and an empirical demonstration, on a real dataset, of how large an evaluation-leakage confound can be in this application domain.
Machine learning for lap-time prediction. Zhao (2024) trains a deep neural network to forecast qualifying lap times, categorizing historical data by driver and circuit; this specialization is functionally close to encoding driver and circuit identity as features, the same mechanism this paper identifies as the dominant confound. Brusik (2024) compares univariate and multivariate LSTM and LSTM-FCN architectures for multi-step lap-time forecasting on FastF1 data spanning 2018–2023 (136,122 laps), using a strict chronological split; error analysis identifies track-status changes as the primary source of large forecasting errors.
Deep learning for pit-stop prediction. Sasikumar, Leema, and Balakrishnan (2025) benchmark five deep sequence and convolutional architectures on FastF1-sourced pit-stop prediction, evaluated on a temporal holdout. Their best model, Bi-LSTM, reaches precision=0.77, recall=0.86, F1=0.81, and ROC-AUC=0.988. Our corrected pit-stop classifier (F1=0.303, ROC-AUC=0.888) does not match it. Fatima and Johrendt's Deep-Racing (2023) reports F1=0.67, and García Tejada's SVM-based classifier (2023) reports F1=0.621.
Explainable F1 strategy models. Todd et al. (2025) apply explainable deep learning and XGBoost to tyre energy degradation prediction. Thomas et al. (2025) target the sequential strategy decision with a reinforcement learning policy (RSRL), achieving an average finishing position of P5.33 on the 2023 Bahrain Grand Prix. Our use of SHAP (TreeExplainer) is in the same interpretability spirit, applied to a simpler supervised tabular formulation.
Positioning. We position this paper's contribution as methodological: a race- and driver-grouped cross-validation protocol, an explicit decomposition of how leaky evaluation inflates results in this domain, honest non-trivial baselines, and a cross-season generalization test, rather than a claim of predictive superiority over any cited comparator.
We use the FastF1 Python API to fetch lap-by-lap timing data for all 22 races of the 2023 Formula 1 season (24,420 raw laps). Weather is merged onto lap data with a nearest-match merge on timestamp (5-minute tolerance) before races are concatenated. For the cross-season generalization test, we additionally fetch six 2024 races (Bahrain, Japan, Monaco, Great Britain, Singapore, Brazil) chosen to reuse 2023 circuit names. Laps are cleaned by requiring an accurate-lap flag and dropping rows missing key fields, leaving 20,447 laps used throughout the paper.
Numeric features: tyre life, stint, lap number, lap-time delta from the previous lap, an approximate gap to the car ahead, track/air temperature, rainfall, position, humidity, and wind speed. Categorical features: tyre compound and track status. The regression target is lap time in seconds. The classification target, PitStopNextLap, is defined as (NextTyreLife < TyreLife) AND (TyreLife > 2), shifted within (Grand Prix, Driver) groups. Under this definition, 707 of 20,447 laps (3.5%) are positive.
We evaluate four scenarios for the lap-time regression task: A — random row-wise split, driver and GP included (reproduces the original leaky setup). B — grouped by race, driver and GP included (GP unseen at test). C — grouped by race, no identity features ("track-agnostic"). D — grouped by driver, GP kept as a feature ("track-aware"). Scenario C is our primary track-agnostic result; Scenario D is our primary track-aware result and the version used for SHAP analysis, the deployed model, and the 2024 generalization test.
For lap-time regression we compare XGBoost against a persistence baseline and linear regression. For pit-stop classification we compare XGBoost against a majority-class baseline and logistic regression with balanced class weights. We compute SHAP values (TreeExplainer) for both final (track-aware) models. Both track-aware models, trained once on the full 2023 season, are evaluated without retraining on the 6-race 2024 holdout (6,133 laps after cleaning).
Table 1 confirms that the original evaluation's near-perfect R² is reproducible almost exactly once both the row-wise split and identity features are restored (Scenario A), and that identity features alone provide no benefit once the split is honest and the circuit is genuinely unseen (Scenario B). Scenario D shows that keeping circuit identity is not illegitimate in general, and yields a strong, honestly-validated result.
| Scenario | Split | Driver/GP features | R² |
|---|---|---|---|
| A | Random row-wise | Both | 0.994 |
| B | Grouped by race | Both (unseen at test) | −0.58 ± 0.47 |
| C (track-agnostic, primary) | Grouped by race | None | −2.26 ± 1.56 |
| D (track-aware, primary) | Grouped by driver | GP only | 0.991 ± 0.002 |
The track-agnostic model performs worse than predicting the training-set mean on unseen circuits (R² < 0), because absolute lap time is dominated by track length and layout. The track-aware model is a real improvement over a strong persistence baseline (MAE 0.54s vs. 0.61s).
| Model | MAE (s) | RMSE (s) | R² |
|---|---|---|---|
| Notebook (as found, not reproducible) | N/A | 0.70 | 0.9973 |
| Paper (as claimed, not reproducible) | 0.174 | 0.769 | 0.995 |
| Track-agnostic: XGBoost | 13.40 ± 2.14 | 16.24 ± 1.78 | −2.26 ± 1.56 |
| Track-agnostic: linear regression | 8.28 ± 1.89 | 10.63 ± 2.53 | −0.29 ± 0.57 |
| Track-agnostic: persistence | 0.61 ± 0.15 | 2.20 ± 0.95 | 0.943 ± 0.038 |
| Track-aware: XGBoost | 0.54 ± 0.01 | 1.03 ± 0.12 | 0.991 ± 0.002 |
| Track-aware: persistence | 0.61 ± 0.05 | 2.41 ± 0.27 | 0.949 ± 0.012 |
The track-agnostic classifier barely beats a majority-class baseline on F1 and is actually worse than logistic regression on ROC-AUC (0.645 vs. 0.669), while the track-aware classifier is a clear improvement over both non-trivial baselines.
| Model | Accuracy | Precision | Recall | F1 | ROC-AUC |
|---|---|---|---|---|---|
| Notebook (as found, not reproducible) | 98.62% | N/A | N/A | 0.72 | N/A |
| Paper (as claimed, not reproducible) | 89.53% | 0.71 | 0.81 | N/A | 0.94 |
| Track-agnostic: XGBoost | 87.8% ± 5.7 | 0.087 ± 0.031 | 0.213 ± 0.082 | 0.114 ± 0.043 | 0.645 ± 0.060 |
| Track-agnostic: majority class | 96.6% ± 0.4 | 0.0 | 0.0 | 0.0 | 0.500 |
| Track-agnostic: logistic regr. | 65.7% ± 6.0 | 0.057 ± 0.009 | 0.565 ± 0.059 | 0.103 ± 0.015 | 0.669 ± 0.041 |
| Track-aware: XGBoost | 89.7% ± 1.5 | 0.200 ± 0.027 | 0.643 ± 0.039 | 0.303 ± 0.030 | 0.888 ± 0.005 |
Figure 1 shows that the track-aware lap-time model's global feature importance is dominated by circuit identity (GP) and weather. Figure 2 shows the opposite, more domain-sensible pattern for the pit-stop model: tyre life and stint dominate, with circuit identity contributing comparatively little.


Figure 1. SHAP analysis, track-aware lap-time model.


Figure 2. SHAP analysis, track-aware pit-stop model.
Both track-aware models, trained only on 2023 data, degrade substantially when evaluated without retraining on the 2024 holdout.
| Model | Metric | 2023 (in-season CV) | 2024 (held out) |
|---|---|---|---|
| Lap time | MAE (s) | 0.54 | 7.85 |
| Lap time | RMSE (s) | 1.03 | 10.01 |
| Lap time | R² | 0.991 | 0.172 |
| Pit stop | Accuracy | 89.7% | 87.7% |
| Pit stop | Precision | 0.200 | 0.080 |
| Pit stop | Recall | 0.643 | 0.329 |
| Pit stop | F1 | 0.303 | 0.129 |
| Pit stop | ROC-AUC | 0.888 | 0.721 |
The pit-stop classifier trails the current published field, and we do not soften this. Our track-aware classifier reaches F1=0.303 and ROC-AUC=0.888, behind Sasikumar et al.'s Bi-LSTM (2025: F1=0.81), Fatima and Johrendt's Deep-Racing (2023: F1=0.67), and García Tejada's SVM (2023: F1=0.621). This paper's contribution is the leakage audit and corrected evaluation protocol, not a claim of competing with the best published pit-stop predictors.
The track-aware framing is narrower than "lap time prediction" as originally framed. It generalizes to an unseen driver on a known circuit, not to an unseen circuit.
Cross-season generalization is weak without retraining. Neither model should be deployed across a season boundary without recalibration.
Safety cars, red flags, and team orders are not modeled. Track status is a coarse proxy at best.
Driver and constructor identity are deliberately excluded from the pit-stop model and the lap-time model's driver dimension, to avoid the identity-memorization problem this paper documents.
Training data is single-season. The 2024 data is used only for evaluation, not training.
The lap-time delta feature is quasi-derived from the regression target. An ablation removing it changed the track-agnostic result by less than 0.03 R².
We audited an existing Formula 1 lap-time and pit-stop prediction pipeline and found that its previously reported near-perfect performance was substantially an artifact of a row-wise random train/test split combined with one-hot-encoded driver and circuit identity, not genuine modeling of race conditions. A track-aware reformulation restores strong, honestly-validated performance for lap time, and a more modest but still non-trivial improvement over baselines for pit-stop classification, which nonetheless trails the current published state of the art. We release the corrected pipeline, the leakage decomposition, and all metrics reported here to support more reproducible evaluation practice in this application area.