Keyword multi-parent title recall optimization method and device based on RAG framework

By matching and assigning different weights in the ES database, combined with reverse order sorting, the problem of poor recall accuracy caused by incomplete text content of the keyword database by large language model is solved, and the accuracy of the recall results is improved.

CN118964548APending Publication Date: 2024-11-15ROCK AI

Patent Information

Application Number
CN202410949877.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

Large language models perform poorly when processing text that is not included in the training data, especially due to poor recall accuracy due to incomplete text content of keyword databases.

Method used

Using the RAG framework-based keyword multi-parent title recall optimization method, by uploading and analyzing knowledge documents in the ES database, matching first-level titles, second-level titles, texts and document names, assigning different weights to query conditions, and combining inverse order sorting The similarity of the simultaneous word is calculated to generate prompt words to improve recall accuracy.

Benefits of technology

By storing richer associated information, the accuracy of recall results of large language models is improved, and the inaccurate recall problems caused by incomplete text content is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118964548A_ABST
    Figure CN118964548A_ABST
Patent Text Reader

Abstract

The invention provides a keyword multi-parent title recall optimization method and device based on an RAG framework, and solves the problem of poor recall accuracy of a large language model caused by incomplete text content of a keyword database. Respectively matching the filtered knowledge document with a first-level title, a second-level title, a third-level title, a text and a document name through regular expressions, and storing matching results in an ES database for subsequently assembling query conditions of the ES database by different weights according to the titles and the document names at all levels. And obtaining a context with high similarity through the assembled query condition and the ES database, and outputting a reasoning result by the LLM in combination with the context and the questions of the user. The problem that the text content of the ES database is incomplete is solved, and the accuracy of LLM recall results is improved by storing richer associated information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of large language models, and in particular to a keyword multi-parent title recall optimization method and device based on a RAG framework. Background Art

[0002] Large language models (LLMs) are trained through deep learning techniques and have powerful natural language processing capabilities, including deep language understanding and generation skills. However, because their knowledge is limited to the training data they have received, their performance may not be satisfactory when dealing with questions that are not included in the training set. To address this challenge, a generation method called "Retrieval Augmented Generation" (RAG) has emerged. This technology enables large language models to answer questions more accurately by retrieving information from private knowledge base documents and incorporating it into prompt instructions. This provides the model with additional contextual knowledge filling, thereby alleviating the dilemma of large models answering inaccurate questions.

[0003] Currently, RAG adopts a multi-channel recall strategy, that is, different technical solutions are used to retrieve similar knowledge base content, and then merged to improve the quality of document recall. Currently, a combination of two recall strategies is used: vector retrieval (Milvus database) and keyword retrieval (Elasticsearch database, hereinafter referred to as ES).

[0004] However, keyword recall currently has certain limitations, especially the problem of incomplete content when the text is segmented and stored in ES. Since a single document may have a lot of content, it is impossible to store it in one ES index. The current system stipulates that each index storage length is 100 Chinese characters. For example, a document with 10,000 Chinese characters will be divided into 100 text contents, which will be indexed and stored in ES separately. Some of the semantics of daily documents are presented through titles. For example, the first-level title is "1. China", the second-level title is "2. Shanghai", and the text content is "Delicious food near Zhongshan Road includes...". This type of document is segmented into fixed-size text and stored in ES. The title and content may be split into two index contents. At this time, the recalled content will be incomplete. For example, if the recall question is: "What are the delicious foods on Zhongshan Road in Guangdong?", the content under the second-level title "2. Shanghai" will be mistakenly recalled, because the text content in the ES index is missing and the content of the parent title is not stored, resulting in inaccurate recalled content. Summary of the invention

[0005] The present invention provides a keyword multi-parent title recall optimization method and device based on a RAG framework to solve the problem that the text content of the keyword database is incomplete, which leads to poor recall accuracy of a large language model.

[0006] In a first aspect, the present invention provides a keyword multi-parent title recall optimization method based on a RAG framework, which specifically comprises the following steps:

[0007] Step S1, upload the knowledge document D1 to the ES database;

[0008] Step S2, obtaining question Q1 and performing basic verification on question Q1, and generating query condition W1 based on question Q1;

[0009] Step S3: Recall the ES database through the query condition W1 to form context T1;

[0010] Step S4, sort the context T1 in reverse order according to the similarity, take the top n contexts in similarity, and form context T2;

[0011] Step S5, generating prompt word P1 through context T2 and question Q1;

[0012] Step S6: Input the prompt word P1 into LLM, perform reasoning through LLM, generate and output the reasoning result.

[0013] Wherein, n is a positive integer.

[0014] Preferably, in step S1, uploading the knowledge document to the ES database specifically includes the following steps:

[0015] Step S101, uploading knowledge document D1 and parsing D1 to form a parsed document D2;

[0016] Step S102, extracting and filtering the text content of D2 to form a processed text C1;

[0017] Step S103, segment C1 according to each a characters to form an array C2 containing a plurality of small blocks of text;

[0018] Step S104, traverse each small block of text in C2, match the first-level title, second-level title, third-level title, text and document name in C1, and form a matching result C3;

[0019] Step S105, traverse C3, obtain each small block of text and its corresponding first-level title, second-level title, third-level title, text and document name, and save them in Elasticsearch.

[0020] Wherein, a is a positive integer.

[0021] The document name may be regarded as a title.

[0022] Preferably, in step S102, invalid paragraphs, spaces, line breaks and other special symbols are filtered using regular expressions.

[0023] Preferably, in step S2, basic verification of question Q1 includes checking the character length and sensitive words of question Q1.

[0024] Preferably, in step S2, query condition W1 is generated based on question Q1, specifically by assigning different weights to the first-level title, second-level title, third-level title, text and document name, respectively, and reassembling question Q1 to generate query condition W1.

[0025] Preferably, in step S4, the calculation of the similarity is shown as follows:

[0026] score=TF×IDF

[0027] Among them, TF (Term Frequency) represents the frequency of the words in the query appearing in the document, and IDF (Inverse Document Frequency) represents the inverse document frequency of the document containing the query words.

[0028] Preferably, in step S4, the reverse order is used because when receiving the prompt word, LLM will pay more attention to the front content and understand the back content less, that is, the more important context should be placed at the front, which is conducive to generating high-quality content.

[0029] The prompt words described in this application represent the input provided by the user to the model to guide the model to generate relevant outputs.

[0030] Preferably, the prompt word P1 can be a question, a sentence, a text, or any form of input determined by the nature of the task. The user interacts with the model through the prompt word, requiring the model to generate a specific type of answer or perform a specific task.

[0031] In a second aspect, the present invention also provides a keyword multi-parent title recall optimization device based on a RAG framework, which specifically includes the following modules:

[0032] The knowledge document upload module is used to upload the knowledge document D1 to the ES database;

[0033] A query condition generation module, connected to the knowledge document upload module, is used to obtain question Q1 and perform basic verification on question Q1, and generate query condition W1 based on question Q1;

[0034] A context recall module, connected to the query condition generation module, is used to recall in the ES database according to the query condition W1 to form a context T1;

[0035] A sorting processing module, connected to the context recall module, is used to sort the context T1 in reverse order according to similarity, and take the top n contexts in similarity to form context T2;

[0036] A prompt word generation module, connected to the sorting processing module, for generating a prompt word P1 through the context T2 and the question Q1;

[0037] The result output module is connected to the prompt word generation module and is used to input the prompt word P1 into the LLM, perform reasoning through the LLM, generate and output the reasoning result.

[0038] Wherein, n is a positive integer.

[0039] Preferably, the knowledge document upload module specifically includes the following submodules:

[0040] The first submodule of knowledge document upload is used to upload knowledge document D1 and parse D1 to form a parsed document D2;

[0041] A second knowledge document upload submodule, connected to the first knowledge document upload submodule, is used to extract and filter the text content of D2 to form a processed text C1;

[0042] A third submodule for uploading knowledge documents, connected to the second submodule for uploading knowledge documents, is used to segment C1 according to each a characters to form an array C2 containing a plurality of small blocks of text;

[0043] The fourth submodule for knowledge document upload is connected to the third submodule for knowledge document upload, and is used to traverse each small block of text in C2, match the first-level title, second-level title, third-level title, text and document name in C1, and form a matching result C3;

[0044] The fifth submodule of knowledge document upload is connected to the fourth submodule of knowledge document upload, and is used to traverse C3, obtain each small block of text and its corresponding first-level title, second-level title, third-level title, text and document name, and save them in Elasticsearch.

[0045] Wherein, a is a positive integer.

[0046] The document name may be regarded as a title.

[0047] Preferably, in the second submodule of knowledge document upload, invalid paragraphs, spaces, line breaks and other special symbols are filtered by regular expressions.

[0048] Preferably, in the second submodule of knowledge document upload, basic verification of question Q1 includes checking the character length and sensitive words of question Q1.

[0049] Preferably, in the second submodule of knowledge document upload, query condition W1 is generated based on question Q1, specifically by assigning different weights to the first-level title, second-level title, third-level title, text and document name, and reassembling question Q1 to generate query condition W1.

[0050] Preferably, in the fourth submodule of knowledge document upload, the calculation of the similarity is shown as follows:

[0051] score=TF×IDF

[0052] Among them, TF represents the frequency of the words in the query in the document, and IDF represents the inverse document frequency of the documents containing the query words.

[0053] Preferably, in the fourth submodule of knowledge document uploading, the reverse order is used because when LLM receives the prompt word, it will pay more attention to the front content and understand the back content less, that is, the more important context should be placed at the front, which is conducive to generating high-quality content.

[0054] The prompt words described in this application represent the input provided by the user to the model to guide the model to generate relevant outputs.

[0055] Preferably, the prompt word P1 can be a question, a sentence, a text, or any form of input determined by the nature of the task. The user interacts with the model through the prompt word, requiring the model to generate a specific type of answer or perform a specific task.

[0056] In a third aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a keyword multi-parent title recall optimization method based on a RAG framework as described in any one of the first aspects of the present application.

[0057] In a fourth aspect, the present invention further provides an electronic device, comprising: a memory storing a computer program; and a processor communicatively connected to the memory, for executing a keyword multi-parent title recall optimization method based on a RAG framework as described in any one of the first aspects of the present application when the computer program is called.

[0058] Compared with the prior art, the present invention has the following obvious outstanding substantive features and significant advantages:

[0059] The present invention provides a keyword multi-parent title recall optimization method and device based on the RAG framework, which solves the problem that the text content of the keyword database is incomplete, which in turn leads to poor recall accuracy of the large language model. The filtered knowledge document is matched with the first-level title, second-level title, third-level title, text and document name respectively through regular expressions, and the matching results are saved in the ES database for subsequent assembly of query conditions of the ES database with different weights according to the titles and document names at each level. Through the assembled query conditions and the ES database, a context with high similarity is obtained, and the LLM outputs the inference result in combination with the context and the user's question. The problem of incomplete text content in the ES database is solved, and the accuracy of the LLM recall result is improved by storing richer related information. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] The accompanying drawings, which constitute part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention. In the accompanying drawings:

[0061] Figure 1 It is a flow chart of a keyword multi-parent title recall optimization method based on a RAG framework according to a preferred embodiment of the present invention.

[0062] Figure 2 It is a structural schematic diagram of a keyword multi-parent title recall optimization device based on a RAG framework according to a preferred embodiment of the present invention.

[0063] Figure 3 It is a schematic diagram of a keyword multi-parent title recall optimization method based on a RAG framework according to a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0064] The present invention provides a keyword multi-parent title recall optimization method and device based on a RAG framework. In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0065] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0066] Embodiment 1:

[0067] like Figure 1 As shown, the keyword multi-parent title recall optimization method based on the RAG framework described in this embodiment specifically includes the following steps:

[0068] Step S1, upload the knowledge document D1 to the ES database.

[0069] Optionally, in step S1, uploading the knowledge document to the ES database specifically includes the following steps:

[0070] Step S101, upload the knowledge document D1 and parse D1 to form a parsed document D2.

[0071] Step S102: extract and filter the text content of D2 to form a processed text C1.

[0072] Optionally, in step S102, invalid paragraphs, spaces, line breaks and other special symbols are filtered using regular expressions.

[0073] Step S103, segment C1 according to each a characters to form an array C2 containing a plurality of small blocks of text.

[0074] Wherein, a is a positive integer. In this embodiment, a is set to 100.

[0075] Step S104, traverse each small block of text in C2, match the first-level title, second-level title, third-level title, text and document name in C1, and form a matching result C3;

[0076] Step S105, traverse C3, obtain each small block of text and its corresponding first-level title, second-level title, third-level title, text and document name, and save them in Elasticsearch.

[0077] The document name may be regarded as a title.

[0078] Step S2: obtain question Q1 and perform basic verification on question Q1, and generate query condition W1 based on question Q1.

[0079] Optionally, in step S2, basic verification of question Q1 includes checking the character length and sensitive words of question Q1.

[0080] Optionally, in step S2, query condition W1 is generated based on question Q1, specifically by assigning different weights to the first-level title, second-level title, third-level title, text and document name, and reassembling question Q1 to generate query condition W1.

[0081] Step S3: Recall the ES database using the query condition W1 to form context T1.

[0082] Step S4: sort the context T1 in reverse order according to the similarity, and take the top n contexts in terms of similarity to form context T2.

[0083] Here, n is a positive integer, and in this embodiment, n is set to 10.

[0084] In step S4, the calculation of the similarity is shown as follows:

[0085] score=TF×IDF

[0086] Among them, TF represents the frequency of the words in the query in the document, and IDF represents the inverse document frequency of the documents containing the query words.

[0087] Among them, in step S4, the reverse order is because when LLM receives the prompt word, it will pay more attention to the front content, and understand the later content less, that is, the more important context should be placed at the front, which is conducive to generating high-quality content.

[0088] Step S5: Generate prompt word P1 through context T2 and question Q1.

[0089] Step S6: Input the prompt word P1 into LLM, perform reasoning through LLM, generate and output the reasoning result.

[0090] The prompt words described in this application represent the input provided by the user to the model to guide the model to generate relevant outputs.

[0091] Optionally, the prompt word can be a question, a sentence, a text, or any form of input determined by the nature of the task. The user interacts with the model through the prompt word, requiring the model to generate a specific type of answer or perform a specific task.

[0092] Embodiment 2:

[0093] like Figure 2 As shown, the keyword multi-parent title recall optimization device based on the RAG framework described in this embodiment specifically includes the following modules:

[0094] The knowledge document upload module is used to upload the knowledge document D1 to the ES database.

[0095] Among them, the knowledge document upload module specifically includes the following sub-modules:

[0096] The first submodule of knowledge document upload is used to upload knowledge document D1 and parse D1 to form a parsed document D2.

[0097] The second knowledge document upload submodule is connected to the first knowledge document upload submodule and is used to extract and filter the text content of D2 to form a processed text C1.

[0098] Optionally, in the second submodule of knowledge document upload, invalid paragraphs, spaces, line breaks and other special symbols are filtered through regular expressions.

[0099] Optionally, in the second submodule of knowledge document upload, basic verification of question Q1 includes checking the character length and sensitive words of question Q1.

[0100] Optionally, in the second submodule of knowledge document upload, query condition W1 is generated based on question Q1, specifically by assigning different weights to the first-level title, second-level title, third-level title, text and document name, and reassembling question Q1 to generate query condition W1.

[0101] The third submodule for uploading knowledge documents is connected to the second submodule for uploading knowledge documents and is used to segment C1 according to each a characters to form an array C2 containing a plurality of small blocks of text.

[0102] Wherein, a is a positive integer.

[0103] The fourth submodule of knowledge document upload is connected to the third submodule of knowledge document upload, and is used to traverse each small block of text in C2, match the first-level title, second-level title, third-level title, text and document name in C1, and form a matching result C3.

[0104] Optionally, in the fourth submodule of knowledge document upload, the calculation of the similarity is shown as follows:

[0105] score=TF×IDF

[0106] Among them, TF represents the frequency of the words in the query in the document, and IDF represents the inverse document frequency of the documents containing the query words.

[0107] Optionally, in the fourth submodule of knowledge document upload, the reverse order is because when LLM receives the prompt word, it will pay more attention to the front content, and understand the later content less, that is, the more important context should be placed at the front, which is conducive to generating high-quality content.

[0108] The fifth submodule of knowledge document upload is connected to the fourth submodule of knowledge document upload, and is used to traverse C3, obtain each small block of text and its corresponding first-level title, second-level title, third-level title, text and document name, and save them in Elasticsearch.

[0109] The document name may be regarded as a title.

[0110] The query condition generation module is connected to the knowledge document upload module, and is used to obtain question Q1 and perform basic verification on question Q1, and generate query condition W1 based on question Q1.

[0111] The context recall module is connected to the query condition generation module and is used to perform a recall in the ES database according to the query condition W1 to form a context T1.

[0112] The sorting processing module is connected to the context recall module and is used to sort the context T1 in reverse order according to the similarity, and take the top n contexts in similarity to form context T2.

[0113] Wherein, n is a positive integer.

[0114] The prompt word generation module is connected to the sorting processing module and is used to generate the prompt word P1 through the context T2 and the question Q1.

[0115] The result output module is connected to the prompt word generation module and is used to input the prompt word P1 into the LLM, perform reasoning through the LLM, generate and output the reasoning result.

[0116] The prompt words described in this application represent the input provided by the user to the model to guide the model to generate relevant outputs.

[0117] Optionally, the prompt word P1 can be a question, a sentence, a text, or any form of input determined by the nature of the task. The user interacts with the model through the prompt word, requiring the model to generate a specific type of answer or perform a specific task.

[0118] Embodiment 3:

[0119] like Figure 3 As shown, a schematic diagram of a keyword multi-parent title recall optimization method based on a RAG framework described in this embodiment.

[0120] 1. The process of saving knowledge documents to the ES database

[0121] from Figure 3 As can be seen in the figure, after the knowledge document is uploaded to Manage, the system first parses the document content. After the document is parsed, the system automatically divides the document into units of 100 words. Figure 3 In the example, the document is divided into multiple paragraphs, such as paragraph 1 contains 0-100 words, paragraph 2 contains 101-200 words, paragraph 3 contains 201-300 words, and so on, forming multiple continuous small blocks of text.

[0122] After the document segmentation is completed, the system traverses each small block of text and matches the associated information of the document, such as the parent title, file name, etc. After the matching is completed, the system saves the matching results of each small block of text and its corresponding titles at all levels, file names, etc. into the ES database.

[0123] 2. Input user questions and obtain LLM reasoning results

[0124] First, after the user asks a question through the interface, the system first filters the question raised by the user to check whether the character length of the question raised by the user is too long or whether it contains sensitive words. If so, the subsequent process will be stopped directly and the corresponding prompt will be given. Otherwise, the subsequent process will continue.

[0125] According to the questions raised by the user, the system splices the query conditions for the ES database according to the preset weight distribution strategy. Among them, in this embodiment, the matching weight in the small block text is 1, the matching weight in the third-level title is 0.8, the matching weight in the second-level title is 0.7, the matching weight in the first-level title is 0.6, and the matching weight in the document name is 0.5. That is, according to the hierarchical structure of the document content, the weight value of the small block text is the highest, the weight value of the title increases as the title level decreases (from level one to level three), and the weight value of the document name is the lowest. Specifically, small blocks of text are given the highest weight of 1 because of their detailed content and direct reflection of document details; the third-level title, as a more specific paragraph marker, has a weight of 0.8; the second-level and first-level titles, although at a higher level, as the overall structural identifiers of the document, they provide the framework and overview of the document, but they are less detailed than the third-level titles, so their weights are 0.7 (second-level title) and 0.6 (first-level title) respectively; the document name, as the overall identifier of the document, contains less information, but plays a key role in quickly locating the document, so it is given a weight of 0.5. Through such a weight distribution strategy, the system can more effectively splice the query conditions for the ES database, so that it can more accurately match the user's query intent during retrieval, improving the accuracy and efficiency of retrieval.

[0126] Then, the system assembles the ES database query conditions of the 100-word index, inputs it into the ES database for retrieval, recalls the context information related to the user's question through the ES database, calculates the similarity of the contexts recalled by the ES database and arranges them in reverse order (i.e., similarity from large to small), and takes the top 10 contexts with the greatest similarity.

[0127] Based on the top 10 similarity contexts, a prompt is generated, and the generated prompt and the original question raised by the user are input into the LLM. The LLM performs reasoning and outputs the result to the user.

[0128] The specific embodiments of the present invention are described in detail above, but they are only examples, and the present invention is not limited to the specific embodiments described above. For those skilled in the art, any equivalent modifications and substitutions made to the present invention are also within the scope of the present invention. Therefore, the equalization changes and modifications made without departing from the spirit and scope of the present invention should be included in the scope of the present invention.

Claims

1. A method for optimizing keyword multi-parent title recall based on RAG framework, It is characterized in that The specific steps include: Step S1, upload the knowledge document D1 to the ES database; Step S2, obtaining question Q1 and performing basic verification on question Q1, and generating query condition W1 based on question Q1; Step S3: Recall the ES database through the query condition W1 to form context T1; Step S4, sort the context T1 in reverse order according to the similarity, take the top n contexts in similarity, and form context T2; Step S5, generating prompt word P1 through context T2 and question Q1; Step S6, input the prompt word P1 into LLM, perform reasoning through LLM, generate reasoning results and output them; Wherein, n is a positive integer.

2. According to the method of claim 1, a keyword multi-parent title recall optimization method based on RAG framework, It is characterized in that In step S1, the knowledge document is uploaded to the ES database, which specifically includes the following steps: Step S101, uploading knowledge document D1 and parsing D1 to form a parsed document D2; Step S102, extracting and filtering the text content of D2 to form a processed text C1; Step S103, segment C1 according to each a characters to form an array C2 containing a plurality of small blocks of text; Step S104, traverse C2, obtain small blocks of text, match the first-level title, second-level title, third-level title, text and document name in C1, and form a matching result C3; Step S105, traverse C3, obtain each small block of text and its corresponding first-level title, second-level title, third-level title, text and document name, and save them in Elasticsearch; Wherein, a is a positive integer.

3. A method for optimizing keyword multi-parent title recall based on RAG framework according to claim 2, It is characterized in that In step S102, invalid paragraphs, spaces, line breaks and other special symbols are filtered using regular expressions.

4. According to the method of claim 1, a keyword multi-parent title recall optimization method based on RAG framework, It is characterized in that In step S2, basic verification of question Q1 includes checking the character length and sensitive words of question Q1.

5. A method for optimizing keyword multi-parent title recall based on RAG framework according to claim 1, It is characterized in that In step S2, query condition W1 is generated based on question Q1. Specifically, different weights are assigned to the first-level title, second-level title, third-level title, text and document name, and question Q1 is reassembled to generate query condition W1.

6. A method for optimizing keyword multi-parent title recall based on RAG framework according to claim 1, It is characterized in that In step S4, the calculation of the similarity is shown as follows: score=TF×IDF Among them, TF (Term Frequency) represents the frequency of the words in the query in the document, and IDF (Inverse Document Frequency) represents the inverse document frequency of the documents containing the query words; The reason for the reverse order is that when LLM receives the prompt word, it will pay more attention to the front content and understand the back content less, that is, the more important context should be placed at the front, which is conducive to generating high-quality content.

7. A method for optimizing keyword multi-parent title recall based on RAG framework according to claim 1, It is characterized in that The prompt word P1 can be a question, a sentence, a text, or any form of input determined by the nature of the task. The user interacts with the model through the prompt word, requiring the model to generate a specific type of answer or perform a specific task.

8. A device for optimizing keyword multi-parent title recall based on RAG framework, It is characterized in that The modules include: The knowledge document upload module is used to upload the knowledge document D1 to the ES database; A query condition generation module, connected to the knowledge document upload module, is used to obtain question Q1 and perform basic verification on question Q1, and generate query condition W1 based on question Q1; A context recall module, connected to the query condition generation module, is used to recall in the ES database according to the query condition W1 to form a context T1; A sorting processing module, connected to the context recall module, is used to sort the context T1 in reverse order according to similarity, and take the top n contexts in similarity to form context T2; A prompt word generation module, connected to the sorting processing module, for generating a prompt word P1 through the context T2 and the question Q1; A result output module, connected to the prompt word generation module, used to input the prompt word P1 into the LLM, perform reasoning through the LLM, generate and output the reasoning result; Wherein, n is a positive integer.

9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for optimizing keyword multi-parent title recall based on a RAG framework as described in any one of claims 1 to 7 is implemented.

10. An electronic device, It is characterized in that The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for optimizing the recall of keyword multi-parent titles based on the RAG framework is implemented as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • A knowledge question and answer system and method based on biomedical literature

    CN109829042A

  • Question and answer method and device, equipment and medium

    CN117236340A

  • Water conservancy knowledge base question and answer method, system and device

    CN117609473A

  • Professional field generation type question answering method and electronic equipment

    CN117725189A

  • Question and answer system construction method fusing large language model and domain knowledge

    CN118113832A

Cited By

  • Network information equipment guarantee field question pair generation method and device

    CN121543721A

  • A network information equipment guarantee field question generation method and device

    CN121543721B

  • Method for Generating Responses of Large Language Models Using Retrieval-Augmented Generation

    KR103019438B1