Rana Maninder Singh
Lesson 1 of 12Advanced AI Engineering & LLMOps

From Prototype to Production

Lesson opener

In one line: A prototype proves that a model can answer; production proves that the whole system answers safely, repeatably, affordably and accountably when nobody is watching.

Why it matters: Most LLM demos fail in the gap between "it answered my five test questions" and "it is used by 1,800 people against live policy documents." Closing that gap is mostly engineering around the model: access control, validation, fallbacks, monitoring, ownership and a clear stop condition. The model call is the smallest part of the work.

Before this lesson: Evaluation & Safety basics and Deployment, Monitoring & Operations. This course (LLMOps) starts where those end.

Northline Consumer Goods (illustrative) built a policy assistant over a weekend. In the leadership demo it answered "How many days can I carry over?" fluently and cited a PDF. The sponsor now wants it live for all 1,800 office staff in three weeks. Nobody has decided who owns the policy content, whether contractors may use it, what happens when the model provider is slow, or how a wrong answer about travel approval limits would be noticed. The demo is real. The system is not yet.

What you will be able to do

Deliverable: a one-page readiness gap assessment for the Northline policy assistant, with evidence per criterion, a list of blockers, a list of accepted risks with owners, and a go / conditional-go / no-go recommendation.

Prerequisites

PrerequisiteWhy it matters
Calling an LLM APIYou should know what a request, response, token and timeout are.
RAG basicsThe policy assistant retrieves from documents; this lesson treats that as one layer.
Evaluation & Safety basicsReadiness criteria rely on having at least a small evaluation set.
Deployment, Monitoring & Operations (agents)Introduces deployment and monitoring ideas that this course makes stricter.
Integration Governance & OperationsShows how integrations are owned and monitored.
Security & Cost on cloudBackground on identity, secrets and budgets.

Plain English

A prototype answers the question "can this work?" It runs on one laptop, uses sample data, has one user and fails quietly. A pilot answers "does this help a small group?" It has named users, real data and a feedback channel, but a human is watching closely. A production service answers "can the organisation depend on this?" It needs owners, access rules, tests that run before every change, monitoring, an incident path and a way to switch off.

A language model is non-deterministic and probabilistic: the same question can produce different wording, and a fluent answer can be wrong. You cannot fix that inside the model. You surround it with deterministic controls: ordinary code and configuration that behaves the same every time, such as authentication, permission filters, input limits, schema validation, allow-lists, rate limits and kill switches. The rule of thumb is: let the model do language work, let code do rule work.

An LLM application is easier to reason about as layers:

LayerWhat it doesTypical risk if neglected
Channel and identityWeb app, Teams, API; knows who the user isAnonymous or wrong-audience use
Gateway and policyRate limits, input size, logging, kill switchRunaway cost, abuse
Orchestration and promptsBuilds the request, calls tools, parses outputUntracked changes, brittle parsing
Model accessProvider or self-hosted model, routing, timeoutsOutage, silent model change
Retrieval and dataDocuments, indexes, permissionsWrong, stale or unauthorised content
Validation and output controlsSchema checks, citation checks, refusalsUnsupported claims reach the user
ObservabilityTraces, metrics, cost, feedbackFailures nobody sees
Evaluation and releaseTest sets, gates, approvalsRegressions shipped unnoticed
Human oversightReview queues, escalation, ownershipNo one accountable

Every production trade-off is a choice between quality, latency, cost, risk and control. A bigger model may improve quality but raise latency and cost. Stricter validation reduces risk but may refuse more questions. Writing the choice down ("we accept 4 s median latency to get citation checking") is the difference between engineering and hoping.

Teacher walkthrough

