Stack360 Logo
Stack360
Stack360 Icon
Stack360
Skip to main content
Stack360 Logo

AI

How to Stop an AI Chatbot From Making Things Up

By Tayyab Zia, Head Software Engineer · Reviewed by Azmat Rana

  • October 12, 2026
  • 4 min read
  • 6 sections

A chatbot makes things up when it answers from memory. The fix is to make it look the facts up first, then answer only from what it found. This is called retrieval-augmented generation, or RAG. We built Money Ball, an NFL stats chatbot, this way in three months.

  1. 01Why general models get facts wrong

    A large language model learns from text up to a cutoff date. It doesn’t know last week’s results, and it doesn’t store exact numbers reliably. Ask it for a player’s yards this season, and it may produce a figure that only sounds right.

    Sports stats are a hard case: specialized, precise and changing every week. A wrong number looks exactly like a right one.

  2. 02How Money Ball answers a question

    Money Ball lets fans and analysts ask about NFL players and teams in a chat. Before the model writes anything, the system queries a live sports database. The model then turns those results into an answer.

    So the numbers come from the database, not from the model’s memory. The model’s job is to understand the question and explain the result.

    When the stats don’t cover a question, Money Ball asks a follow-up, such as which season or which player, instead of guessing.

  3. 03What it runs on

    Money Ball uses an open-source language model. It doesn’t need the largest model available, because the facts come from the database. It runs as Docker microservices, so new stats are ingested and analyzed quickly. The backend uses Django and Node.js, with PostgreSQL and Redis. It is live at app.moneyball-ai.com.

  4. 04Rules that keep answers honest

    1. Retrieve first, every time. If the system skips the lookup, the model falls back on memory.

    2. Give the model only what it needs. A short, relevant set of results works better than a long dump of data.

    3. Decide what happens when the data doesn’t cover the question. A follow-up question or “I don’t have that” beats a confident guess.

    4. Keep the math out of the model. Totals and averages should come from the database query.

    5. Test with real questions, including awkward ones, and check every number against the source.

  5. 05How we tested it

    Before launch, we checked Money Ball three ways. We compared its answers with the stats database, and ran a fixed set of real and awkward questions. The client also tested it and reported anything that came back wrong.

  6. 06Where else this works

    The same pattern fits any AI feature built on a business’s own facts: product catalogs, policies, contracts or support history. The model handles the language, and your data supplies the facts.

    It doesn’t remove the need for checks. If the source data is wrong, the answer will be wrong too, so someone has to own the data.

Common questions

What is RAG? Retrieval-augmented generation. The system looks up facts in your own data and gives them to the model, which answers from them.

Does RAG stop every hallucination? No. Stanford researchers found that legal research tools built on retrieval still hallucinated between 17% and 33% of the time (Magesh et al., 2024 (opens in a new tab)). That is why the instructions and the testing matter as much as the retrieval.

How long does a chatbot like this take to build? Money Ball took three months.

Which model does it need? RAG works with most large language models, because the facts come from your data. Money Ball uses an open-source model.

Ready to build the next success story?

Partner with a studio that ships production systems — and stays accountable after launch.