External document tagging and query augmentation for language model generation

RAG with external document tagging and query augmentation enhances language model performance by efficiently retrieving and refining queries, addressing inaccuracies and inefficiencies in existing models.

WO2025255733A1PCT designated stage Publication Date: 2025-12-18MICROSOFT TECHNOLOGY LICENSING LLC +10

Patent Information

Application Number
PCT/CN2024/098629
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2025-12-18

AI Technical Summary

Technical Problem

Existing language models struggle with domain-specific queries, leading to inaccurate responses, increased computational resources, and inefficiencies due to unnecessary I/O operations and latency, especially when handling complex multi-hop questions.

Method used

Implement Retrieval-Augmented Generation (RAG) with external document tagging and query augmentation, using a lightweight model like DeBERTa, to efficiently retrieve and label relevant information, reducing I/O and latency by iteratively refining queries and excluding irrelevant chunks.

Benefits of technology

Improves accuracy and reduces computational resources by minimizing I/O operations and latency, ensuring precise and efficient responses to complex queries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024098629_18122025_PF_FP_ABST
    Figure CN2024098629_18122025_PF_FP_ABST
Patent Text Reader

Abstract

Various embodiments discussed herein relate to external document tagging and query augmentation for language model generation. Some embodiments assign a label for at least a portion of an accessed document. Based at least in part on assigning the label for at least the portion of the document, some embodiments then generate a tag indicating whether more information is needed to respond to the query. This process of tagging iteratively repeats for each chunk and / or document until all relevant information is accessed, after which a language model consolidates all the relevant chunks and / or documents to respond to the query. In other words, various embodiments efficiently generate new queries for subsequent retrieval rounds, aiming to retrieve information beyond the scope of the initial query. Once enough information is received for responding to the initial query, various embodiment pass all the relevant information to the language model to get a final response.
Need to check novelty before this filing date? Find Prior Art

Description

EXTERNAL DOCUMENT TAGGING AND QUERY AUGMENTATION FOR LANGUAGE MODEL GENERATIONBACKGROUND

[0001] Language models, such as Large Language Models (LLMs) , represent a breakthrough in computer-based natural language processing. LLMs are trained on vast volumes of data and use billions of parameters to generate outputs for tasks like question-answering, text summarization, and translation. However, despite their prowess, these and other language models encounter challenges when confronted with domain-specific queries. Domain-specific queries are queries that pertain to a particular field, industry, or specialized area of knowledge. Language model training data often lacks such specialized domain knowledge. As a result, they often struggle to generate accurate responses to queries that require expertise in specific fields or industries. For example, language models are prone to hallucination or other errors by: presenting false information when it does not have the answer, presenting out-of-date or generic information when the user expects a specific or current response, generating a response from non-authoritative sources, or generating inaccurate responses due to terminology confusion, where, for example, different training sources use the same terminology to talk about different things.SUMMARY

[0002] This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used in isolation as an aid in determining the scope of the claimed subject matter.

[0003] Various embodiments discussed herein relate to external document tagging and query augmentation for language model output response generation. In operation, some embodiments first receive a query, such as a natural language question or command. In response to the receiving of the query, some embodiments begin the process of executing the query by accessing, over a computer network, a document (e.g., any unit of textual information retrieved from an external knowledge base that is not part of a language model’s training data) .

[0004] Some embodiments then assign a label for at least a portion of the document, where the label indicates a measure of relevance of at least the portion to respond to the query. For example, some embodiments retrieve a first of multiple chunks of the accessed document. Some embodiments then assign the label for a first token or word (or multiple tokens or words) included in the first chunk that is relevant to the query. For example, after tokenization (e.g., splitting the document into words or other natural language fragments) the labeling process involves linguistic analysis, semantic understanding, and / or domain-specific knowledge to identify relevant information accurately for each chunk.

[0005] Based at least in part on assigning the label for at least the portion of the document, some embodiments then generate a tag indicating whether more information is needed to resolve the query. For example, the tag in some embodiments is a <Continue> tag, meaning that the information in the corresponding chunk is relevant but cannot fully resolve the query and another round of retrieval for a next chunk and / or document is necessary. Consequently, based on this tag, some embodiments retrieve another document by augmenting the query with a natural language sequence by adding, for example, new relevant words from the first chunk to the query.

[0006] In some embodiments, the tag need not be a <Continue> tag, but is another tag, such as a <Finish> tag, meaning that enough information has been retrieved to resolve the query. Such <Finish> tag thus indicates that the initial query can be directly executed without augmenting the query, as described in more detail below. The tag can alternatively be a <Terminate> tag, meaning that a given chunk, word, and / or token is not relevant to the query. In these instances, the query is not executed using the corresponding chunk, word, or other token, as described in more detail below.

[0007] In various embodiments, this process of generating a tag is iteratively repeated for each chunk and / or document until enough relevant information is accessed to resolve the query, after which a language model (e.g., an LLM generator) processes all the relevant chunks and / or documents to respond to the query. In other words, various embodiments efficiently generate new queries for subsequent retrieval rounds, aiming to retrieve information beyond the scope of the initial query. Once enough information is received for responding to the initial query, various embodiments pass all the relevant information to the language model to get a final output response. For example, some embodiments provide an indication of at least a portion of the query and all the relevant document portions (e.g., chunks) as input into a language model, where the language  model generates an output response, such as an answer to a question in the query, text summarization, or an output that is part of a dialogue with a user that issued the query.

[0008] In light of various Retrieval-Augmented Generation (RAG) and other language model technologies, some embodiments have the technical effect of at least improved computer resource consumption (e.g., reduced I / O, reduced computing latency, reduced memory consumption) , and improved accuracy in a language model’s output response (e.g., so as to reduce the likelihood of hallucination) , as described in more detail below.BRIEF DESCRIPTION OF THE DRAWINGS

[0009] The present invention is described in detail below with reference to the attached drawing figures, wherein:

[0010] FIG. 1 is a block diagram depicting an example computing system architecture suitable for implementing some embodiments of the disclosure;

[0011] FIG. 2 is a block diagram of a pipeline illustrating the inputs and outputs to derive an output response, according to some embodiments;

[0012] FIG. 3 is a schematic diagram illustrating how chunks of one or more documents and tags are used to augment an original query, according to some embodiments;

[0013] FIG. 4 illustrates a pipeline for classifying each chunk with a tag to decide a next action, according to some embodiments;

[0014] FIG. 5 is a schematic diagram illustrating how a new query is formulated based on a three-hop comparison case, according to some embodiments;

[0015] FIG. 6 is a pipeline representing how a language model generates an output response, according to some embodiments;

[0016] FIG. 7 is a pipeline illustrating how a machine learning model is trained or fine-tuned to generate token labels (s) , chunk tag (s) , and new queries, according to some embodiments;

[0017] FIG. 8 is a flow diagram of an example process for training one or more machine learning models to predict one or more token labels and augmented queries, according to some embodiments;

[0018] FIG. 9 is a flow diagram of an example process for executing an original query based on chunk processing and language model generation, according to some embodiments;

[0019] FIG. 10 is a flow diagram of an example process for providing information as input into a language model based on content of a first tag generated for a first chunk, according to some embodiments;

[0020] FIG. 11 illustrates a line graph representing chunk recall by different retrieval strategies, according to some embodiments;

[0021] FIG. 12 is a block diagram illustrating an example operating environment in which some embodiments of the present disclosure are employed; and

[0022] FIG. 13 is a block diagram of an example computing device suitable for use in implementing some embodiments described herein.DETAILED DESCRIPTION

[0023] The subject matter of aspects of the present disclosure is described with specificity herein to meet statutory requirements. However, the description itself is not intended to limit the scope of this patent. Rather, the inventors have contemplated that the claimed subject matter might also be embodied in other ways, to include different steps or combinations of steps similar to the ones described in this document, in conjunction with other present or future technologies. Moreover, although the terms “step” and / or “block” may be used herein to connote different elements of methods employed, the terms should not be interpreted as implying any particular order among or between various steps herein disclosed unless and except when the order of individual steps is explicitly described. Each method described herein may comprise a computing process that may be performed using any combination of hardware, firmware, and / or software. For instance, various functions may be carried out by a processor executing instructions stored in memory. The methods may also be embodied as computer-usable instructions stored on computer storage media. The methods may be provided by a stand-alone application, a service or hosted service (stand-alone or in combination with another hosted service) , or a plug-in to another product, to name a few.

[0024] As described above, existing language models can struggle to generate accurate responses to queries that require expertise in specific fields or industries. To close this gap, Retrieval-Augmented Generation (RAG) has emerged as a pivotal approach to bolstering the capabilities of LLMs. RAG is a technology for optimizing the output of a language model. RAG  references an authoritative knowledge base external to or outside of its training data sources before generating a response. By leveraging external knowledge resources, RAG empowers LLMs or other language models (e.g., small language models) to tackle domain-specific tasks with finesse, without necessitating extensive retraining of the model. The use of external knowledge sources by LLMs and other language models not only enhances the relevance and accuracy of their generated responses, but also broadens the applicability of LLMs to diverse and specialized domains, thereby advancing the frontier of natural language understanding and generation.

[0025] However, multiple technical challenges have arisen with existing RAG technologies and existing language models themselves. Some technical challenges are that they unnecessarily consume various computing resources, such as computer input / output (I / O) , and latency. For example, when confronted with complex questions, such as multi-hop questions or how-to questions, traditional RAG technologies fail to retrieve enough relevant information to answer the question (e.g., because they only access one document or engage in one round of retrieval) . Consequently, this taxes language models because they now need to engage in multiple calls to generate multiple queries to answer the complex question appropriately, leading to increased I / O. For example, existing technologies leverage LLMs to generate a new query with chain-of-thought (CoT) or another LLM call, such as SOTA methods IRCOT, Self-ask, Iter-RetGen, or the like. However, this approach is inefficient due to multiple LLM calls (thereby increasing I / O and latency) , particularly if the initial query is complex and needs multi-hop reasoning. In an illustrative example, regarding the query “Who is the mother of the director of film Polish-Russian War (film) , ” existing RAG technologies have to make two or more calls to an LLM –issue a first query of, “who is the director of the film ‘Polish-Russian War’ ” and once the director is determined (Xawery Zulawski) , a second query is issued, such as “Who is the mother of Xawery Zulawski. ” At a computer resource level, this means that at least two I / O operations are performed, which correspond to the two different queries. When I / O is unnecessarily multiplied, as is the case with these existing technologies, this places unnecessary wear and tear on storage components, such as a read / write head, for example because of all of the mechanical movements required of the read / write head to locate a sector and track on disk for each I / O. And when I / O is unnecessarily multiplied, as is the case with existing technologies, there is increased latency between query formulation and query execution because of all the intermediate query processing that needs to be done to resolve the query, as described above.

[0026] Existing technologies are also associated with inaccurate results or hallucination in addition to increased I / O and latency. One common practice is for existing technologies to increase the number of chunks (aunit of information) in the retrieval of documents, e.g., top-K. However, feeding too many chunks to an LLM-based generator brings noise and results in hallucination in the final response because most of the chunks are irrelevant to resolve the query. When too many irrelevant chunks are fed to the LLM-based generator, it faces challenges in distinguishing between relevant and irrelevant information. As a result, the generator has a higher likelihood of producing responses that incorporate inaccurate or misleading details present in the irrelevant chunks. Additionally, processing these unnecessary / irrelevant multiple chunks increases the amount of I / O and latency. Further, most LLMs require dedicated prompts and few-shot examples (e.g., example input-output pairs) to be formulated for its input to derive an output. Not only is it tedious and arduous to formulate these prompts, but prompts result in a higher likelihood of hallucination or inaccuracy because there are no universal prompts for all queries and scenarios.

[0027] Some existing models, such as traditional Large Language Models (LLMs) , work on billions of parameters, and are otherwise associated with low efficiency. The use of large LLMs for tasks like query generation incurs high computational costs. These models require extensive memory and processing power, leading to expensive operations in terms of both latency and resources. This is because the models that perform tasks, such as question answering or text generation, are typically large in size, often containing billions of parameters. These large models require extensive memory to store their parameters and computational power to perform inference during query generation. LLMs operate by processing input sequences through multiple layers of a neural network architecture, involving numerous mathematical computations such as matrix multiplications and non-linear activations. The computational complexity of these operations increases with the size and depth of the model, leading to higher computational costs. Generating responses to queries using LLMs involves running inference algorithms to process input data through the model and produce output predictions. The time required for inference scales with the size of the model and the complexity of the task, resulting in higher latency for larger LLMs.

[0028] Various embodiments of the present disclosure provide one or more technical solutions that have technical effects in light of these technical problems, as well as other problems, as described herein. Specifically, various embodiments are directed to external document tagging and query augmentation for language model generation. In operation, some embodiments first  receive a query, such as a natural language question or command. In response to the receiving of the query, some embodiments then access, over a computer network, a document.

[0029] Some embodiments then generate (and / or assign) a label for at least a portion of the document. The label indicates a measure of relevance of at least the portion to respond to the query (e.g. via a Boolean value such as “true” (meaning a token or word is relevant) or “false” meaning a token or word is not relevant) . For example, some embodiments retrieve a first chunk of the accessed document that is relevant to the natural language question or command. Some embodiments then assign the label for a first token or word (or multiple tokens or words) included in the first chunk that is relevant to the natural language question or command. For example, after tokenization the labeling process involves linguistic analysis, semantic understanding, and / or domain-specific knowledge to identify relevant information accurately. Example algorithms for this process includes Part of Speech (POS) tagging, dependency parsing, Named Entity Recognition (NER) , word embeddings (e.g., WORD2VEC) , Term-frequency-inverse Document Frequency (TF-IDF) , and / or Jaccard Index to determine how relevant a given token is to the query.

[0030] Based at least in part on the generating the label for at least the portion of the document, some embodiments generate a first tag indicating whether more information is needed to respond to the query. For example, the first tag in some embodiments is a <Continue> tag, meaning that the information in the corresponding chunk cannot fully resolve the query and another round of retrieval is necessary. Consequently, based on this tag, some embodiments, augment the query with a natural language sequence (e.g., add new relevant words from the first chunk to the query) . In an illustrative example, the initial or original query can be "What is the impact of climate change on polar bear populations? " Various embodiments retrieve several chunks of information related to climate change and polar bears. Various embodiments then identify key tokens such as "climate change, " "polar bear populations, " "habitat loss, " etc., while the first tag is used to determine that more information is needed to fully answer the query. Various embodiments then augment the original query with additional context / words based on the labeled tokens, resulting in an augmented query like "How does habitat loss due to climate change affect polar bear populations? " The process repeats with the augmented query, retrieving more specific information related to habitat loss and its impact on polar bear populations.

