Domain-Specific Question Answering With Query-Ranked Context Reduction
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Large language models (LLMs) struggle to provide accurate responses to domain-specific questions due to limited training data and token limits in prompts, leading to inaccurate responses, especially when dealing with non-standard terminology or rapidly changing contexts.
Innovation Solution
Implement context reduction techniques to identify the most relevant sentences from a context document using reinforcement learning, reducing the context to fit within the LLM's token limit while maintaining accuracy, by ranking sentences based on similarity to the query and dynamically determining the number of sentences to preserve.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If the entire context document is provided to the language model, then the model has access to complete information for accurate domain-specific responses, but the prompt exceeds the LLM's token limit and execution costs increase
Solution Approach 1:
The patent extracts only the most relevant sentences from the context document based on similarity scoring against the query. A sentence embedding model compares each sentence in the context document with the query to identify and extract only those sentences that are most relevant to answering the specific question, thereby reducing token quantity while preserving response accuracy.
Solution Approach 2:
The context document is segmented into individual sentences, which are then independently evaluated for relevance to the query. This segmentation allows the system to selectively include only necessary portions of the context rather than processing the entire document, effectively managing token limits while maintaining information quality.
2Reliability
If more sentences are preserved from the context document, then response accuracy is maintained, but the prompt size increases and may exceed token limits
Solution Approach 1:
The patent dynamically adjusts the number of sentences to preserve based on query-specific relevance scoring. Instead of using a fixed threshold, the system calculates similarity scores between the query and each context sentence, then selects sentences based on these dynamic parameters, optimizing the balance between accuracy and prompt size for each specific query.
3Reliability
If domain-specific context is provided to improve accuracy on non-standard terminology, then the LLM can handle specialized queries, but the execution cost increases due to larger prompt size
Solution Approach 1:
The system extracts only the essential domain-specific sentences that contain non-standard terminology or specialized knowledge relevant to the query. By using similarity scoring, it identifies and extracts only those context sentences that contribute to domain-specific accuracy, eliminating redundant information and reducing execution costs.
Data Source
AI summary
Methods and systems for context reduction include identifying a context document relating to a query. A number of sentences of the context document to preserve is determined. The sentences of the context document are ranked according to respective similarities between the sentences and the query. A reduced context is generated that preserves the determined number of highest ranked sentences of the context document and eliminates other sentences from the context document. The query is executed with a language model, including the reduced context in a prompt, to generate a response.


