LLM Context Window Segmentation for Accurate Low-Cost Conversations
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The increasing size of the context window in conversational large language models (LLMs) leads to higher interaction costs and accuracy degradation due to the finite amount of information that can be sent back and forth, requiring effective management to optimize cost and accuracy.
Innovation Solution
Implementing a context window management system that utilizes static and dynamic contexts to manage the size of the context window, including splitting the context into sets of static, short-term, and long-term dynamic contexts, and using a context window manager to control the number of tokens within an acceptable limit.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If the context window size is increased to capture more conversation history, then the accuracy of the LLM responses is improved, but the interaction cost increases
Solution Approach 1:
The patent segments the context window into multiple fixed-size chunks, where each chunk captures a specific portion of the conversation history. This segmentation allows the system to manage context in discrete units, sending only relevant chunks to the LLM rather than the entire conversation history, thereby reducing interaction costs while maintaining accuracy for each segment.
Solution Approach 2:
The patent implements dynamic context window management by adjusting which context chunks are sent to the LLM based on the current conversation state. The system dynamically selects and combines relevant context chunks, optimizing the context window size for each interaction to balance accuracy and cost efficiency.
2Stability of the object's composition
If the context window size is increased to maintain conversation context, then the coherence of multi-turn conversations is improved, but the processing time increases
Solution Approach 1:
By dividing the conversation history into segmented context chunks, the system can process and send only the relevant segments to the LLM for each turn, rather than processing the entire conversation history. This reduces processing time while maintaining conversation coherence through selective context provision.
Solution Approach 2:
The patent performs preliminary organization of context into fixed-size chunks before the LLM interaction. This pre-processing step allows for faster retrieval and combination of relevant context during conversation, reducing the processing time required during actual LLM interactions while maintaining coherence.
3Measurement precision
If the context window size is increased to provide more background information, then the relevance of LLM responses is improved, but the complexity of context management increases
Solution Approach 1:
The patent simplifies context management complexity by organizing context into fixed-size segmented chunks with clear boundaries. This segmentation provides a structured framework that makes context management more systematic and less complex, while still providing sufficient background information for relevant responses.
Solution Approach 2:
The patent changes the parameter of context organization from a continuous, variable-size context window to discrete, fixed-size chunks. This parameter change simplifies the management complexity by providing regular, predictable units that are easier to track, store, and retrieve, while maintaining the ability to provide relevant background information.
Data Source
AI summary
Methods and systems for context window management of large language models are disclosed. An example method includes: receiving a message in a user language; preprocessing the message; setting a static context based on a topic of the message for a text sequence including the message, if the topic is new or different from a topic of a preceding message; attaching the static context to a context window; attaching a long term dynamic context to the context window based on the message and one or more previous messages in the text sequence; attaching a short term dynamic context to the context window based on the message; providing the context window to a language model server; receiving a database access command based on the context window from the language model server; providing the database access command to a database; and receiving a result response to the database access command from the database.


