Blog
AITechnology

AI inventing answers for customers? 7 ways to cut hallucination

Click Star TeamNovember 04, 202610 min read
AI inventing answers for customers? 7 ways to cut hallucination
SUMMARY

Anthropic's documentation lists 7 techniques to reduce hallucination and says none removes errors entirely. The article covers all 7, with a 2-call code sample, a test question set and when a human must review.

An online shop lets a chatbot answer customers about returns. The policy says 30 days, but the bot says 60 because that number sounds plausible. This is an illustrative example, not a real measurement.

This article draws on documents from Anthropic, OpenAI and Google plus a paper on arXiv, checked on November 4, 2026. The technical core is Anthropic's "Reduce hallucinations" page.

The short answer: that page lists exactly 7 techniques and says they reduce errors but do not remove them. The article covers all 7, with a 2-call code sample, a way to measure errors and a rule for when a human must review.

Key points

  • Hallucination is when a model writes something factually wrong or inconsistent with the context it was given, in fluent text.
  • Anthropic's page lists 7 techniques: 3 basic and 4 advanced. It states they do not remove hallucination entirely and gives no figure for how much they reduce it.
  • In Click Star's view, easiest for a customer chatbot: tell the model to use only the documents provided and give it a fixed "I don't know" sentence, which also signals a hand-over to staff.
  • OpenAI writes that answering with an existing support article can be safer than new model-written text, and that a human should review outputs where possible.
  • The Claude Sonnet 5.5 migration guide says temperature, top_p and top_k return a 400 error, so "lower the temperature" is unavailable there.
  • Click Star's 5-step framework (not from an outside source) combines the techniques; an answer that fails a check goes to a person.

Table of the 7 hallucination-reduction techniques in Anthropic's documentation: 3 basic and 4 advanced, with what each does and whether it is basic or advanced

What AI hallucination is, and why chatbots still make things up

Hallucination is an answer that is factually wrong or inconsistent with the documents provided, yet sounds convincing. Anthropic's "Reduce hallucinations" page (no date shown, read November 4, 2026) says this happens even with models like Claude.

The arXiv paper "Why Language Models Hallucinate" (submitted September 4, 2025) argues that models guess when unsure, like students facing a hard exam question, because training and scoring reward guessing. That is the authors' argument; Click Star read only the abstract.

Separate a model that invents from documents that are wrong or incomplete. OpenAI writes that wrong context leaves the model unable to answer correctly, and too much irrelevant context drowns real information and causes hallucination ("Optimizing LLM Accuracy", no date shown, read November 4, 2026).

7 techniques to reduce hallucination, per Anthropic's documentation

Anthropic's page splits them into 3 basic strategies and 4 advanced techniques. Here are all 7, with the source's conditions and Click Star's view for customer chatbots.

1. Allow the model to say "I don't know". Anthropic advises giving the model explicit permission to admit uncertainty, and says this can sharply reduce false information.

2. Quote word for word before answering. For long documents (the page gives a threshold of over 20,000 tokens, the units a model counts text in), have the model copy the relevant sentences verbatim first, then work only from them.

3. Verify with citations. Have the model cite a quote for each claim, or, after writing, find a supporting quote for each claim and drop any it cannot support. Anthropic also offers a Citations feature; its page (no date shown, read November 4, 2026) says it guarantees citation pointers valid for the documents provided.

