Мазмұнға өту
Мақала Kazakh тілінде әлі жарияланбаған. English нұсқасы көрсетілуде.

Citations, Abstention Policies, and Hallucination Guardrails in Customer-Facing RAG

2 мин оқу

In customer-facing AI, a wrong confident answer is far more damaging than an honest handoff. Telling a buyer the wrong return window, shipping fee, or compliance guarantee destroys trust and can create legal liability. Production RAG requires explicit abstention policies and verifiable citations.

Designing a Three-State Answer Policy

Instead of forcing the model to answer every query, define three explicit outcomes:

OutcomeTrigger ConditionUser Experience
Grounded AnswerRetrieved evidence directly answers the questionConcise reply with verifiable source link or reference
Clarifying QuestionQuery is ambiguous across multiple retrieved policiesShort question narrowing scope (for example region or plan tier)
Abstain + EscalateNo supporting evidence above calibrated confidence floorHonest "I don't have confirmed details on that" + route to human

Verifiable Citation Contracts

Never let the LLM invent raw URLs from memory. Assign short opaque IDs ([S1], [S2], [S3]) to retrieved chunks in the prompt, ask the model to cite those IDs in structured output, and map verified IDs back to canonical links in application code.

ts
export interface GroundedAnswer {
  decision: "answer" | "clarify" | "abstain";
  replyText: string;
  citedSourceIds: string[];
}

export function validateCitations(
  output: GroundedAnswer,
  allowedIds: Set<string>
): GroundedAnswer {
  const validIds = output.citedSourceIds.filter(id => allowedIds.has(id));
  if (output.decision === "answer" && validIds.length === 0) {
    return {
      decision: "abstain",
      replyText: "I could not verify that detail in our documentation. Let me connect you with a specialist.",
      citedSourceIds: [],
    };
  }
  return { ...output, citedSourceIds: validIds };
}

High-Risk Domains Need Deterministic Checks

For numbers that carry financial or legal weight (live inventory, exact order status, account-specific pricing), do not rely on prose snippets alone. Pair RAG with typed tool calls that fetch authoritative state from your transactional source of truth.

Continue to the next pillar: LLMOps, Evaluation, and Prompt Engineering: Production Playbook.

Бұл пайдалы болды ма?