A Foundation Model for Soccer

Ethan Baron, Daniel Hocevar, Zach SalehearXiv 2024

Abstract

We propose a foundation model for soccer, which is able to predict subsequent actions in a soccer match from a given input sequence of actions. As a proof of concept, we train a transformer architecture on three seasons of data from a professional soccer league. We quantitatively and qualitatively compare the performance of this transformer architecture to two baseline models: a Markov model and a multi-layer perceptron. Additionally, we discuss potential applications of our model. We provide an open-source implementation of our methods at https://github.com/danielhocevar/Foundation-Model-for-Soccer.

Introduction

In sports analytics, predicting the next sequence of play is a critical component for tactical planning and player evaluation. While traditional approaches, such as Markov chains, can estimate the probability of immediate transitions, they often lack the capacity to capture long-term context or the complex spatial relationships inherent in a match. This research introduces a "foundation model" for soccer, applying the philosophy of large-scale pre-training to learn general representations of the game that can be utilized for various downstream analytical tasks.

Methods

The researchers framed soccer modeling as a sequence prediction task, analogous to how Large Language Models (LLMs) predict the next word in a sentence.

Tokenization and Architecture

To translate soccer into a machine-readable "language," the pitch (105x68 yards) was discretized into a 10x10 grid. Each action was converted into a token containing the team (home/away), the action type (e.g., pass, dribble), and the grid location.

The core of the model is a Transformer decoder architecture, which utilizes self-attention mechanisms to weigh the importance of previous actions when predicting the next move. The study evaluated two variants: a "Small" model (365k parameters) and a "Large" model (548k parameters).

Overview of the Transformer architecture and the internal decoder block used for action sequence prediction.

Datasets

The model was trained using the StatsBomb Open Data repository, specifically three seasons (2018–2021) of the FA Women’s Super League. The dataset comprises 939,920 individual actions across 326 matches, processed into the standardized SPADL (Soccer Player Action Description Language) format. The data was split into 80% training, 10% validation, and 10% testing sets.

Key Insights and Results

Soccer "Grammar" and Embeddings

Qualitative analysis using UMAP visualizations revealed that the model successfully learned the underlying "grammar" of soccer. Without explicit instruction on field geometry or team tactics, the model automatically clustered similar actions together and differentiated between home and away team styles within its high-dimensional embedding space.

UMAP visualizations of action embeddings, colored by action type (left) and team (right), demonstrating the model's ability to learn game structure.

Quantitative Performance

The "Large" Transformer achieved a test accuracy of 0.429, outperforming both the Markov model (0.424) and the MLP (0.418). More significantly, the Transformer showed superior calibration in its probability assignments, achieving a Mean Log Likelihood of -2.534 compared to the Markov model's -2.975. This indicates a much more sophisticated understanding of match uncertainty.

Scaling and Context

Performance improved with dataset size, following trends observed in natural language processing. However, the researchers noted diminishing returns when increasing the context window beyond 9 actions, suggesting that the immediate tactical past is the primary driver of sequential predictability in soccer.

Limitations and Future Work

While the model excels at predicting logical sequences (like throw-ins followed by receivals), it struggles with low-frequency, "random" events such as interceptions. Future work aims to scale the dataset to thousands of matches and incorporate specific player IDs to create player-centric foundation models. Such advancements could eventually power advanced win-probability simulations and expected possession value (EPV) calculators.

Summary updated

BibTeX
@misc{baron2024foundation,
  author = {Ethan Baron and Daniel Hocevar and Zach Salehe},
  title = {{A Foundation Model for Soccer}},
  year = {2024},
  eprint = {2407.14558},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.14558},
}
Figure