Skip to page content
SAVRN
Search Plan a project

Open-weight model

F1-Strategy

by Haokun Wang hkstormstout/F1-Strategy

F1-Strategy is an open-weight model from Haokun Wang, released under MIT License. Its published files total 12.9 MB.

Watch a race unfold, explore pit strategy, and reproduce the model training behind it. Pitwall combines an animated Formula 1 race center with a historical race simulator and an end-to-end machine-learning pipeline. Race Center opens with a recorded race.

Parameters—
Context—
Weights5.4 MB
Licensemit
AccessOpen weights
Monthly Downloads—

Model Card

By Haokun Wang, published under mit, revision e77a89ba37fe.

Watch a race unfold, explore pit strategy, and reproduce the model training behind it. Pitwall combines an animated Formula 1 race center with a historical race simulator and an end-to-end machine-learning pipeline. Race Center opens with a recorded race. Cars follow actual OpenF1 position samples around a recorded circuit trace, with smooth interpolation between samples. and selected-car views. gear, throttle, brake, completed-lap sectors, weather, and race-control messages. rejoin position from current gaps, and an undercut watch for nearby rivals. pretraining and fine-tuning results. Historical replay is free, with OpenF1 coverage from 2023 onwards. The first load of a race downloads and…

Read Haokun Wang's full model card

Pitwall AI

Watch a race unfold, explore pit strategy, and reproduce the model training behind it. Pitwall combines an animated Formula 1 race center with a historical race simulator and an end-to-end machine-learning pipeline.

Open the live demo · Training results · Race Center guide

Explore the race

Race Center opens with a recorded race. Cars follow actual OpenF1 position samples around a recorded circuit trace, with smooth interpolation between samples.

  • Track position: follow any driver, toggle labels, and switch between full-circuit and selected-car views.
  • Race panels: classification and gaps, tyre compounds and stint history, speed, gear, throttle, brake, completed-lap sectors, weather, and race-control messages.
  • Pit window: measured-history pit-lane time, estimated race-time loss, projected rejoin position from current gaps, and an undercut watch for nearby rivals.
  • Playback: pause, seek, restart, and replay at 1×–60×. Timing follows the replay cursor.
  • Strategy Lab: compare the baked model experiments and read the latest published pretraining and fine-tuning results.

Historical replay is free, with OpenF1 coverage from 2023 onwards. The first load of a race downloads and caches its GPS and telemetry, which can take a minute or more. Positions are approximate; missing or stale data stays unavailable.

The Live tab checks the current session, refreshes every 15 seconds and uses a 20-second playback buffer. It shows a waiting screen between sessions. Current live data requires an OpenF1 subscription and server credentials; the public replay needs neither. See connection setup.

Latest training result

The October 16 run used 120,935 lap records across 109 events, including 17 completed 2026 races acquired through OpenF1. A separate pit-time model fitted 1,815 routine measured stops from earlier races. The policy lifecycle covers supporting-model pretraining and adaptation, simulator validation, behavioral cloning, four-frame PPO pretraining, and recent-event fine-tuning.

Held-out policy Mean position Mean race time (s) Mean pit stops
Source PPO 8.575 5983.33 1.60
Fine-tuned PPO 8.550 5986.12 1.82
Dynamic-programming benchmark 8.400 5972.31 1.00

The new PPO candidate is not promoted. It trailed dynamic programming by 13.73 seconds on the held-out event-weighted comparison. Evaluation used 40 paired episodes across three eligible events and one training seed. Both simulator gates passed the required Spearman rho ≥ 0.7 (0.828 and 0.821). The independent measured pit-time model is available to Race Center regardless of policy promotion.

Read the model card for splits, uncertainty, supporting-model metrics and limitations, and the algorithm decision for the research behind the method. The race-center strategy desk is a labelled nominal dry-race DP reference, separate from the calibrated evaluation benchmark.

Run locally

Use Python 3.11 and uv.

