Layer 5 — AI Infrastructure · Chapter 2

Training, Inference, and the Model Lifecycle

Book chapterLayer 5

AI infrastructure must support two very different forms of computation. Training changes a model by updating its parameters. Inference uses a trained model to produce predictions, content, decisions, or actions. Between them lies a lifecycle of experimentation, evaluation, packaging, deployment, monitoring, and revision.

Training infrastructure

Training systems coordinate large datasets and repeated mathematical operations across many processors. Their central concerns are throughput, synchronization, fault recovery, reproducibility, and efficient use of expensive compute.

Pretraining, adaptation, and post-training

Not every organization trains a frontier model from the beginning. Many start with an existing model and adapt it through fine-tuning, parameter-efficient methods, preference optimization, reinforcement learning, distillation, prompt design, or retrieval. Each approach creates different infrastructure needs.

StagePurposeInfrastructure emphasis
PretrainingLearn broad patterns from very large datasets.Massive distributed compute, data pipelines, checkpoints, and long-running job reliability
Fine-tuningAdapt a model to a task, style, policy, or domain.Curated data, experiment management, evaluation, and moderate compute
Post-trainingImprove instruction following, preferences, reasoning behavior, or safety.Human or synthetic feedback, reward signals, evaluation suites, and iterative runs
DistillationTransfer behavior from a larger model into a smaller or cheaper one.Teacher-generated data, quality comparison, and efficiency measurement
InferenceUse the model to answer real requests.Latency, batching, availability, caching, scaling, and cost control

Inference is not one workload

Real-time chat, document processing, code completion, image generation, speech, recommendation, and background analysis have different requirements. Some demand an immediate first response; others can be placed in a queue and processed in large batches. Some use a small model thousands of times per second; others invoke a large reasoning model for a small number of difficult tasks.

The deployment lifecycle

  1. Register: store an approved model version with its lineage and evaluation results.
  2. Package: define runtime dependencies, numerical precision, hardware requirements, and configuration.
  3. Stage: deploy to a limited environment or group of users.
  4. Compare: use controlled experiments, shadow traffic, or canary deployment to compare versions.
  5. Promote: route more production traffic after quality and operational checks.
  6. Monitor: watch latency, cost, errors, safety events, drift, and user outcomes.
  7. Roll back or retire: remove versions that fail, become unsafe, or are no longer economical.

Model versioning is more than a file number

A production result may depend on the model, system prompt, sampling settings, retrieval index, tool definitions, safety policy, application code, and external data. Reproducibility therefore requires versioning the complete inference configuration, not only the model weights.

The operational unit of AI is often not “the model.” It is the model plus data, instructions, tools, policies, and runtime.