If you're a Formula 1 (F1) fan, have you ever wondered why F1 teams have very different performances between qualifying and practice sessions? Why do they have multiple practice sessions in the first place? Can practice session results actually tell something about the upcoming qualifying race? In this post, originally written by a data scientist at the Amazon ML Solutions Lab, we show how qualifying results can be predicted from practice session performance by combining domain knowledge with machine learning. The work was developed as part of the collaboration between F1 and the Amazon ML Solutions Lab to generate new F1 Insights powered by AWS, and the resulting predictions were integrated into a new "Qualifying Pace" insight for each Grand Prix.
Each F1 GP consists of several stages. The event starts with three practice sessions (P1, P2, and P3), followed by a qualifying (Q) session, and then the final race. Teams approach practice and qualifying sessions differently because the sessions serve different purposes. Practice sessions are the teams' opportunity to test strategies and tire compounds and gather data for race day. Qualifying sessions, in contrast, exist purely to set the starting grid, so teams focus solely on the fastest possible lap. Because of this shift in tactics, Friday and Saturday practice results often fail to predict the qualifying order.
This post describes deterministic and probabilistic methods for modeling the time difference between the fastest lap in a practice session and the fastest lap in qualifying, written as ∆t = tq − tp. The goal was to use that modeled delta to predict the upcoming qualifying standings from practice session data.
Where the delta comes from
The delta between practice and qualifying fastest laps comes primarily from two sources: fuel level and tire grip.
A higher fuel level adds weight and reduces the car's speed. Teams vary fuel level freely in practice — in the second session (P2) it's common to begin with low fuel and run heavier fuel loads later — but they run minimal fuel in qualifying specifically to record the fastest possible lap. How much fuel load matters depends on the circuit: it changes with the number and length of a track's straights.
Tires matter just as much. Each event, the supplier brings intermediate and full wet tires for damp and heavy-rain conditions, plus three dry compounds — hard, medium, and soft — that trade durability for grip: the hard tire lasts longest but grips least, the soft tire grips most but degrades fastest. Track temperature and moisture affect how quickly a given compound degrades over a run, and that in turn changes how much grip is available. As with fuel, the size of this effect is circuit-specific. According to the article's authors, drawing on internal timing data, car performance dropped sharply on wet tires: at the 2018 Italian GP, where P1 ran in wet conditions and qualifying was dry, the fastest P1 lap was reported as more than 10 seconds slower than the qualifying pole time — consistent with published race-weekend reports that Friday practice at Monza that year began wet and dried out before a dry qualifying session.
Data and the approaches that were tried
Given this understanding, the most direct approach would use fuel level and tire grip data to estimate the qualifying lap time from a known practice performance. But at the time this analysis was done, no data records were available that directly captured fuel load or tire grip during a session. The team instead worked with what was available: the fastest lap time for each session (P1, P2, P3, and Q) at each GP since 1950, along with driver, car, team, and circuit identifiers drawn from F1's public results, plus partial-year weather data giving track wetness and temperature for each session.
Two implicit modeling strategies were explored, both using team, driver, and circuit identity as inputs rather than direct fuel or tire measurements. The first was a rule-based, empirical model that attributed the observed delta to per-circuit and per-team effects, using known lap-time sensitivities to fuel mass and tire grip that F1 provided from simulation runs on each track. The second was a regression model using driver and circuit indicators, which let the data itself learn each driver's sensitivity to each circuit without ever being told the underlying fuel or tire mechanism. Deterministic versions of this were built with XGBoost and AutoGluon, and a probabilistic version with PyMC3.
Models were trained on race data from 2014 to 2019 and tested against 2020 races. Earlier seasons were excluded because of significant car development and regulation changes over the years, and any race where either the practice or qualifying session was wet was dropped, since the resulting delta was treated as an outlier rather than a representative data point.
Training on Amazon SageMaker
The regression models were trained on Amazon SageMaker, a managed service for building, training, and deploying ML models. Multiple iterations were run over feature sets and hyperparameters, and SageMaker's customized metrics definitions made it possible to record and compare candidate models consistently. Automatic model tuning reduced mean squared error on the test data by 45% compared with default hyperparameters. The XGBoost model itself used SageMaker's built-in implementation, which offered better logging, hyperparameter validation, and a broader set of metrics than a standalone implementation would have.
The rule-based model
The rule-based approach assumes ∆t comes primarily from systematic, known variations in tire grip by circuit and fuel level by team, with everything left over treated as a small, zero-mean residual:
∆t = ∆tf(team, circuit) + ∆tg(circuit) + residual
Here ∆tf and ∆tg are the effects computed from the known lap-time sensitivities to fuel mass and tire grip, combined with the estimated fuel-load and tire-grip variation for each team and circuit, respectively — not the sensitivities themselves. The model assumes a hierarchy: grip variation by circuit sits at the top level, with fuel variation by team nested underneath it. To simplify further, the interaction term was dropped and fuel variation for each team was assumed constant across all circuits, reducing the model to ∆t = f(team) + g(circuit) + residual. Because the fuel and grip sensitivities were known in advance, team fuel variation and circuit grip variation could be estimated directly from the data.
How much these sensitivities matter depends on a circuit's layout. The Italian GP circuit has fewer corners and longer straights than the Singapore GP circuit, for example, so extra tire grip is worth comparatively more at a corner-heavy track like Singapore than at a power track like Monza.
The ML regression model
The regression approach skips the explicit fuel-and-grip mechanism entirely and instead fits ∆t directly against indicator variables for circuit, team, and driver — letting the model learn whatever pattern of variation exists in the data without being told why it exists.
The hierarchical Bayesian model
A separate challenge was noise. The random component of ∆t could be non-negligible — a driver drifting slightly off their usual line through a corner, or simply varying effort between sessions — and the deterministic models above had no way to represent that uncertainty explicitly. A hierarchical Bayesian model was built to address this.
As in the rule-based model, circuit-level grip variation sits at the top of the hierarchy, but the Bayesian version also incorporates individual-level variation when estimating those group-level effects — a middle ground between pooling all the data together (ignoring real differences between circuits and drivers) and fitting a separate model per circuit (21 separate regressions, one per track). The resulting varying-intercepts model assigned each driver-under-circuit combination its own intercept, each circuit its own intercept, and added terms for the difference in track wetness between practice and qualifying and the difference in track temperature between the two sessions.
Testing against the 2020 season
Once ∆t was predicted, it was added to each driver's practice lap time to produce a predicted qualifying time, and rankings were derived from those predicted times and compared with the actual qualifying order. This was tested across all three practice sessions for the 2020 Austria, Hungary, and Great Britain Grands Prix (P2 for Hungary was excluded because that session was wet).
The Bayesian model went further, producing a full uncertainty range around each prediction based on its posterior samples rather than a single point estimate. That made it possible to rank drivers by their median predicted pace while still flagging cases where two drivers' predicted-pace distributions overlapped closely enough that either one might turn out faster on the day.
How the models compared
Model quality was assessed with mean squared error (MSE) and mean absolute error (MAE) on lap times, and with rank discounted cumulative gain (RDCG) on the resulting rankings — RDCG was chosen because only the top 10 finishers score championship points, so ranking errors near the front of the field matter more than errors further back. For the Bayesian model, the median of the posterior was used to compute all three metrics.
Using raw practice lap times with no correction produced an MSE of 2.822 seconds² and an MAE of 1.544 seconds on the P2 test sessions, with an RDCG of 0.92; on P3 the raw numbers were an MSE of 1.053, an MAE of 0.949, and an RDCG of 0.95. Every corrected model did substantially better on lap-time error: on P2, the rule-based model reached an MSE of 0.349 and MAE of 0.462 (the best MSE and MAE of the four models on that session), XGBoost reached 0.358 and 0.472, AutoGluon reached 0.567 and 0.591, and the hierarchical Bayesian model reached 0.431 and 0.521. On P3, XGBoost had the lowest error at an MSE of 0.141 and MAE of 0.297, the rule-based and Bayesian models tied at an MSE of 0.186 (MAE 0.346 and 0.332 respectively), and AutoGluon reached an MSE of 0.351 and MAE of 0.459. Ranking accuracy moved by a smaller margin across all models, with RDCG scores clustering between 0.87 and 0.96 — AutoGluon's 0.96 on P3 was the single highest value recorded, and the raw, uncorrected P3 baseline of 0.95 was itself already close to the corrected models. No one method dominated every metric on every session, which the authors read as a sign of how much random error remains in the underlying lap-time data even after fuel and tire effects are accounted for.
Broadly, correcting for fuel and tire effects — whether through explicit domain-derived sensitivities or through models that learned team, driver, and circuit patterns implicitly — cut the mean absolute lap-time prediction error to well under a second, down from a mean absolute error of up to 1.544 seconds when using uncorrected practice times directly.
What came of it
This work became part of a set of new F1 Insights powered by AWS released across 2020. The specific insight described here, Qualifying Pace, was introduced to broadcasts starting at the 2020 Turkish Grand Prix, with F1's own channels announcing it that race weekend as a new on-screen graphic powered by AWS. Years later, Qualifying Pace remains one of the seven driver-performance metrics AWS lists on its official F1 partnership materials, and F1 Insights as a whole has grown considerably beyond its original scope since 2020.
Guang Yang is a data scientist at the Amazon ML Solutions Lab, where he works with customers across various verticals to apply ML/AI solutions to their problems.
Responses