AI Engineering
/

Model Serving & Inference

Model Serving & Inference

Reason about prefill, decode, batching, memory, and tail latency.

Start topic

Diagnose a slow first token, profile time to first token and throughput, and choose a serving strategy that holds tail latency under load.

4 questions

Questions

Easy

Easy
Conceptual

1.5 h

Split a slow first token into queue wait, prefill, and emit from a server trace, and choose a serving configuration per workload instead of by throughput alone.

Medium

Medium
Hands-on

3 h

Summarize per-request timing records into latency, TTFT, request TPOT, and throughput with failures kept in the counts, then use a KV memory estimate and stage timings to find what limits a long-prompt load profile.

Medium
Conceptual

3 h

Compare a hosted model API with a self-hosted open-weight model for a live tutor and a nightly scoring job: apply a quality gate, compute monthly cost at real utilization and the breakeven volume, check a data-location rule, and say what would reverse the choice.

Hard

Hard
System Design

4 h

Choose how to serve interactive hints and offline drafts on four memory-limited accelerators: compute KV headroom, check measured tail-latency and quality gates, and design scheduling, overload handling, and verification.

What you will be able to do

  • Distinguish inference from training, and a serving system from a model checkpoint
  • Explain prefill and decoding, and split a server TTFT into queue wait, prefill, and emit
  • Compare latency with throughput and say where each clock starts and stops
  • Explain how KV memory and batching affect queueing and concurrency
  • Describe quantization and caching without treating them as guaranteed speedups
  • Choose a serving configuration per workload from latency, failure, quality, and cost evidence
  • Freeze a benchmark contract that names the model artifact, runtime, hardware, workload distributions, and success definition
  • Validate per-request timing records and compute success latency, TTFT, request TPOT, and throughput over an observation window
  • Keep timeouts, rejections, and other non-success outcomes visible in a latency report

Before you start

Suggested, not required.

Hands-on exercises

Topic boundaries

This topic covers runtime scheduling, memory, and hardware. AI Application Integration covers streaming state in the client and server.

Related on CodeSnatch