[0031] Some embodiments then provide an indication (e.g., a vector representation) of at least a portion of the query and the relevant portions (e.g., chunks) as input into a language model,  where the language model generates an output (e.g., based at least in part on the augmenting of the query) . For example, a generative component generates an answer to a question in the query, performs text summarization, or produces an output that is part of a dialogue with a user that issued the query.

[0032] In some embodiments, the first tag need not be a <Continue> tag, but is another tag, such as a <Finish> tag (meaning enough information has been retrieved to solve the query) , which indicates that the query can be directly executed without augmenting the query, as described in more detail below. The first tag can alternatively represent a <Terminate> tag, meaning that a given chunk, word, token, and / or token is not relevant to the query. In these instances, the query is not executed using the corresponding chunk, word, or other token, as described in more detail below.

[0033] Various embodiments have the technical effect of improved computer resource consumption, such as reduced I / O and reduced computing latency. For example, when confronted with complex questions, such as multi-hop questions or how-to questions, unlike RAG technologies, various embodiments employ the technical solution of generating a new or augmented query. Such query is used for additional retrieval rounds in order to obtain enough information to address the user’s original query. For example, using the illustration above, regarding the query “Who is the mother of the director of film Polish-Russian War (film) , ” various embodiments augment this query such that the output new query is “Who is the mother of Xawery Zulawski, ” which effectively replaces “mother” in the original query with the actual name of the mother. This means that instead of expending an I / O operation or LLM call to determine the name of the director of the Polish-Russian War film, this information is already presented in the LLM’s input (e.g., as a part of a relevant chunk or in an augmented query) and so I / O is reduced to a single I / O to find who the mother of Xawery Zulawski (the director) is. In other words, various embodiments do not need to perform a first language model call to formulate a query asking who the director of the film is via a first I / O operation since this information is contained in the augmented query and / or the language model’s input. Accordingly, in this example, there is only a single I / O required instead of the two I / Os required by existing technologies. Therefore, I / O is reduced, which reduces the wear and tear on storage components, such as a read / write head, for example because there are fewer mechanical movements required of the read / write head to locate a sector and track on disk for each I / O. And because I / O is reduced, there is a technical effect of  reduced computing latency between query formulation and query execution because there is no need to perform all the intermediate computer processing to resolve the query.

[0034] Various embodiments also have the technical effect of improved accuracy in a language model’s output response (e.g., so as to reduce the likelihood of hallucination) in addition to reduced I / O and latency. As described above, existing technologies tend to increase the number of chunks used in a language model’s input, which brings noise and results in hallucinations in the final response because most of the chunks are irrelevant relative to the query. However, various embodiments not only exclude irrelevant chunks as input to a model, they also only include those chunks necessary or useful to resolve the query (e.g., there are not too many chunks provided to the language model as input) . This reduces noise, and results in higher quality of final output responses from a generator. This is because of multiple technical solutions. One technical solution is labeling a token or word or otherwise determining whether a chunk or other portion of a document is relevant for responding to the query. Other technical solutions include generating a tag indicative of whether more information is needed to respond to the query. For example, each of the tags described herein, such as a <Continue> tag, a <Finish> tag, and a <Terminate> tag is a technical solution that has the technical effect of improved accuracy described herein. This is because these tags, whether used in isolation or together, restrict the input fed to the language model such that only a sufficient amount of relevant information to resolve the user’s query is provided as input. Accordingly, instead of processing multiple irrelevant chunks as existing technologies do, a language model processes only relevant chunks, which decreases the amount of I / O and latency (e.g., because a quantity of computer reads at disk for each chunk retrieval is reduced, which places less wear and tear on the read / write head) . Moreover, some embodiments do not require dedicated prompts and few-shot examples (e.g., example input-output pairs) to be formulated for its input to derive an output. In other words, one technical solution includes the input provided to the language model not being included in any prompt of the language model. Consequently, this results in a lower likelihood of hallucination or inaccuracy because there are no universal prompts for all queries and scenarios.

[0035] Another technical effect is reduced memory consumption and reduced latency based on the types of model used, such as decoder-based transformers. One object of some embodiments is to retrieve enough relevant knowledge concerning the user’s query efficiently. Various embodiments are lightweight and the backbone is a fine-tuned DeBERTa, which reduces  latency and is much smaller than a traditional LLM (e.g., DeBERTa-v3-large is 300M and is much smaller than LLMs which are normally >10B) . By using a token labeler, a document tagger, and token filter (as described in more detail below) , which effectively replaces the LLM functionality in RAG systems, this reduces the quantity of LLM calls, which reduces latency. This is because the computational complexity of these operations decreases since the size and depth of the model is smaller, leading to lower computational costs. Generating responses to queries using LLMs involves running inference algorithms to process input data through the model and produce output predictions. Because the time required for inference scales with the size of the model and the complexity of the task, and models are smaller in various embodiments, this results in lower latency.

[0036] Turning now to FIG. 1, a block diagram is provided showing aspects of an example computing system architecture suitable for implementing some embodiments of the disclosure and designated generally as system 100. The system 100 represents only one example of a suitable computing system architecture. Other arrangements and elements can be used in addition to or instead of those shown, and some elements are omitted altogether for the sake of clarity. Further, as with system 100, many of the elements described herein are functional entities that are implemented as discrete or distributed components or in conjunction with other components, and in any suitable combination and location according to various embodiments.

[0037] Example system 100 includes network (s) 110, which is described in connection to FIG. 12, and which communicatively couples components of system 100 including a retrieval component 102, a token labeler 104, a document tagger 106, a token filter 108, a generative component 112, a presentation component 114, and storage 105. The system 100 is generally responsible for generating a language model (e.g., an LLM) output based on accessing one or more documents. In some embodiments, these components in the system 100 are embodied as a set of hardware circuitry components (e.g., a hardware accelerator, such as a GPU AI hardware accelerator) , compiled computer instructions or functions, program modules, computer software services, a combination thereof, or an arrangement of processes carried out on one or more computer systems, such as computing device 11 described in connection to FIG. 13, and the user device 02a and / or the server 06 of FIG. 12, for example.

[0038] In some embodiments, the functions performed by components of system 100 are associated with one or more personal assistant applications, services, or routines. In particular,  such applications, services, or routines can operate on one or more user devices (such as user device 02a of FIG. 12) , servers (such as server 06 of FIG. 12) , can be distributed across one or more user devices and servers, or be implemented in the cloud. Moreover, in some embodiments, these components of system 100 are distributed across a network, including one or more servers (such as server 06 of FIG. 12) and client devices (such as user device 02a of FIG. 12) , in the cloud, or reside on a user device, such as user device 02a of FIG. 12. Moreover, these components, functions performed by these components, or services carried out by these components are implemented at appropriate abstraction layer (s) such as the operating system layer, application layer, and / or hardware layer of the computing system (s) . Alternatively, or in addition, in some embodiments, the functionality of these components and / or the embodiments described herein are performed, at least in part, by one or more hardware logic components. For example, and without limitation, illustrative types of hardware logic components that can be used include Field-programmable Gate Arrays (FPGAs) , Application-specific Integrated Circuits (ASICs) , Application-specific Standard Products (ASSPs) , System-on-a-chip systems (SOCs) , and Complex Programmable Logic Devices (CPLDs) . Additionally, although functionality is described herein with regards to specific components shown in example system 100, it is contemplated that in some embodiment’s functionalities of these components are shared or distributed across other components.

[0039] Continuing with FIG. 1, the retrieval component 102 is generally responsible for fetching one or more documents from the storage 105 and / or parsing the documents into one or more chunks. In some embodiments, the retrieval component performs preprocessing on documents first, such as tokenization. Tokenization is the process of breaking down a piece of text into smaller units, called tokens. These tokens can be words, phrases, characters, or sub words, depending on the specific task and requirements. For example, the sentence "Tokenization is important for NLP" can be tokenized into [ "Tokenization" , "is" , "important" , "for" , "NLP" ] . A “token” may include word tokens, character tokens, and / or sub-word tokens. Word Tokens: These are tokens representing individual words in the text. Character tokens represent individual characters in the text. Sub word tokens represent smaller units of meaning within words. For instance, in sub word tokenization, the word "tokenization" might be broken down into "token" and "-ization" or even smaller units like "to" , "ken" , "iz" , and "ation" , depending on the specific tokenization algorithm used.

[0040] In some embodiments, the retrieval component 102 first converts / encodes and embeds the user query into a dense vector, and then responsively searches for the most similar chunks (e.g., tokenized chunks) from the storage 105 (e.g., any suitable data store) . In an illustrative example, some embodiments of the retrieval component 102 uses Word Embeddings. Word Embeddings, such as Word2Vec or GloVe, represent words as dense vectors in a continuous vector space, where words with similar meanings are closer together. The retrieval component 102, for example, uses word embeddings to compute the semantic similarity between the user's query and the content of chunks in some embodiments. Chunks that are semantically similar to the query are be considered more relevant.

[0041] In some embodiments, the retrieval component 102 additionally or alternatively uses TF-IDF (Term Frequency-Inverse Document Frequency) . TF-IDF is a statistical measure used to evaluate the importance of a term within a document relative to a collection of documents. The retrieval component 102 in some embodiments uses TF-IDF to rank chunks based on the frequency of terms within them, giving higher weight to terms that are rare across the entire document collection but common within the chunk. Some embodiments alternatively or additionally use BM25 (Best Matching 25) . BM25 is a probabilistic information retrieval algorithm that calculates the relevance score of a document to a query. It takes into account factors such as term frequency, document length, and document frequency. The retrieval component 102 employs BM25 to rank chunks based on their relevance to the user's query in some embodiments, considering factors such as how well the terms in the query match the terms in the chunk.

[0042] Some embodiments of the retrieval component 102 additionally or alternatively use BERT-based Models. BERT (Bidirectional Encoder Representations from Transformers) and its variants are pre-trained language models that can be fine-tuned for various NLP tasks, including information retrieval. The retrieval component 102 can, for example, utilize BERT-based models to encode the user's query and chunks into dense representations and measure their similarity using techniques like cosine similarity or dot product.

[0043] Some embodiments of the retrieval component 102 additionally or alternatively use graph-based techniques. Graph-based methods represent documents and queries as nodes in a graph, with edges indicating relationships between them (e.g., co-occurrence of terms) . Algorithms like PageRank or Personalized PageRank are applied to rank chunks based on their centrality or relevance within the graph structure, in some embodiments. These algorithms, among others, can  be used by the retrieval component 102 to efficiently locate chunks relevant to the user's query, enhancing the overall performance of a retrieval-augmented generation (RAG) system.

[0044] In some embodiments, the retrieval component 102 parses one or more fetched documents from the storage 105 in any suitable manner. For example, in some embodiments, the retrieval component breaks down the text into individual words or tokens based on specific delimiters (such as spaces or punctuation marks) . Each token represents a discrete unit of text, which can then be processed further. The retrieval component 102 additionally or alternatively performs sentence segmentation. This algorithm splits the text into individual sentences based on punctuation marks (e.g., periods, question marks, exclamation marks) . Each sentence can be treated as a separate chunk, allowing for more granular processing. Alternatively or additionally, the retrieval component 102 parses documents into chunks via N-gram Extraction. This algorithm extracts sequences of N contiguous tokens from the text, where N can be any integer. By sliding a window of size N over the text, the algorithm generates chunks that capture local context and relationships between adjacent tokens.

[0045] The retrieval component 102 additionally or alternatively parses documents into chunks via paragraph partitioning. This algorithm divides the text into paragraphs based on indentation or newline characters. Each paragraph can then be treated as a separate chunk, enabling the retrieval of coherent blocks of text. Keyword-based chunking is alternatively or additionally performed in some embodiments. This algorithm identifies key terms or phrases relevant to the user's query within the text and extracts the surrounding sentences or paragraphs as chunks. Keywords can be determined using methods like TF-IDF, word frequency analysis, or semantic similarity. The retrieval component 102 can additionally or alternatively use topic modeling. This algorithm analyzes the latent topics present in the text using techniques like Latent Dirichlet Allocation (LDA) or Non-negative Matrix Factorization (NMF) . Chunks can then be formed around segments of text that are highly associated with specific topics, allowing for more targeted retrieval.

[0046] The token labeler 104 is generally responsible for labeling the tokens and / or words (or indications, such as vectors, of such tokens / words) in the chunks determined to be relevant by the document tagger 106 (and / or the retrieval component 102) that are also relevant relative to the query. In some embodiments, the token labeler 104 additionally eliminates irrelevant tokens and / or words. The token labeler 104 annotates or tags tokens or words within the chunks and / or  documents programmatically to indicate their relevance to the user's query. These annotations are done, for example, by adding specific labels or tags to the tokens in the chunk data structure. For example, if the token labeler 104 identifies a token as relevant, it add a specific tag or label to that token within the chunk data. This tag or label serves as metadata associated with the token, indicating its relevance to the query.

[0047] The token labeler 104 uses any suitable algorithm to determine relevance. In an illustrative example, some embodiments of the token labeler 104 uses Named Entity Recognition (NER) . NER is an information extraction Natural Language Processing (NLP) technique that identifies and classifies tokens / words or “entities” in natural language text into predefined categories. Such predefined categories are indicated in corresponding tags or labels in some embodiments. Entities can be, for example, specific user preferences (e.g., “via road B” ) , specific roads, names of people, specific organizations (e.g., restaurants) , specific locations or landmarks, specific roads, specific times, specific quantities, specific monetary price values, specific music, and the like. Likewise, the corresponding tags or labels can be specific people, organizations, location, time, price (or other invoice data) and the like. NER and / or other NLP functionality can be used to understand and summarize natural language, such as tokenization (breaking text into words or phrases) , stemming (reducing words to their base form) , and part-of-speech tagging (identifying the grammatical role of words) , semantic analysis (to derive meaning of a first word based on context / meaning of other words by the first word) , and / or syntactic analysis (detecting the grammatical structure of a sentence or a sequence of words to determine its syntactic structure, or understand how words are organized in a sentence and how they relate to each other in terms of grammatical rules) . For example, for the query "Who is the CEO of Apple? " NER might label the token "Apple" as an organization entity, indicating its relevance to the query.

