Method and system for enhancing large language model reliability

The hierarchical language model system addresses LLM hallucinations by using a Higher-Level Language Model and Lower-Level Language Models in parallel to select and refine responses, improving reliability and accuracy in natural language processing applications.

GB2637684APending Publication Date: 2025-08-06IP MIND LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
GB2023018920
Authority / Receiving Office
GB · GB
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-12-12
Publication Date
2025-08-06

AI Technical Summary

Technical Problem

Existing Large Language Models (LLMs) suffer from hallucinations, generating factually incorrect or contextually inconsistent responses, which undermines their reliability in critical applications like medical diagnoses and legal consultations.

Method used

A hierarchical language model system comprising a Higher-Level Language Model (HLLM) and multiple Lower-Level Language Models (LLLMs) processes prompts in parallel, leveraging consensus-building and paraphrasing algorithms to select contextually consistent responses, reducing hallucinations through inter-model dialogue and feedback loops.

Benefits of technology

The system significantly reduces hallucinations, enhancing response reliability and accuracy by integrating diverse domain-specific expertise, ensuring contextually appropriate and coherent outputs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

A computer-implemented method for improving the reliability of language models in natural language processing employs a hierarchical structure comprising a Higher-Level Language Model (HLLM) and multiple Lower-Level Language Models (LLLMs). The HLLM, functioning in a supervisory role, initiates and coordinates the LLLMs, which may be specialized in distinct domains or could be different instances of the HLLM itself. The system enhances response accuracy and diversity by utilizing paraphrasing algorithms to create varied prompts, subsequently processed by the LLLMs in parallel. The HLLM compares the LLLMs' responses, determining a consensus response group based on content consistency and contextual relevance. Post-processing may occur by the HLLM further enhancing the output's coherence and readability. Implemented on distributed computing systems, this method significantly reduces hallucinations in responses, ensuring contextually appropriate and reliable output.
Need to check novelty before this filing date? Find Prior Art

Description

