liveBook · Manning

Chapter 10: Model inference and serving

What you will learn in chapter 10 of Machine Learning Platform Engineering

The chapter introduces the move from trained, validated models to serving them as APIs, outlines the BentoML deployment path, and explains the value and limits of self-service deployment.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The chapter introduces the move from trained, validated models to serving them as APIs, outlines the BentoML deployment path, and explains the value and limits of self-service deployment.

Key terms: BentoML, model serving, service, container, MLflow, self-service model deployment, early validation, nonproduction environments, production deployment

10.1 Model deployment is hard

This section explains why deploying an ML model adds serving, operational, and governance challenges to an already complex software deployment process.

Key terms: ML model deployment, continuous integration (CI), continuous deployment (CD), inference patterns, batch predictions, real-time inference, model scalability, hardware requirements, resource management, data dependencies

10.2 BentoML: Simplifying model deployment

This section explains how BentoML reduces the work of turning developed models into deployable, scalable, and manageable inference services.

Key terms: unified model serving, reproducible builds, API layer abstraction, real-time API serving, batch inference, scalability, adaptive microbatching, resource optimization, monitoring and logging, model management

10.3 A whirlwind tour of BentoML

This section sets up the chapter’s YOLOv8 serving example by introducing BentoML installation, verification, and the project workspace.

Key terms: YOLOv8, BentoML Service, ML service, BentoML, serving directory

10.3.1 BentoML Service and Runners

The section explains how BentoML API servers and Runners handle inference requests, then outlines two endpoints for a YOLOv8 object detection service.

Key terms: BentoML Service, API server, Runner, inference, horizontal scaling, load balancing, parallel processing, Python worker, /inference, /render

10.4 Executing a BentoML Service locally

This section introduces the plan to create and run a BentoML Service locally, starting with a Runner and exposing an object detection model through a REST API.

Key terms: BentoML Service, Runner, object detection model, REST API

10.4.1 Loading a model with BentoML Runner

This section builds a locally served YOLOv8 BentoML Service, extends it with downloadable image results, and explains its built-in observability endpoints.

Key terms: YOLOv8Runnable, bentoml.Runnable, @bentoml.Runnable.method, bentoml.Runner, yolov8_custom.pt, bentoml.Service, @svc.api, Image(), JSON(), async def

10.5 Building Bentos: Packaging your service for deployment

This section shows how to package a BentoML service as a Bento, build it, and containerize it for deployment.

Key terms: Bento, bentofile.yaml, service file, base Docker image, bentoml build, Bento tag, service_name:version_label, bentoml containerize, BentoCloud, container image

10.5.1 Bento tags: Versioning and managing your Bentos

This section explains how Bento tags identify deployable versions and how to verify that a containerized YOLOv8 Bento works.

Key terms: Bento tags, yolo_v8:3jghhcfxvwsrnbsb, bentoml build, workers, API page, /invocation, /render, container image, dependencies, consistency

10.6 BentoML and MLflow inference

The section combines MLflow’s model registry with BentoML to turn the recommender model into a locally tested, containerized inference service.

Key terms: MLflow, BentoML, model registry, experiment tracking, inference service, prod alias, model URI, MLflow client, bentofile, bentoml build

10.7 Using only MLflow to create an inference service

This section shows how to serve an MLflow-registered model without BentoML and explains when that simpler approach is preferable.

Key terms: MLflow tracking APIs, MLflow model registry, REST endpoint, Docker, /health, /invocations, MLflow ecosystem, BentoML, fine-grained deployment options, monitoring

10.8 KServe: An alternative to BentoML

This section introduces KServe’s Kubernetes-based deployment workflow and compares when to choose KServe, BentoML, or MLflow for model serving.

Key terms: KServe, K8s namespace, InferenceService, custom resource definition, DNS, BentoML, MLflow, Kubeflow, fine-grained control, model versioning

10.9 Summary

The chapter summary recaps BentoML’s serving workflow and observability features, then compares serving with BentoML and MLflow against simpler or alternative tool choices.

Where this is used later

Concepts explained in this chapter

← Chapter 9: Model training and validation: Part 2 Chapter 11: Monitoring and explainability →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.