Since the advent of Moneyball, sports teams around the world have incorporated data analysis into their decision making. At Modal, we’re fortunate to partner with one of the world’s best soccer teams in their quest to win their championship. To honor their request for anonymity, we will be referring to them as AFC Richmond.
The problem: Processing spatio-temporal match data efficiently
In every match, computer vision systems are deployed to produce large amounts of tracking data for every player. Typical tracking data contains x/y positions for each of the 22 players and the ball at 25 frames-per-second, resulting in ~3.5 million observations per game. AFC Richmond was looking for a solution to ingest their tracking data for each frame of a match, run inference on it, and write the results to cloud storage. AFC Richmond uses a custom transformer-based model that takes as input the unstructured spatio-temporal data from sequences of play, and produces structured outputs and high-dimensional embeddings. These outputs and embeddings are used for analyzing the performance of the players in different situations: was it the right time to take a shot? How effective was the positioning of the players during a particular moment? How do other teams handle such situations?
Before Modal, AFC Richmond tried using a GPU cluster on a major cloud provider, but it was not well set up for this workflow and required them to choose from a limited set of instance types. This limitation meant that AFC Richmond had to pay for larger and more powerful configurations than they needed. Furthermore, long cluster warmup times (6-8 minutes) added to their costs and made horizontal scaling trickier than they had hoped.
Modal’s solution: serverless batch processing on GPUs
AFC Richmond decided to switch over to Modal so that their infrastructure would be more flexible to build on. They didn’t have to worry about underutilization, and containers started up in a matter of seconds. The usage-based pricing and serverless nature of the product resulted in a 50% cost reduction for processing a full season of games.
Modal is also well set up to scale automatically based on the volume of data inputs. Using Airflow on Modal, AFC Richmond was able to achieve high parallelization, processing data for games in a matter of minutes rather than hours.
Furthermore, the team loved the smooth developer experience; they were able to get set up and run their first job within hours:
Bonus: Semantic search with embeddings
AFC Richmond also built a lightweight in-memory vector DB on top of Modal, as this turned out to be cheaper than using managed vector DB solutions. This allowed them to make queries based on the semantic similarity of embeddings generated in the previous steps. As an example: coaching staff can take a particular moment of a match and query for similar situations that showed up in a different match to determine the best course of action for the players.
We’re excited to partner with AFC Richmond to develop more use cases and are honored that we can indirectly deliver joy to millions of soccer fans around the world.