How verification works

How verification works

This is the whole point of MaxModel, so here is the honest mechanism — no hand-waving.

The guarantee

Every claim in a verified answer is backed by a quote that appears character-for-character in a source you supplied. If a quote can’t be found in your sources, the claim is dropped.

The check is deterministic code. There is no second model “grading” the answer — that approach can hallucinate too. A string either is or is not a substring of your source.

The pipeline

A verified.create call runs three steps:

  1. EXTRACT — one model call (through the gateway) turns the question + your sources into candidate claims. Each claim comes with a quote the model says supports it, and the id of the source it came from. The quotes are not trusted yet.
  2. VERIFY — for each claim, code checks the quote against the named source’s text.
    • The source id must exist → otherwise unknown_source.
    • The quote must be found in that source’s text under the active mode → otherwise quote_not_found.
    • On success, the exact character range [start, end) in the original source is recorded.
  3. ASSEMBLE — grounded claims become the text (with inline [id] markers) and citations. Everything that failed verification goes into unsupported, and never appears in text.

Because step 2 is pure string matching, the same input always produces the same verification result — easy to test, impossible to fudge.

strict vs lenient

Both modes are deterministic. They differ only in how forgiving the match is:

ModeMatches when the quote equals the source span after…
strict (default)normalizing whitespace and case
lenientthe above, plus tolerating punctuation / diacritic differences

strict is the safe default. Use lenient when your sources and the model’s quoting differ only in punctuation (e.g. a dropped comma) and you’d rather keep the claim than drop it.

In both modes the returned range maps back to the original source text, so you can highlight the exact span even though matching was done on a normalized copy.

What this catches

  • Fabricated facts — a number or policy the model invented isn’t in your sources, so its quote won’t match → dropped into unsupported.
  • Misattribution — a real quote pinned to the wrong source id fails the source check.
  • Paraphrase-as-quote — if the model paraphrases instead of copying, the quote won’t be verbatim → dropped.

What it does not do

  • It does not fact-check your sources. If a source is wrong, a faithful quote of it is still “grounded.” MaxModel guarantees traceability to your sources, not ground truth.
  • It does not retrieve. You decide what goes into sources.
  • It is not a moderation or safety filter.

Honest degradation

MaxModel fails loud rather than returning ungrounded text as if it were verified:

  • No sources and allowUngrounded is false → 400 no_sources.
  • The model returns an unparseable structure even after a retry → 502 extraction_failed.
  • Set allowUngrounded: true to explicitly opt into a flagged plain answer (grounded: false) when grounding isn’t possible.