Semantic Cache Query Matching With Per-Query Distance Thresholds

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Fuzzy matching in semantic caches for question answering systems using generative AI models leads to incorrect responses and cache misses due to the rigidity and arbitrariness of similarity threshold choices, which are not optimized for precision and recall.

Innovation Solution

Generate a distance-dependent F1-optimized similarity threshold based on semantically preserving synthetic variations of queries, using embeddings and training separate thresholds for each query in a semantic cache to improve accuracy.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If a fixed similarity threshold is used for fuzzy matching in semantic cache, then the system can operate with simple structure and fast processing, but it leads to incorrect responses and cache misses due to rigidity and arbitrariness of threshold choice

Engineering Contradiction:
Improveresponse timeVSAvoidaccuracy of cache matching
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent transforms the static, fixed similarity threshold into a dynamic, adaptive threshold that automatically adjusts based on the specific query and cache contents. The system computes an optimal threshold for each query using training data and performance metrics (precision, recall, F1 score), making the threshold flexible rather than rigid. This resolves the contradiction by maintaining fast processing (inheriting from simple structure) while improving accuracy through adaptive threshold selection.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The patent changes the parameter of the similarity threshold from a fixed constant to a variable that can take different values based on query characteristics and performance optimization. By computing customized thresholds for different queries based on training data analysis, the system optimizes the threshold parameter dynamically, thereby improving cache matching accuracy without sacrificing processing speed.

Inventive Principle:
Principle #35Parameter changes

2Productivity

If a lower similarity threshold is used to increase cache hit rate, then more queries can be served from cache, but it increases the risk of incorrect responses due to overly permissive matching

Engineering Contradiction:
Improvecache hit rateVSAvoidprecision of matching
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent optimizes the similarity threshold parameter based on performance metrics including precision and recall. By analyzing training data and computing the F1 score for different threshold values, the system selects thresholds that balance cache hit rate with matching precision. This prevents both overly strict thresholds (low hit rate) and overly permissive thresholds (high false positives), achieving an optimal balance point.

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The patent implements a feedback mechanism where the system evaluates cache matching performance using precision, recall, and F1 score metrics on training data. This feedback is used to iteratively optimize and select the best threshold value, ensuring that the threshold achieves the desired balance between cache hit rate and response accuracy. The feedback loop continuously refines the threshold based on actual performance.

Inventive Principle:
Principle #23Feedback

3Reliability

If a higher similarity threshold is used to ensure response accuracy, then fewer incorrect responses occur, but it increases cache misses and requires more API calls to LLM

Engineering Contradiction:
Improveprecision of cache matchingVSAvoidcache hit rate
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent dynamically adjusts the similarity threshold parameter to optimize the balance between precision and cache hit rate. Rather than using a uniformly high threshold that would cause excessive cache misses, the system computes customized thresholds for different queries based on training data analysis. This allows the system to maintain high precision where needed while being more permissive in cases where cache hits are more likely, thereby maximizing overall cache effectiveness.

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The patent applies different similarity threshold values to different queries based on their specific characteristics and the distribution of distances in the training data. Instead of using a single global threshold, the system tailors the threshold locally for each query context, optimizing the precision-hit rate tradeoff for each individual case. This local optimization approach maximizes overall system performance.

Inventive Principle:
Principle #3Local quality

4Reliability

If custom distance thresholds are computed for each query using training data and F1 optimization, then cache matching accuracy is improved, but the system complexity and computation time increase

Engineering Contradiction:
ImproveF1 score of cache matchingVSAvoidthreshold computation system
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent performs threshold optimization in advance during a training phase, where the system pre-computes optimal thresholds based on historical query data and performance metrics. This preliminary action creates a ready-to-use threshold configuration that can be applied during actual query processing without requiring complex real-time computations. The heavy computational work is done beforehand, simplifying the online system while maintaining high accuracy.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS12530293B2System and method for processing queries against semantic cache entries using unique distance-based thresholds
Publication Date: 2026.01.20 MICROSOFT TECHNOLOGY LICENSING LLC
  • US12530293B2 patent drawing
  • US12530293B2 patent drawing
  • US12530293B2 patent drawing

AI summary

A method, computer program product, and computing system for processing a dataset of query-answer pairs. Synthetic variations of queries are generated and each of the synthetic variations of queries are mapped to a corresponding answer from the dataset. An embedding dataset is generated by transforming the synthetic variations into synthetic query embeddings and the queries into query embeddings. A first set of embeddings is defined for storage in a semantic cache and a second set of embeddings are defined and are not stored in the semantic cache. A separate distance threshold is assigned to each embedding of the first set of embeddings and a pairwise distance between each query and the synthetic variations is determined. Distance thresholds for respective pairwise distances between a query and synthetic variations of the query are generated. Subsequent queries are processed using the semantic cache and the distance thresholds.