Field of the Invention: The present invention relates to the field of natural language processing (NLP) and, more specifically, to methods and systems for improving the reliability of Large Language Models (LLMs) used in NLP applications. Background of the Invention: Natural Language Processing (NLP) has witnessed remarkable advancements with the advent of sophisticated Large Language Models (LLMs), exemplified by models such as GPT (Generative Pretrained Transformer). LLMs are computer-based models capable of generating human-like text based on input prompts and have gained significant attention for their applications in machine translation, chatbots, content generation, and various other areas of human-computer interaction. These models have demonstrated impressive capabilities in generating coherent and contextually relevant text. However, the utilization of LLMs in practical applications has revealed a critical challenge-hallucinations. Hallucinations in the context of LLMs refer to the propensity of these models to generate responses that are factually incorrect or contextually inconsistent, often leading to unreliable and misleading outputs. The generation of hallucinations by LLMs has raised concerns regarding their applicability in domains where accuracy and trustworthiness are paramount, including but not limited to medical diagnoses, legal consultations, and educational content generation. In the prior art, various techniques have been proposed to mitigate the issue of hallucinations in LLMs. These techniques encompass post-processing methods, fine-tuning, and the integration of rule-based systems. While some success has been achieved in reducing hallucination occurrences, these approaches have limitations such as increased computational complexity, reduced generative capacity, or insufficient adaptability to diverse contexts. Furthermore, the existing solutions primarily focus on enhancing the reliability of individual LLMs, without leveraging the potential benefits of parallel processing and consensus-building among multiple LLMs to address the challenge of hallucination effectively. The technical problem that the present invention seeks to address is the reliable generation of natural language text by LLMs while significantly reducing the occurrence of hallucinations. Specifically, the invention aims to provide a method and system that can improve the reliability of LLM-generated responses by harnessing the power of multiple LLMs processing the same prompt in parallel. The solution aims to identify and select responses that exhibit content and contextual consistency, thus offering a more trustworthy and accurate outcome in a wide range of NLP applications. Summary of the Invention: In light of the challenges posed by hallucinations in LLMs, the present invention proposes a novel method and system for enhancing the reliability of language model outputs by parallel processing. By leveraging the collective intelligence of multiple LLMs and selecting responses based on consensus, the invention, as set out in the appended claims, offers a solution to the technical problem, enabling the generation of more reliable and contextually consistent natural language text. Detailed Description Certain preferred embodiments of the invention will now be described, by way of example only, with reference to the accompanying drawings, in which: Fig. 1 is a high-level diagram showing the components of the hierarchical language model system, including user interface, LLLMs, HLLM, and data flows. Fig. 2 illustrates the different domain specialists as LLLMs with examples such as Medicine, Finance, Engineering and Legal. Fig. 3 illustrates the structure of the neural network architecture and algorithms used within the higher-level generalist HLLM model. Fig. 4 illustrates a possible flow from receiving user query to generating the final response. Fig. 5 illustrates a synthesis step showing how segments from different LLLM responses can be combined. Fig. 6 depicts how user ratings of responses are fed back to improve the HLLM over time. Fig. 7 illustrates how inter-model dialogues can be used to obtain response improvement. Fig. 8 demonstrates the diversity-based response improvement workflow. Fig. 1 shows a high-level diagram of the overall architecture and components of the hierarchical language model system for generating optimal responses to user queries. With reference to fig. 1, a user interface (100) comprises the communication channel through which a user query (101) is received as input text, images, video and / or audio. This interface (100) could include components such as microphones, touchscreens, cameras, keyboards, speakers etc. It also conveys the final response (108) back to the user. Alternatively, the user interface could be implemented as an Application Programming Interface (API) such that it is possible for software applications to enter queries into the system and receive responses. In Fig. 1, the user query (104) is sent to the higher-level language model (HLLM) module (103), which analyses it and transmits it, or instructions derived from it, to the lower-level language models (LLLMs). Multiple LLLM modules (102) act as domain specialists, each trained on data from a specific field and / or having specific attributes which make it more efficient for particular tasks. Example fields include medicine, engineering, finance, etc. Examples of specific attributes include the ability to process video or audio data, the ability to handle complex mathematical formulae etc. Four example LLLM modules are shown (102A, 102B, 102C and 102D), however any number of LLLM modules could exist in the system. In context of the invention, the distinction between the Higher-Level Language Model (HLLM) and the Lower-Level Language Models (LLLMs) primarily revolves around their functional roles rather than their inherent complexity or specialization. While the LLLMs are typically specialized models, each adept in a specific domain or knowledge area, the HLLM operates in a supervisory capacity. It coordinates and integrates the outputs of the LLLMs, ensuring optimal response generation and system performance. Importantly, the HLLM is not necessarily more or less complex or sophisticated than the LLLMs. In some scenarios, the LLLMs might actually be different instances of the same model as the HLLM, with the key difference being their designated roles within the system. The HLLM's primary function is to orchestrate the overall process, manage the interaction among the LLLMs, and refine the final output, leveraging the specialized capabilities of each LLLM irrespective of their individual complexities or similarities to the HLLM. Alternatively, the query be simultaneously propagated to all relevant LLLM modules (102) at the same time it is sent to the HLLM. This alternative is shown by the dashed lines in Figure 1. In some examples of the invention, the user query may be provided to all of the LLLMs, without considering which LLLM modules are relevant to subject-matter / domain of the user query. The HLLM module (103) operates at an overall system level to analyse, select and synthesize the most appropriate response from the proposed responses generated by the LLLMs (102). The HLLM (103) implements algorithms detailed in this disclosure for identifying optimal responses based on relevance, accuracy, redundancy and / or other criteria. A central controller / processor (not shown) handles coordination of the modules (102,103) and data flows. It transmits the user query (101) to the HLLM (103) and the LLLMs (102), collects their responses (105), feeds them to the HLLM (103), obtains the final response (106), and propagates it back (108) through the user interface (100). Database (107) may optionally act as a systems memory component, storing corpora and datasets for training the LLLMs (102), queries (101), the associated proposed responses (105A-105D), the associated optimal responses (106), interaction history for feedback learning by the HLLM (103), and other system data. Optimal responses may be sent directly from the HLLM (103) to the user interface (100) e.g. for interactive user access, such as in a chat or API access; or may be stored in the database (107). In the latter case, the user may interrogate the database (107) by means of the user interface (100). In both cases, the user interface (100) communicates the optimal responses to the user (108). Finally, feedback such as the assessments of the quality or relevance of the optimum responses obtained from the user or other quality assessment systems could be transmitted to the HLLM (103) in order to improve the quality of future responses. This is depicted in Fig. 1 as an optional feedback path (109). In a specific example of the invention, the feedback may be obtained from external software applications by means of an API in the user interface. In summary, Fig. 1 provides a broad overview of the key hardware and software modules, and the high-level workflow in the hierarchical language model system. The interfaces between components are intended to be adaptable to different implementations as per system requirements. With reference to Fig. 1, a typical operational flow would be as follows: 1. upon receiving a user query through an interface, the system transmits the query to the HLLM; 2. the HLLM transmits the query or instructions derived from the query to one or more of the most relevant LLLMs; a. LLLMs may be determined as relevant based on conditions such as whether the domain or dataset associated with the LLLM corresponds to the domain or subjectmatter of the query; 3. In an alternative example of the invention, the query may be transmitted directly from the User Interface 100 to one or more of the LLLMs as well as the HLLM. 4. Each relevant LLLM generates a proposed response based on its training and expertise. The proposed responses may then be compiled into a set of alternative answers. 5. The HLLM receives the proposed responses directly from the LLLM(s). Alternatively, the proposed responses may be stored in the memory (107) and the HLLM may retrieve the proposed response(s) from there. The analysis of the response(s) carried out by the HLLM is a multi-step one: 1. Relevance Check: The HLLM evaluates each answer for its relevance to the original query, potentially assigning a score based on how well each answer addresses the user's query. 2. Redundancy Removal: To ensure diverse perspectives, the HLLM identifies and removes or de-prioritizes redundant or highly similar answers. 3. Answer Synthesis: Based on the analysed responses, the HLLM may choose to either select the best response outright, synthesize a new answer by integrating elements from multiple LLLM-generated answers (i.e. from one or more proposed responses); or create a further query for one or more of the LLLMs. 4. Optimization: Before finalizing the answer, the HLLM may perform additional refinements, ensuring the response is coherent, grammatically correct, and styled appropriately for the intended audience or application. Finally, the selected or synthesized answer is either transmitted back to the user through the User Interface 100 or stored in the Database 107. During relevance analysis, the HLLM may employ attention mechanisms to compare question and answer embeddings, assigning relevance scores using cosine similarity. Answers with low relevance scores are filtered out. For redundancy removal, fuzzy string matching could be used to identify semantic overlaps between answers. A threshold could determine when overlap is too high. Clustering algorithms such as k-means could also group semantically similar answers / proposed responses. When synthesizing optimal responses, the HLLM may use a Sequence-to-Sequence model with pointer networks to fluidly combine important segments from different answers / proposed responses. The pointers would allow copying pieces of text directly from the inputs. A beam search method could be used to generate multiple candidate combinations. The candidates then being ranked using a scaled dot-product attention mechanism that learns optimal ways to fuse answers. The highest scoring combination could then be selected as the synthesized response. During optimization, the HLLM or a separate language model fine-tuned on the target domain may be used to paraphrase, correct grammar, and improve the overall coherence of the final response. Synthesis and optimization greatly improve relevance over merely selecting between proposed responses. The overall pipeline reduces repetitive and irrelevant responses compared to individual LLLMs. Fig. 4 illustrates the step-by-step operational workflow of the hierarchical language model system from receiving a user query to generating the final response. The process includes: i. Query Input (400) - The user enters a query through the user interface which is received by the central controller. ii. Query Transmission (401) - The central controller forwards the query to the HLLM and optionally also directly to the LLLMs. ill. At step 402, the HLLM formulates a query or queries for the LLLMs. The query may be the same for all LLLMs or may be different and could, for example, be adapted to the specific attributes of respective LLLMs. The query is transmitted by the controller from the HLLM to the relevant LLLMs. iv. LLLM Response Generation (403) - Each LLLM independently analyses the query and generates a candidate / proposed response based on its domain-specific training. v. Compile Responses (404) - The controller compiles all LLLM generated responses into a collective set of candidate answers and transmits the candidate answers to HLLM. vi. HLLM Analysis (405) - The HLLM analyses each candidate response based on criteria such relevance, accuracy, redundancy. vii. Optimal Selection / Synthesis (406) - Using its algorithms, the HLLM selects the best response or synthesizes a new response from components. viii. Post-Processing (407) - The optimized response may undergo grammar / style refinement. ix. Output Response (408) - The final response is either sent back to the user interface to be accessed immediately by the user and / or stored in the database (107) for later access by the user. x. User Feedback (409 - 411) - The user can optionally provide feedback ratings on the response, enabling the HLLM to improve over time. xi. Optionally, the HLLM can be refined in real-time so as to implement improvements based on the feedback. The HLLM could then repeat the LLLM queries and / or the response analysis and the selection and / or synthesis until the optimized response(s) satisfies specific quality metrics. This real-time feedback loop is shown as dashed line (412) in fig. 4. In summary, Fig. 4 maps out the operational workflow and key steps in generating the system's responses to user queries. The process leverages both lower-level domain-specific models and higher-level general models to produce an optimized output. Fig. 2 illustrates the domain-specific architecture of the lower-level language models (LLLMs) in the hierarchical system. Multiple LLLM modules exist, each trained on data from a particular domain or field of knowledge. As depicted, example domains include: • Medicine LLLM (200A) - Trained on datasets like medical textbooks, journals, patient health records, etc. to generate responses to medical queries. • Finance LLLM (200B) - Trained on earnings reports, financial news, stock data to respond to finance-related questions. • Engineering LLLM (200C) - Trained on textbooks, publications, manuals, standards, and other technical documents to provide engineering-focused answers. • Legal LLLM (200D) - Trained on statutes, case law, legal textbooks, and other legal content to handle law-related queries. The number and specificity of LLLMs can be adapted based on the breadth of domains the system is meant to cover. LLLMs may utilize domain-specific vocabularies, ontologies, and language conventions particular to their field. Their training leverages state-of-the-art neural network architectures such as Transformers, BERT, and GPT-3 customized for each domain. The modular domain-based architecture allows combining specialized understanding with overall versatility. In summary, Fig. 2 provides an overview of the domain specialization employed in the lower-level language models to enable optimized responses for diverse queries. The multi-domain approach balances broad knowledge with targeted expertise. Fig. 3 illustrates the internal architecture and algorithms implemented within the higher-level language model (HLLM) for analysing candidate / proposed responses and generating an optimal output / response. The components include: • Encoder (300) - Employs self-attention layers to map the input query and candidate responses to dense vector representations. Helps assess relevance. • Candidate Analysis (301) - Components such as clustering, scoring or ranking are used to evaluate accuracy, redundancy, and other factors. • Decoder (302) - Uses algorithms such as beam search to generate and rank multiple optimized candidate responses for selection. • Synthesis Mechanisms (303) - Pointer networks, seq2seq models, and attention layers combine relevant pieces of candidate answers. • Post-Processing (304) - Weights, heuristics, and language models refine output for coherence, grammar, and style. • Policy Update Unit (305) - Reinforcement learning algorithms update model parameters based on user feedback to improve response optimization policy. • External Knowledge Sources (306) - APIs, databases, and corpus resources augment the model's contextual knowledge. The components leverage the latest techniques in deep learning and natural language processing to balance generalizability with custom optimization abilities. The model may build on standard architectures like BERT and GPT-3. The Encoder (300) receives the input query and candidate responses as input. Its output vector representations feed into the Candidate Analysis module (301) and the Decoder (302). The Candidate Analysis module (301) performs clustering, scoring etc on the encoded vectors. It has bidirectional connections to the Decoder (302) to provide analysis and annotations. The Decoder (302) leverages the encoded vectors and analysis from 301. It outputs synthesized candidate responses, using search algorithms, to the Synthesis Mechanisms module (303). The Synthesis Mechanisms module (303) refines and combines decoded response candidates using pointer networks and attention layers. Its output feeds into Post-Processing module (304). The Post-Processing module (304) employs language models and heuristics to improve response quality. Its output is the final HLLM generated optimal response. The Policy Update Unit (305) provides reinforcement learning capabilities. It trains on user feedback flowing back into the system. It also tunes parameters of modules 300-304 to improve response optimization policy. The role of the External Knowledge module (306) is to provide additional contextual data, APIs, and knowledge databases to augment the other components as needed. The bi-directional connections depicted in Fig. 3 represent API calls. In summary, Fig. 3 provides an overview of the algorithms and architectural components within the HLLM that enable analysis and generation of high-quality responses tailored to the input query. The unit selections are designed to be trainable and adaptable using feedback data. Fig. 5 provides a more detailed look at the response synthesis mechanisms implemented in the HLLM to combine relevant components from candidate answers into an optimized output. The steps include: 1. Input Candidates (500) - The candidate responses generated by the LLLMs are fed into the HLLM synthesis algorithms. 2. Segmentation (501) - Each candidate is segmented into chunks or phrases representing distinct ideas using boundary detection techniques. 3. Content Scoring (502) - The relevance of each chunk to the original query is quantified using similarity metrics and weights. 4. Pointer Networks (503) - Key segments are copied from the candidates as pointers to form a sequence-to-sequence mapping. 5. Combination (504) - The pointers are fluidly combined into complete sequences using an encoder-decoder architecture. 6. Candidate Generation (505) - Beam search generates multiple synthesized candidate combinations for consideration. 7. Candidate Scoring (506) - The candidates are evaluated for coherence, conciseness, grammar, and other attributes. 8. Selection (507) - The highest scoring synthesized candidate is selected as the optimal response (508). The synthesis techniques leverage innovations like pointer networks to fluidly stitch relevant content from multiple sources. This allows tailoring responses to user queries by identifying and combining the most pertinent information. In summary, Fig. 5 maps out the synthesis process to create optimized and nuanced responses that integrate the strengths of multiple specialized LLLMs. The components may be designed to be trainable to continually improve combination quality. Adaptive Learning and Feedback Loop An optional but valuable component of the system is a feedback loop. After the HLLM provides the final answer, users may offer feedback, rating the quality, relevance, and accuracy of the response. This feedback may be utilized to fine-tune the HLLM's selection or synthesis process, making the system more accurate and efficient over time. Advantageously, the feedback loop may operate in real-time allowing responses to be refined. The feedback loop's adaptation techniques may draw from reinforcement learning principles, structuring user ratings and preferences as rewards. Details such as the reward architecture, balancing exploration vs exploitation, and experience replay may help optimize the system's performance over multiple query-response cycles. The feedback loop enables the HLLM to refine its selection and synthesis capabilities over multiple query-response cycles. User ratings on dimensions such as relevance and coherence may be compiled as rewards. This feedback loop may also influence how the HLLM generates and refines instructions or sub-instructions for LLLMs subsequently. A policy gradient reinforcement learning algorithm may use these reward signals to update parameters that control the ranking, combination, and optimization stages. Actions that produce higher rewards may be reinforced. To balance exploration, epsilon-greedy selection may be used. The HLLM may exploit learned high-reward strategies most of the time HLLM but at times may explore new selection mechanisms. The synthesized responses, user ratings, and HLLM's internal Q-values may be stored in a database. This experience replay could allow periodic retraining of the HLLM on past successful and unsuccessful responses to prevent overfitting. It will be understood that the feedback loop may improve the cumulative success rate of responses. The HLLM may evolve its strategies based on a Darwinian selection of high-performing actions. Fig. 6 illustrates the adaptive feedback loop implemented in the system to allow continual learning and improvement of the higher-level language model's (HLLM) response optimization capabilities. The process includes: 1. Generate Response (600) - The HLLM produces a response to the user query based on its current policies. 2. Present to User (601) - The response is provided to the user through the interface. 3. User Rates Response (602) - The user rates the response on dimensions such as relevance, accuracy, coherence, etc. 4. Compile Feedback (603) - The ratings and feedback are compiled into reward signals. 5. Feedback to HLLM (604) - The rewards are fed back into the HLLM's policy update unit. 6. Policy Adaptation (605) - Using reinforcement learning, the HLLM updates its parameters to evolve its response optimization policy. 7. Historical Data Storage (606) - Interaction data is stored for training and testing to prevent overfitting. 8. Model Re-training (607) - The HLLM is periodically re-trained on accumulated interaction data. The feedback loop allows adapting the HLLM's selection and synthesis capabilities based on empirical user interactions over time. This bolsters performance, customization, and human-like conversation. In summary, Fig. 6 outlines the self-improvement mechanisms built into the system architecture. The components enable experiential learning by the models to optimize conversational flow. Specialized Handling of Mixed Input Modalities In a further example of the invention, the system may include a mix of LLLMs with distinct specializations in processing different types of input data. For instance, Formula Handling LLLMs may excel at analysing queries containing mathematical expressions and formulas using e.g. LaTeX decoding, symbolic manipulation, and math-aware encoders. Table Processing LLLMs could incorporate techniques from semantic parsing and data mining to interpret queries about statistical tables. Graphics LLLMs may leverage computer vision and multimodal understanding to extract meaning from charts, diagrams, and other visuals. When responding to queries regarding technical documents (e.g. technical standards) containing a blend of text, figures, tables, and mathematical notation, the HLLM could delegate different modalities to the specialized LLLMs best suited for each. For text passages, the HLLM may rely on an LLLM with strong natural language capabilities. For interpreting a mathematical formula, it could call the Formula Handling LLLM. For tabular information, it could leverage the Table Processing LLLM. For a diagram analysis, it could use the Graphics LLLM. The HLLM would then assimilate the complementary inputs, inferences, and conclusions from the diverse LLLMs. Using meta-learning techniques, it could combine these fragmented insights across modalities into a unified response synthesizing the salient pieces. This would enable the system to handle mixed-modality documents and leverage hybrid reasoning across specialized models tailored for different input types. The HLLM orchestrates the models to produce cohesive responses integrating multimodal analysis. In the system architecture with lower-level LLLMs dedicated to particular modalities (e.g. text, formulas, tables, graphics), the user's original query could be routed directly to the HLLM rather than broadcasting to all LLLMs simultaneously. The HLLM's encoder would then parse and interpret the initial user query to determine which components involve textual passages, mathematical notation, tabular data, visual diagrams, etc. Based on this modulation analysis, the HLLM could then selectively route specific portions, subqueries, or extracted features to the specialized LLLM(s) optimally suited for that modality. For example, detected formula segments might be passed to the Formula Handling LLLM, table data delegated to the Table Processing LLLM, and chart image features sent to the Graphics LLLM. This would allow allocating each query component to the most relevant specialized LLLM for efficient distributed processing based on modalities detected by the HLLM upfront. The HLLM would later assimilate the outputs from the modal-specific LLLMs into a combined response. The routing via the HLLM (rather than broadcasting the full query) would therefore enable leveraging the most apt LLLMs for different modalities. Inter-Model Dialogue for Response Improvement In some examples of the invention, the HLLM may additionally engage in a conversation with one or more of the LLLMs to request clarification, additional information, or refinements to improve the quality of the proposed responses. Here the term "conversation" denotes not only a direct exchange of data, but also a fluid and adaptive exchange between the HLLM and LLLMs. It encompasses a broad communication process, including the sharing of insights, suggestions, and collaborative exploration. Conversations may be dynamic and can evolve based on new inputs, leading to innovative approaches in understanding and processing natural language prompts and responses. It follows from this that the responses by LLLMs to queries posed by the HLLM could themselves be queries e.g. to request further information or clarification of the original query. For example, if the initial proposed response from the Medical LLLM contains ambiguous acronyms or terminology, the HLLM may query the Medical LLLM to expand on the unclear terms to make the answer more understandable. The Medical LLLM may itself by responding with a query as to the what level of complexity or length the response should be. As another example, the HLLM may detect that the proposed response from the Engineering LLLM lacks sufficient detail or explanation of key principles. The HLLM can then probe the Engineering LLLM with follow-up questions to fill in gaps in the initial response. The HLLM may also request the Finance LLLM to double-check critical numerical data in its proposed response or ask for up-to-date figures from real-time market data feeds. Additionally, if the initial proposals appear incomplete, biased, or contradictory, the HLLM may engage individual LLLMs in a back-and-forth conversation to clarify ambiguous points, improve objectivity, provide supporting references or excerpts of documents or resolve conflicting statements. Equally, the HLLM may receive a response from one LLLM, and query a different LLLM to improve the response. For example, a journal reference provided by an LLLM not having document analysis functionality, could be passed to an LLLM endowed with internet access to identify the referenced journal. This journal reference could then be passed to a further LLLM with suitable document reading functionality e.g. one able to operate a PDF reader plugin, for the extraction of excerpts. The exchange may employ conversational protocols and conventions common in the LLLMs' domains to elicit expanded, balanced, and well-rounded perspectives. This inter-model interaction enables tapping into the specialized knowledge within each LLLM to iteratively improve response quality in terms of completeness, accuracy, objectivity, and coherence. The HLLM may use a hybrid approach, synthesizing its own final response after concluding the dialogue exchanges rather than selecting any single LLLM's response outright. Fig. 7 provides an example diagram outlining how inter-model dialogues may be employed in the system to enable iterative improvement of responses. As depicted, the HLLM (701) engages with various LLLMs (702) in a two-way conversational flow. Based on its analysis of an initial user query, the HLLM (701) exchanges information with relevant LLLMs (702) to request clarifications around ambiguous terminology (as shown with the Medical LLLM (702A) example above); probe for additional details where responses may lack sufficient context (as shown with the Engineering LLLM (702C)); verify or cross-check critical data (as shown with the Finance LLLM (702B)); or delegate particular elements, like mathematical expressions, to specialized handlers (as shown with the Formula Handling LLLM (702D)). As shown in fig. 7, the HLLM may instruct the LLLMs e.g. Engineering LLLM (702C) to delegate elements such as mathematical expressions directly to specialist LLLMs e.g. Formula Handling LLLM 702D, or LLMs may interact with each other directly without the need to refer back to the HLLM. This is depicted in fig. 7 in the form of a query and response conversation between Engineering LLLM 702C and Formula Handling LLLM 702D. Bidirectional interactions allow the HLLM to leverage the niche capabilities within each LLLM beyond just their initial query responses. This collective inter-model conversation taps into distributed knowledge to improve quality dimensions such as completeness, impartiality, accuracy and coherence. As an example, supporting excerpts requested from the Formula Handling LLLM may be combined with market data retrieved by the Finance LLLM to enhance a response coordinated by the HLLM. The integrated system is therefore able to harness both wide general knowledge along with specialized domain understanding through a connected network of language models working in conjunction. LLLM Capability Profiling for Optimized Routing In addition to modality analysis on the query, the HLLM can profile the capabilities of each LLLM through conversational exchanges. During initialization or periodically, the HLLM (701) can probe the LLLMs (702) with domain-specific questions, edge cases, and sample inputs to benchmark strengths and limitations. For instance, the HLLM may evaluate the Formula Handling LLLM (702D) on mathematical reasoning skills by posing esoteric physics problems requiring calculus or linear algebra. A Table Processing LLLM could, for example, be tested on handling complex datasets and queries requiring multivariate analysis. The HLLM catalogues the capabilities uncovered for each LLLM into a knowledge base. When routing query components, the HLLM consults this knowledge base to allocate portions optimally based on both modulation type and aligned LLLM competencies. For example, a statistics heavy table extracted from the query may get routed to a Table Processing LLLM specialized in econometrics rather than a generalist table-handling model. Dynamic capability profiling via interrogative conversations allows the HLLM to make informed routing decisions to match query facets with the most apt LLLMs beyond just modalities. This results in responses tailored to the specialized competencies of the underlying LLLM ensemble. Diversity-Based Response Improvement In a further example of the invention, the HLLM at the heart of the system integrates a diversitybased response improvement module, which leverages the specialized knowledge encapsulated within the LLLMs. As depicted in Fig. 8, when an initial user query (801) is received, the HLLM analysis component (802) employs paraphrasing algorithms (803) to generate multiple rephrased variants (804) of the original query. These paraphrased queries are each routed to subsets of relevant LLLMs (805), chosen, for example, based on domain alignment. Fig. 8 shows LLLMs 1 - N. Typically, N would be at least 3 i.e. there would need to be at least three LLLMs in order to be sure of a consensus if one of the LLLMs began hallucinating. It is extremely rare for two LLLMs to hallucinate consistently with each other at the same time. However, it is possible to operate the system with as few at two LLLMs, although this would introduce certain limitations compared to a system using three or more LLLMs. The preferred method involves a majority consensus mechanism to select the most consistent and accurate responses, which is most effective with three or more LLMs to ensure a clear majority. However, with two LLMs, the system could still offer benefits, albeit with a different approach to response selection and validation. For example, with two LLLMs the HLLM can compare responses for consistency and accuracy. While this does not necessarily provide a majority consensus, it does allow for a basic level of cross-verification between the two models. Furthermore, two LLLMs can still provide a degree of redundancy and error checking. If both LLLMs produce similar responses, it can increase confidence in the accuracy of the output. Conversely, discrepancies between the two responses can flag potential issues for further review. In such cases, however, the HLLM may need to play a more significant role in analysing and synthesizing the responses from the two LLMs, potentially increasing the complexity of its decision-making process. In cases where the two LLMs provide conflicting responses, the HLLM would face a dilemma. In such a case the HLLM could, for example, report both alternative responses to the user, together with its concerns; or interrogate the LLLMs further to understand the cause of the disagreement; or even resolve the difference from its own domain knowledge. Returning to Fig. 8, the LLLMs provide a rich set of candidate responses (806), exploring different facets of information, terminology, and contextual interpretations. If operating on a parallel processing framework, the LLLMs may process the natural language prompts, both original and paraphrased, in parallel. The HLLM plays a crucial role in analysing the responses generated by the LLLMs. It collects all responses (807) and employs consistency thresholding (808), as shown in Fig. 8, to partition them into groups based on semantic similarity. The largest group (809), forming the consensus cluster, is indicative of the most reliable and contextually appropriate responses. The HLLM synthesis component (810), as illustrated in Fig. 8, then selects or combines responses within the consensus cluster to produce the final output response (811). An additional post processing phase (812) refines the response for coherence, grammatical correctness, and stylistic appropriateness to generate a response to the user (813). Optionally, user feedback can be incorporated into this phase for continuous improvement and adaptation. The system is adept at detecting and eliminating hallucinations through its diverse input processing and parallel response analysis. By leveraging the diverse perspectives provided by the LLLMs, the system effectively identifies outlier responses that may be hallucinations. The consensus-based selection process, as demonstrated in Fig. 8, ensures that only those responses that surpass a certain threshold of similarity and consistency are chosen, thereby filtering out hallucinatory content. The synthesis and refinement phases further eliminate any residual hallucinatory elements, ensuring the final output is both accurate and contextually relevant. This example of the invention is suited for implementation on distributed computing systems, and the architecture of the system facilitates scalability and adaptability to various applications and user needs. The inclusion of a feedback mechanism allows for continuous system improvement, making the system more adept at recognizing and eliminating hallucinations over time. Enhanced Diversity-Based Improvement Building upon the previously outlined structure of the HLLM and LLLMs, a further example of the invention introduces advanced capabilities for enhancing the diversity-based response improvement and anti-hallucination features, as depicted in Fig. 8. These capabilities leverage the interactive and conversational dynamics between the HLLM and LLLMs, augmenting the system's efficiency and accuracy. Enhanced Diversity-Based Response Improvement 1. Dynamic Query Refinement: The HLLM's ability to engage in dialogues with LLLMs is utilized for dynamically refining the user's query. This interactive process, depicted in the initial stages of Fig. 8, allows for a deeper exploration of the query's context, leading to more nuanced paraphrased variants (804) and, subsequently, a wider array of responses (806) from the LLLMs. 2. Iterative Paraphrasing and Enhanced Interpretations: The system employs paraphrasing algorithms (803), as shown in Fig. 8, in tandem with interactive discussions between the HLLM and LLLMs. This iterative process yields paraphrases that encapsulate a broader spectrum of interpretations, enhancing the diversity and depth of the LLLMs' responses. 3. Cross-Model Learning and Domain Enhancement: Through conversational exchanges, the LLLMs share and integrate insights from their respective domains, enriching each model's understanding and response capabilities. This cross-model learning fosters a collaborative environment, enhancing the overall diversity and quality of the responses. Advanced Anti-Hallucination Mechanisms 1. Contextual Verification Through Dialogue: The HLLM uses its conversational capabilities to verify the contextual accuracy of responses from the LLLMs. As illustrated in the latter stages of Fig. 8, this involves a deeper analysis of responses, allowing the HLLM to detect and address potential hallucinations effectively. 2. Real-time Feedback and Correction: In instances where the HLLM identifies inaccuracies or inconsistencies in an LLLM's response, it may provide immediate feedback. This real-time correction mechanism enhances the system's ability to rapidly eliminate hallucinatory content from the responses. 3. Consensus Building and Response Synthesis: The HLLM orchestrates a consensus-building process among the LLLMs, guiding them towards a unified and coherent response. This process, culminating in the synthesis component (810) in Fig. 8, ensures that the final output response (811) is a product of collective agreement and refinement, significantly reducing the risk of hallucinations. Incorporating these advanced features into the claimed system further elevates its capacity to generate accurate, reliable, and contextually appropriate responses. The interactive dialogue between the HLLM and LLLMs, as integrated into the system's architecture, not only enhances response diversity but also plays a crucial role in the real-time detection and elimination of hallucinations. This synergistic approach, as depicted in Fig. 8, ensures a more robust and effective solution to the challenges faced in natural language processing, particularly in improving the reliability and contextual relevance of language model outputs. In conclusion, the hierarchical language model system proposed herein offers a balanced blend of the vast knowledge encapsulated in generalist models and the nuanced, domain-specific expertise of specialized models. By orchestrating these components in a hierarchical manner, the system significantly improves consistency, reliability, and accuracy in generating responses to a wide array of user queries.

