Chapter 4. Model Serving: Architectures and Implementation
After we register the model, it will be ready for use by downstream systems. This raises the following question: how do we generate predictions and serve them to end users?
Many ML models are deployed as batch processes, where predictions are generated on a schedule (e.g., daily or hourly) and written to a database—either directly or transferred via mechanisms such as Secure File Transfer Protocol (SFTP). This database typically serves as the backend for an internal application, such as a demand forecasting or pricing system, that consumes the predictions for downstream decision making.
While implementing a full batch inference pipeline is one of the most common deployment patterns in production environments, we will not focus on it in this book. In practice, this setup would follow the same approach we demonstrated earlier when running the predict function in Chapter 3. However, instead of running inference on observations from the test set, we would generate predictions on fresh, unseen, and unlabeled data, with the results persisted to a table for downstream consumption by other systems or applications.
In this chapter, I’ll cover situations in which ML applications need to deliver predictions in real time.
There are three main scenarios we’ll cover:
- Model Serving
-
All the features are available to the model via the payload, and predictions are computed at the moment of request.
- Serving precomputed batch predictions ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access