Deploying AI

18. Deploying AI#

A prototype becomes a service when it is packaged, configured, and served reliably. This chapter covers how models and AI applications are served, how containers make deployments repeatable, and how a release pipeline moves a tested candidate into service and, when needed, back out.

  • Model Serving: Endpoints, batching, and scaling turn a model into a dependable service.

  • Containers: Images, Compose files, and external configuration make AI deployments repeatable.

  • Release Pipelines: Code, data, and AI regression gates, a release manifest, readiness checks, and rollback connect a candidate to one release decision.

Chapter Video

This fast-paced tour covers the container concepts, including images, containers, Dockerfiles, and Compose, that make AI deployments repeatable.

100+ Docker Concepts you Need to Know (8:28) by Fireship

Hosted on YouTube; property of its original creator, embedded here for educational reference only.

Learning Objectives

By the end of this chapter, you will be able to:

  1. Describe how an AI model is exposed as a service endpoint.

  2. Explain batching and scaling choices for inference workloads.

  3. Package an AI application in a container with external configuration and secrets.

  4. Explain how a release pipeline connects code, data, and AI regression gates, a release manifest, readiness checks, and rollback.

  5. Build and test a model service request handler in Python.

Chapter Flow

Glossary

#

Term

Explanation

1

Deployment

Releasing software to an environment where users can reach it.

2

Model serving

Running a model as a service that answers inference requests.

3

Inference endpoint

A network address that accepts inputs and returns model outputs.

4

Batch inference

Running a model on many inputs at once, often on a schedule.

5

Horizontal scaling

Adding more instances of a service to handle more load.

6

Container

A packaged application with its dependencies that runs the same way everywhere.

7

Container image

The built, versioned template from which containers start.

8

Docker Compose

A tool that defines and runs multi-container applications from one file.

9

Environment variable

A named value supplied to a program at run time, often for configuration.

10

Secret

Sensitive configuration such as an API key or password.

11

Self-hosted model

A model run on infrastructure the organization controls.

12

Open-weight model

A model whose trained parameters are published for others to run.

13

Inference handler

A validated boundary around a model/pipeline call.

14

Liveness

Whether a process should be considered alive.

15

Readiness

Whether a process should receive work.

16

Graceful shutdown

Bounded completion or reporting of in-flight work.

17

Build context

Files supplied to an image build.

18

Image digest

A content identity for a container image.

19

Secret injection

Supplying sensitive runtime configuration outside the image.

20

Shadow deployment

Evaluating candidate results without applying their effects.

21

Request validation

Checking input shape and limits before processing.

22

Canary release

Directing a limited share of work to a candidate version.

23

Rollback

Returning service traffic to a previously accepted version.

24

Release pipeline

Stages connecting candidate checks, artifact delivery, readiness, and activation.

25

Bundle digest

A fingerprint of the complete declared artifact bundle.

26

Delivery receipt

Evidence identifying the artifact delivered under a declared protocol.

27

Readiness evidence

A candidate-bound observation determining whether it may receive work.