git clone https://github.com/whk-irl/F1_Strategy.git
cd F1_Strategy
uv sync --python 3.11 --extra dev
uv run streamlit run services/frontend/app.py

Open http://localhost:8501. Race Center fetches historical data on first use. Strategy Lab includes baked models and 2022–2025 lap data, so training is optional for exploring those experiments. The published model card and chart also ship with the app; full checkpoints and MLflow runs remain local generated artifacts.

For live access, set OPENF1_TOKEN on the server, or OPENF1_USERNAME and OPENF1_PASSWORD for automatic token renewal. .env.example lists optional settings. Keep credentials in environment variables or the hosting provider's secret store.

Retrain end to end

uv run python -m services.ingestion.acquire --years 2026 --provider auto
uv run python scripts/acquire_pit_history.py --years 2023,2024,2025,2026
uv run python -m ml.pipelines.pit_time
uv run python -m ml.pipelines.train --config configs/training.pit-time.json
flowchart LR
    A[FastF1 / OpenF1] --> B[Bronze → Silver → Gold]
    A --> P[Measured pit timing → venue forecast]
    B --> C[World-model pretraining and adaptation]
    C --> D[Simulator fidelity gates]
    P --> D
    D --> E[Behavioral pretraining]
    E --> F[History-aware PPO]
    F --> G[Recent-event fine-tuning]
    G --> H[Held-out evaluation against DP]
    H --> I[Versioned artifacts and MLflow report]

Acquisition is resumable and records source checksums. Features are rebuilt causally; event splits are chronological, with validation for checkpoint selection and separate final test events. Policy learning starts only after both simulator gates pass.

The local profile budgets 200,000 PPO source steps and 100,000 fine-tuning steps. It writes checkpoints, normalization statistics, split membership, metrics and provenance under runs/. Use --resume to verify completed stages of an unchanged run. Choose a new output_dir after changing source, data or configuration; the saved October 16 run is tied to the source fingerprint in its report.

See the training guide for configuration, artifacts and inference. The 96-input staged candidate has a dedicated loader and does not overwrite the legacy 21-input models.

Validation and scope

uv run ruff check .
uv run ruff format --check .
uv run mypy services/ ml/
uv run pytest

The October 16 update passed 167 tests with 89.14% configured coverage, plus Ruff and mypy checks. Replay controls and desktop/mobile layouts were checked in the browser. Authenticated active-session timing still requires verification during a race.

This is an independent research project. Opponents follow recorded trajectories; they do not react to the policy. The trained candidate covers dry races without red flags and does not model tyre inventory. Results do not establish real-race superiority.

The repository also contains cloud-agnostic storage, serving and infrastructure scaffolding. Deployment instructions describe the existing Streamlit Community Cloud app. See architecture and scope for the wider project.

License

The project declares the MIT license. Race data is supplied by FastF1 and OpenF1. This project is unofficial and is not affiliated with Formula 1, the FIA, or any team.

Identity and Version

Repository
hkstormstout/F1-Strategy
Publisher
Haokun Wang
Task
Not stated by the source
Modality
Other
Library
Not stated by the source
Parameters
Not stated by the source
Languages
Not stated by the source
Revision
e77a89ba37fefbca6610a98e02448cc710cd64f2
First published
2026-10-17
Last updated
2026-10-17

Files and Weights

174 files, 12.9 MB in total. The weights are 2 files totalling 5.4 MB in pt.

