<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://eln.excellgen.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MadeleineMassey</id>
	<title>ELN - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://eln.excellgen.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MadeleineMassey"/>
	<link rel="alternate" type="text/html" href="https://eln.excellgen.com/index.php?title=Special:Contributions/MadeleineMassey"/>
	<updated>2026-12-05T16:50:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://eln.excellgen.com/index.php?title=Semantic_Caching:_The_Promise_And_The_Pitfall_Of_One_Similarity_Threshold&amp;diff=63789</id>
		<title>Semantic Caching: The Promise And The Pitfall Of One Similarity Threshold</title>
		<link rel="alternate" type="text/html" href="https://eln.excellgen.com/index.php?title=Semantic_Caching:_The_Promise_And_The_Pitfall_Of_One_Similarity_Threshold&amp;diff=63789"/>
		<updated>2026-11-09T00:49:56Z</updated>

		<summary type="html">&lt;p&gt;MadeleineMassey: Created page with &amp;quot;&amp;lt;br&amp;gt;Semantic caching is a technique for reducing the cost and latency of serving large language model responses. Instead of asking the model to generate a fresh answer for every incoming query, a semantic cache stores the response to a previously answered question. When a new query arrives, the system compares its meaning to the stored queries, not by exact text match but by embedding similarity. An embedding model converts each query into a vector of numbers that captur...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;Semantic caching is a technique for reducing the cost and latency of serving large language model responses. Instead of asking the model to generate a fresh answer for every incoming query, a semantic cache stores the response to a previously answered question. When a new query arrives, the system compares its meaning to the stored queries, not by exact text match but by embedding similarity. An embedding model converts each query into a vector of numbers that captures its semantic content. The new query’s vector is compared to each stored vector using cosine similarity, which measures the angle between them. If the similarity is high enough, the cache returns the stored answer without calling the model again. The decision to reuse or regenerate is governed by a single similarity threshold, typically shipped as a default between 0.80 and 0.95.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The savings are attractive. A cache hit avoids a full model inference, which is both expensive in [https://realitysandwich.com/_search/?search=compute compute] and slow in wall-clock time. For high-traffic applications, even a modest hit rate can cut operational costs substantially and reduce perceived latency for users. The engineering appeal is obvious: a simple, fast vector lookup replaces a costly generation step. The problem is that the threshold itself is where the design gets fragile, because semantic similarity does not always align with answer equivalence.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Consider a customer support bot. A user asks, &amp;quot;How do I cancel my subscription?&amp;quot; The cache stores a response. Later, another user asks, &amp;quot;How do I pause my subscription?&amp;quot; These two queries are semantically close. They share vocabulary, structure, and intent. An embedding model will likely give them a high cosine similarity. But the correct answers are different: cancelling ends the service, while pausing suspends it temporarily. If the threshold is set too low, the cache returns the cancellation instructions for the pause question. This is a false cache hit: the stored answer is reused even though it is wrong for the new query. The cost and latency savings are real, but the quality suffers. The opposite error is also possible. A lightly reworded paraphrase, such as &amp;quot;I’d like to stop my subscription&amp;quot; versus &amp;quot;Please cancel my plan,&amp;quot; might score below the threshold, causing a miss and a wasted regeneration.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;A 2026 preprint by Guerin Green of [https://zenodo.org/records/23667256 Novel Cognition] examined this problem directly. The author built a labelled set of 243 English customer-support question pairs across eight domains. The set included 101 heavily reworded paraphrases, which should get the same answer, and 102 near-miss pairs, which differ by a word or by word order but need different answers. A further 40 lightly reworded paraphrases were reported separately. All pairs were scored by cosine similarity using the open embedding model Qwen3-Embedding-0.6B. The results were striking. The near-miss pairs scored higher, with a median of 0.801, than the genuine paraphrases, with a median of 0.691. The area under the ROC curve was 0.144, with a 95% bootstrap interval of 0.097 to 0.195, meaning the two distributions were inverted rather than merely overlapping. In other words, the embedding model was systematically more confident about wrong pairs than about right ones.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;At a threshold of 0.85, which is the default of one commercial service, the model matched none of the 101 paraphrases and 29 of the 102 near-misses, a 28.4% false hit rate. The cache would have returned wrong answers for those 29 queries while missing every genuinely rephrased question. False matches reached zero only above a threshold of 0.985, but at that level, 2 of the 40 near-verbatim repeats were still missed. The trade-off is brutal: to eliminate wrong answers, you must also reject most legitimate reuse.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The preprint also found that similarity correlated with word-set Jaccard overlap, with a Pearson r of 0.695, including within each label. That suggests the embedding model was leaning on surface lexical overlap rather than deeper meaning. Adding a query-instruction prefix halved false matches at 0.85, down to 12.7%, without changing the ordering of the pairs, but it did not solve the inversion.&amp;lt;br&amp;gt; &amp;lt;br&amp;gt;The author argues that a threshold is a property of one embedding model on one traffic distribution, not a transferable constant. What works for one domain, one model, and one set of question phrasings will fail elsewhere. The preprint describes a labelled near-miss protocol for setting the threshold on your own data. The pairs, the scores, and an analysis script that recomputes every statistic are released under CC BY 4.0, so practitioners can reproduce the findings and adapt the method.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The lesson for engineers is not to abandon semantic caching but to treat the threshold as a measured parameter, not a default. Other embedding models need their own measurement. A single number cannot capture the boundary between &amp;quot;same answer&amp;quot; and &amp;quot;different answer&amp;quot; because that boundary is linguistic, contextual, and domain-specific. The promise of cost and latency savings is real, but it is only safe when the threshold is tuned against a labelled set of near-miss pairs. Without that, semantic caching is a bet that similarity equals correctness, and the research shows that bet often loses.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>MadeleineMassey</name></author>
	</entry>
	<entry>
		<id>https://eln.excellgen.com/index.php?title=User:MadeleineMassey&amp;diff=63788</id>
		<title>User:MadeleineMassey</title>
		<link rel="alternate" type="text/html" href="https://eln.excellgen.com/index.php?title=User:MadeleineMassey&amp;diff=63788"/>
		<updated>2026-11-09T00:49:46Z</updated>

		<summary type="html">&lt;p&gt;MadeleineMassey: Created page with &amp;quot;The hidden cost of loose thresholds: how near-miss queries poison LLM caches, and strategies to filter them with embedding distance metrics.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Have a look at my blog post: [https://zenodo.org/records/23667256 Novel Cognition]&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The hidden cost of loose thresholds: how near-miss queries poison LLM caches, and strategies to filter them with embedding distance metrics.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Have a look at my blog post: [https://zenodo.org/records/23667256 Novel Cognition]&lt;/div&gt;</summary>
		<author><name>MadeleineMassey</name></author>
	</entry>
</feed>