Podcast

MLOps + Machine Learning

James Sutton, AlgorithmiaEpisode 15 · 1:01:50 · Oct 2020 · 244 views
Thumbnail for MLOps + Machine Learning Watch on YouTube
TL;DR
  1. 1

    Large machine learning models can create deployment delays because downloading and loading a model may take up to 30 minutes during scale-up.

  2. 2

    Teams should start with research and add engineering processes after they have found a useful machine learning application.

  3. 3

    When data contains PII, teams can build a replica with dummy data, demonstrate the architecture, and work with the customer to adapt it to the real environment.

Summary

James Sutton discusses the engineering problems that appear when machine learning systems move from experiments into production. He explains how large embedding models can make scaling slow, especially when each request creates a separate instance and traffic arrives in bursts. His solution for one document-classification system converted a large model into a lookup structure backed by a prefix tree and files in S3. Sutton also describes CPU, GPU, memory, and input-output bottlenecks, along with ways to parallelize work and buffer data. On maturity, he argues that teams should not automate training and deployment before they know that a model has a useful application. Automation should grow as the system gains traction. The conversation ends with system tradeoffs around reliability, speed, cost, consistency, availability, and privacy. For PII-restricted work, Sutton recommends building a dummy replica and refining it collaboratively with the customer.

Key ideas
03:10

A difficult project can be a practical way into machine learning

James Sutton began in metallurgical engineering and worked for two years as a forensic engineer doing failure analysis. He wanted to make things, so he spent about eight months teaching himself programming while working on earthquake forecasting. The project used data from Topcoder, which Sutton described as an older, less structured version of Kaggle. The available tools predated Caffe, TensorFlow, and PyTorch, so he built his own machine learning framework. He used the project and a blog post when applying to Algorithmia, which became his first software job. Sutton also says that perseverance matters more than current skill in many engineering hires, especially when people must work through unstructured problems.

08:28

Embeddings make compact representations useful, but their models can be expensive to load

Sutton explains embeddings as internal representations that describe information in a more concise form. They can represent documents, images, videos, or other inputs. Unlike a compressed file, an embedding has structure that machine learning systems can use. A model can sometimes change an image feature or perform word arithmetic, such as subtracting one word vector from another, to expose relationships in the representation. For document classification, embeddings can separate categories such as cats and dogs, allowing a classifier to compare a new item with labelled examples. The inference calculation may be fast, but the trained model can have a large memory footprint, sometimes reaching around three gigabytes.

12:46

Model size and burst traffic create deployment bottlenecks

A large model is difficult to scale when a new machine must download it, deserialize it, and place it into memory before serving requests. Sutton says this process can take up to 30 minutes in some cases. Algorithmia's shared-tenancy setup also creates separate instances for different users to protect data and model security. That means a system may sit idle for 20 minutes and then need to process a thousand documents at once, with each new instance carrying the model-loading cost. Sutton distinguishes input-output bottlenecks from CPU-bound work. He also describes GPU memory limits and the use of data loaders to buffer inputs and outputs when the model and data cannot all fit in GPU memory.

24:03

A lookup structure can replace repeated loading of a large language model

For one document-classification system, Sutton's team realized that the model's token vocabulary was finite. They converted the model into a lookup table, similar to a Python dictionary with keys and values. They then organized the keys with a prefix tree. Each branch narrowed the search by prefixes, and branches with around 500 elements were saved as separate files in S3. The remaining tree acted as an index. A lookup could load a small index, follow the path for a token such as a word beginning with a particular sequence, and download only the relevant bucket. Sutton says this avoided downloading the full three-gigabyte model for every request and reduced the amount of data needed for a lookup.

30:07

MLOps tools are moving toward production use

Sutton separates tools used by practitioners for data science from systems designed to run machine learning reliably in production, although the two groups are starting to overlap. He mentions Anaconda's environment-serving work, Jupyter's serving system, and Google's serving tools. In his view, teams eventually discover that running a TensorFlow model inside a Flask application is insufficient when the server stops or receives more requests than it can handle. Algorithmia had focused on production reliability for several years, while the wider machine learning ecosystem was beginning to use the term MLOps more widely in 2020. The production concerns he names are reliability, maintainability, deployment, and handling scale.

38:48

Maturity should grow after a team finds a useful application

Sutton agrees that companies differ widely in machine learning maturity. Smaller companies built around machine learning may have an advantage because production concerns are part of their projects from the start. Some large customers also have mature systems and have built extensive continuous integration and continuous deployment pipelines. Most companies, however, are still moving from models that work in demonstrations to models that can run in production. Sutton argues that early-stage teams should explore before automating. They should not build a full retraining and deployment system until they know the model has a useful application. The process is gradual. Research comes first, then engineering practices increase as the model gains traction and customers rely on it.

41:49

Production architecture depends on the requirements of each system

Sutton gives network anomaly detection as an example of a production machine learning workflow. A company may collect data from many devices and servers, aggregate it with streaming tools such as Spark or Kafka, and read logs from systems such as Kibana or Splunk. A recent time window can contain millions of data points, so the pipeline transforms those events into features and smaller summaries before sending them to a model. The model may run inside Spark ML pipelines or in an external service. It can classify anomalies directly or compare forecasts with observed values. Sutton says these systems often need results within minutes, since detecting a problem a week later is of little use. The architecture depends on the actual reliability and data requirements.

51:12

Privacy restrictions call for a working replica and close collaboration

Sutton describes customers whose data contains personally identifiable information and cannot be shared with Algorithmia. Some customers do not want inputs or outputs recorded in logs, and they may require only generic exception messages. In those cases, his team builds a replica of the workflow with dummy data. For image-duplicate detection, they could use public images or generate random images to test the general technique without receiving the customer's real data. The replica cannot prove that the real workflow will work perfectly, so Sutton follows it with an architecture demonstration, documentation, and a working session. The customer then identifies missing details, and both teams refine the example until it matches the customer's actual process.

"You start off doing research and then it swaps towards engineering once you really find that thing that might make sense."39:49
Who should watch
  • You are deploying embedding or document-classification models and scale-up time is becoming a problem.
  • Your team is comparing machine learning maturity models with what it can reasonably automate today.
  • You work with customer data that contains PII and need a practical way to test an architecture without receiving the real data.