Take the policy assistant and walk it through a readiness review, one decision at a time.

  1. Business owner. Name one person accountable for the assistant's answers (for example the Head of HR Operations, illustrative). Without an owner there is nobody to approve scope, accept risk or answer a complaint.
  2. Approved users. Decide who may use it: employees only? contractors? Each group has different entitlement to policy content. Record the decision and enforce it through identity, not through a note in the UI.
  3. Sources. List the exact documents that may be used (HR policy v7, Travel policy v4) and exclude drafts, personal files and old versions. Each source needs an owner and a review date.
  4. Permissions. Some policy content (for example executive compensation bands) must not be retrievable by everyone. Retrieval must filter by the user's entitlements before text reaches the prompt.
  5. Deterministic controls. Decide what is code: input length limit, authentication, per-user rate limit, output schema, refusal when no source supports the answer, and a kill switch.
  6. Validation. Define how an answer is checked before display: each claim cites a retrieved passage, the cited passage exists, and dates or amounts quoted appear in the source.
  7. Human review. Decide which answers require a person: low-confidence answers go to an HR queue; a sample of high-confidence answers is reviewed weekly.
  8. Escalation. Define who is paged for a safety issue, who handles a wrong-answer complaint, and the time limit for each.
  9. Monitoring. Choose signals: latency percentiles, error rate, refusal rate, thumbs-down rate, citation-check failures, cost per question, share of answers routed to humans.
  10. Fallback. Define what users see if the model is down or slow: a search-only mode listing relevant policy pages, or a message pointing to the HR mailbox. A fallback is designed behaviour, not an error page.
  11. Stop condition. Write the rule that turns the service off or back to pilot: for example, any confirmed leak of restricted content, or two consecutive weekly samples under the agreed groundedness threshold.
  12. Decision. Compare findings to criteria; unmet blockers mean "no-go" for the date requested.

Worked example

Northline scores the assistant against ten criteria. Blockers are criteria where an unmet state means launch cannot proceed, whatever the schedule. The script below is a minimal, stdlib-only gap assessment. It does not call any model.

from dataclasses import dataclass


@dataclass(frozen=True)
class Criterion:
    key: str
    description: str
    blocker: bool   # True: launch cannot proceed if unmet
    met: bool
    evidence: str


CRITERIA = [
    Criterion("owner", "Named business and technical owner", True, True, "RACI v2 signed"),
    Criterion("users", "Approved user groups enforced by identity", True, True, "SSO group: employees"),
    Criterion("sources", "Approved source list with owners", True, True, "2 policies, owners named"),
    Criterion("permissions", "Retrieval filtered by entitlement", True, False, "Not implemented"),
    Criterion("eval", "Evaluation set run before release", True, False, "12 questions only"),
    Criterion("fallback", "Designed behaviour when model is down", False, False, "Generic error page"),
    Criterion("monitoring", "Latency, error, refusal, cost dashboards", False, True, "Dashboard v1"),
    Criterion("human_review", "Review queue and sampling plan", False, False, "Not defined"),
    Criterion("incident", "Escalation path with named contacts", True, True, "Runbook v1"),
    Criterion("stop", "Written stop condition and kill switch", True, False, "No kill switch"),
]


def assess(criteria):
    gaps = [c for c in criteria if not c.met]
    blockers = [c for c in gaps if c.blocker]
    if blockers:
        decision = "NO-GO"
    elif gaps:
        decision = "CONDITIONAL-GO"
    else:
        decision = "GO"
    return decision, gaps, blockers


decision, gaps, blockers = assess(CRITERIA)
print("Decision:", decision)
print("Blockers:", [c.key for c in blockers])
print("Accepted-risk candidates:", [c.key for c in gaps if not c.blocker])

Running it prints NO-GO, blockers permissions, eval and stop, and non-blocking gaps fallback and human_review. The useful part is the shape: every criterion has evidence, and a schedule cannot convert a blocker into an accepted risk. Only the business owner can accept a non-blocking gap, in writing, with a date to close it.

A second workplace case

Northline Procurement wants an LLM tool that drafts supplier emails from an ERP purchase order. The risk profile differs: no document retrieval, but the draft is sent externally. Layers that matter most are output validation (PO number, amounts and delivery dates must match ERP data exactly, checked by code, not by the model), human review (buyer approves each email), and a stop condition (disable sending if more than 2% of drafts fail amount validation in a week). The same readiness list applies; the weights move. Retrieval permissions matter less; deterministic output checks and human approval matter more.

Failure example

Symptom: Two weeks after launch, a manager in Supply Chain asks the assistant about a bonus scheme and receives a figure from a draft policy that was never approved. A screenshot circulates.

Diagnosis: The document index was built from a shared folder that included drafts. No source-approval step existed, no metadata marked document status, and no validation checked that cited documents were approved versions. The answer was fluent and cited a real file, which made it more convincing.

Correction: Rebuild the index from an approved-source list only; add a status metadata field and filter retrieval to approved; add a validator that rejects any citation to a non-approved document; add the draft folder to an exclusion list in ingestion.

