TecnoStack
Start a projectالعربية
A central LLM release card connects by four spokes to Release gate, Staged rollout, Rollback and Monitoring, the controls placed around every release.
AI engineering

No test set catches every wrong answer, so LLM hallucinations in production are managed around each release: a gate agreed before the results, a staged rollout that starts in shadow mode, monitoring of live answers, and a rehearsed incident and rollback routine.

In this article

Silent video with on-screen text. The transcript below repeats every screen and describes what it shows.

Watch on the video page

  1. 0:00–0:06

    Treat the prompt edit as a release • Version stamped • Change note • Prompt update

    The Prompt update badge, one illustrative prompt edit, sits at the head of its own lane and stays fixed for the whole film. A blank version tag with no characters swings into view with the caption Version stamped, and a Change note card slides in. The tag travels to the end of the badge and is tied on with a string, the caption follows, and the Change note card docks beside the badge: the edit is treated as a release. The card and caption then clear, and the tag stays on the badge.

  2. 0:06–0:12

    Sign the gate before the results • Permission tests • Pay and leave slice • Owner signs first • Prompt update

    The Prompt update badge and its tag stay fixed. A closed two-panel gate slides into the lane ahead of the badge. Two pale plates, Permission tests and Pay and leave slice, travel onto the gate as its blocking conditions. An Owner signs first card appears on the gate and a signature line draws itself before any result slot exists. A bolt slides across the seam: the gate stays shut and nothing has been evaluated.

  3. 0:12–0:18

    Start with a shadow run • Wider stages wait • Prompt update • Current version • New version • Users see this • Reviewers compare

    The Prompt update badge and its tag stay fixed, and beside them three dim stage markers stay unlit next to Wider stages wait. The shadow-run figure assembles whole: a question bubble, the Current version and New version cards, the users group labelled Users see this, a blank dashed answer card and a bracket labelled Reviewers compare. A question marker leaves the bubble and splits into both lanes at once: the upper copy passes the Current version and reaches the users; the lower copy passes the New version along a dashed lane and stops on the blank answer card inside the Reviewers compare bracket. No comparison result is shown.

  4. 0:18–0:24

    Watch the answers users get • Sampled review • Automatic checks • User reports • Prompt update

    The Prompt update badge and its tag stay fixed. A stream of blank answer chips flows along a line, standing for live answers. The signal cards Sampled review, Automatic checks and User reports slide in one at a time, and a line traces from each card to the stream and ends in a small ring on it. No alert, score or status light appears.

  5. 0:24–0:30

    Rehearse containment before launch • Feature flag off • Current permissions reapplied • Prompt update • Rollback • Versioned settings • Approval before sending • Outgoing message

    The Prompt update badge and its tag stay fixed, and a switch labelled Feature flag off slides from on to off in their lane. The rollback-limits figure appears whole: a dashed boundary labelled Rollback holds the Versioned settings stack, a route leaves it towards the closed Approval before sending gate, and a dashed line continues past the gate to the Outgoing message envelope. A marker traces the curved rollback arrow and stops on the stack, and a Current permissions reapplied plate attaches beside the stack. A second marker rides the route and stops in front of the closed gate; the Outgoing message stays behind it. No incident is shown.

You manage LLM hallucinations in production with controls around each release, because no test set catches every wrong answer. Four controls do most of the work: a release gate agreed before the results arrive, a staged rollout that starts in shadow mode, monitoring of the answers users actually receive, and an incident and rollback routine your team has rehearsed.

The controls below assume you already have an evaluation set. Our companion guide explains how to build one and how to choose the hallucination metrics and slices a gate reads.

Any change that can alter an answer is a release and goes through the same gate as a new feature. Teams tend to gate features and wave the quieter changes through, although these move answers just as much:

  • a new model version, or a provider's update to the model you already call
  • an edited system prompt or answer template
  • a new chunking rule, embedding model or retrieval setting
  • a new tool, or a changed tool definition
  • a large batch of documents added to the index
  • a change to how permissions sync from the source systems

