$ lexprog.com

// notes from an old coder -- php, databases, and the occasional rant

[October 19, 2026] AI

Cite Chunk IDs, Not Vibes

Ask for citations that map to retrieval chunk IDs. You can then verify the claim against the source instead of trusting fluent prose.

────────────────────────────────────────────────────────

Cite Chunk IDs, Not Vibes

Tip: Make the model point at retrieved spans

Ask for citations that map to retrieval chunk IDs. You can then verify the claim against the source instead of trusting fluent prose.

system = "Answer only from the chunks. Cite [chunk_id] after each claim."

Gotcha: Uncited answers hide retrieval misses

If the model cannot cite, it probably guessed. Fail closed and re-retrieve instead of shipping the guess.

if not re.search(r"\[\w+\]", answer):
    raise UncitedAnswer()

Source: https://docs.anthropic.com/en/docs/build-with-claude/rag

────────────────────────────────────────────────────────
<-- back to posts