Validation: Run a test set containing 20 questions whose only supporting text sits in draft documents. Every one must return "no approved source found". Re-test after each ingestion run.

Prevention: Make the approved-source list and the status filter readiness criteria, with an owner who signs off each source. Include draft-trap questions in the permanent regression set.

Guided practice

Scenario: The IT Service Desk at Northline wants a "how do I..." assistant over 300 knowledge-base articles. Staff will paste screenshots and error messages. List five readiness gaps you would check first and the deterministic control for each.

Hints:

  1. Think about who the users are and whether the articles contain internal-only or admin-only procedures.
  2. What happens to pasted text and screenshots that might contain passwords or personal data?
  3. What does the user see if the model provider is unavailable?
  4. How would you know the answers are getting worse after an article update?
  5. What is the stop condition?

Complete solution:

GapQuestionDeterministic control
AudienceAre admin-only runbooks in the index?Metadata audience filter applied from the user's SSO group before retrieval
Sensitive inputDo pasted errors contain secrets?Input scanner masks patterns resembling tokens and passwords before the model call; raw input not stored
FallbackModel down?Keyword search over article titles, with a banner "AI answers unavailable"
RegressionArticle edits change answers?Re-run 60-question evaluation set after every re-index; block publish if groundedness drops below threshold
Stop conditionWhen do we turn it off?Kill switch in config; off if restricted content appears in any answer or error rate stays above 5% for an hour

Owner: Service Desk Manager. Approved users: employees and approved contractors with a service-desk entitlement. Escalation: on-call IT operations lead. Human review: weekly sample of 25 answers plus all thumbs-down answers.

Independent practice

Choose a small LLM idea in your own workplace, or use "meeting-notes summariser for the Finance team." Write a readiness gap assessment of at most one page.

Acceptance criteria

Common mistakes

  1. Treating a good demo as evidence of production quality. A demo is five hand-picked questions.
  2. Letting the model enforce rules that code can enforce, such as "never reveal salary bands," in the prompt alone.
  3. Skipping the owner. Without a named person nobody can accept a risk or approve a change.
  4. Indexing everything in a shared folder, including drafts and obsolete versions.
  5. Having no designed fallback, so an outage becomes a blank page and a flood of tickets.
  6. Measuring only average latency; the slowest 5% of requests are what users complain about.
  7. Setting no stop condition, so there is no agreed trigger for rollback.
  8. Allowing the schedule to turn a blocker into an "accepted risk" without the owner's written decision.

Quick check

  1. What distinguishes a pilot from a production service, in terms of controls?
  2. Give two examples of work that should be deterministic code rather than left to the model.
  3. Why is a designed fallback better than an error page?
  4. What is a blocker criterion, and who can accept a non-blocking gap?
  5. In the Northline failure example, which two controls would have prevented the draft-policy answer?

Answers:

  1. A pilot has named users and close human watching; production adds owners, access enforcement, pre-release tests, monitoring, an incident path and a stop condition so it does not depend on someone watching.
  2. Authentication and permission filtering; schema validation of output; rate limits; kill switch. Any rule that must hold every time.
  3. A designed fallback keeps users productive (for example search-only mode) and reduces tickets, and its behaviour is tested rather than accidental.
  4. A blocker is a criterion whose unmet state stops launch regardless of schedule; the business owner accepts non-blocking gaps in writing with a closing date.
  5. An approved-source list with a status filter at retrieval, and a validator that rejects citations to non-approved documents.

Quiz alignment

The quiz (QUIZ_LLMOPS1) covers prototype vs pilot vs production, the layered view of an LLM system, deterministic controls versus model judgement, the quality/latency/cost/risk/control trade-offs, readiness criteria and blockers, fallback and stop conditions, and the draft-policy failure case. Every answer is supported by the sections above.

Lesson summary

Production readiness is about the system around the model. Name owners and approved users, restrict sources and enforce permissions in code, validate outputs, design human review and escalation, monitor, define fallbacks and write down the stop condition. Score readiness against explicit criteria with evidence, treat blockers as blockers, and make trade-offs explicit decisions.

Bridge to the next lesson

A production system still has to choose which model to call, from where, under what limits, and what happens when that model is slow or unavailable. The next lesson covers model access, selection, routing and fallbacks, so that changing or losing a model never happens silently.

Sources

Northline Consumer Goods and all names, numbers and thresholds are illustrative. Thresholds must be set by your own owners, based on your own evaluation data.