Weights2 files · 5.4 MB
Configuration109 files · 571.0 KB
Documentation19 files · 82.4 KB
Other39 files · 6.8 MB
Repository5 files · 10.9 KB
Every file
FileTypeSizeSHA-256
models_baked/tire_patch_tst/model.ptWeights2.6 MB f779ab89447c
models_baked/tire_tcn_gru/model.ptWeights2.8 MB 9dffc305dc40
.devcontainer/devcontainer.jsonConfiguration1.1 KB —
.github/workflows/ci.ymlConfiguration2.6 KB —
.github/workflows/train-cloud.ymlConfiguration5.7 KB —
.pre-commit-config.yamlConfiguration2.6 KB —
configs/training.local.jsonConfiguration750 B —
configs/training.pit-time.jsonConfiguration765 B —
docker-compose.ymlConfiguration3.7 KB —
infra/argo/workflows/train-safety-car.yamlConfiguration1.8 KB —
infra/argo/workflows/train-strategy-policy.yamlConfiguration2.4 KB —
infra/argo/workflows/train-tire-degradation.yamlConfiguration1.9 KB —
ml/__init__.pyConfiguration —
ml/features/__init__.pyConfiguration312 B —
ml/features/data_sources.pyConfiguration277 B —
ml/features/definitions.pyConfiguration3.9 KB —
ml/features/entities.pyConfiguration269 B —
ml/features/feature_store.yamlConfiguration372 B —
ml/features/feature_views.pyConfiguration443 B —
ml/models/__init__.pyConfiguration —
ml/models/_loader.pyConfiguration3.5 KB —
ml/models/safety_car/__init__.pyConfiguration —
ml/models/safety_car/predict.pyConfiguration3.1 KB —
ml/models/safety_car/train.pyConfiguration9.5 KB —
ml/models/strategy_policy/__init__.pyConfiguration —
ml/models/strategy_policy/per_buffer.pyConfiguration9.7 KB —
ml/models/strategy_policy/predict.pyConfiguration5.5 KB —
ml/models/strategy_policy/predict_dqn.pyConfiguration6.2 KB —
ml/models/strategy_policy/predict_staged.pyConfiguration3.0 KB —
ml/models/strategy_policy/train.pyConfiguration14.2 KB —
ml/models/strategy_policy/train_dqn.pyConfiguration19.6 KB —
ml/models/tire_degradation/__init__.pyConfiguration —
ml/models/tire_degradation/model_patch_tst.pyConfiguration4.4 KB —
ml/models/tire_degradation/model_tcn_gru.pyConfiguration6.3 KB —
ml/models/tire_degradation/predict.pyConfiguration3.4 KB —
ml/models/tire_degradation/predict_sequence.pyConfiguration12.2 KB —
ml/models/tire_degradation/sequence_dataset.pyConfiguration11.0 KB —
ml/models/tire_degradation/train.pyConfiguration7.2 KB —
ml/models/tire_degradation/train_sequence.pyConfiguration14.4 KB —
ml/models/tire_degradation/wrapper.pyConfiguration2.6 KB —
ml/pipelines/__init__.pyConfiguration —
ml/pipelines/config.pyConfiguration2.9 KB —
ml/pipelines/data.pyConfiguration6.0 KB —
ml/pipelines/pit_time.pyConfiguration10.1 KB —
ml/pipelines/policy.pyConfiguration18.5 KB —
ml/pipelines/report.pyConfiguration3.4 KB —
ml/pipelines/train.pyConfiguration15.4 KB —
ml/pipelines/world_models.pyConfiguration10.5 KB —
models_baked/manifest.jsonConfiguration1.4 KB —
models_baked/pit_time.jsonConfiguration6.4 KB —
models_baked/sc/conda.yamlConfiguration7.6 KB —
models_baked/sc/python_env.yamlConfiguration114 B —
models_baked/tire/conda.yamlConfiguration7.6 KB —
models_baked/tire/python_env.yamlConfiguration114 B —
models_baked/tire_patch_tst/config.jsonConfiguration176 B —
models_baked/tire_patch_tst/norm_stats.jsonConfiguration546 B —
models_baked/tire_tcn_gru/config.jsonConfiguration173 B —
models_baked/tire_tcn_gru/norm_stats.jsonConfiguration546 B —
scripts/acquire_pit_history.pyConfiguration2.9 KB —
scripts/export_for_deploy.pyConfiguration3.1 KB —
scripts/upload_gold_to_s3.pyConfiguration2.4 KB —
scripts/validate_tire_models.pyConfiguration6.1 KB —
services/__init__.pyConfiguration —
services/api/__init__.pyConfiguration —
services/frontend/__init__.pyConfiguration —
services/frontend/app.pyConfiguration1.5 KB —
services/frontend/race_center.pyConfiguration6.7 KB —
services/frontend/strategy_lab.pyConfiguration54.8 KB —
services/ingestion/__init__.pyConfiguration —
services/ingestion/acquire.pyConfiguration10.9 KB —
services/ingestion/config.pyConfiguration4.0 KB —
services/ingestion/fastf1_client.pyConfiguration4.0 KB —
services/ingestion/openf1_archive.pyConfiguration10.2 KB —
services/ingestion/pipeline.pyConfiguration8.1 KB —
services/ingestion/schemas/__init__.pyConfiguration260 B —
services/ingestion/schemas/bronze.pyConfiguration2.2 KB —
services/ingestion/schemas/gold.pyConfiguration2.6 KB —
services/ingestion/schemas/silver.pyConfiguration2.7 KB —
services/ingestion/storage.pyConfiguration5.6 KB —
services/ingestion/transforms.pyConfiguration10.5 KB —
services/live/__init__.pyConfiguration52 B —
services/live/obs_builder.pyConfiguration8.9 KB —
services/live/openf1_client.pyConfiguration7.6 KB —
services/live/race_data.pyConfiguration19.5 KB —
services/simulator/__init__.pyConfiguration89 B —
services/simulator/circuits.pyConfiguration1.6 KB —
services/simulator/env.pyConfiguration35.8 KB —
services/simulator/lap_simulator.pyConfiguration5.4 KB —
services/simulator/pit_time.pyConfiguration1.4 KB —
services/simulator/tyre_calibration.pyConfiguration7.2 KB —
services/simulator/validator.pyConfiguration6.8 KB —
test_policy.pyConfiguration3.7 KB —
tests/__init__.pyConfiguration —
tests/conftest.pyConfiguration4.1 KB —
tests/data_quality/__init__.pyConfiguration —
tests/data_quality/test_contracts.pyConfiguration4.4 KB —
tests/integration/__init__.pyConfiguration —
tests/unit/__init__.pyConfiguration —
tests/unit/ingestion/__init__.pyConfiguration —
tests/unit/ingestion/test_acquisition.pyConfiguration7.3 KB —
tests/unit/ingestion/test_schemas.pyConfiguration2.9 KB —
tests/unit/ingestion/test_storage.pyConfiguration4.6 KB —
tests/unit/ingestion/test_transforms.pyConfiguration6.0 KB —
tests/unit/live/__init__.pyConfiguration —
tests/unit/live/test_obs_builder.pyConfiguration11.2 KB —
tests/unit/test_pit_time.pyConfiguration1.7 KB —
tests/unit/test_race_data.pyConfiguration10.9 KB —
tests/unit/test_staged_pipeline.pyConfiguration6.7 KB —
tests/unit/test_training_lifecycle.pyConfiguration4.5 KB —
tests/unit/tire/__init__.pyConfiguration —
tests/unit/tire/test_sequence_models.pyConfiguration13.9 KB —
ADR-0001.mdDocumentation1.8 KB —
CLAUDE.mdDocumentation8.1 KB —
README.mdDocumentation7.5 KB —
docs/architecture.mdDocumentation5.5 KB —
docs/decisions/0001-cloud-agnostic-mlops.mdDocumentation1.5 KB —
docs/decisions/0002-aws-s3-gpu-training.mdDocumentation3.1 KB —
docs/decisions/0003-dqn-per-strategy-policy.mdDocumentation5.1 KB —
docs/decisions/0004-sequence-tire-models.mdDocumentation4.4 KB —
docs/decisions/0005-staged-policy-training.mdDocumentation5.1 KB —
docs/decisions/0006-recorded-race-center.mdDocumentation2.3 KB —
docs/guides/aws-setup.mdDocumentation7.6 KB —
docs/guides/deployment.mdDocumentation2.9 KB —
docs/guides/race-center.mdDocumentation6.3 KB —
docs/guides/staged-training.mdDocumentation6.8 KB —
docs/model-cards/2026-10-15-retraining.mdDocumentation5.2 KB —
docs/model-cards/2026-10-16-pit-time-retraining.mdDocumentation4.9 KB —
docs/scope.mdDocumentation1.9 KB —
scope.mdDocumentation1.9 KB —
tests/fixtures/README.mdDocumentation612 B —
.streamlit/config.tomlOther271 B —
DockerfileOther1.6 KB —
MakefileOther10.3 KB —
data/gold_2022_2025.parquetOther2.6 MB a29c62ecbdac
data/gold_2024.parquetOther965.8 KB a8952d079716
docs/assets/pit-time-training-summary.pngOther73.4 KB —
docs/assets/race-center.pngOther125.5 KB 0ee637fa8f13
docs/assets/training-summary.pngOther186.7 KB 5df7f43b77b8
infra/docker/postgres-init.sqlOther213 B —
infra/terraform/aws/backend.tf.exampleOther504 B —
infra/terraform/aws/bootstrap/main.tfOther3.9 KB —
infra/terraform/aws/ecr.tfOther1.7 KB —
infra/terraform/aws/eks.tfOther4.6 KB —
infra/terraform/aws/iam.tfOther4.2 KB —
infra/terraform/aws/main.tfOther1.5 KB —
infra/terraform/aws/outputs.tfOther1.6 KB —
infra/terraform/aws/s3.tfOther1.9 KB —
infra/terraform/aws/terraform.tfvars.exampleOther620 B —
infra/terraform/aws/variables.tfOther2.3 KB —
infra/terraform/aws/vpc.tfOther1.2 KB —
ml/models/safety_car/DockerfileOther748 B —
ml/models/strategy_policy/DockerfileOther1.4 KB —
ml/models/tire_degradation/DockerfileOther1.2 KB —
models_baked/dqn_policy/model/policy.zipOther651.3 KB 78df98b94954
models_baked/policy/model/policy.zipOther964.6 KB d7affdfdb6fb
models_baked/sc/MLmodelOther787 B —
models_baked/sc/model.pklOther6.9 KB 8a9cb535de7f
models_baked/sc/registered_model_metaOther39 B —
models_baked/sc/requirements.txtOther6.4 KB —
models_baked/tire/MLmodelOther788 B —
models_baked/tire/model.pklOther181.1 KB f6e87fcba4e9
models_baked/tire/registered_model_metaOther39 B —
models_baked/tire/requirements.txtOther6.4 KB —
pyproject.tomlOther5.1 KB —
requirements.txtOther670 B —
services/frontend/race_center_component/app.jsOther28.6 KB —
services/frontend/race_center_component/index.htmlOther10.7 KB —
services/frontend/race_center_component/style.cssOther21.4 KB —
uv.lockOther837.6 KB —
.dockerignoreRepository295 B —
.env.exampleRepository3.0 KB —
.gitattributesRepository1.7 KB —
.gitignoreRepository6.0 KB —
ml/notebooks/.gitkeepRepository —

License and Download

License
mit
Access
Open weights, no gate
Download size
5.4 MB
Download from Haokun Wang

Released by Haokun Wang through its official repository on Hugging Face. Read the license.

Memory Requirements

PrecisionWeights in memory
As published5.4 MB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About F1-Strategy

Can I use F1-Strategy commercially?

Yes. F1-Strategy is released under MIT License. The MIT License is a short permissive license. It permits commercial use, modification and redistribution, provided the copyright notice and permission notice are included.