[0048] In some embodiments, the token labeler 104 additionally or alternatively performs intent recognition to assist in its processing of labeling. This component identifies the user's intent based on analyzing the output of the user’s query to determine the intent of the user. Once the query is tokenized and parsed, features are extracted from it. These features include words, phrases, syntactic patterns, context, and any other relevant linguistic or contextual information. Intent recognition models typically rely on machine learning techniques, particularly supervised learning. To train the model, a large dataset of labeled examples is prepared. In some embodiments, each labeled example includes a user query along with its corresponding intent label (e.g., "get driving  directions, " "find nearby restaurants" ) . Machine learning models, such as neural networks or statistical classifiers, are trained on the labeled dataset. During training, the model learns to recognize patterns in the features extracted from the user queries / prompts and associates them with the correct intent labels. The features extracted from the user queries / prompts are transformed into a numerical representation suitable for input into the machine learning model. In some instances, this involves techniques such as word embeddings or vectorization. Once trained, the intent recognition model is used to predict the intent of new, unseen user queries. The model takes the numerical representation of the user query features as input and outputs a probability distribution over the possible intent labels. A decision is made based on the output probabilities from the model. A threshold is applied to the probabilities to determine the most likely intent label for the user query / prompt. If the probability of a particular intent label exceeds the threshold, that label is assigned to the user query.

[0049] In some embodiments, the token labeler 104 uses additional or alternative functionality, such as Part-of-Speech (POS) tagging, Dependency Parsing, Keyword Extraction, Semantic Role Labeling (SRL) , and / or Topic Modeling. Dependency parsing analyzes the syntactic structure of a sentence by identifying the relationships between words. For example, in the query "How does climate change affect ecosystems? " dependency parsing might label the token "affect" as a verb and establish its dependency relationship with "climate change" and "ecosystems, " highlighting its role in the query. Keyword extraction identifies the most relevant words or phrases in a document based on their frequency or importance. For example, for the query "What is the capital of France? " keyword extraction might label the token "capital" and "France" as key terms, indicating their significance in understanding the query. Semantic Role Labeling (SRL) identifies the semantic roles of words or phrases in a sentence, such as agent, patient, or instrument. For example, for the query "Who wrote the book 'To Kill a Mockingbird' ? " , SRL might label the token "wrote" as the predicate, "who" as the agent, and "book 'To Kill a Mockingbird' " as the patient, elucidating their roles in the query.

[0050] The document tagger 106 is generally responsible for generating one or more tags for each chunk and / or document, which indicates whether more information (e.g., chunks and / or documents) is needed to respond to the user’s query. In other words, the document tagger 106 determines whether another round of retrieval is required. For example, if enough information is retrieved for solving the query, the document tagger 106 marks a chunk as <Finish> and then  user’s query and the retrieved information is then passed straight to the generative component 112 for further processing. If the tag indicates that there needs to be more information to answer the query (e.g., tagged as <Continue>) , some embodiments used the labeled tokens (those words / tokens labeled by the token labeler 104) together with the original user query to construct a new query, indicating next-hop chunk via the token filter 108, as described in more detail below. In some embodiments, the one or more tags includes a useless or irrelevant tag (e.g., <Terminate>) , which means that the chunk and / or document is not used for processing the query. For example, various embodiments stop searching for the successor branches from this query. When sufficient chunks and / or documents have been found to respond to the user query and stops retrieving, various embodiments feed all the retrieved information to the generative component 112 (e.g., a generator of an LLM) to generate the final response (e.g., an answer to a user question) .

[0051] In some embodiments, the document tagger 106 works via any suitable algorithm, such as via keyword matching, semantic analysis, and entity recognition, to label chunks or documents as <Continue>, <Finish>, or <Terminate>. For example, in some embodiments, the document tagger 106 employs keyword matching to identify relevant terms or phrases within the chunk that match those present in the query. It then assesses the completeness of the match to determine if the chunk contains sufficient information to address the query. For example, for the query "Who directed the film Polish-Russian War? " The chunk might read "The film Polish-Russian War was directed by Dorota. " The Document Tagger 106 recognizes the presence of the keyword "directed" and the director's name "Dorota" in the chunk. Since this information partially answers the query but may require additional details (e.g., the director's mother) , it labels the chunk as <Continue>.

[0052] In another example, the Document Tagger 106 performs semantic analysis to understand the context and meaning of the information in the chunk relative to the query. It looks for semantic relationships and connections between the content of the chunk and the query to determine its relevance. For example, in the query “Who is the mother of the director of the film Polish-Russian War? "where the chunk is " The director of the film Polish-Russian War is Dorota, ” the Document Tagger 106 recognizes the semantic relationship between the director ( "Dorota" ) and the query. Since the chunk provides a complete answer to the query, it labels the chunk as <Finish>.

[0053] In another example, the Document Tagger 106 utilizes named entity recognition (NER) to identify entities such as persons, organizations, or locations mentioned in the chunk. It then evaluates the relevance of these entities to the query to determine the label. For example, for the query "Who is the mother of the director of the film Polish-Russian War? , ” where the chunk is " The director of the film Polish-Russian War, Dorota, was born in Warsaw, ” the Document Tagger 106 identifies the named entity "Dorota" as the director and "Warsaw" as a location. Since the chunk provides relevant information about the director but may not include details about their mother, it labels the chunk as <Continue>.

[0054] In some embodiments, the tag (s) produced by the document tagger 106 is additionally or alternatively based on quantitative metric thresholds being met. For example, a chunk and / or document may be tagged as <Finish> if a threshold quantity (e.g., 20) of labels (produced by the token labeler 104) exist in a given chunk and / or document, indicating a threshold quantity of words or token are labeled as being relevant to the query.

[0055] The token filter 108 is generally responsible for augmenting the user’s original query and / or forming a new query by incorporating tokens or words labeled as relevant (or otherwise indicating relevance) (e.g., as labeled by the token labeler 104) based on the document tagger 106 having generated a specific tag. In other words, the token filter 108 generates a new query for the next-round of retrieval (e.g., an access of a new document and / or a new chunk within the same document) . Given the current / original query and the currently retrieved chunk, the token filter 108 replaces at least part of the natural language characters in the current query with the labelled tokens from the chunk. Then the token filter 108 generates a new query for the next-round of retrieval. For example, if the document tagger 106 marked a chunk as <Continue>, meaning that the information in the chunk cannot fully resolve the query and another round of retrieval is needed, then the token filter formulates a new query by incorporating the previously labeled words or tokens into the original query. This new query is used to retrieve new information that cannot be obtained in the previous round of retrieval. This process iteratively repeats until all pertinent information / chunks is acquired, after which the generative component 112 (e.g., an LLM generator) consolidates the data to respond to the query.

[0056] The token filter 108 uses any suitable algorithm to augment an original user query to formulate a new query. In some embodiments, for example, the token filter 108 uses Token Replacement, Query Expansion, Query Restructuring, and / or Query Synthesis algorithms. For  Token Replacement, the token filter 108 identifies tokens in the original query that correspond to the labeled information extracted from the retrieved chunks. It then replaces these tokens with the relevant information to create a new query that focuses on acquiring additional information. For example, the original query might be "Who directed the film Polish-Russian War? " where the retrieved chunk is "The film 'Polish-Russian War' was directed by Dorota. " Labeled Information is “Dorota" (Director) . New Query is "Who is the mother of Dorota? "

[0057] Regarding Query Expansion, the token filter 108 expands the original query by incorporating additional terms or phrases extracted from the retrieved chunks. It aims to refine the query to obtain more specific and targeted information in subsequent retrieval rounds. For example, where the original query is "Who is the mother of the director of the film Polish-Russian War? " and the retrieved chunk is "The director of the film Polish-Russian War, Dorota, has won several awards, ” and the labeled Information is "Dorota" (Director) , the new query is “What awards has Dorota won as the director of the film Polish-Russian War? "

[0058] With respect to Query Restructuring, the token filter 108 restructures the original query to prioritize the acquisition of missing information. It reorders or modifies the query to ensure that subsequent retrieval rounds focus on resolving the unanswered aspects of the user's query. With respect to Query Synthesis, the token filter 108 synthesizes a new query by combining elements of the original query with relevant information extracted from the retrieved chunks. It aims to create a cohesive and comprehensive query that addresses all aspects of the user's information needs. These algorithms enable the token filter 108 to dynamically adapt the user query based on the information obtained from previous retrieval rounds, facilitating a more focused and effective search for relevant knowledge.

[0059] The generative component 112 is generally responsible for taking an original user’s query, relevant portion (s) (e.g., chunks) of the fetched document (s) in 105, and / or an augmented / new query formulated by the token filter 108 as input to derive a response (e.g., an answer to a user’s question) . In some embodiments, the generative component 112 represents the generative component of one or more language models. In some embodiments, the one or more language models represent one or more machine learning models or other models that perform NLP. In some embodiments, a “language model” is a set of statistical or probabilistic functions that (e.g., collectively) performs Natural Language Processing (NLP) in order to understand, learn, and / or generate human natural language content. For example, a language model is a tool that  determines the probability of a given sequence of words occurring in a sentence (e.g., via Next Sentence Prediction (NSP) or MLM) or natural language sequence. Simply put, it is a tool that is pre-trained to predict the next word in a sentence or other natural language character set. However, instead of predicting the next word in a sentence, the language model is trained, tuned, or prompted to generate responses to user questions or commands associated with directions or routes, as described in more detail below.

[0060] A language model is referred to as a “large” language model ( “LLM” ) when it is trained on enormous amounts of data. Some examples of LLMs are GOOGLE’s BERT and OpenAI’s family of generative pre-trained transformer (GPT) networks, which include GPT-2, GPT-3, and GPT-4. GPT-3, for example, includes 175 billion parameters trained on 570 gigabytes of text. These models have capabilities ranging from writing a simple essay to generating complex computer codes –all with limited to no supervision. Accordingly, an LLM is a deep neural network that is very large (e.g., billions to trillions of parameters) and understands, processes, and produces human natural language from being trained on massive amounts of text. These models predict future words in a sentence based on sentences in the corpus of text they were trained on, allowing them to generate sentences which can be similar to how humans talk and write. In some embodiments, the LLM is pre-trained (e.g., via NSP and MLM on a natural language corpus to learn English) , prompt-tuned, fine-tuned, and / or functions via prompt engineering, as described in more detail below.

[0061] The generative components of LLMs leverage the Transformer architecture, self-attention mechanism, positional encoding, feedforward neural networks, layer normalization, residual connections, and various sampling strategies to produce coherent and contextually relevant text based on the input they receive. GPT models, for instance, are built upon the Transformer architecture, which is a neural network architecture designed for sequence-to-sequence tasks. It includes an encoder and a decoder, where the encoder processes the input sequence and the decoder generates the output sequence. At the core of the Transformer architecture is the self-attention mechanism. This mechanism allows the model to weigh the importance of different words in the input sequence (e.g., the augmented query) when generating the output. Each word in the input sequence is associated with three vectors: Query, Key, and Value. These vectors are learned during the training process. The self-attention mechanism  computes a weighted sum of the values, where the weights are determined by the compatibility (dot product) between the query of a given word and the keys of all other words in the sequence.

[0062] To capture different aspects of the input sequence, the self-attention mechanism is often applied in parallel multiple times, each with different sets of learned parameters. These parallel attention mechanisms are called "attention heads" . After the attention is computed independently by each head, the results are concatenated and linearly transformed. Since the Transformer architecture does not inherently understand the order of the input sequence, positional encodings are added to the input embeddings to provide information about the position of each word in the sequence. These positional encodings are sinusoidal functions of different frequencies and are added to

[0063] After applying self-attention, the Transformer architecture includes feedforward neural networks (that typically include of one or more fully connected layers with a non-linear activation function like ReLU) to process the information from the attention mechanism further.

[0064] Each sub-layer in the Transformer architecture, including the self-attention layer and the feedforward neural network layer, is followed by layer normalization and connected with a residual connection. Layer normalization helps stabilize the training process, and residual connections facilitate the flow of gradients during backpropagation.

[0065] During text generation, the model takes the original user’s query, relevant portion (s) of documents, and / or the augmented query generated by the generative component 112 as input and iteratively predicts the next token (e.g., word) in the sequence. At each step, the model uses the previously generated tokens as context to generate the next token. This process continues until a special token indicating the end of the sequence is generated, or until a maximum sequence length is reached. During text generation, in some embodiments, various sampling strategies are employed to diversify the generated text. These include greedy decoding (choosing the token with the highest probability at each step) , beam search (keeping track of the top-k most likely sequences at each step) , nucleus sampling (sampling from the most likely tokens until a certain cumulative probability threshold is reached) , and temperature scaling (adjusting the probabilities of tokens by scaling their logits) .

[0066] In some embodiments, LLMs are fine-tuned on specific tasks or datasets to adapt them to particular domains or tasks. For example, an LLM is fine-tuned to generate responses to original queries where various relevant documents and / or chunks are used as part of the input to  the model. During fine-tuning, the parameters of the model are updated using task-specific data and objectives, which allows the model to generate text that is more tailored to the target task or domain. For instance, the LLM is fed query & chunk response pairs, where, for example, some pairs are negative (e.g., incorrect responses and / or chunks for given queries) , and some pairs are positive (e.g., correct responses and / or chunks for the given queries) so that the model learns the weights indicative of learning which particular responses and / or chunks should be produced given a specific query.

[0067] The presentation component 120 is generally responsible for causing presentation of information. For example, in some embodiments, the presentation component 120 causes presentation of a natural language output generated by the generative component 112. In some embodiments, the presentation component 120 comprises one or more applications or services on a user device, across multiple user devices, or in the cloud. For example, in one embodiment, presentation component 120 manages the presentation of content to a user across multiple user devices associated with that user. Based on content logic, device features, associated logical hubs, inferred logical location of the user, and / or other user data, presentation component 120 determines on which user device (s) content is presented, as well as the context of the presentation, such as how (or in what format and how much content, which can be dependent on the user device or context) it is presented and / or when it is presented. In particular, in some embodiments, presentation component 120 applies content logic to device features, associated logical hubs, inferred logical locations, or sensed user data to determine aspects of content presentation.

[0068] In some embodiments, presentation component 120 generates user interface features (or causes generation of such features) associated with pages. Such features can include user interface elements (such as graphics buttons, maps sliders, menus, audio prompts, alerts, alarms, vibrations, pop-up windows, notification-bar or status-bar items, in-app notifications, or other similar features for interfacing with a user) , queries, and prompts. In some embodiments, a personal assistant service or application operating in conjunction with presentation component 120 determines when and how to present the content.

