Back to Home

Triage-and-Voice: fix for LLM hallucinations

Triage-and-Voice pattern solves the hallucination problem in LLM by separating analysis and response generation. First pass extracts structured data, backend substitutes verified facts, second forms voice. Acceleration by 2–3 times, security through code.

Split LLM: Triage-and-Voice against hallucinations
Advertisement 728x90

The Triage-and-Voice Architectural Pattern for Eliminating LLM Hallucinations

An LLM in a chatbot analyzes a conversation and, instead of providing the actual hotline number, invents a children's helpline. The instruction "do not invent contacts" is ignored. The reason is a conflict of tasks in a single pass: precise analysis and empathetic response compete for tokens, leading to hallucinations in critical data.

The Problem with Single-Pass Architecture

In the standard LLM product scheme, user input goes directly to the model, which produces the final answer. Analysis requires structured JSON output with precise facts: participants, risks, goals. Formulating the response is a creative task involving voice and tone.

Combining these into a single prompt leads to compromises:

Google AdInline article slot
  • The model sacrifices accuracy for style.
  • Hallucinations are masked as convincing text.
  • It's impossible to programmatically distinguish fact from fiction.

Increasing model power (reasoning models, more tokens) reduces error frequency but does not eliminate the problem. In complex cases with subtext, even top models confuse motives and fabricate details. The risk concerns trusted data: prices, addresses, dosages, service contacts.

The Triage-and-Voice Pattern

Split processing into two LLM passes with a backend gatekeeper between them.

Pass 1: Triage. Structural analysis without style. The model extracts the signal into JSON:

Google AdInline article slot
{
  "mood": "anxiety",
  "is_crisis": false,
  "crisis_type": null,
  "participants": [...],
  "motives": [...]
}

Crisis example:

{
  "mood": "red_flag",
  "is_crisis": true,
  "crisis_type": "violence"
}

Backend gate. Deterministic code checks flags:

if (triage.IsCrisis) {
    var contacts = await db.GetVerifiedCrisisContacts(triage.CrisisType);
    prompt = crisisPromptTemplate.WithContacts(contacts);
}

Verified data from the database is inserted. Routing by rules: crisis → special prompt.

Google AdInline article slot

Pass 2: Voice. The model receives enriched input and generates a response in the desired tone. It does not analyze or invent facts.

Testing on DeepSeek V3.2 (dozens of crisis cases): zero contact hallucinations.

Advantages of Separation

  • Separation of responsibility. Triage focuses on structure (tokens for facts). Voice focuses on style (tokens for empathy). Quality in both dimensions improves (verified on 40 eval cases).
  • Caching. Analysis is done once. When changing voice (perspectives in a Telegram bot), only Voice is rerun. Metrics: first response 30–45 s (vs 50–90 s), subsequent responses 15–20 s.
  • Safety. Control is in code, not in the prompt. The model sets a flag ("when"), the backend decides ("what"). Testable, predictable.

Application Scenarios

The pattern is relevant for LLM products with:

  • Input analysis + output generation.
  • Trusted data (finance, legal references, medicine).
  • Edge cases (crises, exceptions).
  • Multiple perspectives without reanalysis.
  • A needed checkpoint between analysis and output.

Principle: model analyzes → code decides → model formulates.

Refactoring signal: the prompt contains "DO NOT invent [data]".

Key Points

  • Architectural shift: from one call to two with a gate, eliminating task conflict.
  • Performance metrics: analysis is cached, Voice speeds up 2–3 times.
  • Safety: deterministic backend inserts facts, model does not touch the database.
  • Scalability: applicable to chatbots, analytics, products with edge cases.
  • Verified: 40 eval + dozens of crisis runs without hallucinations.

Risks of Naive Architecture

One call = atomic operation without validation. Lacks:

  • Model decision validation before reaching the user.
  • Analysis cache.
  • Edge case routing.
  • Insertion of verified data.

Trusting probabilistic generation in critical places is a vulnerability. Triage-and-Voice adds control: +1 call, +1 gate = verifiable pipeline.

— Editorial Team

Advertisement 728x90

Read Next