AI Engineering
Follow a token through a model, a passage through retrieval, or an action across an agent’s trust boundary. Explore 318 concepts in 75 chapters.
Chapter guide
Model foundationsFollow text into a model, one prediction at a time.
Prediction
Attention and generation
Model selection
Model families and media
Running open-weight modelsLoad a verified checkpoint, measure quantization error and choose where inference runs.
Building model applicationsTurn an application request into a validated result.
The request
Prompt and response contracts
Controlled generation
Training and inferenceTrace which parameters change and where serving capacity goes.
Adapting a model
Efficient models
Serving
Release checks
From corpus to checkpoint
Retrieval and groundingFollow a source document from ingestion to a cited answer.
Build the collection
Search and rank
Assemble and test answers
Structured data and evidence
Agent design and orchestrationDecide what the model controls and where a workflow must stop.
Control and state
Reasoning and action
Memory and coordination
Cross-service delegation
Running agents reliablyTest trajectories, recover failed runs and evaluate changes.
Model Context ProtocolTrace July 2026 requests and compare each walkthrough with its November 2025 counterpart.
Production AI architecturesFollow eight production systems from a real request through an engineering decision.
Release and serving
Permissions, state and feedback
Voice and visual evidence
Reels and mnemonics
Reel production list · 35 topics
Each brief pairs a proposed explainer with a pause for recall.
Predict one token, then feed it back
Follow one logit vector through a draw and show the changed prefix.
Pause after the draw and predict what the next call receives.
From an example to a next-token predictionA word crosses two boundaries
Animate text becoming token IDs and then rows of a learned table.
Hide the table and ask which step determines sequence length.
Tokens, vocabulary and learned representationsOne attention head, two keys
Show a causal mask and combine two values with weights ¾ and ¼.
Reveal the values first and ask for the weighted output.
Attention and the context windowMove the nucleus cutoff
Keep three masses fixed and move top-p from 0.85 to 0.95.
Predict the first threshold at which the third token can appear.
Sampling and trustworthy answersWatch three clocks on a streaming response
Contrast first byte, first visible text and validated completion.
Pause at a disconnect and decide whether the task finished.
Streaming, token budgets and costA valid receipt with the wrong total
Trace an amount through parser, schema and source verification.
Hide the receipt and ask which gates have actually passed.
Structured output and validationTwo small matrices change one projection
Freeze a weight grid and add the product of two narrow matrices.
Recover adapter parameter count for rank four.
Supervised tuning, LoRA and training dataPairwise feedback and the length shortcut
Show a judge ranking answers before and after controlling for verbosity.
Choose the independent check that tests a preference gain.
Learning from preferencesWhere the KV cache grows
Append tokens while retaining key and value blocks per layer.
Double context and predict the change in cache bytes.
Attention kernels, KV heads and long contextA short request leaves the batch
Animate a three-step and a one-step request sharing decode slots.
Choose when a waiting request can enter.
Batching, decoding and serving cachesThe exception across a chunk boundary
Slide the split across a policy and its exception.
Choose a unit that can answer the holiday question.
Choosing and annotating chunk boundariesReturn the price with its header
Detach a table cell from its row and then reconstruct its evidence.
Name the metadata needed to cite this amount.
Chunking documents with internal structureTwo rankings for one error code
Fuse a lexical list and a dense list, showing each contribution.
Recompute the winner after removing one list.
Lexical, semantic and hybrid retrievalPromote the exception from eighth to first
Trace a correct passage through shortlist, reranker and final context.
Predict what happens when the passage starts outside the shortlist.
Rewriting, filtering and re-rankingA correct quotation that misses the question
Follow two gold passages and two generated claims through separate checks.
Identify which metric the second missing fact can reduce.
Evaluating retrieval and answer qualityCompare possible routes with one actual run
Animate a state update selecting one edge of a graph.
Find the first wrong decision from its trace.
Typed state, routing and graph executionA crash between a refund and a checkpoint
Stop a worker immediately after the external ledger commits.
Decide which record to inspect before a retry.
Checkpoints, interrupts and replayA proposal crosses the authority boundary
Show a valid refund request being stopped before execution.
Name the check that schema validation cannot replace.
Tool selection, execution and observationA deleted address in a cached summary
Trace one fact through authoritative memory and its derivatives.
Find the remaining copy after the primary record is deleted.
Working memory, retrieval and forgettingTwo workers, one underlying source
Trace two agent messages back to the original draft and approved policy.
Count independent evidence rather than workers.
Multi-agent coordination and shared stateOne more search or abstain?
Track a missing date, a targeted rewrite and a finite search budget.
Choose a stop condition when the date stays missing.
Grading evidence and adapting retrievalGrade the environment after three runs
Replay equivalent trajectories and a duplicate booking.
Pick the run that fails despite a convincing final message.
Evaluating complete agent runsOne request, two protocol revisions
Compare an initialized November connection with a self-describing July request to another replica.
Pause at replica B and identify where the quote state lives.
MCP hosts, clients and stateless requestsThe quote needs one more answer
Trace a request for missing input and compare it with historical server-requested sampling.
Pause before resumption and identify the caller and the pending input.
Multi-round input and legacy samplingTwo replies arrive out of order
Return IDs 42 and 41 in reverse order to the client.
Reconnect each response to its original caller.
Authorization, tasks and request tracingFit a small weight and an outlier on four bits
These two weights share a toy group. The first lies inside the fine codebook range and the second exceeds it.
Increasing the toy scale reduces outlier clipping but what can it cost?
What quantization does to a weightShould the bilingual support model ship?
The evaluation team records both outcomes for each task, retaining ties and reviewer disagreements. Eight net wins are encouraging, but they do not establish improvement for each population.
The shadow worker is faster and the aggregate rises, but the Spanish guardrail fails. What should control promotion?
Model evaluation, rollout and rollbackCan a former team member reopen a cached answer?
Removing the employee from payroll changes membership while the indexed handbook remains byte-identical.
The source text is unchanged and the old answer is a perfect semantic match. Can it be served after access is revoked?
Permission-aware enterprise retrievalInterrupt the interviewer halfway through a question
The input stream continues during playback. Track turn identity and the device clock so the new speech can be associated with an interruption.
The answer was fully generated before interruption, but only half was audible. Which history should guide the next turn?
Real-time voice interview architectureFind the quarter behind a plotted value
Store the source revision, OCR and the page image. Preserve the visual relationship between line style and legend entry.
The correct page is retrieved but the highlighted value belongs to another series. Where should evaluation record the failure?
Visual documents and video evidenceA long document arrives among short conversations
Reserve capacity for prompt tokens, concurrent chats and the expected decode state. Queue or decline a request that cannot fit its declared limits.
Split pools reduce prefill delay but repeatedly miss the inter-token target. What comparison should decide deployment?
Serving mixed workloads on an inference clusterCould the fraud model know this at purchase time?
The ledger records event and arrival times. A later fraud report labels this transaction after the prediction has already been served.
A new feature is highly predictive but arrives after the purchase. How should the training set use it?
Predictive ML features and feedbackResume a draft after approval expires
A durable event records the draft version, operation key and original approval expiry. It can be read after the worker vanishes.
An old summary says “approved” but the current grant expired. What may the worker do?
Durable sessions and isolated agent workersA slow provider during an invoice rush
The tenant requires EU processing and a typed amount field. A third provider fails residency and never receives the input.
Only an out-of-region route can meet the deadline. Which response respects the contract?
Routing across model providersFrom a downloaded checkpoint to a local chat reply
Download the Q4_K_M file at the pinned revision, compare its SHA-256 digest and retain the license alongside the artifact.
A model starts but prints role markers and continues the user’s message. What should be checked first?
Run an open-weight model on your computer
Illustrated mnemonics · 11 stories
The typesetter cuts, numbers and sets the word.
A typesetter cuts a word into familiar pieces, reads the number on each drawer, then sets the matching blocks on the page.
See the illustration in Tokens, vocabulary and learned representationsPack the rules, pack the evidence, leave room for the reply.
A travel case has three compartments. Instructions go in first, source cards go in next, and an empty compartment is reserved for the answer.
See the illustration in Attention and the context windowRead the receipt, stamp the form, match the total.
A clerk reads a receipt, checks its fields against a form and compares the total with the original slip before filing.
See the illustration in Structured output and validationFreeze the mural. Paint the change on two strips.
A conservator leaves a large tiled mural untouched and uses a tall strip and a wide strip to specify a small correction.
See the illustration in Supervised tuning, LoRA and training dataFind the card. Fetch the page. Cite the line.
A librarian finds a catalog card, fetches the matching edition and points to the line that answers the reader.
See the illustration in Retrieval-augmented generationFind the pages, check the claims, answer the reader.
A librarian lays out the requested pages, checks each sentence against them and rereads the reader’s question.
See the illustration in Evaluating retrieval and answer qualityBookmark the page. Stamp the receipt. Check the stamp on return.
A clerk leaves a bookmark at the pending refund, stamps a ledger when money moves, and checks the stamp after an interruption.
See the illustration in Checkpoints, interrupts and replayWrite the order. Check the badge. File the receipt.
A clerk writes a proposed order, a gatekeeper checks the signer’s badge, and the cashier files the outcome.
See the illustration in Tool selection, execution and observationTwo reporters, one clipping, one source.
Two reporters hand an editor copies of the same clipping. The editor traces both reports to the same original before deciding what is corroborated.
See the illustration in Multi-agent coordination and shared stateRead the manual, borrow the recipe, ring the till.
At a shop, a manual supplies facts, a recipe supplies a reusable procedure, and ringing the till performs a transaction.
See the illustration in Resources, prompts and toolsThe server sends a request slip. The host holds the phone.
In the November 2025 protocol, a researcher passes a request slip across a counter. The host checks what may be shared, calls the expert and returns the approved reply.
See the illustration in Multi-round input and legacy sampling