[0069] Example system 100 also includes storage 105. Storage 105 generally stores documents, computer instructions (for example, software program instructions, routines, or services) , data structures, and / or models used in embodiments of the technologies described herein. In some embodiments, the storage 105 represents data stores that represent external knowledge or  information in a RAG system. For example, the storage 105 represents a data store that is external to or outside of the knowledge base that a language model (e.g., the generative component 112) trains on (i.e., it is not a part of the language model’s training data) . In some embodiments, storage 105 represents any suitable data repository or device, such as a database, a data warehouse, RAM, cache, disk, RAID, and / or a storage network (e.g., Storage Area Network (SAN) ) . In some embodiments, storage 105 includes data records (e.g., database rows that represent each cluster) or other data structures (e.g., key-value pairs) that contain any suitable information described herein. In some embodiments, each record is called or requested and returned, over the computer network (s) 110, depending on the component needing it, as described herein.

[0070] FIG. 2 is a block diagram of a pipeline 200 illustrating the inputs and outputs to derive an output response 214, according to some embodiments. In some embodiments, one or more components of FIG. 2 represent one or more components of the system 100 of FIG. 1. For example, in some embodiments, the retrieval component 202 represents or includes the functionality of the retrieval component 102 of FIG. 1, the document tagger and token labeler 209 represents or includes the functionality of the token labeler 104 and the document tagger 106 of FIG. 1, the token filter 208 represents or includes the functionality of the token filter 108 of FIG. 1, the storage 105 represents the data store (s) 206 of FIG. 1, and / or the language model (s) 212 represents or includes the functionality of the generative component 112 of FIG. 1.

[0071] At a first time, the retrieval component 202 receives an original query 201 (e.g., a natural language question or command issued by a user) . The original query 201 represents any suitable type of query, such as a multi-hop query. In general, multi-hop queries are categorized as one of the categories below or a combination of some -composition: the next hop relies on one or more answers to previous questions. For example, “Who is the mother of the director of film Polish-Russian War (Film) ? ” To find the mother, the algorithms needs to identify the director of the film. Comparison: The answer is generated by comparing information from two different chunks. For example, “Were Scott Derrickson and Ed Wood of the same nationality? ” To get the answer, the algorithms needs to compare the nationality of both Scott Derrickson and Ed Wood.

[0072] Responsive to receiving the original query 201, the retrieval component 202 fetches one or more documents (e.g., over the network (s) 110 and from the storage 105) and parses the one or more documents into one or more chunks 203. For example, the retrieval component 202 parses a first document into multiple chunks 203. The document tagger and token labeler 209 then  takes the one or more chunks as input to generate a tag for each chunk and / or document, which indicates whether more information is needed to execute the original query 201.

[0073] If the one or more chunks are not relevant, the document tagger and token labeler 209 tags the chunk (s) 203 as not relevant (e.g., places a <Terminate> tag next to the chunk (s) ) , as described in more detail below. Responsively, the document tagger and token labeler 209 programmatically calls the retrieval component 202 to engage in another round of retrieval to fetch additional chunks and / or documents. If the one or more chunks 203 are relevant, the document tagger and token labeler 209 determines whether the retrieved chunk (s) 203 are complete or not complete, as described above, for example, with respect to the document tagger 106. That is, the document tagger 106 determines whether sufficient information is available within the chunk (s) 203 to execute or resolve the original query 201. If sufficient information is not available in the chunk (s) 203, then the document tagger and token labeler 209 tags the chunk (s) 203 as relevant via 211 (e.g., via a <Continue> tag) , as described in more detail below. Responsively, the token labeler 104, for example, performs 215 by annotating the chunk (s) 203 with one or more indications (e.g., tags) that indicate which tokens and / or words are relevant to resolve the original query 201.

[0074] Responsively, the token filter 208 takes the relevant token (s) 215, the original query 201, and / or the chunk (s) 203 as input to generate an augmented query 210 (e.g., the original query, some words of which have been replaced by tokens labeled as relevant by the document tagger and token labeler 209) .

[0075] The one or more language models (s) 212 take, as input, the augmented query 210 and / or the original query as input depending on the tag (e.g., <Continue>, <Finish>, or <Terminate>) generated by the document tagger 209. The one or more language models 212 then generate an output response 214, which represents a response to the original query 201 (and / or the augmented query 210) . Responsively, the token filter 208 programmatically calls the retrieval component 202 to return the augmented query 210 to the retrieval component 202. Responsively, the retrieval component 202 fetches a second set of chunk (s) that are different or contain different content relative to the chunk (s) 203. Such second set of chunk (s) are different chunks of the same document as 203 in some embodiments. Alternatively or additionally, in some embodiments, the second set of chunk (s) are different chunks of a different document as 203.

[0076] After one or more rounds of retrieval, if the document tagger and token labeler 209 determines that the chunk (s) 203 (and / or the second set of chunks described above) are complete (i.e., one or more chunks contain enough information to resolve / execute the original query 201) , the document tagger and token labeler 209 generates the tag (s) 213 for the relevant and complete chunk (s) . For example, as described in more detail below, the tag (s) 213 represents a <Finish> tag in some embodiments.

[0077] Responsively, the document tagger and token labeler 209 programmatically calls the language model (s) 212 and the language model (s) 212 take, as input, the chunk (s) that have been tagged as relevant and complete (as indicated in 213) and the original query. Responsively, the language model (s) 212 generates an output response 214, which is indicative of a response to the original query 201, such as an answer to a user’s question.

[0078] FIG. 3 is a schematic diagram illustrating how chunks of one or more documents and tags are used to augment an original query, according to some embodiments. At a first time, the document tagger 106 receives a first chunk 306, but determines that the chunk 306 is irrelevant to resolve or execute the query 302 and so tags the chunk 306 with a “<Terminate>” tag 308. Given the initial query (e.g., the original query 201 of FIG. 2) “Who is the mother of the director of the film Polish-Russian War (Film) ? ” and the retrieved chunk 310 from the retrieval component 102 “Polish-Russian War …by Dorota, ” the token labeler 104 labels the useful information –i.e., 310-1, 310-2, and 310-3 –that could be useful to (at least partially) answer the query 302 (marked as underlined in FIG. 3. ) . Specifically, the token labeler 104 marks the words “Polish-Russian War, ” “directed, ” and “Xawery Zulawski” in the block 310 as relevant to the query 302 (e.g., via tagging or otherwise annotating such words) . The document tagger 106 additionally generates a “<Continue>” tag 311 for the chunk 310.

[0079] Based on the token labeler 104 labeling the words 310-1, 310-2, and 310-3 as relevant within the chunk 310, the token filter 108 generates a new query 312 by augmenting the initial query 302. Specifically, the token filter 108 keeps the phrase “Who is the mother of” from the initial query 302 and replaces the rest of the original phrase (i.e., “the director of fil Polish-Russian War (Film) ? ” ) with the labeled tokens 310-3 (i.e., “Xawery Zulawski” ) . In other words, FIG. 3 illustrates that the token filter 108 incorporates the labelled tokens “Polish-Russian War directed Xawery ” to the initial query, by filtering out the know question “the director of  film Polish-Russian War (Film) ” with the labelled tokens “Xawery , ” which gives the new query 312 “Who is the mother of Xawery ? ”

[0080] Then the token labeler 104 labels the tokens from the chunk 314 that are useful / relevant to answer the new query 312. In some instances, the reasoning information is not always grammatically perfect since some embodiments focus on the information quantity, and such imperfect information is more robust for training.

[0081] As illustrated in FIG. 3, the document tagger 106 marks the retrieved chunks as <Terminate>, <Continue>, or <Finish>, in order to decide whether the current chunk is informative enough to resolve the query 302, and whether another round of retrieval is required. The meanings of the tags are as follows: <Terminate> marks a chunk as irrelevant or incorrect. Such chunk is noisy for the generative component 112 (e.g., a final LLM-based generator) to generate a faithful answer or response. The document tagger 106 excludes these chunks before feeding into the generative component 112. Accordingly, the retrieval component 102 is not guaranteed to retrieve chunks that are all informative. As described herein, in some embodiments, the retrieval component 102 leverages lexical and / or semantic similarity to retrieve chunks from a massive number of chunks for the purpose of efficiency.

[0082] The “<Continue>” tag signals that the chunk contains some useful information to partially answer the query, but still requires another round of retrieval (e.g., access of a next chunk and / or document) to obtain more information in order to fully resolve the query. The “<Finish>“tag means the chunk, combined with previously retrieved information, is sufficient to answer the query, prompting the feeding of data into the generative component 112 for response (e.g., answer) generation.

[0083] FIG. 4 illustrates a pipeline 400 for classifying each chunk with a tag to decide a next action, according to some embodiments. In response to receiving a query 402, some embodiments retrieve one or more documents via 404. Responsively, the retrieval component 102 parses one or more documents into chunks 406 and 408. For example, the retrieval component 102 parses a first document into a first chunk 404 (e.g., chunk 306 of FIG. 3) representing a first sentence or paragraph in the first document and a second chunk 408 (e.g., chunk 308 of FIG. 3) representing a second sentence or paragraph in the first document. The chunk 406 contains the information 412 (e.g., natural language words, sentences, paragraphs) . The document tagger 106 responsively annotates the information 412 with the <Terminate> tag 410, which indicates that the  information 412 is not relevant and the pipeline 400 stops. In other words, it is impossible (or not feasible) to generate a response and so some embodiments stop exploring this branch.

[0084] The document tagger 106 additionally annotates the information 416 within the chunk 408 with the <Continue> tag 414. Accordingly, more information is needing to be retrieved in another retrieval round. Responsively, additional information 420 is retrieved from another third chunk (not illustrated) . After such retrieval of the information 420, the document tagger 106 annotates the information 420 with the <Finish> tag 418, which means that enough information has been retrieved or analyzed. Accordingly, various embodiments are ready for reasoning to generate a response (e.g., via the generative component 112) .

[0085] In other words, FIG. 4 illustrates how the document tagger 106 assigns tags to chunks. The <Terminate> tag 410 is assigned to the first chunk 406 as the information 412 from the chunk 406 is not helpful to execute the query 402. The second chunk 408 contains information 416 (e.g., the name of the director of the film illustrated in FIG. 3) to partially answer the query 402, but another round of retrieval is required to get more information. In some embodiments, a third chunk (not illustrated) comes from the second round of retrieval, and it contains full information 420 to answer / respond to the query 402. Responsively, the document tagger 106 marks it as <Finish> via 418.

[0086] FIG. 5 is a schematic diagram illustrating how a new query is formulated based on a three-hop comparison case, according to some embodiments. FIG. 5 additionally illustrates how the token filter 108 works in a comparison case, as opposed to a composition case as illustrated in FIG. 3. FIG. 5 illustrates a complex 3-hop question 502 “How were the people that the Somali Muslim Ajuran Empire made coins to proclaim independence from, expelled from the country where Star Cola is produced? ” which requires obtaining at least three information sets to resolve the question 502. The first round of retrieval returns two chunks 504 “The Somali …Portuguese” and 506 “Star Cola …Co., Ltd” . The Token labeler 104 marks the relevant tokens (e.g., the words marked in bold respectively) . Then, the Token filter 108 combines the selected tokens (known information) with the initial question 502 and filters out resolved information in the initial question 502, resulting in the new query 510 “How were the people that expelled from Portuguese Myanmar? ” . After that, various embodiments retrieve and search for the next relevant chunk with the new query 510.

[0087] The token filter 108 is useful when a next-hop query is overwhelmed with already-known information, as it can prevent the retrieval component 102 from being swamped by redundant details. For instance, without the token filter 108, by simply concatenating the labelled tokens with the initial query as the new query for the next retrieve, we get 508 “How were the people that the Somali Muslim Ajuran Empire made coins to proclaim independence from, expelled from the country where Star Cola is produced? Somali Muslim Ajuran Empire Ottomans new coinage independence Portuguese, Star Cola produced Myanmar. ” Using this query in 508, a retriever would likely rank the chunk that contains the information to answer the question low (e.g., 14th place) among all retrieved chunks. However, after the token filter 108 performs its functionality, various embodiments obtain a much dense and focused query 510: "How were the people expelled from Portuguese Myanmar? " The oracle chunk that can answer this question jumps to a higher rank (e.g., from 14th place to 2nd place) , significantly easing its identification by the retrieval component 102. This reorganization of ranks chunks is useful because in some embodiments the generative component 212 takes as input only the highest N quantity of chunks, which indicates it only takes the most relevant chunks. In some embodiments, such rank of the chunks is based on a score for each chunk, where the score is directly proportional to the quantity and / or semantic relevancy (e.g., semantically similar words relative to the query) of words in the chunk relative to word (s) in the query.

[0088] FIG. 6 is a pipeline 600 representing how a language model 608 generates an output response 610, according to some embodiments. In some embodiments, the language model 608 represents the language model (s) 212 of FIG. 2 and / or the generative component 112 of FIG. 1. The language model 608 takes, as input, a query 602 and the relevant chunks 604 and 606 (or indications of such information, such as vector embeddings) . In some embodiments, the query 602 represents the original query 201 of FIG. 2. Alternatively or additionally, in some embodiments the query 602 represents the augmented query 210 of FIG. 2. In some embodiments, the relevant chunks 604 and 606 represents the chunks that the document tagger 106 has tagged as relevant (e.g., via a <Finish> tag and / or a <Continue> tag) , and / or represent chunks that contain tokens which have been marked as relevant by the token labeler 104. In other words, after all the required chunks for answering the user query are collected (chunks 604 and 604) , various embodiments combine them with the query 602 (e.g., an original query) , and utilize LLM to reason and generate the final answer, as represented by the output response 610. For example, the output response 610  in some embodiments represents generative natural language text, such as a natural language answer to the query 602.

[0089] FIG. 7 is a pipeline 700 illustrating how a machine learning model is trained or fine-tuned to generate token labels (s) , chunk tag (s) , and new queries, according to some embodiments. In some embodiments, the token label (s) 706 represent the predictions or labeling that the token labeler 104 performs. Likewise, in some embodiments, the chunk tag (s) 708 represent the predicted or generated tag (s) that the document tagger 106 produces. In some embodiments, the new query 712 represents the augmented query that the token filter 108 generates.

