Embedding-Based Query Rejection for Reliable Language Model Answers
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Language models often provide incorrect answers when queried for information outside their knowledge base corpus, leading to unacceptable error rates, especially in low fault tolerance systems like medicine and finance, due to outdated knowledge bases and shifting user interests.
Innovation Solution
Implement out-of-distribution query detection using an embedding model to generate query and document vectors, compare their similarity scores, and reject queries that fail to satisfy a threshold, ensuring accurate responses by applying the language model only to in-distribution queries.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If the language model is applied to answer all user queries, then the system responds to all queries, but the accuracy deteriorates when queries are out-of-distribution
Solution Approach 1:
The system performs preliminary query classification using an embedding model before applying the language model. Queries are pre-sorted into in-distribution and out-of-distribution categories based on similarity scores against the knowledge base corpus, allowing the language model to be applied only to relevant queries where it can provide accurate answers.
Solution Approach 2:
An embedding model serves as an intermediary component between the user query and the language model. This intermediary classifies queries by computing similarity scores and filtering out out-of-distribution queries before they reach the language model, thereby improving overall answer accuracy while maintaining response rate.
2Reliability
If the knowledge base corpus is continuously updated to maintain accuracy, then the information remains current, but the cost and time consumption increase
Solution Approach 1:
The system automatically detects out-of-distribution queries and uses these detections to identify gaps in the knowledge base corpus. This self-service mechanism allows the system to proactively update the corpus with new information from rejected queries, maintaining information currency without requiring manual intervention or continuous updates.
Solution Approach 2:
The system implements feedback by using the similarity scores and rejection decisions from out-of-distribution query detection to guide future knowledge base updates. Queries that are rejected due to low similarity scores provide feedback about missing information, enabling targeted updates to the corpus that reduce the frequency and cost of maintenance.
3Reliability
If out-of-distribution queries are rejected, then the answer accuracy improves, but the system becomes less adaptable to new topics
Solution Approach 1:
The system uses feedback from rejected out-of-distribution queries to identify and add new topics to the knowledge base corpus. By analyzing the patterns of rejected queries, the system can determine which topics are emerging and update the corpus accordingly, maintaining high answer accuracy while improving adaptability to new subjects.
Solution Approach 2:
The knowledge base corpus is made dynamic through continuous, targeted updates based on query analysis. Rather than a static corpus, the system actively adapts the corpus composition by adding new information from rejected queries, allowing the system to maintain accuracy while expanding its topic coverage over time.
Data Source
AI summary
A method includes receiving a query from a user device and applying an embedding model to the query to generate a query vector data structure. A vector comparator is applied to the query vector data structure and embedded document chunk vector data structures to output a score measuring a semantic similarity between the vector data structures. The embedded document chunk vector data structures are generated by the embedding model being applied to documents in a knowledge base corpus. Responsive to the score failing to satisfy a threshold value, the query is rejected as being an out-of-distribution query by transmitting an electronic reject message. Responsive to the score satisfying the threshold value and indicating that the query is an in-distribution query, the language model is applied to the query and to the knowledge base corpus to output an answer. The method also includes returning the answer to the user device.