Give each one a version identifier and a short change note. Pin model versions where your provider allows it, and log which model, prompt, retrieval configuration and index version produced every answer. When someone investigates a bad answer three weeks later, they can rebuild the exact conditions.

If your model calls run through the adapter-service architecture, one service sits between your application and the model. That service is the natural place to stamp versions on each request and to switch configurations without redeploying the main application.

Keep the release record short: what changed, which evaluation-set version you ran, the results per slice, and who approved the release and why. A governance reviewer will ask for exactly this record.

A release gate is a written list of conditions that a change must meet before more users see it, agreed and signed by a named owner before the evaluation runs. Write it first. Criteria written after the scores arrive tend to bend toward whatever the new version happened to achieve.

Separate blocking conditions from advisory ones. An illustrative gate for an HR policy assistant that answers in Arabic and English might read:

ConditionTypeWhy
Every permission test passesBlockingBetter answers elsewhere cannot offset restricted content shown to the wrong employee.
No new unsupported claims in the pay and leave sliceBlockingAn error there costs the most, in money and in trust.
The assistant still declines questions no accessible document coversBlockingFewer declines usually means the assistant is answering without a source.
A person has reviewed both the Arabic and English slicesBlockingOne language can regress while the other improves.
Answer length, latency and cost per answerAdvisoryThe owner may accept a time-limited exception.

The thresholds depend on what an error costs in each slice. That is a business decision, so a named business owner approves them; the engineering team should not sign its own gate.

When a blocking condition fails, fix the cause and run the gate again, or narrow the release if you can isolate the failing capability and ship the rest safely. A permission failure always blocks. For an advisory condition, the owner may record an exception with the remaining risk and a review date. No exception waives a security or legal requirement, and nobody can override the gate without leaving a record.

Roll it out in stages, because passing the offline gate says little about live traffic: real questions drift away from any test set. Each stage widens exposure only after the previous one shows no new failure pattern.

  1. Shadow run. The new version answers real questions in parallel while users still see the current one. Reviewers compare the two on a sample. Our staged rollout guide explains running the model in shadow mode first inside an existing system.
  2. Internal users. Staff who know the domain use the new version and report problems through a visible channel.
  3. Small group. A limited set of real users, behind a feature flag you can switch off at once.
  4. Wider release. Only after the earlier stages show nothing new.

At every stage, keep the previous model setting, prompts, retrieval configuration and index snapshot ready to restore. Before you restore them, apply current permissions, required deletions and security fixes. An old index must not bring back access that someone has since revoked.

The same real questions go to the current version, which users see, and in parallel to the new version, whose answers reviewers compare.

In a shadow run, the new version answers the same real questions in parallel while users still see the current version. Reviewers compare a sample before any wider stage; no comparison result is shown.

You monitor them by combining a sampled human review with automatic checks and user reports, because no single automatic metric can confirm that every live answer is correct. Each signal catches something different and misses something different:

SignalWhat it catchesWhat it cannot tell you
Sampled human review, by slice and languageUnsupported claims, wrong policy, awkward ArabicAnything outside the sample
Automatic checks: cited passage exists, the user may see it, numbers and units match the sourceInvented citations, permission leaks, mangled figuresWhether a correctly cited answer is the right answer
User reports routed to the document ownerOutdated sources and errors reviewers missedSilence does not mean the answers are right
Rate shifts: declines, empty retrievals, tool errors, latency, costDrift after an upstream changeWhether quality went up or down

Reviewers should label the live sample with the same guide you used for the evaluation set, so the numbers stay comparable. A changed rate tells you where to look; it does not prove that quality rose or fell.

Watch upstream changes too. Edited documents, reorganised permissions and provider model updates can change answers without any release on your side. Monitoring logs hold real questions, so restrict who can read them, keep only what you need and set a retention limit.

Treat it as a production incident: contain the harm first, then investigate. Harm here means a wrong policy sent to many employees, restricted content shown to the wrong person, or a tool action taken on bad information.