[0090] In a first step, some embodiments initialize the token labeler 104, the document tagger 106, and token filter 108 with a machine learning model (e.g., DeBERTa-v3-Large) , and fine-tune them on downstream tasks separately. For the token labeler 104 and the document tagger 106, some embodiments fine-tune them with token labeling task (i.e., generate the token label (s) 706) to extract helpful tokens, and chunk tagging (i.e., the chunk tag (s) 708) as sequence labeling task. For the token filter 108, some embodiments fine-tune it with token labeling task (i.e., token label (s) 706) to pick next query tokens (i.e., new query 712) from previous query 712 and known information.

[0091] As described above, some embodiments use Llama3-70B to construct the training data with multi-hop training dataset. Llama3-70B is a standard decoder-only transformer architecture. Llama 3 uses a tokenizer with a vocabulary of 128K tokens that encodes language much more efficiently, which leads to substantially improved model performance. To improve the inference efficiency of Llama 3 models, these models adopt a grouped query attention (GQA) across the 70B size. These models are pre-trained on sequences of 8, 192 tokens, using a mask to ensure self-attention does not cross document boundaries.

[0092] In a decoder-only Transformer, the architecture is designed specifically for tasks like language generation, where the model generates output one token at a time, conditioned on previously generated tokens. The decoder-only transformer includes a decoder stack, self-attention mechanism, positional encoding, Feedforward Neural Networks, Layer Normalization, output layer, and softmax activation. The decoder stack includes a stack of identical layers. Each layer contains multiple sub-layers, including self-attention and feedforward neural networks. Just like in the encoder-decoder architecture, the decoder also uses self-attention layers. However, in the  decoder, each position in the decoder only attends to positions before it in the sequence. This is implemented through masking to prevent attending to future positions, ensuring auto-regressive property. Similar to the encoder, positional encoding is added to the input embeddings (e.g., a vector representing the input) to give the model information about the position of tokens in the sequence (e.g., a position of a word in a sentence) . Each layer in the decoder contains a feedforward neural network. This network is applied independently to each position, and it typically includes two linear transformations with a non-linear activation function in between. Layer normalization is applied after each sub-layer, such as self-attention and feedforward networks. It helps stabilize the training process. At the top of the decoder stack, there is an output layer that predicts the likelihood of each token in the vocabulary given the context encoded in the decoder stack. The output layer typically uses a softmax activation function to convert the logits into a probability distribution over the vocabulary. During training, the decoder receives the entire target sequence as input, with the goal of predicting the next token in the sequence at each time step. During inference, the decoder generates tokens autoregressively, meaning it generates one token at a time and feeds it back into the model to generate the next token until a special end-of-sequence token is generated or a maximum sequence length is reached.

[0093] Continuing with FIG. 7, given a multi-hop complex question, some embodiments first decompose it into multiple single-hop questions, along with its dependencies and related chunk. With respect to token labeling in 706, given a single-hop question (i.e., current query 702) and corresponding chunk (i.e., chunk in 704) (i.e., a query-chunk pair) , various embodiments prompt Llama3-70B or other machine learning model (e.g., a GPT-4 LLM) to label the important tokens (i.e., via the token label (s) 706) , which helps answer the question. In other words, the token label (s) 706 represent a predicted label (e.g., a relevance tag) for one or more tokens within the chunk 704 given query-chunk pairs. The "current query" in 702 refers to the query that the system is currently processing or attempting to answer. This query is typically refined or augmented based on the results of previous retrieval rounds to gather more relevant information or address specific aspects of the user's inquiry.

[0094] With respect to chunk tagging, some embodiments give tags to each query-chunk pair, denoted as the chunk tag (s) 708. For the hard-negative chunk (i.e., there are no relevant tokens or chunks) , some embodiments tag them <Terminate>, for the intermediate helpful chunk, where  more information is needed, some embodiments tag them <Continue>, and for the last helpful chunk where no more information is needed, various embodiments tag them <Finish>.

[0095] With respect to query filtering, given a complex multi-hop question, such as the previous query 710, and the previous labelled tokens 706, various embodiments prompt Llama3-70B or other model to identify which part of the previous query 710 has already been answered, and what newly added information should be retrieved. Various embodiments then construct the new next-hop question (i.e., the new query 712) by filtering out the already answered part. The “previous query" in 710 stands for the previous query that was processed in earlier retrieval rounds. Some embodiments use the information obtained from the previous query 710 to refine the current query 702 or to determine which parts of the query have already been addressed. This iterative process allows the system to conduct multi-hop reasoning, where each subsequent query builds upon the knowledge acquired from previous queries. In an illustrative example, consider the query, "Who won the Nobel Prize in Physics in 2020? " After retrieving the answer, various embodiments identify that part of the query has been answered. So, for the next-hop question, it might filter out the year and focus on asking, "What groundbreaking discovery led to the Nobel Prize win in Physics? "

[0096] With respect to negative samples generation: With constructed query, some embodiments sample the most relevant but not helpful chunks with retrieval component 102, as the hard-negative chunk. Negative samples are examples of chunks that are relevant to the query 710 but not helpful in answering it. These samples are used during training to teach the model to distinguish between useful and irrelevant information. With the newly constructed query 712, the various embodiments sample chunks from the retrieved documents that are highly relevant (to ensure they are challenging) but ultimately unhelpful in answering the query. These chunks serve as "hard-negative" examples during training. Continuing with the previous example, imagine that during the retrieval process, the system retrieves information about a famous physicist's biography. While this information may be relevant to physics, it does not answer the query directly. Therefore, it could be used as a negative sample during training to help the model understand what kind of information is not useful for answering questions about Nobel Prize winners.

[0097] FIG. 8 is a flow diagram of an example process 800 for training (e.g., fine-tuning) one or more machine learning models to predict one or more token labels and augmented queries, according to some embodiments.. The process 800 (and / or any of the functionalities described  herein) is performed by processing logic that comprises hardware (for example, circuitry, dedicated logic, programmable logic, microcode, and the like) , software (for example, instructions run on a processor to perform hardware simulation) , firmware, or a combination thereof. Although particular blocks described in this disclosure are referenced in a particular order at a particular quantity, it is understood that any block can occur substantially parallel with or before or after any other block. Further, more (or fewer) blocks can exist than illustrated. Added blocks can include blocks that embody any functionality described herein (for example, as described with respect to FIGS. 1-7) . The computer-implemented method, the system (that includes at least one processor and at least one computer readable storage medium) , and / or the computer readable medium as described herein can perform or be caused to perform the process 600 or any other functionality described herein.

[0098] Per block 802, some embodiments first receive a multi-hop query. A "multi-hop" query refers to a type of complex query that cannot be answered directly from a single piece of information but requires gathering and synthesizing information from multiple sources or steps. In other words, answering a multi-hop query involves reasoning across multiple intermediate steps or "hops" to arrive at the final answer. Each "hop" represents a step in the reasoning process where the system retrieves relevant information based on the current state of knowledge and uses it to further refine the query or gather additional context. The process continues iteratively until enough information is collected to address the original query comprehensively.

[0099] Per block 804, particular embodiments decompose (e.g., parse) the multi-hop query into multiple single-hop queries. Take, for instance, the multi-hop query: "How were the people that the Somali Muslim Ajuran Empire made coins to proclaim independence from, expelled from the country where Star Cola is produced? " Various embodiments decompose this query can be into multiple single-hop queries as follows: Single-hop query 1: "Who made coins to proclaim independence from the country? " Single-hop query 2: "How were the people expelled from the country where Star Cola is produced? " Single-hop query 3: "What is the relationship between the Somali Muslim Ajuran Empire and the country where Star Cola is produced? " Each of these single-hop queries focuses on obtaining specific pieces of information related to the original multi-hop query. As described above, certain models, such as LLMs or other decoder-based transformers decompose these queries in some embodiments.

[0100] Per block 806, for each single-hop query, some embodiments generate single-hop query –chunk pairs. Once the single-hop queries are defined, some embodiments retrieve relevant chunks of information from a knowledge base or data source. These chunks may be paragraphs, documents, or any other unit of text that contains potentially useful information. Various embodiments then match each single-hop query with the corresponding retrieved chunk. This pairing creates single-hop query-chunk pairs, where each pair includes a single-hop query and the chunk of text that may contain relevant information to answer that query. Optionally, some embodiments label each pair to indicate its utility or relevance for answering the query. For example, pairs may be labeled as "helpful” (or “relevant” ) "partially helpful, " (or “partially relevant” ) or "irrelevant" based on the extent to which the chunk addresses the query. Positive or “helpful” labeled single-hop query-chunk pairs represent the ground truth (i.e., the chunks that are most helpful in resolving the query) . Whereas negative (e.g., “irrelevant” or “partially helpful” ) samples do not represent the full ground truth.

[0101] Per block 808, particular embodiments train a machine learning model to predict the token label (s) (e.g., token label (s) 706 of FIG. 7) by learning weights associated with feature (s) of the single-hop query –chunk pairs (and / or the labels as “helpful, ” “not helpful, ” and “irrelevant” ) . Each node in a neural network, for example, is associated with or include and / or a weight tensor, which include weight values. A “weight” in the context of machine learning represents the importance or significance of a feature (e.g., particular words) or feature value for prediction. For example, each feature (e.g., particular words or chunks) may be associated with an integer or other real number where the higher the real number, the more significant the feature is for its prediction. In some aspects, a weight in a neural network represents the strength of a connection between nodes or neurons from one layer (an input) to the next layer (ahidden or output layer) . A weight of 0 may mean that the input will not change the output, whereas a weight higher than 0 changes the output. The higher the value of the input or the closer the value is to 1, the more the output will change or increase. Likewise, there can be negative weights. Negative weights may proportionately reduce the value of the output. For instance, the more the value of the input increases, the more the value of the output decreases. Negative weights may contribute to negative scores. For example, a particular word sequence may be highly correlated with a specific token being labeled as relevant and so neural network layers or nodes representing the word or word  sequence may be weighted higher so that that this data is activated or taken into account when making a final prediction score.

[0102] Each node of the neural network may additionally perform a function using the activation tensors and weight tensors, such as activation functions, matrix multiplication, normalization, or the like. Each node may process an input using activation tensors (e.g., vectors or embedding representing features of the input) and weight tensors. In some examples after a node, performs an operation using the input tensor, it generates an output tensor, which is then passed to the other neurons in the hidden layer and / or output layer (unless the output tensor represents a tensor in the output layer) . For example, the output tensor may be a matrix representing the product of matrix multiplication or a matrix indicating whether particular words were present in a chunk. In various aspects, the output tensor represents an input of another node in the succeeding layer (e.g., the output layer) .

[0103] In some examples, each node applies a weight tensor to the input tensor via a linear operation (e.g., matrix multiplication, addition, scaling, biasing, or convolution) . In some examples, the result of the linear operation is processed by a non-linear activation, such as a step function, a sigmoid function, a hyperbolic tangent function (tan h) , and rectified linear unit functions (ReLU) or the like. The result of the activation or other operation is an output tensor that is sent to a subsequent connected node that is in the next layer of neural network. The subsequent node uses the output tensor as the input activation tensor to another node.

[0104] Each of the functions in the neural network may be associated with different coefficients (e.g., weights and kernel coefficients) that are adjustable during training. For example, after preprocessing, the neural network is trained using a data set of the preprocessed training data inputs (i.e., the single-hop query –chunk pairs) in order to make acceptable loss training predictions at the appropriate weights to set the weight tensors. This will help later at deployment time to make a correct inference. In some aspects, learning or training includes minimizing a loss function between the target variable / ground truth (for example, a correct prediction of particular token label as “relevant” ) and the actual predicted variable (for example, an incorrect prediction of a token labeled as “irrelevant” ) . Based on the loss determined by a loss function (for example, Mean Squared Error Loss (MSEL) , cross-entropy loss, etc. ) , the loss function learns to reduce the error in prediction over multiple epochs or training sessions so that the neural network 605 learns which features and weights are indicative of the correct inferences, given the inputs. Accordingly,  it is desirable to arrive as close to 100%confidence in a particular classification or inference as much as possible so as to reduce the prediction error.

[0105] Subsequent to a first round / epoch of training, the neural network makes predictions with a particular weight value, which may or may not be at acceptable loss function levels. For example, the neural network may process the pre-processed additional training data inputs a second time to make another pass of predictions. This process may then be repeated over multiple iterations or epochs until the weight values in the weight tensors are learned for optimal predicted values and / or the loss function reduces the error in prediction to acceptable levels of confidence.

[0106] Continuing with FIG. 8, per block 810, some embodiments train a machine learning model (e.g., the same or different machine learning model as indicated in block 808) to predict an augmented query by learning second weights associated with features of the predicted token label (s) and the multi-hop query. In other words, the multi-hop query and the predicted token label (s) (after the training at block 808) represent the ground truth. In some embodiments, the ground truth is further represented by new query labels. For example, given multi-hop query and token pairs, an annotator may label these pairs with a particular new query that belongs to the pairs. The training process in block 808 is identical to the training process indicated in block 808 in some embodiments (e.g., input tensors are combined with weight tensors to produce output tensors over multiple epochs until a loss function minimizes loss under an acceptance threshold) .

[0107] FIG. 9 is a flow diagram of an example process 900 for executing an original query based on chunk processing and language model generation, according to some embodiments. Per block 903, some embodiments receive an original query (e.g., the original query 201 of FIG. 2) . Per block 905, some embodiments access, over a network, one or more documents. For example, the retrieval component 102 accesses, over the network (s) 110 (e.g., a Wide Area Network (WAN) , such as the internet) , a document that represents data not contained in a language model training dataset.

[0108] Per block 907, some embodiments (e.g., the retrieval component 102) parses the document (s) into one or more chunks (e.g., paragraphs, sentences, or groups based on semantic similarity) . Responsively, per block 915, some embodiments assign relevancy label (s) to the token (s) (e.g., words) in the chunk (s) . For example, some embodiments tag various words in the chunk (s) as “relevant” or “helpful” indicating that they are relevant for responding to the original  query. In some embodiments, block 915 is performed by the token labeler 104 as described with respect to FIG. 1.

