Skip to content
The Collection

03 · Real-Time ML

~15ms

for 10,000 race simulations

Real-time F1 pit-wall strategy simulator that runs 10,000 Monte Carlo race simulations in about 15 milliseconds.

The Exhibit

01·Problem

“

Race strategists need to predict how a driver's lap times will evolve as tires degrade and fuel burns off, then simulate thousands of "what if" scenarios — different pit windows, undercuts, safety cars — fast enough to matter in a live race.

02·Approach

  1. 01

    Two-stage ML pipeline: Ridge regression with degree-2 polynomial features trained on 10 circuits predicts a baseline lap time per track (extrapolating to unseen circuits like Monza).

  2. 02

    XGBoost predicts the per-lap residual using race-state features (tyre age, compound, position, fuel load, stint, weather) anchored to the GP median pace — trained across 9,300+ laps for a 0.35s cross-validated MAE, 64% below a median baseline.

  3. 03

    Vectorized Monte Carlo engine in NumPy runs 10,000 simulations in ~15ms, injecting model residuals and Gaussian noise.

  4. 04

    WebSocket-driven live race state: chaos events (rain, safety cars, crashes) triggered from an iPad "steward" view ripple into new simulations instantly across all connected Pit Wall clients.

  5. 05

    Gemini generates a context-aware radio call narrating outcomes — purely for presentation, no computation.

  6. 06

    FastF1 pipeline extracts historical timing, weather, and telemetry into static JSON for the Next.js frontend, avoiding heavy backend REST payloads.

03·Architecture

Swipe to explore

04·Results

0.996

R² (5-fold CV lap KFold)

0.35s

CV mean absolute error, 64% below baseline

~15ms

for 10K Monte Carlo simulations

05·Stack

Next.js · FastAPI · WebSockets · Ridge Regression · XGBoost · NumPy · Gemini