A valid pointer does not prove the claim correct (Click Star's view). The page also says Citations cannot be combined with structured outputs (output forced into a fixed schema) on user-provided documents; the API returns a 400 error.

4. Check the chain of reasoning. Use thinking (the model reasoning before it answers) with display: "summarized" and read the summarized reasoning when an answer looks wrong. On Sonnet 5.5 thinking text is omitted by default, so set display.

5. Run several times and compare. Run the same prompt several times; differing results may signal hallucination. Each run is a billed call, so Click Star prefers it for sampling, not every message.

6. Iterative refinement. Feed an output into a follow-up prompt that asks the model to verify earlier statements and catch inconsistencies.

7. Restrict outside knowledge. State that only the provided documents may be used, not general knowledge. For a bot answering a shop's own policies, Click Star treats this as the first to switch on.

What OpenAI and Google add

OpenAI's Safety Best Practices page (no date shown, read November 4, 2026) describes a pattern that can be safer where possible: return content from a validated set of materials on the backend, for example routing a customer question to the closest support article instead of answering from scratch.

Google's "Grounding with Google Search" page (no date shown, read November 4, 2026) says connecting Gemini to web content reduces hallucination and gives citations. That is the public web, not a shop's private documents (Click Star's view).

Example prompt and 2-call code

Click Star's 5-step framework, not from an outside source: provide documents, quote verbatim, answer from the quotes, check with code and a second call, then send or hand over.

The code uses Anthropic's Python SDK and the model name claude-sonnet-5-5 from the migration guide. That guide says Sonnet 5.5 thinks by default and max_tokens covers thinking, so the code sets 8000 and drops truncated replies. The prompts are in Vietnamese; translate them for your customers.

import re
import anthropic
client = anthropic.Anthropic()
MODEL = "claude-sonnet-5-5"
P1 = """Chỉ dùng tài liệu trong thẻ <tai_lieu>, không dùng kiến thức khác.
<tai_lieu>
{tai_lieu}
</tai_lieu>
Câu hỏi của khách: {cau_hoi}
1. Chép nguyên văn các câu liên quan vào thẻ <trich_dan>, mỗi câu một dòng.
2. Chỉ dựa vào các câu đó, viết câu trả lời ngắn vào thẻ <tra_loi>.
3. Nếu tài liệu không đủ, ghi đúng chữ KHONG_CO trong thẻ <tra_loi>."""
P2 = """<tai_lieu>
{tai_lieu}
</tai_lieu>
<ban_nhap>
{ban_nhap}
</ban_nhap>
Tách bản nháp thành từng ý, mỗi ý một dòng: "CO | ý | câu chứng minh trong tài liệu" hoặc "THIEU | ý". Đặt kết quả trong thẻ <kiem_tra>."""
def hoi(prompt):
    r = client.messages.create(model=MODEL, max_tokens=8000,
                               messages=[{"role": "user", "content": prompt}])
    if r.stop_reason != "end_turn":
        return ""
    return "".join(b.text for b in r.content if b.type == "text")
def the(text, ten):
    m = re.search(rf"<{ten}>(.*?)</{ten}>", text, re.S)
    return m.group(1).strip() if m else ""
def gon(s):
    return " ".join(s.split())
def tra_loi_khach(tai_lieu, cau_hoi):
    nhap = hoi(P1.format(tai_lieu=tai_lieu, cau_hoi=cau_hoi))
    cau = the(nhap, "tra_loi")
    trich = [d for d in the(nhap, "trich_dan").splitlines() if d.strip()]
    if not cau or "KHONG_CO" in cau.upper() or not trich:
        return None
    if any(gon(d) not in gon(tai_lieu) for d in trich):
        return None
    kiem = hoi(P2.format(tai_lieu=tai_lieu, ban_nhap=cau))
    dong = [d.replace("*", "").lstrip("-• ").strip()
            for d in the(kiem, "kiem_tra").splitlines() if d.strip()]
    if not dong or not all(re.match(r"CO\s*\|.+\|\s*\S", d) for d in dong):
        return None
    return cau

The function returns None when the answer is empty, says KHONG_CO, quotes text absent from the documents or the second call returns a line that is not CO. Hand those to staff. Limit: the quote check only blocks invented quotes; it misses a very short quote or a free-worded refusal.

It ran against a mock for these cases: pass, no information, fabricated quote, unsupported claim, missing check tag, bulleted or bold lines, KHONG_CO with a period, truncated reply. Unfamiliar formats are blocked, so the function may hand over a correct answer.

The function does not classify consequences. Questions on price, refunds or return deadlines, like the opening example, still go to a reviewer per the table below; the function only filters unsupported drafts.

Flow of 5 steps from documents to answer: provide documents, quote verbatim, answer from quotes, check with code and a second call, send to the customer or hand over to a person

Measuring errors with a test question set

Anthropic's "Define success criteria and build evaluations" page (no date shown, read November 4, 2026) advises a test set that mirrors real questions, with edge cases such as irrelevant or nonexistent input data.

The page also says to automate grading where possible: code is fastest and most reliable, humans are slow and costly, and model grading needs a reliability test first.

For hallucination, the key group is questions whose answer is absent from the documents, since the correct answer is "hand over to staff" (Click Star's view). The pass threshold is yours to set; OpenAI advises estimating the cost of each kind of success and failure up front.

Checklist of the test question set in 4 groups: in the documents, not in the documents, easily confused and tempting the bot to invent

Which answers AI may send alone, which need a reviewer

OpenAI advises a human review of outputs before use, especially in high-stakes areas, and the reviewer needs the source information (Safety Best Practices, read November 4, 2026). In the "Optimizing LLM Accuracy" example, when failure is very costly the human decides and the AI only assists.

The table below is Click Star's reference framework, not from an outside source, for splitting answers by consequence. Questions on price, refunds or return deadlines always go to a reviewer, even after passing checks.

Comparison of 2 groups of answers: those AI may send after passing checks and those that require a human reviewer

What this means for Vietnamese businesses

The sources read hold no public measurement of hallucination rates for Vietnamese-language chatbots or Vietnamese businesses. The only way to know is to measure on your own documents and questions.

Click Star's view. In systems that answer from documents, the error can start in the documents: policies exist in several versions and an old price list lingers somewhere. Clean the documents first, then tell the model to use only those.

Click Star offers AI integration and AI automation services, so it has a related interest.

What to do: a 7-day plan

Click Star's reference plan, not an industry standard.

Days 1 to 2: clean the inputs

  • Gather the official documents (policies, prices, warranty) and drop old versions.
  • Write the fixed "I don't know" sentence and choose who takes over the conversation.
  • List consequential question types (price, refunds, returns, commitments) that a person always reviews.

Days 3 to 5: write and test

  • Write the prompt around 3 points: use only the documents, quote verbatim, give a fixed sentence when information is missing.
  • Build a 4-group test set with a reference answer for each question.
  • Run it and record every invented answer or needless refusal, then fix the documents or prompt.

Days 6 to 7: add checks and fix the process

  • Add the code-based quote check and the second call, then rerun the test set.
  • Send every answer that fails a check to a person.
  • Rerun the set whenever documents or the model change.

Common mistakes

  1. Telling the model "don't make things up" with no escape sentence and no measurement.
  2. Mixing old and new documents in a single store, then blaming the model.
  3. Relying on temperature, which returns a 400 error on Claude Sonnet 5.5.
  4. Treating a citation as proof of correctness, when a valid pointer does not show the claim is right.
  5. Testing only questions answered in the documents.
  6. Running several times on every message without counting calls and cost.
  7. Dropping the human reviewer on consequential answers because all 7 techniques are applied.

What is not known

Anthropic's page gives no figure for how much the techniques reduce errors, so it is unknown which is strongest. Click Star also has no measurements for Vietnamese.

The code ran only against a mock, not the real API, so it is unknown where real output deviates in format; deviations are blocked and handed over. OpenAI's explainer of the same title was blocked to Click Star's tools, so the arXiv paper was read via its abstract only.

Share this articleLinkedInFacebook

Need tailored advice for your business?

Click Star helps you build a solution that fits your industry and scale. We answer every question during business hours.

Chat on ZaloMessage us for adviceCall hotline0383 406 735