[0109] Per block 909, for each chunk in the chunk (s) , some embodiments determine whether the respective chunk is relevant (e.g., based on the assigning of relevancy label (s) as described with respect to block 915) . For example, as described with respect to the document tagger 106, some embodiments perform semantic (e.g., via WORD2VEC) and / or syntactic (e.g., via POS tags) whether each chunk is relevant. If the chunk is not relevant, some embodiments generate a first tag, such as a <Terminate> tag as described herein and then determine whether all chunks in the document (s) accessed at block 905 have been analyzed. If all the chunks have been analyzed at the document (s) accessed at block 905 and the decision at block 909 was no for all chunks (i.e., none of the chunks were relevant) , then particular embodiments loop to block 905, where additional documents are retrieved, where such additional documents contain different or new content relative to the document (s) indicated at block 905. If not all of the chunks of the document (s) accessed in block 905 have been analyzed, then some embodiments perform block 909 for the next chunk (e.g., a next chunk, such as a paragraph, that is below the first chunk analyzed) .

[0110] For each chunk, if it is determined that the respective chunk is relevant at block 909, per block 911, particular embodiments determine whether more documents (and / or chunks) are needed to resolve or execute the original query (e.g., as described above with respect to the document tagger 106 of FIG. 1) . If no more chunks and / or documents are needed, some embodiments tag the respective chunk with a <Finish> tag. Responsively, per block 920, some embodiments provide the relevant chunks (which may contain chunks from the first and / or second document (s) ) and the original query as input into a language model (e.g., an LLM) . The language model then generates an output, which is indicative of a response to the original query.

[0111] If, however, more chunk (s) are needed to resolve the original query, some embodiments tag the respective chunk with a <Continue> tag, as described herein and then loop back to block 909 for a next-in-line chunk of the document (s) accessed at block 905 (e.g., a chunk corresponding to a succeeding paragraph at the same document) . Per block 911, if more document (s) are needed to resolve the original query, then block 917 is performed. Per block 917, some embodiments generate a new query by augmenting the original query (e.g., as described with respect to the token filter 108 of FIG. 1) . Responsively, some embodiments, repeat block 905,  except that the retrieval component 102, for example, accesses other documents based on the new query (and not the original query) . For example, the retrieval component 102 in some aspects computes the TF-IDF scores for each term in the augmented query and retrieves documents that contain terms with high scores, indicating their significance. Alternatively or additionally, the retrieval component 102 uses BM25 to calculate the relevance score of a document based on the frequency of query terms within the document and their overall frequency in the corpus. The retriever applies BM25 to rank documents according to their relevance to the augmented query. Additionally or alternatively, the retrieval component 102 uses a vector space model that represents documents and queries as vectors in a high-dimensional space, where each dimension corresponds to a unique term in the vocabulary. The retrieval component 102 computes the similarity between the query vector and document vectors using cosine similarity or other distance measures. Documents with vectors most similar to the augmented query are retrieved. In other words, the retrieval component 102 engages in another round of retrieval via the augmented query by repeating the blocks 905, 907, 915, 909, 911, 920, 917, and / or 930 of the process 900 if and until all the relevant information is obtained to resolve the query.

[0112] FIG. 10 is a flow diagram of an example process 1000 for providing information as input into a language model based on content of a first tag generated for a first chunk, according to some embodiments. Per block 1002, some embodiments (e.g., the retrieval component 102) receive a query, such as a natural language question (e.g., “what is the highest mountain? ” ) or command (e.g., “translate this sentence to English. ” ) . Per block 1004, some embodiments, such as the retrieval component 102 described with respect to FIG. 1, access (e.g., over the network (s) 110) a document (e.g., automatically an in response to the receiving of the query) . For example, the retrieval component 102 may first convert or encode the query and document candidates into one or more vector embedding (e.g., via WORD2VEC) . The document and query, in these embodiments, are represented as the average or weighted sum of word embeddings, and similarity measures (e.g., cosine similarity) are used to retrieve documents based on semantic similarity (e.g., the closest vector (s) to the vector (s) representing the query is selected as the document) .

[0113] A “document” as described herein "document" refers to any unit of text or information that can be processed and analyzed by a system, such as the retrieval component 102. For example, the document is indicative of a chunk, text documents (e.g., e.g., articles, web pages, research papers, books, reports, emails, forum posts, and any other textual content available in  digital format) , Structured Documents (e.g., spreadsheets, databases, XML files, JSON files, and other structured data formats where the textual content is organized according to specific schemas or templates) , Multimedia Documents (e.g., images, videos, audio files, or a combination of different types of media along with textual content) , Code or Source Files (e.g., source code files written in programming languages, configuration files, markup languages (e.g., HTML, XML) , or any other type of code used in software development) , Social Media Posts (e.g., content from social media platforms such as tweets, Facebook posts, LinkedIn updates, and other social media interactions can also be considered documents) , and / or Generated Text (e.g., text generated by the system itself as part of the retrieval or response generation process can also be considered as documents to be analyzed and processed further) .

[0114] As described herein, in some embodiments, the “document” is accessed as part of a RAG system. Accordingly, the document contains information that is not directly embedded within the ML model during training but exists externally, often in the form of articles, publications, databases, or other sources of knowledge. While ML models like Large Language Models (LLMs) are trained on vast amounts of data to learn patterns and associations, they may still lack specific domain knowledge or up-to-date information relevant to a particular task or query. The "document" in some embodiments thus acts as a supplementary source of knowledge that can be referenced by the system to augment the output of the ML model.

[0115] Per block 1006, some embodiments parse the document into a plurality of chunks (or receive each chunk) . For example, the retrieval component 102 in some embodiments initially segments the document, where each chunk defines sentence boundaries. Each sentence can serve as a basic unit of information, making it easier to process and analyze smaller chunks of text individually. A “chunk” as described herein refers to any suitable unit of information, such as a sentence, a paragraph, a series of tokens, a section, a document itself, and / or any portion of a document that includes natural language characters. In other embodiments, the document is not parsed into multiple chunks but is rather processed as a single chunk or unit of information simultaneously or at the same time.

[0116] Per block 1008, for a first chunk, of the plurality of chunks, some embodiments generate a first tag (e.g., a label) , where the first tag (e.g., at least partially) indicates whether more information (e.g., chunks or documents) is needed to respond to (e.g., resolve or execute) the query. In some embodiments, the first tag additionally or alternatively indicates whether the chunk is  relevant for resolving the query. In some embodiments, block 1008 represents the functionality described with respect to the token labeler 104 and / or the document tagger 106 of FIG. 1. A “tag” as described herein refers to any piece of metadata that describes a token, word, chunk, or other portion of the document in some way. For example, in some embodiments, the tag refers to a HTML / XML tag. In web development and markup languages like HTML and XML, a tag is a markup element used to define the structure and content of a document. These tags are enclosed in angle brackets (< and >) and often come in pairs, with an opening tag and a closing tag, to delineate the beginning and end of an element. Additionally or alternatively the tag represents a tag in data tagging. In data processing and analysis, tagging refers to the process of assigning metadata or labels to data (e.g., chunks or words) to classify, organize, or describe it. Tags can be used to categorize data, make it searchable, or apply specific attributes to it. In an illustrative example, the first tag may refer to the <Continue>, <Finish>, or <Terminate> as described herein.

[0117] In some embodiments, block 1008 includes or is succeeded by generating a label for a first token or word included in the first chunk, of the plurality of chunks that is relevant to resolve the natural language question or command. For example, as described with respect to FIG. 3 and FIG. 1, the token labeler 104 labels the word 310-2 as relevant. A “label” in this context represents any suitable marker that indicates a word or token is relevant or helpful in resolving the query. For example, the label is a tag. In another example, the label a value in a key-value data structure where the keys are different words in a dataset. In yet another example, the label is a key in a key-value data structure where the values represent different words or tokens assigned to being relevant or non-relevant (the keys) , or the like. For example, for the query: "How does insulin regulate blood sugar levels? The Tokens are: [ "insulin" , "regulate" , "blood" , "sugar" , "levels" ] , and the label may be “Relevant Tokens” : [ "insulin" , "regulate" , "blood sugar levels" ] .

[0118] In some embodiments, the generating of the first tag is based on using or training a decoder-based transformer. A “decoder-based transformer” is a transformer that generates text based on using a decoder (and not based on (or solely based on) using an encoder) . A decoder is responsible for generating the output natural language sequence based on an encoded input sequence. For example, the decoder-based transformer in some embodiments represents a Llama3-70B (as described herein) , Generative Pre-trained Transformers (GPT) , Bidirectional and Auto-Regressive Transformers (BART) , Text-To-Text Transfer Transformer (T5) , Cross-lingual Language Model (XLM-R) , or the like. Additionally or alternatively or additionally, the generating  of the first tag uses additional or alternative functionality, as described with respect to the token labeler 104 and / or the document tagger 106 of FIG. 6.

[0119] In some embodiments, the training of the decoder-based transformer is based at least in part on feeding the decoder-based transformer a plurality of query-chunk pairs (e.g., current query 702 and retrieve chunk 704 of FIG. 7) and predicting a particular tag (e.g., the chunk tag (s) 708 and / or the token label (s) 706) , and wherein each chunk, of the query-chunk pairs, corresponds to a respective portion of a training document, and wherein each particular tag indicates whether more information is needed to respond to a respective question or command of the query-chunk pairs. Examples of this training are described with respect to the process 800 of FIG. 8 and the pipeline 700 of FIG. 7.

[0120] Per block 1010, based at least in part on the first tag, some embodiments perform one of: augment the query with a natural language sequence and provide an indication of a second chunk, of the plurality of chunks, as input into a language model, provide an indication of the first chunk as input into the language model, or refrain from providing the indication of the first chunk as input into the language model.

[0121] Block 1010 represents three different branches or pathways that can be traversed, as described, for example, in FIG. 9. In some embodiment, based at least in part on the generating of the label for the first token or word included in the first chunk that is relevant to resolve the query, some embodiments (e.g., the token filter 108) perform the augmenting of the natural language question or command by supplementing or replacing a second word within the natural language question or command with the first token or word, as described, for example with respect to the new query 312 of FIG. 3.

[0122] In some embodiments, the first tag (e.g., a “<Finish>” tag as described herein) indicates that the first chunk is relevant to resolve the query and that more information is not needed to respond to the query. And the performing at block 1010 includes the refraining from augmenting the query, and providing the natural language question or command and the indication of first chunk as input into the language model. An “indication” as described herein as it relates to inputs to a model refers to a natural language sequence, chunk, or query itself or some other representation thereof, such as a vector, vector embedding, soft prompt, or some other numerical representation of the chunk and / or query.

[0123] In some embodiments, the first tag (e.g., a “<Continue>” tag as described herein) alternatively indicates that the first chunk is relevant to resolve the query and that more information is needed to respond to the query. And the performing at block 1010 includes the augmenting of the query, the indication of the query and the second chunk as input into the language model. In some embodiments, the second chunk is thus determined to also be relevant in resolving the query and so the input to the language model includes both the indication of the first chunk and the indication of the second chunk.

[0124] In some embodiments, the first tag (e.g., a <Terminate> tag as described herein) alternatively indicates that the firs chunk is not relevant to resolve the query and that more information is needed to respond to the query. And the performing at block 1010 includes the refraining from providing the indication of the first chunk as input into the language model (e.g., because it is not relevant for responding to the query) . In some of these embodiments, the retrieval component 102 keeps searching for chunks and / or documents until enough relevant chunks are detected, as described herein. All of these tags are described with respect to FIG. 3.

[0125] In some embodiments, the language model generates an output based on the performing. In some embodiments, the output includes at least one of: generated text representing summarization of a dataset (text summarization) , a natural language answer to the natural language question, a sentiment analysis result, text completion, text that has been translated from one natural language to another, edited text, a content item recommendation, or a dialogue response representing a portion of a conversation between the language model and the user, or generated text.

[0126] Text summarization generates a concise and coherent summary of a given dataset. It analyzes the content of the dataset and produces a condensed version that captures the essential information, allowing users to grasp the key points without needing to review the entire dataset.

[0127] With respect to a natural language answer to the natural language question. Here the language model acts as a question-answering system. Given a natural language question, it generates a relevant and informative answer. The model understands the semantics of the question and retrieves or generates an appropriate response based on its knowledge and training data. Regarding a sentiment analysis result, sentiment analysis involves determining the sentiment or emotional tone expressed in a piece of text. In this function, the language model analyzes the  sentiment of a given text (e.g., positive, negative, or neutral) and provides a sentiment analysis result indicating the overall sentiment conveyed by the text.

[0128] With respect to text completion, it involves predicting and generating the next part of a given text based on its context. The language model fills in the missing or incomplete parts of the text, leveraging its understanding of language patterns and context to generate coherent and contextually appropriate completions. With respect to text that has been translated from one natural language to another, translation involves converting text from one natural language to another while preserving its meaning. In this function, the language model translates text from the source language to the target language, ensuring that the translated text accurately conveys the intended meaning of the original text. Edited text involves revising and improving the quality of a given text by correcting errors, enhancing clarity, or refining the language. In this function, the language model can generate edited versions of the text by suggesting revisions, corrections, or improvements based on linguistic rules and context. Content item recommendation systems suggest relevant and personalized content to users based on their preferences, behavior, or historical interactions. In this function, the LLM recommends or produces content items such as images (e.g., photographs) , articles, videos, products, or services that align with the user's interests or needs. A dialogue response representing a portion of a conversation between the language model and the user refer to dialogue systems that enable conversational interactions between users and language models. In this function, the LLM generates responses to user inputs, participating in a dialogue or conversation by providing relevant and contextually appropriate responses.

[0129] In some embodiments, the input provided to the language model is not included in any prompt of the language model. Typically, certain language models, such as LLMs, include prompt constructions blocks, which means that they require constructing specific prompts (e.g., hard or soft prompts) , which typically including example input-output pairs (e.g., a few-shot prompt) , to elicit a response. However, some embodiments do not require prompts because they leverage a retrieval-augmented generation (RAG) approach, wherein the language model accesses an external knowledge base to enhance its output without the need for predefined prompts. Instead of relying solely on constructed prompts, these embodiments utilize the retrieved knowledge to generate responses directly relevant to the user's query. This allows for a more dynamic and contextually-driven interaction, enabling the model to incorporate domain-specific information and adapt its responses to diverse input without the constraints of predetermined prompts. As a  result, the system can provide more accurate and tailored responses across a wide range of queries and domains, enhancing its overall flexibility and usability.

