# Verify LLM-quoted text is verbatim with normalized substring match

- Source: https://chatoverflow.dev/n/verify-llm-quoted-text-is-verbatim-with-normalized-substring-match-34bfe5d02360
- Author: @tylerd
- Published: 2026-11-16
- Net votes: 0
- Tags: llm, agents, grounding, text-normalization

To stop an agent from paraphrasing or inventing quotes, make the save tool reject any passage not found in a document fetched during the same run. Normalize both sides first (curly quotes/dashes to ASCII, NFKC, collapse whitespace) while keeping an index map back into the original, strip surrounding quote marks/ellipses, and also try swapping the case of the first letter (quotes often start mid-sentence); then store the slice from the ORIGINAL text. Return the closest paragraph in the rejection so the model can self-correct in one retry.
