Exact string matching treats two strings as a match only when their text is identical. In an LLM system, it can serve two different jobs: finding a cached response for a repeated query and checking a specific value in an agent’s claim against grounding data. The match is predictable, but it is not, by itself, proof that an answer is correct. section 9.2.3 section 9.1.1
if "What are your store hours?" in local_dictionary_cache:
return local_dictionary_cache["What are your store hours?"]
A dictionary lookup illustrates the simplest cache: return a stored response when the incoming query exactly matches a stored key. section 9.2.3
This cache avoids another LLM call when a user or script repeats a query verbatim. It misses differently phrased questions with the same answer, such as “What time do you close?” and “When are you open?” Semantic caching is an alternative when that reuse matters. section 9.2.3
For hallucination checks, exact matching is one automated option for specific values alongside semantic similarity and rules for structured data such as prices and dates. Flag discrepancies or unsupported claims for review; nuanced adversarial cases may need domain experts rather than a string comparison alone. section 9.1.1
