
If you ship software that talks to customers, you will eventually ship a wrong answer. The useful engineering question is not how to make that impossible. It's how to make wrong answers rare, easy to spot, and quick to recover from. This post walks through a build workflow for doing that, from grounding to monitoring, and looks at why the work is mostly about the system around the model rather than the model itself.
Why a wrong answer is now a company problem
For a while, a hallucination was treated as a quirk of the technology. A 2024 ruling in Canada helped change that. In Moffatt v. Air Canada (2024 BCCRT 149), a customer relied on an airline chatbot's description of its bereavement fare policy, and the description was wrong. The airline argued it shouldn't be liable for what its chatbot said. The tribunal disagreed and found that the airline had not taken reasonable care to ensure the chatbot was accurate. A more detailed summary is available from Law360 Canada.
For engineers, the takeaway is practical. Anything the product says to a customer should be treated like any other production behavior: specified, tested, observable, and owned by someone.
What counts as a hallucination in a product context
A hallucination is output that sounds plausible but is false, unsupported, or invented. The distinction that matters for design is between a wrong answer and a confidently wrong one. In customer-facing software the common shapes are invented facts or sources, fabricated citations, wrong product details, made-up policies, and unsupported claims delivered in the same tone as supported ones.
The design goal follows from that: since you can't prevent every instance, build so that each instance is visible and recoverable.
Retrieval helps, but it isn't the whole fix
The usual first move is retrieval-augmented generation, where the model answers from a set of documents rather than from its general training. It's a good move. It also has limits that are worth knowing before you rely on it.
Stanford RegLab and HAI researchers evaluated commercial legal research tools built on retrieval and found that, while they reduced errors compared with a general-purpose model, they still hallucinated in roughly one of every six queries or more. Part of the problem was the retrieval step itself, which sometimes surfaced the wrong or an inapplicable document that the model then answered from confidently. That's 2024 data from a legal setting, so treat the figure as an illustration, not a general benchmark. The design lesson holds up anyway: retrieval lowers the error rate, and the rest of the workflow handles what's left.
Step 1: Ground the answers
Start by deciding exactly what the system may read. Strong sources are help center articles, product documentation, FAQs, pricing pages, and a verified knowledge base. Weak ones are unverified web content, conflicting or stale pages, and internal notes never meant for customers.
Implementation-wise, that means retrieval restricted to an approved corpus, a process for keeping that corpus current, and source links carried through to the final answer. The failure to plan for is staleness. If an old and a new version of the same policy both live in the index, the model will repeat whichever one retrieval ranks higher. Grounding doesn't clean up your documentation; it makes the state of your documentation visible.
Step 2: Constrain what the system can say
Define the allowed topics, the claims the system can make, the actions it can take, and the tone and format of responses. A baseline rule set might read: answer only from the knowledge base, never invent a policy, and when unsure, say so and escalate.
Treat that as a layered control rather than a single prompt. System prompts set the boundary in plain language, allowlists and denylists handle topics that are always in or always out, policy checks catch commitments the business can't back (refunds, delivery dates, legal statements), and output validation compares the final answer against the retrieved source before the customer sees it. Each layer fails sometimes. Stacking them is what makes the combination dependable.
Step 3: Show sources and signal uncertainty
Put the source in the answer. An answer such as "Based on our pricing page, the Pro plan costs $29 per month," with a link, lets a customer verify it and lets your team audit it. An answer with no source is itself a signal worth surfacing.
Be careful with confidence indicators. A model's self-reported confidence is a weak proxy for correctness. If you display uncertainty, derive it from measurable properties, such as how strongly retrieval matched the question, and keep a plain "I'm not sure" fallback available.
Step 4: Escalate on purpose
Decide in advance which cases never go to the AI alone: low-confidence answers, sensitive topics, legal or financial questions, high-risk customers, and unusual patterns. When a case escalates, transfer to a human or open a ticket, attach the conversation context and a summary, and set a clear response expectation.
The quality bar for the handoff is whether the customer has to repeat themselves. If they do, the escalation path is a regression in experience. If they don't, it reads as the system working as designed.
Step 5: Test with real questions
An AI feature isn't done until it handles real questions, and real questions are messier than ones engineers write. Build a test set from actual support history where possible. Include common questions, edge cases, ambiguous phrasing ("can I cancel?" means different things at different points in a subscription), and adversarial prompts that try to extract a promise the system shouldn't make.
Score both accuracy and groundedness, meaning whether the answer is actually supported by the retrieved source, not only whether it sounds right. Record failures, fix them, and rerun the suite whenever prompts, sources, or models change.
Step 6: Monitor and feed failures back
Production is where the test set gets better. Track hallucination rate, grounding accuracy, escalation rate, customer feedback, and recurring knowledge gaps. Review failed conversations, update the knowledge base, tighten prompts and guardrails, and add sources where customers keep asking about undocumented things. A rising escalation rate isn't automatically bad; it can mean the system is correctly admitting what it can't answer.
Why the build process matters as much as the model
Look closely at where hallucination problems originate and a pattern shows up: most are settled before a customer sends a single message. They're settled when someone chooses which sources the system can read, where the boundaries sit, what the handoff looks like, and how testing is wired in. When those decisions get improvised mid-implementation, they come out inconsistent, and inconsistency is where wrong answers get through.
That observation is part of why some teams are moving toward architecture-first build platforms. 8080.ai is one example. It coordinates specialized agents (Tech Lead, Frontend, Backend, DevOps, QA, and AI Engineer), and the Tech Lead agent designs the architecture and generates a System Requirements Document, database schemas, and API contracts before implementation agents begin. For a customer-facing AI feature, that ordering gives you a written place to record which sources the assistant can read, which topics need a human, and what the handoff contract looks like, before any of it is buried in code.
There's an honest limit here. A platform like 8080.ai can structure the build, but it can't supply the content or the policy. Your knowledge base, your accuracy bar, and your escalation thresholds still come from your team. What a plan-first approach changes is that those inputs have a defined place to live and can be reviewed like any other part of the design.
Common pitfalls
Trusting output without review is the most common one, and it's solved by testing before launch and after it. A weak or stale knowledge base produces generic or wrong answers, so assign an owner to it. Skipping guardrails lets the system say anything, so constrain it and validate outputs. Skipping monitoring means hallucinations go unnoticed for weeks, so instrument grounding, escalation, and feedback from the first day.
Whether these can be fully prevented is a fair question. They can't. Grounding, guardrails, citations, and escalation make them rare and visible, which is a more honest promise than "it won't happen," and the better your testing and monitoring, the more of that promise you can actually keep. Always escalate low-confidence, sensitive, or high-risk cases to a person, and treat a context-rich handoff as a feature of the product.
Takeaways
Ground the system in sources you trust. Constrain what it can say in more than one layer. Show where answers come from. Hand off what it shouldn't decide. Test against real questions. Monitor and iterate. And remember that your company will be held responsible for every answer the product gives, which is the strongest argument for making these design decisions deliberately and up front.
Comments
Join the discussionNo comments yet. Be the first to comment.