Claims

1. A method for improving the reliability of language models:a) receiving a natural language prompt at a Higher-Level Language Model (HLLM);b) the HLLM instructing a plurality of Lower-Level Language Models (LLLMs), based on the prompt;c) the plurality of LLMs generating responses to the instructions;d) the HLLM comparing the generated responses to determine a consensus response group;e) the HLLM determining an output response from at least one response from the consensus response group.

2. The method of claim 1, wherein prior to instructing the plurality of LLLMs, the HLLM generates a plurality of paraphrased prompts based on the received natural language prompt and provides each of said plurality of LLLMs with a different paraphrased prompt for processing.

3. The method of claim 2, wherein the plurality of paraphrased prompts are generated through natural language paraphrasing techniques that maintain or enhance the context and intent of the original natural language prompt.

4. The method of claim 2, further comprising using a paraphrase diversity algorithm to ensure that the plurality of paraphrased prompts are distinct and diverse.

5. The method of claim 2, wherein the plurality of paraphrased prompts are generated based on a thesaurus, semantic analysis and / or machine learning models trained on paraphrasing data.

6. The method of claim 1, wherein the plurality of LLLMs processing different paraphrased prompts collectively generate responses that encompass a wider range of potential interpretations and information sources.

7. The method of any of claims 1-7, further comprising post-processing by the HLLM of the output response to enhance its coherence and readability.