Contain. Prepare the options before launch, so nobody improvises at midnight:

  • switch the feature off behind its flag
  • fall back to a safer mode, such as search results with links and no generated answer
  • remove or restrict the document involved
  • disable one specific tool
  • roll back to the previous release

Investigate. Preserve the evidence under access control: the question, the retrieved and permitted passage IDs, the answer and the versions involved. Find which stage failed: the document, retrieval, permissions, the prompt or the model. Add the case to the evaluation set so the gate catches it next time, and decide with the owner whether to tell the affected users.

Actions raise the stakes. If the system can send messages or change records, go back to deciding whether you need an AI agent at all, and put human approval in front of any action with external effects.

Rollback loops back over versioned settings inside its boundary; an outgoing message lies outside it, so a closed approval gate stands before sending.

Rollback can restore settings that carry versions, such as the model setting, prompts and index. It cannot recall a message a tool already sent, so the approval belongs before the send. The gate is shown closed; no message has been approved.

Rollback restores the previous behaviour only if you version every answer-changing component together: model setting, prompts, retrieval configuration, tool definitions and the index. Write a one-page runbook that names who may trigger a rollback and how, then rehearse it in a non-production environment before launch.

Rollback cannot undo what the system already did. Restoring the old code does not unsend an email, reopen a ticket or restore a record a tool changed. You can repair some changes with a compensating action that you validate separately. Sent messages and their consequences may be beyond repair, which is the strongest argument for human approval before external actions. We write down which actions wait for a person's approval before we connect agents that send messages or change records.

Both describe the same controls in their own vocabulary, and neither is a law or a certification. NIST says its AI Risk Management Framework (AI RMF 1.0, released 26 January 2023) is intended for voluntary use. It is organised into four functions: Govern, Map, Measure and Manage. Several subcategories match the controls in this guide:

  • MEASURE 2.4: the system's functionality and behaviour are monitored in production.
  • MANAGE 2.4: mechanisms and assigned responsibilities exist to supersede, disengage or deactivate a system whose performance or outcomes are inconsistent with intended use. That is your feature flag, fallback mode and rollback.
  • MANAGE 4.1: post-deployment monitoring plans cover user input, appeal and override, incident response, recovery and change management.
  • MANAGE 4.3: incidents and errors are communicated to the relevant people, and the response is followed and documented.

NIST's Generative AI Profile (NIST AI 600-1, published 26 July 2024) extends the framework to generative AI. As of October 2026, NIST states that AI RMF 1.0 is being revised under the White House AI Action Plan, so check the current version before you quote a subcategory number in a policy.

The OWASP Top 10 for LLM Applications 2025 lists misinformation, including hallucination, as LLM09. Its suggested mitigations include human review of sensitive content, automatic validation of key outputs and telling users about the system's limits.

These frameworks help you organise controls and evidence; they do not guarantee safe behaviour. The practices in this guide are TecnoStack's recommendations, not NIST or OWASP requirements. For ownership, inventories and legal scope, read our guide to AI governance for boards.

Before an LLM feature reaches its first real users, you should be able to say yes to each line:

  • Every answer-changing component has a version, and each answer is logged with those versions.
  • The release gate is written, its blocking conditions are named, and a business owner has signed it.
  • The shadow run and internal stage have an owner and a review sample.
  • The feature flag, safer fallback mode and rollback have been tested outside production.
  • Restoring an old index reapplies current permissions and deletions.
  • Monitoring combines human review, automatic checks and user reports, with access limits and a retention period on the logs.
  • Tools with external effects need human approval.
  • The incident runbook names who contains, who investigates and who decides on telling users.

If you are taking an AI feature from pilot to live users, our custom AI systems service includes an evaluation set and a version review, and we can set up the gate, monitoring and rollback with your team.

Discuss your website, store, app or AI project in Arabic or English. We agree the scope before work starts.

Book a free scoping callCompare services and prices