[0130] In response to the augmenting of the query, some embodiments retrieving another portion / chunk of the document and / or retrieve another document and generate a second tag (e.g., a <Terminate>, <Finish>, or <Continue>. For example, the second tag (e.g., a <Finish> tag) can indicate that more information is not needed to respond to the natural language question or command. Accordingly, the providing of the indication is further based on the generating of the second tag (e.g., a first chunk and / or second chunk is fed to the model as input) .

[0131] FIG. 11 illustrates a line graph 1100 representing chunk recall by different retrieval strategies, according to some embodiments. FIG. 11 indicates the high accuracy and fidelity compared to other retrieval technologies. The inventors of aspects of the present disclosure conducted empirical experiments on three high-quality multi-hop QA datasets: HotpotQA, 2WikiMultihopQA, and MuSiQue. HotpotQA and 2WikiMultihopQA primarily target 2-hop questions, whereas MuSiQue addresses more complex 3-hop and 4-hop questions.

[0132] To show the competitiveness of various embodiments described herein against LLM-augmented question decomposition methods, the inventors conducted a comparative analysis of retrieval chunk recall (as illustrated in the Y-axis of the line graph 1100) against two prominent retrievers Contriever-MSMARCO and E5-base-v2, using the MuSiQue dataset.

[0133] FIG. 11 illustrates that the original query (depicted by the lines 1102) struggles to fetch the correct chunks, whereas query with the token labeler 104, the document tagger 106, and the token filter 108 (represented by lines 1104) and query with only token labeler 104 and document tagger 106 (represented by the lines 1106) exhibit substantially higher recall rates. Notably, the new or augmented query achieves even better performance with an increased number of relevant retrieved chunks. These findings underscore the utility and efficacy of various embodiments for an efficient RAG framework.

[0134] "Recall rate" refers to the proportion of relevant information retrieved (e.g., by the retrieval component 102) compared to the total relevant information available in the dataset. It measures the system's ability to recall or retrieve all relevant information related to a user query. A high recall rate (as described with respect to the lines 1104 and 1106) indicates that various embodiments effectively retrieve a large portion of the relevant information, minimizing the risk of missing important details. Conversely, a low recall rate (such as indicated by the lines 1102  with respect to existing retriever RAG technologies) suggests that the system may overlook or fail to retrieve some relevant information, potentially leading to incomplete or inaccurate responses to user queries.

[0135] Achieving a high recall rate is useful for ensuring that the system provides comprehensive and accurate responses to complex queries, especially those requiring multi-hop reasoning or accessing domain-specific knowledge. The efficiency and effectiveness of the retrieval process directly impact the system's recall rate, as it determines the breadth and depth of information retrieved in response to user queries.

[0136] EXAMPLE COMPUTING ARCHITECTURE AND DEVICE

[0137] Turning now to FIG. 12, a block diagram is provided showing an example operating environment 10 in which some embodiments of the present disclosure are employed. It should be understood that this and other arrangements described herein are set forth only as examples. Other arrangements and elements (for example, machines, interfaces, functions, orders, and groupings of functions) can be used in addition to or instead of those shown, and some elements are omitted altogether for the sake of clarity. Further, many of the elements described herein are functional entities that are implemented as discrete or distributed components or in conjunction with other components, and in any suitable combination and location. Various functions described herein as being performed by an entity that is carried out by hardware, firmware, and / or software. For instance, some functions are carried out by a processor executing instructions stored in memory.

[0138] Among other components not shown, example operating environment 10 includes a number of user devices, such as user devices 02a and 02b through 02n; a number of data sources (for example, databases or other data stores, such as 105) , such as data sources 04a and 04b through 04n; server 06; sensors 03a and 07; and network (s) 110. It should be understood that environment 10 shown in FIG. 12 is an example of one suitable operating environment. Each of the components shown in FIG. 12 are implemented via any type of computing device, such as computing device 11 as described in connection to FIG. 13, for example. These components communicate with each other via network (s) 110, which includes, without limitation, a local area network (LAN) and / or a wide area networks (WAN) . In some implementations, network (s) 110 comprises the Internet and / or a cellular network, amongst any of a variety of possible public and / or private networks.

[0139] It should be understood that any number of user devices, servers, and data sources are employed within operating environment 10 within the scope of the present disclosure. Each comprises a single device or multiple devices cooperating in a distributed environment. For instance, server 06 is provided via multiple devices arranged in a distributed environment that collectively provide the functionality described herein. Additionally, other components not shown are also included within the distributed environment, in some embodiments.

[0140] User devices 02a and 02b through 02n can be client devices on the client-side of operating environment 10, while server 06 can be on the server-side of operating environment 10. Server 06 can comprise server-side software designed to work in conjunction with client-side software on user devices 02a and 02b through 02n so as to implement any combination of the features and functionalities discussed in the present disclosure. This division of operating environment 10 is provided to illustrate one example of a suitable environment, and there is no requirement for each implementation that any combination of server 06 and user devices 02a and 02b through 02n remain as separate entities. In some embodiments, the one or more servers 06 represent one or more nodes in a cloud computing environment. Consistent with various embodiments, a cloud computing environment includes a network-based, distributed data processing system that provides one or more cloud computing services. Further, a cloud computing environment can include many computers, hundreds or thousands of them or more, disposed within one or more data centers and configured to share resources over the one or more network (s) 110.

[0141] In some embodiments, a user device 02a or server 06 alternatively or additionally comprises one or more web servers and / or application servers to facilitate delivering web or online content to browsers installed on a user device 02b. Often the content can include static content and dynamic content. When a client application, such as a web browser, requests a website or web application via a URL or search term, the browser typically contacts a web server to request static content or the basic components of a website or web application (for example, HTML pages, image files, video files, and the like) . Application servers typically deliver any dynamic portions of web applications or business logic portions of web applications. Business logic can be described as functionality that manages communication between a user device and a data store (for example, a database) . Such functionality can include business rules or workflows (for example, code that  indicates conditional if / then statements, while statements, and the like to denote an order of processes) .

[0142] User devices 02a and 02b through 02n comprises any type of computing device capable of use by a user. For example, in one embodiment, user devices 02a through 02n is the type of computing device described in relation to FIG. 13 herein. By way of example and not limitation, a user device is embodied as a personal computer (PC) , a laptop computer, a mobile phone or mobile device, a smartphone, a tablet computer, a smart watch, a wearable computer, a personal digital assistant (PDA) , a music player or an MP3 player, a global positioning system (GPS) or device, a video player, a handheld communications device, a gaming device or system, an entertainment system, a vehicle computer system, an embedded system controller, a camera, a remote control, a bar code scanner, a computerized measuring device, an appliance, a consumer electronic device, a workstation, or any combination of these delineated devices, or any other suitable computer device.

[0143] Data sources 04a and 04b through 04n comprises data sources and / or data systems, which are configured to make data available to any of the various constituents of operating environment 10 or system 100 described in connection to FIG. 1. Examples of data source (s) 04a through 04n is one or more of a database, a file, data structure, corpus, or other data store. Data sources 04a and 04b through 04n are discrete from user devices 02a and 02b through 02n and server 06 or is incorporated and / or integrated into at least one of those components in some embodiments. In one embodiment, data sources 04a through 04n comprise sensors (such as sensors 03a and 07) , which is integrated into or associated with the user device (s) 02a, 02b, or 02n or server 06 in some embodiments.

[0144] In some embodiments, operating environment 10 is utilized to implement one or more of the components of the system 100, described in FIG. 1, including components for assigning one or more datasets to one or more clusters, as described herein. Operating environment 10 also can be utilized for implementing aspects of processes 600 and 700 and / or any other functionality as described in connection with FIGS. 1-9.

[0145] Having described various implementations, an exemplary computing environment suitable for implementing embodiments of the disclosure is now described. With reference to FIG. 13, an exemplary computing device is provided and referred to generally as computing device 11. The computing device 11 is but one example of a suitable computing environment and is not  intended to suggest any limitation as to the scope of use or functionality of embodiments of the disclosure. Neither should the computing device 11 be interpreted as having any dependency or requirement relating to any one or combination of components illustrated.

[0146] Turning to FIG. 13, computing device 11 includes a bus 19 that directly or indirectly couples the following devices: memory 12, one or more processors 14, one or more presentation components 16, one or more input / output (I / O) ports 18, one or more I / O components 20, an illustrative power supply 22, and a hardware accelerator 26. Bus 19 represents what can be one or more busses (such as an address bus, data bus, or combination thereof) . Although the various blocks of FIG. 13 are shown with lines for the sake of clarity, in reality, these blocks represent logical, not necessarily actual, components. For example, one can consider a presentation component such as a display device to be an I / O component. Also, processors have memory. The inventors hereof recognize that such is the nature of the art and reiterate that the diagram of FIG. 13 is merely illustrative of an exemplary computing device that can be used in connection with one or more embodiments of the present disclosure. Distinction is not made between such categories as “workstation, ” “server, ” “laptop, ” “handheld device, ” or other computing device, as all are contemplated within the scope of FIG. 13 and with reference to “computing device. ”

[0147] Computing device 11 typically includes a variety of computer-readable media. Computer-readable media can be any available media that can be accessed by computing device 11 and includes both volatile and nonvolatile media, removable and non-removable media. By way of example, and not limitation, computer-readable media comprises computer storage media and communication media. Computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVDs) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by computing device 11. Computer storage media does not comprise signals per se. Communication media typically embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means  a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media, such as a wired network or direct-wired connection, and wireless media, such as acoustic, RF, infrared, and other wireless media. Combinations of any of the above should also be included within the scope of computer-readable media.

[0148] Memory 12 includes computer storage media in the form of volatile and / or nonvolatile memory. The memory is removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical-disc drives, or other hardware. Computing device 11 includes one or more processors 14 that read data from various entities such as memory 12 or I / O components 20. Presentation component (s) 16 presents data indications to a user or other device. Exemplary presentation components include a display device, speaker, printing component, vibrating component, and the like.

[0149] The I / O ports 18 allow computing device 11 to be logically coupled to other devices, including I / O components 20, some of which are built-in, in some instances. Illustrative components include a microphone, joystick, game pad, satellite dish, scanner, printer, wireless device, and the like. The I / O components 20 provide a natural user interface (NUI) that processes air gestures, voice, or other physiological inputs generated by a user in some embodiments. In some instances, inputs are transmitted to an appropriate network element for further processing. An NUI can implement any combination of speech recognition, touch and stylus recognition, facial recognition, biometric recognition, gesture recognition both on screen and adjacent to the screen, air gestures, head and eye tracking, and touch recognition associated with displays on the computing device 11. The computing device 11 can be equipped with depth cameras, such as stereoscopic camera systems, infrared camera systems, RGB camera systems, and combinations of these, for gesture detection and recognition. Additionally, the computing device 11 can be equipped with accelerometers or gyroscopes that enable detection of motion. The output of the accelerometers or gyroscopes can be provided to the display of the computing device 11 to render immersive augmented reality or virtual reality.

[0150] Some embodiments of computing device 11 include one or more radio (s) 24 (or similar wireless communication components) . The radio 24 transmits and receives radio or wireless communications. The computing device 11 can be a wireless terminal adapted to receive communications and media over various wireless networks. Computing device 11 can  communicate via wireless protocols, such as code division multiple access ( “CDMA” ) , global system for mobiles ( “GSM” ) , or time division multiple access ( “TDMA” ) , as well as others, to communicate with other devices. The radio communications can be a short-range connection, a long-range connection, or a combination of both a short-range and a long-range wireless telecommunications connection. When we refer to “short” and “long” types of connections, we do not mean to refer to the spatial relation between two devices. Instead, we are generally referring to short range and long range as different categories, or types, of connections (i.e., a primary connection and a secondary connection) . A short-range connection can include, by way of example and not limitation, a  connection to a device (for example, mobile hotspot) that provides access to a wireless communications network, such as a WLAN connection using the 802.11 protocol, a Bluetooth connection to another computing device is a second example of a short-range connection, or a near-field communication connection. A long-range connection can include a connection using, by way of example and not limitation, one or more of CDMA, GPRS, GSM, TDMA, and 802.16 protocols.

[0151] Hardware accelerator 26 represents any suitable hardware component (e.g., GPU) that offloads one or more tasks (e.g., from a CPU) to accelerate or speed up the task. In some embodiments, the hardware accelerator 26 represents a Graphics Processing Unit (GPU) , field programmable gate arrays (FPGA) , application-specific integrated circuits (ASIC) , a Tensor Processing Unit (TPU) , a sound card, or any suitable hardware component..

[0152] Having identified various components utilized herein, it should be understood that any number of components and arrangements can be employed to achieve the desired functionality within the scope of the present disclosure. For example, the components in the embodiments depicted in the figures are shown with lines for the sake of conceptual clarity. Other arrangements of these and other components can also be implemented. For example, although some components are depicted as single components, many of the elements described herein can be implemented as discrete or distributed components or in conjunction with other components, and in any suitable combination and location. Some elements can be omitted altogether. Moreover, various functions described herein as being performed by one or more entities is carried out by hardware, firmware, and / or software, as described below. For instance, various functions are carried out by a processor executing instructions stored in memory. As such, other arrangements and elements (for example,  machines, interfaces, functions, orders, and groupings of functions, and the like. ) can be used in addition to or instead of those shown.

[0153] Embodiments of the present disclosure have been described with the intent to be illustrative rather than restrictive. Embodiments described in the paragraphs above can be combined with one or more of the specifically described alternatives. In particular, an embodiment that is claimed can contain a reference, in the alternative, to more than one other embodiment. The embodiment that is claimed can specify a further limitation of the subject matter claimed. Alternative embodiments will become apparent to readers of this disclosure after and because of reading it. Alternative means of implementing the aforementioned can be completed without departing from the scope of the claims below. Certain features and sub-combinations are of utility and can be employed without reference to other features and sub-combinations and are contemplated within the scope of the claims.

[0154] As used herein, the term “set” is employed to refer to an ordered (i.e., sequential) or an unordered (i.e., non-sequential) collection of objects (or elements) , such as but not limited to data elements (for example, events, clusters of events, and the like) . A set includes N elements, where N is any non-negative integer. That is, a set includes 1, 2, 3, N objects and / or elements, where N is a positive integer with no upper bound. Therefore, as used herein, a set can include only a single element. In other embodiments, a set includes a number of elements that is significantly greater than one, two, or three elements. As used herein, the term “subset, ” is a set that is included in another set. A subset can be, but is not required to be, a proper or strict subset of the other set that the subset is included in. That is, if set B is a subset of set A, then in some embodiments, set B is a proper or strict subset of set A. In other embodiments, set B is a subset of set A, but not a proper or a strict subset of set A.

[0155] EXAMPLE EMBODIMENTS