8. The method of any of claims 1-7, wherein the plurality of LLLMs comprises different large language models from the same or different providers.

9. The method of claims 1-7, wherein the plurality of LLLMs comprises different instances of the HLLM.

10. The method of any of claims 1-9, further comprising determining a threshold for response consistency, wherein responses that meet or exceed the threshold are included in the majority response group.

11. The method of any of claims 1 - 10, wherein the natural language prompt includes context information, and the comparing step includes the context information to determine response consistency.

12. The method of any of claims 1 - 11, wherein the method is implemented on a distributed computing system.

13. The method of any of claims 1 - 12, wherein at least three LLLMs are instructed.

14. The method of any of claims 1 - 13, wherein a conversation takes place between the HLLM and LLLMs.

15. The method of claim 14, wherein the conversation refines the natural language prompts.

16. The method of any of claims 14 or 15, wherein the conversation enhances the paraphrasing of the natural language prompts.

17. The method of any of claims 14 - 16 wherein the conversation involves the sharing of domain specific insights between the HLLM and LLLMs.

18. The method of any of claims 14 - 17 wherein the HLLM provides real-time corrective feedback to the one or more of the LLLMs.

19. A system for improving the reliability of language models, comprising:a) a Higher-Level Language Model (HLLM) configured to receive a natural language prompt;b) a plurality of Lower-Level Language Models (LLLMs) initiated by the HLLM;c) means for generating responses to the natural language prompt by the plurality of LLLMs;d) means for comparing the generated responses by the HLLM to determine a consensus response group;e) means for determining an output response by the HLLM from at least one response from the consensus response group.

