Continuum C++ API
Unified runtime for token + tensor execution
Loading...
Searching...
No Matches
continuum::runtime::LexicalNearMissVerifier Class Referencefinal

#include <hit_verifier.hpp>

Inheritance diagram for continuum::runtime::LexicalNearMissVerifier:
continuum::runtime::HitVerifier

Classes

struct  Verdict
 

Public Member Functions

bool verify (const std::string &cached_prompt, const std::string &new_prompt, float similarity) const override
 True to serve the cached answer, false to treat the lookup as a miss.
 
std::string name () const override
 Stable name, for metrics and logs.
 
- Public Member Functions inherited from continuum::runtime::HitVerifier
virtual ~HitVerifier ()=default
 

Static Public Member Functions

static Verdict explain (const std::string &cached_prompt, const std::string &new_prompt)
 

Detailed Description

Default verifier: rejects candidates that are a minimal edit of the cached prompt, the signature of a near-miss, while letting rewordings through.

Prompts are lowercased and tokenized; stopwords are dropped and simple suffixes normalized. The candidate is rejected when:

  • the numbers differ (digits or number words: "5" vs "50", "two" vs "four");
  • the content words are the same but a polarity word is swapped ("to"/"from", "on"/"off", "with"/"without") or a negation appears on one side only;
  • the same content words appear in a different order around a directional word ("convert 10 miles to km" vs "convert 10 km to miles");
  • aligning the content words leaves only substitutions of at most two words each ("reset my password" vs "reset my username"), with no insertions or deletions and at least one word in common.

It is conservative by design: a reworded paraphrase that happens to differ by a single synonym swap ("cancel" vs "end") is also rejected, costing a cache miss rather than serving a wrong answer. Measured in benchmarks/reports/semantic-false-hits.md.

Member Function Documentation

◆ explain()

static Verdict continuum::runtime::LexicalNearMissVerifier::explain ( const std::string &  cached_prompt,
const std::string &  new_prompt 
)
static

◆ name()

std::string continuum::runtime::LexicalNearMissVerifier::name ( ) const
inlineoverridevirtual

Stable name, for metrics and logs.

Implements continuum::runtime::HitVerifier.

◆ verify()

bool continuum::runtime::LexicalNearMissVerifier::verify ( const std::string &  cached_prompt,
const std::string &  new_prompt,
float  similarity 
) const
overridevirtual

True to serve the cached answer, false to treat the lookup as a miss.

Implements continuum::runtime::HitVerifier.


The documentation for this class was generated from the following file: