Method for building knowledge base using language model, method for providing response using knowledge base, and computing device for performing same
The method enhances language model responses by constructing a knowledge base with vectorized expected queries and summaries, addressing semantic similarity issues and token limits to provide accurate and reliable answers.
Patent Information
- Application Number
- PCT/KR2025/095336
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-05-23
- Filing Date
- 2025-05-21
- Publication Date
- 2025-11-27
AI Technical Summary
Existing language models face challenges in generating accurate and relevant responses due to low semantic similarity between user queries and documents in knowledge bases, leading to incomplete or misleading information, especially when information is scattered or exceeds token limits.
A method for constructing a knowledge base that involves generating expected queries and summaries from divided data pieces using a language model, vectorizing these to create an index, and augmenting user queries with extracted content data to enhance semantic similarity and information retrieval within token constraints.
Improves retrieval accuracy and generates more accurate and relevant responses by optimizing search speed and information extraction without retraining the language model, while maintaining context and reducing the illusion of incomplete information.
Smart Images

Figure KR2025095336_27112025_PF_FP_ABST
Abstract
Description
Method for constructing a knowledge base using a language model, method for providing responses using a knowledge base, and computing device for performing the same
[0001] The present invention relates to a method for constructing a knowledge base using a language model.
[0002] Large-scale language models (LLMs) possess the versatility to perform a variety of tasks based on extensive training data. However, because language models generate responses based on the patterns and statistics of the training data, if the model fails to accurately understand the context or the training data lacks specific patterns, it can generate incomplete inferences and misleading information, potentially leading to the problem of illusion.
[0003] The Retrieval Augmented Generation (RAG) system retrieves additional information and provides it to the response model to enable response generation by referencing an external knowledge base to improve the output quality of the language model.
[0004] The RAG system retrieves relevant information from an external knowledge base based on the semantic similarity between a user's question and a document. However, a typical user's question and a document containing information to answer that question may be located in different semantic spaces.
[0005] That is, if the semantic similarity between documents is low, the RAG system is likely to fail to properly retrieve relevant documents, and the retrieved documents may not be relevant to the query or contain appropriate information.
[0006] Alternatively, since the RAG system manages documents in the knowledge base by dividing them according to the limit on the number of tokens that the language model can process, if the information required for the response is scattered throughout the document, the retrieved information may not contain all the required information or may lose context.
[0007] In other words, existing language models still show problems in responding based on partial and incomplete information obtained through the RAG system, and this necessitates the development of a new method that can access the knowledge base more accurately and efficiently.
[0008] The present invention aims to propose a method for constructing a knowledge base so that a language model can generate more accurate and relevant responses by matching the search space between the input query through the knowledge base and the language model.
[0009] Specifically, the present invention aims to propose a method for improving the search speed and accuracy of a RAG system by increasing the semantic similarity between a search target and a query and efficiently extracting information within the token constraints of a language model.
[0010] In addition, the present invention aims to propose a method for increasing knowledge expansion and search accuracy without retraining a language model through an established RAG system.
[0011] The present invention aims to propose a response system in which a language model generates accurate and reliable responses by optimizing search accuracy and information extraction.
[0012] In order to achieve the above-described object, a method for constructing a knowledge base performed in a computing device according to an embodiment of the present invention comprises the steps of: generating an expected query related to each data piece divided into a plurality of pieces of original data using a learned language model; generating a summary of the expected query generated from the data piece using the language model; and generating a knowledge base comprising an index that vectorizes the expected query and a summary of the expected query as content data for the index.
[0013] It is preferable that the reference size for determining the above data piece be determined within the number of tokens that can be processed by the language model.
[0014] The above reference size is changed as a unit for generating an expected query, and it is preferable that the step of generating the above expected query generates an expected query from each piece of data divided according to the changed reference size.
[0015] The step of generating the above summary preferably generates a summary for the generated expected query from a plurality of pieces of the above data.
[0016] The step of generating the above summary preferably comprises the steps of generating a plurality of preliminary summaries from each of the plurality of pieces of data; and generating a comprehensive summary summarizing the generated preliminary summaries.
[0017] In order to achieve the above-described object, according to an embodiment of the present invention, a method for providing a response to a query augmented with a knowledge base using a language model, performed in a computing device, comprises: a step of receiving a user query through a user interface; a step of extracting content data by referencing an index of the knowledge base corresponding to a query vector obtained by vectorizing the input user query; a step of augmenting the user query with the extracted content data; and a step of outputting a response of the language model to the augmented user query to the user interface, wherein the knowledge base preferably comprises an index generated by vectorizing a related expected query from data fragments obtained by dividing original data into a plurality of fragments using the language model, and a summary of the query generated from the data fragments using the language model as content data.
[0018] It is preferable that the step of extracting the above content data extracts the corresponding content data by referring to an index determined based on the similarity between the query vector and the index of the knowledge base.
[0019] The step of extracting the above content data preferably extracts the content data from a first or second knowledge base that has different content data corresponding to the index or an embedding target vectorized by the index.
[0020] It is preferable that the step of extracting the above content data extracts the corresponding content data by referring to one of the indexes determined based on the similarity between the query vector and the first index of the first knowledge base or the second index of the second knowledge base.
[0021] In the step of extracting the above content data, if the similarity between the query vector and the first index is less than a threshold value, it is preferable to extract the corresponding content data by referring to the second index determined based on the similarity between the second indexes of the second knowledge base.
[0022] According to an embodiment of the present invention for achieving the above-described object, a computing device includes a processor, a memory communicating with the processor, the memory storing instructions for causing the processor to perform operations, the operations including an operation of generating an expected query related to each data piece by dividing original data into a plurality of pieces using a learned language model, an operation of generating a summary for the generated expected query from the data piece using the language model, and an operation of generating a knowledge base that comprises an index that vectorizes the expected query and a summary for the expected query as content data for the index.
[0023] It is preferable that the reference size for determining the above data piece be determined within the number of tokens that can be processed by the language model.
[0024] The above reference size is changed as a unit for generating an expected query, and it is preferable that the operation of generating the above expected query generates an expected query from each piece of data divided according to the changed reference size.
[0025] The operation of generating the above summary preferably generates a summary for the generated expected query from a plurality of pieces of the above data.
[0026] The operation of generating the above summary is preferably an operation of generating a plurality of preliminary summaries from each of the plurality of pieces of data, and generating a comprehensive summary that summarizes the generated preliminary summaries.
[0027] According to an embodiment of the present invention for achieving the above-described object, a computing device includes a processor, and a memory communicating with the processor, wherein the memory stores instructions for causing the processor to perform operations, and the operations include an operation of receiving a user query through a user interface, an operation of extracting content data by referencing an index of the knowledge base corresponding to a query vector obtained by vectorizing the input user query, an operation of augmenting the user query with the extracted content data, and an operation of outputting a response of the language model to the augmented user query to the user interface, wherein the knowledge base preferably comprises an index generated by vectorizing a related expected query from data pieces obtained by dividing original data into a plurality of pieces using the language model and a summary of the generated query from the data pieces using the language model as content data.
[0028] It is preferable that the operation of extracting the above content data extracts the corresponding content data by referring to an index determined based on the similarity between the query vector and the index of the knowledge base.
[0029] The operation of extracting the above content data preferably extracts the content data from a first or second knowledge base that has different content data corresponding to the index or an embedding target vectorized by the index.
[0030] It is preferable that the operation of extracting the above content data extracts the corresponding content data by referring to one of the indexes determined based on the similarity between the query vector and the first index of the first knowledge base or the second index of the second knowledge base.
[0031] The operation of extracting the above content data preferably extracts the corresponding content data by referring to the second index determined based on the similarity between the second indexes of the second knowledge base when the similarity between the query vector and the first index is less than a threshold value.
[0032] According to the present invention, the semantic similarity between the search target and the query within the knowledge base can be increased, thereby improving the retrieval accuracy of information related to the query. Furthermore, the retrieved additional information enables the language model to generate more accurate and relevant responses to the user's query.
[0033] In addition, the present invention enables optimal extraction of necessary information while taking into account the limitations of processable tokens of a language model.
[0034] In addition, the present invention divides documents in a knowledge base into a limited size according to tokens, and by using a language model, the divided pieces of information can maintain context and prevent distortion of information.
[0035] In addition, the present invention can expand knowledge and improve search accuracy without retraining a language model through a RAG system, save time and cost, and increase the flexibility of the language model.
[0036] By optimizing the search accuracy and information extraction of language models, we can reduce the illusion of language models and build a response system that generates accurate and reliable responses.
[0037] FIG. 1 is an exemplary diagram illustrating a system for building a knowledge base according to one embodiment of the present invention.
[0038] Figure 2 is a flowchart illustrating a method for constructing a knowledge base according to one embodiment of the present invention.
[0039] FIG. 3 is an exemplary diagram illustrating a system for generating predicted queries from a knowledge base according to one embodiment of the present invention.
[0040] FIG. 4 is an exemplary diagram illustrating the generation of a query according to a variable reference size according to one embodiment of the present invention.
[0041] FIG. 5 is an exemplary diagram illustrating a process of extracting a summary as content data to be stored in a data field of a knowledge base according to one embodiment of the present invention.
[0042] FIG. 6 is a flowchart illustrating a process of generating a summary by referencing multiple pieces of data according to one embodiment of the present invention.
[0043] FIG. 7 is an exemplary diagram showing a process of generating a comprehensive summary based on a preliminary summary according to one embodiment of the present invention.
[0044] FIG. 8 is an exemplary diagram illustrating a response system constructed according to one embodiment of the present invention.
[0045] FIG. 9 is a flowchart illustrating a method for providing a specific response service through a knowledge base constructed according to one embodiment of the present invention.
[0046] FIG. 10 is an exemplary diagram illustrating a RAG system within a server that extracts content data for augmenting a query according to one embodiment of the present invention.
[0047] Figure 11 is an exemplary diagram showing an index search process according to one embodiment of the present invention.
[0048] Figure 12 is an exemplary diagram showing a process of providing a response service by a server according to one embodiment of the present invention.
[0049] FIG. 13 is an exemplary diagram illustrating a method for augmenting a user query based on multiple knowledge bases according to one embodiment of the present invention.
[0050] FIG. 14 is an exemplary diagram showing the implementation of a server constructed according to one embodiment of the present invention as a computer device.
[0051] The following merely illustrates the principles of the present invention. Therefore, those skilled in the art will be able to implement the principles of the present invention and invent various devices within the scope and spirit of the present invention, even if not explicitly described or illustrated herein. Furthermore, all conditional terms and embodiments listed herein are expressly intended, in principle, to facilitate understanding of the concepts of the present invention, and should be understood as being in no way limiting to the specifically enumerated embodiments and conditions.
[0052] The above-described objects, features and advantages will become more apparent through the following detailed description with reference to the attached drawings, so that a person having ordinary skill in the art to which the present invention pertains can easily practice the technical idea of the present invention.
[0053] In addition, in describing the present invention, if it is determined that a detailed description of a known technology related to the present invention may unnecessarily obscure the gist of the present invention, the detailed description will be omitted.
[0054] Hereinafter, various embodiments of the present invention will be described in detail with reference to the attached drawings.
[0055] FIG. 1 is a diagram illustrating a system for constructing a knowledge base (330) (Knowledge Base, KB) according to one embodiment of the present invention.
[0056] A knowledge base (330) according to one embodiment of the present invention can be implemented on a network server (300) and can be built based on a language model (320).
[0057] In this embodiment, the knowledge base (330) may be composed of an index (54) and data fields. The knowledge base (330) is primarily used to structure and store knowledge of a specific topic or domain, and may be composed of an index (54) and data fields, like a general database.
[0058] Therefore, in this embodiment, the knowledge base (330) is described as a database that stores and manages additional information referenced for the response of the language model (320) according to the purpose of the database, rather than being distinguished from the database, and provides additional information in the response service process.
[0059] In this embodiment, the index (54) constituting the knowledge base (330) can be used for fast searches and efficient information extraction from the knowledge base (330). Since the knowledge base (330) stores various types of data, the index (54) can be used to quickly find specific concepts or information.
[0060] The knowledge base (330) according to the present embodiment can generate an index (54) by pre-generating an expected query (52) related to content data to be stored in a data field through a language model (320) and embedding the generated expected query (52).
[0061] In this embodiment, the data field is a part that stores actual information in the knowledge base (330), and the data field can be configured in various structures and formats depending on the purpose and type of the knowledge base (330).
[0062] The data field contains details of individual data items, and in this embodiment, the data field can store text values that extract and summarize original data based on an expected query (52) generated through a language model (320).
[0063] In this embodiment, the server (300) utilizes data fields and indexes (54) through a language model (320) to structure original data and support fast and efficient searches.
[0064] The server (300) can extract additional information that can augment a query from an index (54) corresponding to a user's query using a knowledge base (330) constructed using a language model (320).
[0065] A general knowledge base (330) is used to retrieve information related to a query based on direct semantic similarity between a user's query and original data stored in the knowledge base (330).
[0066] However, the user's query and the original data may be located in different semantic spaces (query spaces) depending on the size or representation format of the data.
[0067] Accordingly, the present invention proposes a method of constructing a knowledge base (330) that matches the search space with the query input through the language model (320), thereby enabling the language model (320) to generate a response by referencing more accurate and relevant information.
[0068] Hereinafter, a method for constructing a knowledge base (330) according to the present invention will be described with reference to FIG. 2.
[0069] Figure 2 is a flowchart illustrating a method for constructing a knowledge base according to one embodiment of the present invention.
[0070] The server (300) can generate an expected query (52) related to each data piece that is divided into multiple pieces of original data to be stored in the knowledge base (330) using the learned language model (320) (S100).
[0071] First, the server (300) can divide the original data into multiple data chunks.
[0072] The server (300) can divide the original data into data fragments based on a reference size. Here, the reference size can be determined by considering the maximum input token size (hereinafter referred to as the "maximum number of input tokens") of the language model (320) that provides a response based on the knowledge base (330). That is, the server (300) can divide the document into multiple data fragments so as not to exceed the maximum number of input tokens that can be input into the language model (320) for efficient utilization of the language model (320).
[0073] Specifically, the server (300) may first tokenize a document corresponding to the original data to segment the original data. Tokens may be words, phrases, or individual characters, and the server (300) may tokenize the original data according to the tokenization rules of a predefined language model (320).
[0074] The server (300) sets the maximum size of the document data fragments to be split based on the maximum number of input tokens of the language model (320). For example, if the language model (320) can accommodate 512 tokens, each data fragment may be determined not to exceed this range.
[0075] The server (300) divides the document into data fragments based on the total number of tokens in the original data and the maximum number of input tokens. At this time, the server (300) may additionally impose conditions for dividing the data fragments into sentence units or into larger semantic units (e.g., paragraphs) so that each data fragment maintains its context within the data fragment.
[0076] At this time, the server (300) can prevent an increase in the search and processing time of data fragments by limiting duplication between the data fragments being divided, and increase the consistency of the search results.
[0077] Next, the server (300) can generate a predicted query (52) in units of data pieces using a language model (320).
[0078] FIG. 3 is a diagram illustrating a system for generating a predicted query (52) from a knowledge base (330) according to one embodiment of the present invention.
[0079] The server (300) can generate a prompt for generating an expected query (52). Specifically, the server (300) writes a prompt to generate an expected query (52) that can be derived from pieces of original data included in each piece of data, and inputs the written prompt into a language model (320) to generate an expected query (52).
[0080] The server (300) can generate various types of queries based on natural language through a language model (320).
[0081] Additionally, the server (300) may perform a filtering process to verify the relevance and diversity of queries. The server (300) verifies whether the generated queries are relevant to the content of each piece of data and whether various query types have been generated.
[0082] The server (300) adjusts the prompts for query generation or changes the parameters of the language model (320) to filter the set of queries and generate a final set of queries if the query is unethical or too general, or if the generated query is not related to the content of the data piece.
[0083] The server (300) can generate one or more queries for each piece of data through the language model (320) and can generate a set of queries for the original data of the knowledge base (330).
[0084] The final query set generated through the above process is input into the embedding model (315) and can be stored as an index (54) of the knowledge base (330) through the embedding model (315).
[0085] That is, in this embodiment, the query used as the index (54) is determined from a data fragment of the original data input to the language model (320), and the server (300) can also generate various queries by dynamically changing the standard size for dividing the original data.
[0086] The server (300) can increase the adaptability of the language model (320) to user queries (51) by referencing the knowledge base (330) with an index (54) generated as an embedding target for various queries.
[0087] In this embodiment, the server (300) can generate various expected queries (52) by changing the reference size for dividing the above-described original data.
[0088] FIG. 4 is a diagram illustrating the generation of a query according to a variable reference size according to one embodiment of the present invention.
[0089] Referring to FIG. 4, the server (300) can use each data piece of the original data divided into a variable, not fixed, standard size when generating a query.
[0090] The server (300) generates an expected query (52) from each piece of data divided according to various criteria sizes.
[0091] For example, the server (300) can generate an expected query (52) #1 from a data piece (piece #1) according to a first reference size, and can generate an expected query (52) #3 from a data piece (piece #2) according to a second reference size different from the first reference size.
[0092] At this time, the conditions for changing the reference size can be determined based on the structure or semantic characteristics of the original data. The server (300) generates and filters a query set from data fragments of various sizes.
[0093] In addition, referring to FIG. 4, the server (300) can also generate a more diverse set of queries by adjusting the number of expected queries (52) generated according to the reference size as a prompt.
[0094] For example, the server (300) can generate multiple expected queries (52-1, 52-2) (expected query #1, expected query #2) from data fragments (fragments #1, 54-1).
[0095] That is, the server (300) can generate a predetermined number of expected queries (52) from a piece of data through a prompt, or can generate one or more expected queries (52) depending on the variable size of the piece of data.
[0096] Next, the server (300) generates a summary (56) summarizing the content of the data fragment based on the queries generated using the language model (320) (S200). The server (300) vectorizes the query and uses it as an index (54), and stores the summary (56) as a document in the knowledge base (330).
[0097] FIG. 5 is a diagram illustrating a process of extracting a summary (56) as content data to be stored in a data field of a knowledge base (330) according to one embodiment of the present invention.
[0098] Referring to FIG. 5, in the present embodiment, the server (300) can input a prompt (322) for generating a summary (56) for an expected query (52) into the language model (320) along with a piece of data.
[0099] The server (300) can prompt the language model (320) to accurately summarize the content of a piece of data or provide a concise response (56) to a related query through a prompt (322).
[0100] For example, the server (300) may construct a prompt (322) such as, "Please briefly summarize the content of this fragment that is relevant to [question]. Include the main topic and key content." or "Please provide a response to [question] in this fragment."
[0101] Additionally, the server (300) can also expand the data fragments to be referenced when generating a summary (56) related to the expected query (52).
[0102] For example, if the size of the data fragment to be summarized is input for generating a summary (56) through a language model (320), the server (300) can also input data fragments located before and after the data fragment to be summarized in the entire document (50) within the maximum number of input tokens.
[0103] The server (300) can expand the scope of original data referenced by the language model (320) to multiple data pieces to increase the contextual completeness or accuracy of the generated summary (56).
[0104] FIG. 6 is a flowchart illustrating a process of generating a summary (56) by referencing multiple pieces of data according to one embodiment of the present invention.
[0105] Referring to FIG. 6, the server (300) generates a preliminary summary (56) for an expected query (52) generated from multiple data pieces that are divided from the original data (S210).
[0106] At this time, the plurality of data pieces to be referenced can be determined within the range of tokens that can be processed by the language model (320), and the plurality of data pieces can be determined on the condition that they are consecutive or have the same subject.
[0107] Alternatively, the server (300) may sequentially search the entire original data and have the language model (320) summarize the original data based on the expected query (52).
[0108] In this embodiment, the server (300) can generate a plurality of preliminary summaries (56) from a plurality of pieces of data.
[0109] Afterwards, the server (300) can additionally perform a process of synthesizing the generated preliminary summary (56) to store it as content data.
[0110] Specifically, the server (300) can extract and synthesize the main content of a data fragment based on a preliminary summary (56) by utilizing a language model (320) (S220). The server (300) can collect preliminary summaries (56) by sliding the entire document (50) and synthesize the collected preliminary summaries (56) to create a single summary (56). This will be described in more detail below with reference to FIG. 7.
[0111] FIG. 7 is an exemplary diagram showing a process of generating a comprehensive summary (56) based on a preliminary summary (56) according to one embodiment of the present invention.
[0112] Referring to FIG. 7, the server (300) induces the language model (320) to summarize the content of each piece of data concisely and clearly through the first prompt (322).
[0113] The server (300) induces the language model (320) to summarize the content of each piece of data within the entire document (50) and generate a preliminary summary (56) through the first prompt (322).
[0114] Next, the server (300) combines the generated preliminary summaries (56-1, 56-2) (preliminary summary #1, 쪋, preliminary summary #K) to form a preliminary summary set (58).
[0115] At this time, the preliminary summary set (58) can be generated by a simple combining process of maintaining the order of the generated preliminary summaries (56) and connecting them.
[0116] The server (300) can then configure a second prompt (324) to generate a comprehensive summary (56) from a set of preliminary summaries (58). For example, the server (300) can use the second prompt (324) to say, "Please generate a summary of the entire document based on the preliminary summaries. At this time, synthesize the important contents of each summary, remove duplication, and maintain consistency." to enable the language model (320) to extract key contents from each preliminary summary (56), comprehensively connect them, and remove duplication.
[0117] The server (300) can arrange the preliminary summary (56) generated from each piece of data in a logical order and structure it to reflect the flow of the entire document (50), and at this time, can generate a comprehensive summary (56) in which the main topic and content are emphasized.
[0118] Through the above process, the server (300) can search the entire document (50) to understand the overall context of the document and generate a comprehensive summary (56) that summarizes the content related to the expected query (52).
[0119] The server (300) according to the present embodiment can expand the range of information that the language model (320) can reference within the token limit by generating the above-described comprehensive summary (56).
[0120] The server (300) enables the language model (320) to process substantially more information by summarizing the contents of the entire document (50) in advance within the token limit in the response process described below, and to generate a more effective response to a complex topic.
[0121] Finally, the server (300) builds a knowledge base (330) on the original data through the generated expected query (52) and the summary (56) summarized through the expected query (52).
[0122] The server (300) generates a knowledge base (330) that comprises an index (54) that vectorizes an expected query (52) and a summary (56) for the expected query (52) as content data for the index (54) (S300). At this time, the knowledge base (330) can store the index and content data as a data pair by mapping them to each other.
[0123] Specifically, the server (300) can perform embedding to vectorize the generated expected query (52) in order to use the generated expected query (52) as an index (54).
[0124] Embedding is a process of converting an expected query (52) into a high-dimensional vector, and can be performed for the purpose of indexing a knowledge base (330) for similarity-based search.
[0125] The server (300) sets the embedding vector for the expected query (52) as an index (54) and constructs a knowledge base (330) by storing each summary (56) generated for the expected query (52) as content data.
[0126] The knowledge base (330) built in the server (300) can be used by the RAG system to reference and augment a user's query, and the server (300) builds a response system that provides the output of a language model (320) to the user's query as a response based on the augmented query.
[0127] Hereinafter, a response system utilizing a knowledge base (330) constructed according to the present embodiment will be described with reference to FIG. 8.
[0128] FIG. 8 is a diagram illustrating a response system constructed according to one embodiment of the present invention.
[0129] In this embodiment, the server (300) includes a knowledge base (330) and a language model (320) constructed according to the above-described embodiment, and may include a user interface (370) for receiving a user query (51) from a user.
[0130] In addition, the server (300) may configure a RAG system (340) that augments a user query (51) input through a user interface (370) by referencing a knowledge base (330) and provides the augmented query to a language model. Although not shown in the drawing, the system may further include a receiving unit that receives a user query from a user interface, an augmenting unit that augments the user query by referencing a knowledge base, and a transmitting unit that transmits the augmented query.
[0131] The server (300) can augment the user's (10) query based on the knowledge base (330) before the language model (320) generates a response from the user's query (51) via the RAG system (340).
[0132] A user (10) can input a user query (51) in natural language using a user interface (370) provided by a server (300).
[0133] The input user query (51) is transmitted to the RAG system (340), and the RAG system (340) augments the user query (51) based on the extracted content data with reference to the knowledge base (330).
[0134] The server (300) provides an augmented query to the language model (320) through the RAG system (340) and configures a response system that generates a response to the augmented query from the language model (320).
[0135] The language model (320) according to the present embodiment generates a response by inputting an augmented query (53) instead of directly receiving a user query (51) and provides the response to the user (10) through a user interface (370).
[0136] The response system built on the server (300) provides a response service for a user query (51) by outputting a response generated from a language model (320) to the user (10) through a user interface (370).
[0137] FIG. 9 is a diagram showing a method for providing a specific response service through a knowledge base (330) constructed according to one embodiment of the present invention.
[0138] Referring to FIG. 9, the server (300) receives a user query (51) through a user interface (370) (S1000).
[0139] A user (10) can directly input a user query (51) in natural language form through a user interface (370) provided by the server (300).
[0140] For example, a user (10) can input a user query (51) in natural language form, such as “Who does Cinderella marry?”
[0141] Next, the server (300) extracts content data for augmenting the user query (51) by referencing the index (54) of the knowledge base (330) as a query vector (55) that vectorizes the input user query (51) (S2000).
[0142] FIG. 10 is an exemplary diagram showing a RAG system (340) within a server (300) that extracts content data for augmenting a query according to one embodiment of the present invention.
[0143] Referring to FIG. 10, when a user inputs a user query (51) in the form of “Who does Cinderella marry?” as a prompt, the RAG system (340) can extract information related to the query by referencing the knowledge base (330).
[0144] As a specific process, the RAG system (340) can first vectorize a user query (51) entered for searching the knowledge base (330).
[0145] The vectorization process can be performed by mapping the user query (51) to a common feature space through the same embedding model (315) as the vectorization process of the expected query (52) of the above-described knowledge base (330).
[0146] In this embodiment, the knowledge base (330) generates an index (54) of the expected query (52) itself that can be derived from the original data, so that the search space between the user query (51) input during the response service process and the index (54) of the knowledge base (330) can be identical.
[0147] The server (300) matches the search space between the input user query (51) and the index (54), thereby enabling the RAG system (340) to extract more accurate and expanded information within a limited range of tokens from the knowledge base (330).
[0148] The RAG system (340) extracts content data within the knowledge base (330) by referencing the index (54) of the knowledge base (330) corresponding to the query vector (55) that vectorizes the user query (51).
[0149] Specifically, the RAG system (340) searches for an index (54) that is most similar to a user query (51) based on the similarity between a query vector (55) and an index (54) vector for the user query (51), and can extract content data corresponding to the index (54) by referencing the index (54).
[0150] Figure 11 is an exemplary diagram showing an index (54) search process according to one embodiment of the present invention.
[0151] Referring to FIG. 11, the RAG system (340) can extract content data based on the similarity between vectors.
[0152] The RAG system (340) uses a language model (320) to calculate the similarity between the index (54) vector that vectorizes the expected queries (52) in the index (54) table of the knowledge base and the query vector (55) for the user query (51).
[0153] For example, the RAG system (340) can determine that the index vector with the highest similarity to the query vector (55) for the user query (51) “Who does Cinderella marry?” is the index (index ID: 2) embedding the expected query “What is the background of Cinderella’s marriage?”
[0154] The RAG system (340) can extract the summary (56-2) "Cinderella, who attended a magnificent ball with the help of a wizard, falls in love with the prince. ... The prince conducts a test to find Cinderella by matching her shoe to the entire kingdom. ..." as content data corresponding to the searched index (54-2) from the knowledge base (330).
[0155] The following RAG system (340) augments the user query (51) with content data or expected query (52) and content data (S3000).
[0156] Specifically, in this embodiment, the augmented query to be input to the language model (320) may have a form as shown in Table 1 below.
[0157] Answer the questions below using the information below. Question: Who does Cinderella marry? 2query: What is the background to Cinderella's marriage? With the help of a magician, Cinderella attends a magnificent ball and falls in love with the prince. The prince conducts a test to find Cinderella, challenging the entire kingdom to find her shoe.
[0158] In addition, in the present embodiment, the RAG system (340) can consider the maximum number of token inputs of the language model (320) in the process of augmenting the query, and augment the query to include multiple content data extracted according to the rank of similarity within the maximum number of token inputs. Through this, the present invention allows the RAG system (340) to optimally extract necessary information while considering the limitation of the maximum number of token inputs that the language model (320) can process, so that the language model (320) can refer to it in the response process.
[0159] The following language model (320) outputs the language model's response to the augmented query (53) that augments the user query (51) entered as an input prompt to the user interface (S4000).
[0160] Fig. 12 is a diagram showing a response service provision process of a server (300) according to one embodiment of the present invention.
[0161] Referring to FIG. 12, the language model (320) of the server (300) generates output using an augmented query as input, and provides the generated output to the user (10) through a user interface (370).
[0162] In this embodiment, the server (300) extracts content data generated through an expected query (52) most similar to a user query (51) to generate an augmented query (53) and causes the language model (320) to generate output based on the augmented query (53).
[0163] Furthermore, as an additional embodiment of the present invention, the server (300) can also enable the RAG system (340) to flexibly respond to the form of a user query (51) by diversifying the content data stored in the data field and the embedding target for generating the index (54) constituting the knowledge base (330).
[0164] For example, the server (300) can also construct and operate multiple knowledge bases (330) that have different content data corresponding to the target or index (54) vectorized as an index (54) as shown in Table 2 below.
[0165] The server (300) can extract content data from the knowledge base (330) according to a predetermined priority or criterion.
[0166] Embedding target Data to be stored Knowledge base #1 Query extracted from data fragment Summary that extracts / summarizes necessary content based on the extracted query Knowledge base #2 Split data fragment Split data fragment Knowledge base #3 Summary of data fragment Summary of data fragment or split data fragment Knowledge base #4 Query extracted from data fragment Data fragment linked to the query
[0167] Referring to Table 2, the server (300) can construct a summary (56) that extracts and summarizes necessary content from the data fragment based on the extracted query as the embedding target of the knowledge base (330) 1 (Knowledge Base #1). That is, the knowledge base (330) 1 (Knowledge Base #1) uses the expected query (52) extracted from the data fragment according to the above-described embodiment as the embedding target, and the embedded query is used for search based on semantic similarity, and can be useful for finding a summary (56) that includes a similar topic or concept to a natural language query of a general user.
[0168] Additionally, Knowledge Base (330) 2 (Knowledge Base #2) uses segmented data fragments as embedding targets and can use the stored content data as segmented data fragments.
[0169] Knowledge base (330) 2 directly uses segmented data fragments as embedding targets, enabling retrieval based on the structure and content of the text. Alternatively, if the original data is formally refined, the language model (320) can provide a response based on the original context.
[0170] Additionally, Knowledge Base (330) 3 (Knowledge Base #3) uses a summary of data fragments as an embedding target, and the stored content data may be a summary of data fragments or segmented data fragments.
[0171] Knowledge base (330) 3 uses the summary of data fragments as an embedding target, thereby enabling a more concise search by focusing on the main content included in the user's query.
[0172] Knowledge Base (330) 4 (Knowledge Base #4) uses queries extracted from data fragments as embedding targets, and the content data stored may be the entire data fragment linked to the query.
[0173] Knowledge base (330) 4 uses queries extracted from data fragments as embedding targets, and embedded user queries (51) are searched based on semantic similarity within the same search space as the index (54), enabling more detailed responses based on the original data to be provided based on the entire data fragment.
[0174] The server (300) can determine which knowledge base (330) to use based on the similarity to the user's query among the plurality of knowledge bases (330) above, and can augment the user's query (51) based on the determined knowledge base (330).
[0175] FIG. 13 is an exemplary diagram showing a method for augmenting a user query (51) based on multiple knowledge bases (330) according to one embodiment of the present invention.
[0176] Referring to FIG. 13, the server (300) can extract corresponding content data by referring to an index (54) determined to have a high similarity based on the similarity between the query vector (55) and the first index (54) of the first knowledge base (330) or the second index (54) of the second knowledge base (330).
[0177] In addition, the server (300) augments the user query (51) by referring to the knowledge base (330) according to a predetermined priority among the knowledge bases (330), but when the similarity between the query vector (55) and the first index (54) of the first-ranked knowledge base (330) is less than a threshold value, it is also possible to extract the corresponding content data by referring to the second index (54) determined based on the similarity between the second index (54) of the second-ranked knowledge base (330).
[0178] The present invention improves search speed and accuracy by increasing semantic similarity between a search target and a query, efficiently extracting information within the token limitations of a language model (320), and enables the language model (320) to generate accurate and reliable responses through optimization of search accuracy and information extraction.
[0179] FIG. 14 is a diagram showing the implementation of a server (300) constructed according to one embodiment of the present invention as a computer device.
[0180] Hereinafter, a specific hardware implementation of the server (300) according to the present embodiment will be described with reference to FIG. 14.
[0181] At least one of each module constituting the server (300) is implemented on a general-purpose computing processor and thus may include a processor (388), an input / output (I / O) device (382), a memory (384), an interface (386), and a bus (385). The processor (388), the input / output device (382), the memory (384), and / or the interface (386) may be coupled to each other via a bus (385). The bus (314) corresponds to a path through which data is moved.
[0182] Specifically, the processor (388) may include at least one of a CPU (Central Processing Unit), an MPU (Micro Processor Unit), an MCU (Micro Controller Unit), a GPU (Graphics Processing Unit), a microprocessor, a digital signal processor, a microcontroller, an application processor (AP), and logic elements capable of performing functions similar thereto.
[0183] The input / output device (382) may include at least one of a keypad, a keyboard, a touchscreen, and a display device. The memory (384) may store data and / or programs.
[0184] The interface (386) may perform a function of transmitting data to or receiving data from a communication network. The interface (386) may be wired or wireless. For example, the interface (386) may include an antenna or a wired / wireless transceiver. The memory (384) may further include high-speed DRAM and / or SRAM, etc., as a volatile operating memory that enhances the operation of the processor (388) while protecting personal information.
[0185] Additionally, the memory (384) stores programming and data configurations that provide the functionality of some or all of the modules described herein. For example, it may include logic for performing selected aspects of an augmentation or response method according to the present embodiment using a language model.
[0186] A program or application is loaded as a set of instructions including each operation using the above-described language model stored in memory (384), and the processor is enabled to perform each operation.
[0187] The various embodiments described herein may be implemented in a recording medium readable by a computer or similar device, for example, using software, hardware, or a combination thereof.
[0188] In terms of hardware implementation, the embodiments described herein can be implemented using at least one of ASICs (application specific integrated circuits), DSPs (digital signal processors), DSPDs (digital signal processing devices), PLDs (programmable logic devices), FPGAs (field programmable gate arrays), processors, controllers, micro-controllers, microprocessors, and other electrical units for performing functions. In some cases, the embodiments described herein can be implemented as a control module itself.
[0189] In a software implementation, the procedures and functions described herein, as well as other embodiments, may be implemented as separate software modules. Each of these software modules may perform one or more of the functions and operations described herein. The software code may be implemented as a software application written in a suitable programming language. The software code may be stored in a memory module and executed by a control module.
[0190] The above description is merely an example of the technical idea of the present invention, and those skilled in the art will appreciate that various modifications, changes, and substitutions can be made without departing from the essential characteristics of the present invention.
[0191] Accordingly, the embodiments disclosed in the present invention and the accompanying drawings are intended to illustrate, rather than limit, the technical concept of the present invention, and the scope of the technical concept of the present invention is not limited by these embodiments and the accompanying drawings. The protection scope of the present invention should be interpreted by the following claims, and all technical concepts within the scope equivalent thereto should be interpreted as being included within the scope of the rights of the present invention.
Claims
In a method for constructing a knowledge base performed on a computing device, A step of generating a predicted query for each data piece divided into multiple pieces of original data using a learned language model; A step of generating a summary for the generated expected query from the data piece using the language model; and A step of generating a knowledge base by mapping a vectorized index of the above expected query and a summary of the above expected query to content data, How to build a knowledge base. In the first paragraph, The reference size for determining the above data piece is determined within the number of tokens that the language model can process. How to build a knowledge base. In the second paragraph, The above reference size is changed to the unit for generating the expected query, The step of generating the above expected query is to generate the expected query from each piece of data divided according to the changed reference size. How to build a knowledge base. In the first paragraph, The steps for generating the above summary are: generating a plurality of preliminary summaries from each of the plurality of pieces of data; and Generating a comprehensive summary that summarizes the preliminary summary generated above, How to build a knowledge base. In a method for providing a response using a knowledge base performed on a computing device, A step of receiving a user query through a user interface; A step of extracting content data by referencing an index of the knowledge base corresponding to a query vector that is a vectorized version of the input user query; A step of augmenting the user query with the extracted content data; A step of outputting a response of the language model to the augmented user query to the user interface, The above knowledge base stores at least one data pair that maps an index and content data, wherein the index is vectorized data that generates a related expected query from a data fragment that divides the original data into multiple fragments using a language model, and the content data is a summary generated from the data fragment as an answer to the expected query. How to provide a response. In paragraph 5, The steps for extracting the above content data are: Extracting corresponding content data by referring to an index determined based on the similarity between the query vector and the index of the knowledge base. How to provide a response. In paragraph 6, The steps for extracting the above content data are: Extracting the content data from the first or second knowledge base that has different content data corresponding to the index or the embedding target vectorized by the index, How to provide a response. In paragraph 7, The step of extracting the above content data extracts the corresponding content data by referring to one of the indexes determined based on the similarity between the query vector and the first index of the first knowledge base or the second index of the second knowledge base. How to provide a response. In paragraph 8, The step of extracting the above content data includes extracting the corresponding content data by referring to the second index determined based on the similarity between the second indexes of the second knowledge base when the similarity between the query vector and the first index is less than a threshold value. How to provide a response. processor, including a memory communicating with the processor, The above memory stores instructions that cause the processor to perform operations, The above actions are, The operation of generating predicted queries related to each piece of data by dividing the original data into multiple pieces using a learned language model. An operation of generating a summary for the generated expected query from the data piece using the language model, and An operation of generating a knowledge base that comprises an index that vectorizes the above expected query and a summary of the above expected query as content data for the index, Computing device. In paragraph 10, The reference size for determining the above data piece is determined within the number of tokens that the language model can process. Computing device. In paragraph 11, The above reference size is changed to the unit for generating the expected query, The operation of generating the above expected query generates an expected query from each piece of data divided according to the changed reference size. Computing device. processor, including a memory communicating with the processor, The above memory stores instructions that cause the processor to perform operations, The above actions are, The act of receiving user queries through a user interface; An operation of extracting content data by referencing an index of a knowledge base corresponding to a query vector that is a vectorized version of the user query entered above. An action to augment the user query with the extracted content data; An operation of outputting a response of a language model to the augmented user query to the user interface, The above knowledge base stores at least one data pair that maps an index and content data, wherein the index is vectorized data that generates a related expected query from a data fragment that divides the original data into multiple fragments using a language model, and the content data is a summary generated from the data fragment as an answer to the expected query. Computing device. In paragraph 13, The action of extracting the above content data is: Extracting corresponding content data by referring to an index determined based on the similarity between the query vector and the index of the knowledge base. Computing device.
Citation Information
Patent Citations
System and method for recommending knowledge actively to write document
KR101881439B1
Mobile search apparatus using voice and method thereof
KR1020110114797A
Natural language question-answering system and learning method
KR102491172B1
Method, apparatus and computer program for buildding knowledge graph using qa model
KR102582744B1
An artificial intelligence-based chatbot conversation consultation system and method thereof
KR102653266B1
Cited By
Intelligent retrieval method and system, readable storage medium and computer
CN121412358A
Power grid information system operation knowledge management method, system and device and storage medium
CN122221977A