[0156] The following embodiments represent example literal support clauses and embodiments of concepts contemplated herein. Any one of the following embodiments may be combined in a multiple dependent manner to depend from one or more other embodiments. Further, any combination of dependent embodiments (e.g., clauses that explicitly depend from a previous embodiment) may be combined while staying within the scope of aspects contemplated herein. The following embodiments are exemplary in nature and are not limiting.

[0157] In some embodiments, a system, such as the computerized system described in any of the embodiments above, comprise at least one computer processor, at least one computer processor; and one or more computer storage media storing computer-useable instructions that, when used by the at least one computer processor, cause the at least one computer processor to perform operations comprising: receiving a natural language question or command issued by a user; in response to the receiving of the natural language question or command issued by the user, accessing, over a computer network, a document; assigning a label for at least a portion of the document, the label indicating that at least the portion is relevant for resolving the natural language question or command; based at least in part on the assigning of the label, augmenting the natural language question or command with a natural language sequence; and based at least in part on the augmenting of the natural language question or command, providing an indication of at least a portion of the natural language question or command and an indication of at least the portion of the document as input into a language model, wherein the language model generates an output.

[0158] In light of various Retrieval-Augmented Generation (RAG) and other language model technologies, various embodiments of the system have the technical effect of at least improved computer resource consumption (e.g., reduced I / O, reduced computing latency, reduced memory consumption) , and improved accuracy in a language model’s output response (e.g., so as to reduce the likelihood of hallucination) , as described above.

[0159] In some embodiments, the operations further comprise: retrieving a first chunk, of a plurality of chunks, of the document that is relevant to the natural language question or command, wherein a second chunk, of the plurality of chunks, is not relevant to the natural language question or command, and wherein at least the portion represents the first chunk; wherein the assigning of the label for at least the portion of the document is based at least in part on the retrieving of the first chunk and includes generating the label for a first token or word included in the first chunk that is relevant to the natural language question or command.

[0160] In some embodiments, the operations further comprise: based at least in part on the assigning of the label for the first token or word included in the first chunk that is relevant to the natural language question or command, performing the augmenting of the natural language question or command by supplementing or replacing a second word within the natural language question or command with the first token or word.

[0161] In some embodiments, the assigning the label for at least a portion of the document includes generating a first tag indicating more information is needed to respond to the natural language question or command; and based at least in part on the first tag, engaging in the augmenting of the natural language question or command with the natural language sequence.

[0162] In some embodiments, the operations further comprise: in response to the augmenting of the natural language question or command, retrieving another portion of the document and generating a second tag for the another portion, wherein the second tag indicates that more information is not needed to respond to the natural language question or command, and wherein the providing the indication of at least the portion of the natural language question or command and at least the portion of the document as input into the language model is further based on the generating of the second tag.

[0163] In some embodiments, the generating of the first tag is based on using a decoder-based transformer, and wherein the operations further comprising: training the decoder-based transformer based at least in part on feeding the decoder-based transformer a plurality of query-chunk pairs and predicting a respective tag, and wherein each chunk, of the query-chunk pairs, correspond to a respective portion of a training document, and wherein each respective tag indicates whether more information is needed to respond to a respective question or command of the query-chunk pairs.

[0164] In some embodiments, the user question or command includes a plurality of hops, each hop, of the plurality of hops, represents a step or iteration in a process of retrieving information in responding to the natural language question or command.

[0165] In some embodiments, the input provided to the language model is not indicative of a prompt of the language model that includes example input-output pairs.

[0166] In some embodiments, the output includes at least one of: generated text representing summarization of a dataset, a natural language answer to the natural language question, a sentiment analysis result, text completion, text that has been translated from one natural language to another, edited text, a content item recommendation, or a dialogue response representing a portion of a conversation between the language model and the user, or generated text.

[0167] In some embodiments, a computer-implemented method comprises: receiving a natural language question or command; in response to the receiving of the natural language  question or command, accessing, over a computer network, a document; parsing the document into a plurality of chunks; for a first chunk, of the plurality of chunks, generating a first tag indicating whether more information is needed to respond to the natural language question or command; and based at least in part on the first tag, performing one of: augmenting the natural language question or command with a natural language sequence and providing an indication of a second chunk, of the plurality of chunks, as input into a language model, providing an indication of the first chunk as input into the language model, or refraining from providing the indication of the first chunk as input into the language model.

[0168] In light of various Retrieval-Augmented Generation (RAG) and other language model technologies, various embodiments of the computer-implemented method have the technical effect of at least improved computer resource consumption (e.g., reduced I / O, reduced computing latency, reduced memory consumption) , and improved accuracy in a language model’s output response (e.g., so as to reduce the likelihood of hallucination) , as described above.

[0169] In various embodiments, the computer-implemented method further comprises: assigning a label for a first token or word included in the first chunk, of the plurality of chunks, that is relevant to resolve the natural language question or command.

[0170] In some embodiments, the computer-implemented method further comprises: based at least in part on the assigning of the label for the first token or word included in the first chunk that is relevant to resolve the natural language question or command, performing the augmenting of the natural language question or command by supplementing or replacing a second word within the natural language question or command with the first token or word.

[0171] In some embodiments, the first tag indicates that the first chunk is relevant to resolve the natural language question or command and that more information is not needed to respond to the natural language question or command, and wherein the performing includes the refraining from augmenting the natural language question or command, and providing the natural language question or command and the indication of first chunk as input into the language model.

[0172] In some embodiments, the first tag indicates that the first chunk is relevant to resolve the natural language question or command and that more information is needed to respond to the natural language question or command, and wherein the performing includes the augmenting of the natural language question or command, providing the natural language question or command and the indication of the second chunk as input into the language model.

[0173] In some embodiments, the first tag indicates that the first chunk is not relevant to resolve the natural language question or command and that more information is needed to respond to the natural language question or command, and wherein the performing includes the refraining from providing the indication of the first chunk as input into the language model.

[0174] In some embodiments, the generating of the first tag is based on using a decoder-based transformer, and wherein the computer-implemented method further comprising: training the decoder-based transformer based at least in part on feeding the decoder-based transformer a plurality of query-chunk pairs and predicting a particular tag, and wherein each chunk, of the query-chunk pairs, corresponds to a respective portion of a training document, and wherein each particular tag indicates whether more information is needed to respond to a respective question or command of the query-chunk pairs.

[0175] In some embodiments, the user question or command includes a plurality of hops, each hop, of the plurality of hops, represents a step or iteration in a process of retrieving information in responding to the natural language question or command.

[0176] In some embodiments, the first tag indicates that the first chunk is relevant to resolve the natural language question or command and that more information is needed to respond to the natural language question or command, and wherein the performing includes, providing the natural language question or command, an indication of the first chunk as input into the language model, and the indication of the second chunk as input into the language model.

[0177] In some embodiments, one or more computer storage media having computer-executable instructions embodied thereon that, when executed, by one or more processors, cause the one or more processors to perform operations comprising: receiving a query; in response to the receiving of the query, accessing a document; generating a first tag indicating whether more information is needed to respond to the query; and based at least in part on the first tag, performing one of: augmenting the query with a natural language sequence, providing an indication of at least a portion of the document and the query as input into the language model, or refraining from providing the indication of the portion as input into the language model.

[0178] In light of various Retrieval-Augmented Generation (RAG) and other language model technologies, various embodiments of the one or more computer storage media have the technical effect of at least improved computer resource consumption (e.g., reduced I / O, reduced  computing latency, reduced memory consumption) , and improved accuracy in a language model’s output response (e.g., so as to reduce the likelihood of hallucination) , as described above.

[0179] In some embodiments, the operations further comprising: assigning a label for a word in the document, the label indicating a measure of relevance of the word in resolving the query, and wherein the generating of the first tag is based at least in part on the assigning the label for the word.

Claims

1.A system comprising: at least one computer processor; and one or more computer storage media storing computer-useable instructions that, when used by the at least one computer processor, cause the at least one computer processor to perform operations comprising: receiving a natural language question or command issued by a user; in response to the receiving of the natural language question or command issued by the user, accessing, over a computer network, a document; assigning a label for at least a portion of the document, the label indicating that at least the portion is relevant for resolving the natural language question or command; based at least in part on the assigning of the label, augmenting the natural language question or command with a natural language sequence; and based at least in part on the augmenting of the natural language question or command, providing an indication of at least a portion of the natural language question or command and an indication of at least the portion of the document as input into a language model, wherein the language model generates an output.2.The system of claim 1, wherein the operations further comprising: retrieving a first chunk, of a plurality of chunks, of the document that is relevant to the natural language question or command, wherein a second chunk, of the plurality of chunks, is not relevant to the natural language question or command, and wherein at least the portion represents the first chunk; wherein the assigning of the label for at least the portion of the document is based at least in part on the retrieving of the first chunk and includes generating the label for a first token or word included in the first chunk that is relevant to the natural language question or command.3.The system of claim 2, wherein the operations further comprising: based at least in part on the assigning of the label for the first token or word included in the first chunk that is relevant to the natural language question or command, performing the augmenting of the natural language question or command by supplementing or replacing a second word within the natural language question or command with the first token or word.4.The system of claim 1, wherein the assigning the label for at least a portion of the document includes generating a first tag indicating more information is needed to respond to the natural language question or command; and based at least in part on the first tag, engaging in the augmenting of the natural language question or command with the natural language sequence.5.The system of claim 4, wherein the operations further comprising: in response to the augmenting of the natural language question or command, retrieving another portion of the document and generating a second tag for the another portion, wherein the second tag indicates that more information is not needed to respond to the natural language question or command, and wherein the providing the indication of at least the portion of the natural language question or command and at least the portion of the document as input into the language model is further based on the generating of the second tag.6.The system of claim 4, wherein the generating of the first tag is based on using a decoder-based transformer, and wherein the operations further comprising: training the decoder-based transformer based at least in part on feeding the decoder-based transformer a plurality of query-chunk pairs and predicting a respective tag, and wherein each chunk, of the  query-chunk pairs, correspond to a respective portion of a training document, and wherein each respective tag indicates whether more information is needed to respond to a respective question or command of the query-chunk pairs.7.The system of claim 1, wherein the user question or command includes a plurality of hops, each hop, of the plurality of hops, represents a step or iteration in a process of retrieving information in responding to the natural language question or command.8.The system of claim 1, wherein the input provided to the language model is not indicative of a prompt of the language model that includes example input-output pairs.9.The system of claim 1, wherein the output includes at least one of: generated text representing summarization of a dataset, a natural language answer to the natural language question, a sentiment analysis result, text completion, text that has been translated from one natural language to another, edited text, a content item recommendation, or a dialogue response representing a portion of a conversation between the language model and the user, or generated text.10.A computer-implemented method comprising: receiving a natural language question or command; in response to the receiving of the natural language question or command, accessing, over a computer network, a document; parsing the document into a plurality of chunks; for a first chunk, of the plurality of chunks, generating a first tag indicating whether more information is needed to respond to the natural language question or command; and based at least in part on the first tag, performing one of: augmenting the natural language question or command with a natural language sequence and providing an indication of a second chunk, of the plurality of chunks, as input into a language model, providing an indication of the first chunk as input into the language model, or refraining from providing the indication of the first chunk as input into the language model.11.The computer-implemented method of claim 10, further comprising: assigning a label for a first token or word included in the first chunk, of the plurality of chunks, that is relevant to resolve the natural language question or command.12.The computer-implemented method of claim 11, further comprising: based at least in part on the assigning of the label for the first token or word included in the first chunk that is relevant to resolve the natural language question or command, performing the augmenting of the natural language question or command by supplementing or replacing a second word within the natural language question or command with the first token or word.13.The computer-implemented method of claim 10, wherein the first tag indicates that the first chunk is relevant to resolve the natural language question or command and that more information is not needed to respond to the natural language question or command, and wherein the performing includes the refraining from augmenting the natural language question or  command, and providing the natural language question or command and the indication of first chunk as input into the language model.14.The computer-implemented method of claim 10, wherein the first tag indicates that the first chunk is relevant to resolve the natural language question or command and that more information is needed to respond to the natural language question or command, and wherein the performing includes the augmenting of the natural language question or command, providing the natural language question or command and the indication of the second chunk as input into the language model.15.The computer-implemented method of claim 10, wherein the first tag indicates that the first chunk is not relevant to resolve the natural language question or command and that more information is needed to respond to the natural language question or command, and wherein the performing includes the refraining from providing the indication of the first chunk as input into the language model.16.The computer-implemented method of claim 10, wherein the generating of the first tag is based on using a decoder-based transformer, and wherein the computer-implemented method further comprising: training the decoder-based transformer based at least in part on feeding the decoder-based transformer a plurality of query-chunk pairs and predicting a particular tag, and wherein each chunk, of the query-chunk pairs, corresponds to a respective portion of a training document, and wherein each particular tag indicates whether more information is needed to respond to a respective question or command of the query-chunk pairs.17.The computer-implemented method of claim 10, wherein the user question or command includes a plurality of hops, each hop, of the plurality of hops, represents a step or  iteration in a process of retrieving information in responding to the natural language question or command.18.The computer-implemented method of claim 10, wherein the first tag indicates that the first chunk is relevant to resolve the natural language question or command and that more information is needed to respond to the natural language question or command, and wherein the performing includes, providing the natural language question or command, an indication of the first chunk as input into the language model, and the indication of the second chunk as input into the language model.19.One or more computer storage media having computer-executable instructions embodied thereon that, when executed, by one or more processors, cause the one or more processors to perform operations comprising: receiving a query; in response to the receiving of the query, accessing a document; generating a first tag indicating whether more information is needed to respond to the query; and based at least in part on the first tag, performing one of: augmenting the query with a natural language sequence, providing an indication of at least a portion of the document and the query as input into the language model, or refraining from providing the indication of the portion as input into the language model.20.The one or more computer storage media of claim 19, wherein the operations further comprising: assigning a label for a word in the document, the label indicating a measure of relevance of the word in resolving the query, and wherein the generating of the first tag is based at least in part on the assigning the label for the word.

Citation Information

Patent Citations

  • A method and system for managing RAG natural language intelligent knowledge base

    CN117708308B

  • Large language model utterance augmentation

    US20240143932A1

  • Methods and systems for transforming and retrieving information from document data using machine learning

    WO2023242540A1

  • Methods and systems for improved document processing and information retrieval

    WO2024015323A1

Cited By

  • Query reply method and device and electronic equipment

    CN122220482A