20. The system of claim 19, further comprising means for generating a plurality of paraphrased prompts based on the received natural language prompt by the HLLM, with each of the plurality of LLLMs receiving a different paraphrased prompt for processing.

21. The system of claim 20, wherein the means for generating paraphrased prompts includes natural language paraphrasing techniques that maintain or enhance the context and intent of the original natural language prompt.

22. The system of claim 20, further comprising a paraphrase diversity algorithm to ensure that the plurality of paraphrased prompts are distinct and diverse.

23. The system of claim 20, wherein the means for generating paraphrased prompts is based on a thesaurus, semantic analysis, and / or machine learning models trained on paraphrasing data.

24. The system of claim 19, wherein the plurality of LLLMs processing different paraphrased prompts collectively generate responses that encompass a wider range of potential interpretations and information sources.

25. The system of any of claims 19 - 24, further comprising means for post-processing the output response by the HLLM to enhance its coherence and readability.

26. The system of any of claims 19 - 24, wherein the plurality of LLLMs comprises different large language models from the same or different providers.

27. The system of claims 19 - 24, wherein the plurality of LLLMs comprises different instances of the HLLM.

28. The system of any of claims 19 - 27, further comprising means for determining a threshold for response consistency, wherein responses that meet or exceed the threshold are included in the majority response group.

29. The system of any of claims 19 - 28, wherein the natural language prompt includes context information, and the comparing means includes the context information to determine response consistency.

30. The system of any of claims 19 - 29, implemented on a distributed computing system.

31. The system of any of claims 19 - 30, wherein at least three LLLMs are instructed by the HLLM.

32. The system of any of claims 19 - 31, wherein a conversation takes place between the HLLM and the LLLMs.

33. The system of claim 32, wherein the conversation refines the natural language prompts.

34. The system of either claims 32 or 33, wherein the conversation enhances the paraphrasing of the natural language prompts.

35. The system of any of claims 32 - 34 wherein the conversation involves the sharing of domainspecific insights between the HLLM and LLLMs.

36. The system of any of claims 32 - 35 wherein the HLLM provides real-time corrective feedback to one or more of the LLLMs.

37. A computer program product comprising computer-readable instructions which, when executed by a processor, perform a method according to any of claims 2 to 18.