Chapter 16 of 16: Choose and operate the system

What does the whole cafe actually need?

Arun MalikSeriesAIFoundations
Table of Contents
Builds on chapter 15. Specific dependencies are in the concept map.

A customer asks: “Write a short description of today's soup and save it as a draft.” We can now name the pieces without assuming that every piece is necessary.

Follow one request from start to finish

The application receives the request and identifies the authorized recipe collection. If the current recipe is already supplied, retrieval may be unnecessary. Otherwise, search finds the note and the application selects the relevant content.

The model receives the task, the recipe, and instructions to draft rather than publish. It generates a description. The application checks that the requested draft operation is allowed and validates its arguments. If review is required, it pauses before writing.

The draft tool saves the description. The application checks the resulting record and reports what actually happened. A trace records enough to diagnose failure without storing unrelated customer details.

  1. Request + authorized recipeUse supplied evidence or retrieve the current note.
  2. Model draftsContext guides generation; this invocation does not retrain the weights.
  3. Application validates and savesReview if required, call the allowed tool, and verify the draft record.
  4. Observe and evaluateRecord useful trace events and check the task outcome.
One complete draft-only task. Retrieval and model-directed looping are optional; ordinary code still enforces boundaries.

The model was pretrained before this request. No step here necessarily trains it again. The language model may use transformer computations internally; retrieval, tools, and the harness are surrounding application components. A known sequence can be a workflow. If the next steps need model-directed choices, an agent loop can sit within the same boundaries.

The weights are not the service

A model service is running software that accepts requests and serves model outputs, often through an API. Model weights are learned numerical values; the service also has execution code, hardware, configuration, and possibly additional features.

Downloading weights is not the same as operating a reliable application. Calling a hosted model service is not proof that data stays on your device. Understand which component runs where.

Deployment makes a chosen system version available for use. It includes more than choosing a model name: prompts, tool interfaces, retrieval indexes, permission settings, and runtime code can all affect behavior.

Time, money, and working space

Latency is how long a request or step takes. Time to the first visible word differs from time until the whole task, including tool actions, finishes. Streaming can show progress earlier without making the final saved draft exist earlier.

Cost includes resources spent to run the task, such as model usage, tool calls, hardware, and maintenance. A cheaper individual call can be part of a more expensive workflow if it needs many retries.

Compute and memory resources are the processing work and working storage used by the system. Model weights, intermediate values, and cached attention data need space. GPUs can perform many numerical operations in parallel, but not every task needs one.

TradeoffsChoose using measurements on your task. This triangle names competing concerns, not a numerical law or a performance claim.QualityDelayResources
Choose using measurements on your task. This triangle names competing concerns, not a numerical law or a performance claim.

Choose a setup by checking quality, delay, and total resources on representative tasks. A smaller model or an ordinary rule may be sufficient. A larger model's reputation does not replace testing your own task.

Reuse work carefully

A cache stores reusable results to avoid repeating work. A recipe lookup cache might hold a recently fetched note. A KV cache holds attention keys and values so compatible earlier token computations can be reused during generation.

These are different caches. Neither trains the model or supplies unlimited memory. Cached content needs rules for when it expires or becomes invalid. Reusing a recipe answer after the recipe changes can return stale information. Reusing it across users without checking access can expose private data.

CacheA changed source can invalidate a cached result. Attention KV caches are a different reuse mechanism and have compatibility and memory limits.Recipe v1CachedcopyRecipe v2Invalidate
A changed source can invalidate a cached result. Attention KV caches are a different reuse mechanism and have compatibility and memory limits.

Watch what changes

Monitoring observes a running system over time, including failures, delays, resource usage, and signals of quality. It complements prepared evaluations. Live outcome labels may arrive late, and operational logs alone do not prove answers are correct.

Drift is a change in the data or relationships a system faces over time. A new menu or a different pattern of orders can make earlier assumptions less useful. Version changes can alter behavior too, even when users type the same request.

Record versions, compare on evaluation cases before a rollout, and keep a way to pause or roll back when a change causes trouble. Inspect important subsets, such as unusually large orders, rather than trusting an overall score.

A feedback loop uses observations to guide later changes. Saving a user's correction as context, changing application instructions, updating a source note, and retraining weights are different changes. A thumbs-down button does not tell us which one happens.

A data boundary defines where information may go and who may access it. Check the model service, search storage, tools, caches, and logs. Keep only what the task needs, apply the required access and retention rules, and do not assume that a friendly chat interface makes sensitive information harmless.

ChangeData, versions, and task conditions can change. Feedback can guide a source update, context change, or retraining, but these are different operations. Keep data boundaries intact.EarlierChangedEvaluate before rollout
Data, versions, and task conditions can change. Feedback can guide a source update, context change, or retraining, but these are different operations. Keep data boundaries intact.
Which pieces can we remove for “What is 2 plus 3?”

Ordinary arithmetic can answer 5. No retrieval, model training, multi-agent team, or long-running agent loop is needed. The point of knowing the components is being able to choose, including choosing not to use them.

The useful final question is concrete: what information and authority does this particular task need? Build that system, then check that it does the job.