Retrieval text generation method, system, product and equipment based on self-memory enhancement

By introducing a self-memory mechanism into the search-enhanced generation model, dynamically updating the knowledge base, and iteratively optimizing the generated content, the problems of insufficient knowledge coverage and low quality of generated content caused by fixed corpus and single-time search methods in the existing technology are solved, and high-quality and coherent text generation is achieved, which is suitable for complex natural language processing tasks.

CN119646156APending Publication Date: 2025-03-18HUA DATA TECH (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411761150.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

The existing search enhancement generative model relies on a fixed corpus and cannot update knowledge dynamically, resulting in insufficient knowledge coverage in the generated content, unable to promptly reflect the latest information and knowledge, and the single-time search method is difficult to solve the problem of complex knowledge gaps, and the quality of the generated content is low.

Method used

By receiving the search task, the knowledge search results of the large language model are obtained, the knowledge gap is analyzed, and the search task, knowledge gap and the previous knowledge search result are used as input for the next search, and iterated until there is no knowledge gap in the knowledge search result. Use the generator of the self-memory mechanism to dynamically update the knowledge base, gradually fill the knowledge gap, and optimize the generated content.

Benefits of technology

It significantly improves the quality of generated text, ensures the integrity and coherence of generated content, and is especially suitable for complex tasks that require multi-hop reasoning, reduces dependence on manual intervention, improves retrieval efficiency, and reduces labor costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646156A_ABST
    Figure CN119646156A_ABST
Patent Text Reader

Abstract

The invention discloses a retrieval text generation method and system based on self-memory enhancement, a product and equipment. The retrieval text generation method comprises the following steps: receiving a retrieval task and obtaining a knowledge retrieval result of a large language model; analyzing the knowledge retrieval result to obtain a corresponding knowledge gap; the knowledge gap comprises missing information when the large language model does not complete the retrieval task; and taking the retrieval task, the knowledge gap and a previous knowledge retrieval result as input of next retrieval, and carrying out iteration until the knowledge retrieval result does not have the knowledge gap. According to the retrieval text generation method, each output is used as the input of the next round of retrieval for iteration, the generated content is repeatedly optimized, the knowledge gap is gradually filled, and the latest knowledge and information can be utilized in each round of generation, so that the quality of the generated text is remarkably improved, and the integrity and continuity of the generated content are remarkably improved; the method is especially suitable for complex tasks needing multi-hop reasoning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular to a retrieval text generation method, system, product and device based on self-memory enhancement. Background Art

[0002] Existing retrieval-enhanced generation models play an important role in text generation tasks, but they usually rely on a fixed corpus for single retrieval and have the following main disadvantages:

[0003] Fixed corpus limitation: Retrieval enhancement models rely on a fixed knowledge base and cannot dynamically update knowledge. Over time, the information in these fixed corpora may become outdated or no longer relevant, resulting in insufficient knowledge coverage of the generated content and failure to reflect the latest information and knowledge in a timely manner.

[0004] Limitations of single-shot retrieval: Existing solutions usually use a one-shot retrieval method to extract the reference text that is most relevant to the input text from a fixed corpus. This method cannot fully utilize the feedback information in the generation process and is difficult to solve complex knowledge gap problems. In tasks that generate long texts or require multi-hop reasoning, the single-shot retrieval method is particularly insufficient and cannot guarantee the coherence and logic of the generated content.

[0005] Low quality of generated content: Due to the inability to iteratively optimize the generated content, existing models perform poorly in terms of generation quality and coherence. The generated text often has problems such as logical inconsistency, missing information, and duplication, which cannot meet the needs of high-quality text generation.

[0006] These shortcomings are particularly evident when dealing with complex natural language processing tasks. Existing single-shot retrieval methods are difficult to meet the needs of complex natural language processing, resulting in incomplete answers or high error rates. Summary of the invention

[0007] The technical problem to be solved by the present invention is to overcome the above-mentioned defects in the prior art and to provide a retrieval text generation method, system, product and device based on self-memory enhancement.

[0008] The present invention solves the above technical problems through the following technical solutions:

[0009] The present invention provides a retrieval text generation method based on self-memory enhancement, the retrieval text generation method comprising:

[0010] Receive retrieval tasks and obtain knowledge retrieval results of large language models;

[0011] Analyzing the knowledge retrieval results to obtain corresponding knowledge gaps; the knowledge gaps include missing information when the large language model fails to complete the retrieval task;

[0012] The retrieval task, the knowledge gap and the previous knowledge retrieval result are used as inputs for the next retrieval, and iterations are performed until there is no knowledge gap in the knowledge retrieval result.

[0013] Preferably, the step of analyzing the knowledge retrieval results to obtain corresponding knowledge gaps includes:

[0014] Guiding the large language model to identify and display knowledge gaps in knowledge retrieval results when the retrieval is completed through a preset question template; the preset question template includes a knowledge gap prompt and a necessity analysis prompt;

[0015] The knowledge gap prompt is used to guide the language model to analyze and identify the knowledge gap of the knowledge retrieval result; the necessity analysis prompt is used to guide the language model to explain the necessity of the knowledge gap for the retrieval task.

[0016] Preferably, the step of using the search task, the knowledge gap and the previous knowledge search result as input for the next search includes:

[0017] Input the knowledge gap into a generator with a self-memory mechanism to generate a result as input for the next search; the generator stores the search task and the previous knowledge search result;

[0018] An enhanced search is performed based on the generated results.

[0019] Preferably, the step of performing enhanced retrieval based on the generated results includes:

[0020] generating an initial reasoning chain based on the generated result;

[0021] Performing an extended search on the steps of the initial chain of reasoning to extend and revise the initial chain of reasoning;

[0022] The search is iterated until the reasoning chain is completed and / or the similarity of the content of the reasoning chain of adjacent steps is greater than a preset similarity threshold.

[0023] Preferably, the step of generating an initial reasoning chain based on the generated result comprises:

[0024] Using the large language model to perform natural language understanding and problem decomposition on the generated result to obtain a number of sub-problems;

[0025] The plurality of sub-problems are logically integrated to obtain the initial reasoning chain.

[0026] Preferably, the step of generating an initial reasoning chain based on the generated result comprises:

[0027] A reasoning template corresponding to the generated result is obtained as an initial reasoning chain; the reasoning template includes a plurality of preset reasoning steps.

[0028] The present invention also provides a retrieval text generation system based on self-memory enhancement, the retrieval text generation system comprising:

[0029] A knowledge retrieval module, used to receive retrieval tasks and obtain knowledge retrieval results of a large language model;

[0030] A gap analysis module, used to analyze the knowledge retrieval results to obtain corresponding knowledge gaps; the knowledge gaps include missing information when the large language model fails to complete the retrieval task;

[0031] The retrieval iteration module is used to use the retrieval task, the knowledge gap and the previous knowledge retrieval result as input for the next retrieval, and iterate until there is no knowledge gap in the knowledge retrieval result.

[0032] Preferably, the gap analysis module is specifically used to guide the large language model to identify and display knowledge gaps existing in the knowledge retrieval results when the retrieval is completed through a preset question template; the preset question template includes a knowledge gap prompt and a necessity analysis prompt;

[0033] The knowledge gap prompt is used to guide the language model to analyze and identify the knowledge gap of the knowledge retrieval result; the necessity analysis prompt is used to guide the language model to explain the necessity of the knowledge gap for the retrieval task.

[0034] Preferably, the retrieval iteration module is specifically used to input the knowledge gap into a generator with a self-memory mechanism to generate a result as an input for the next retrieval; the generator stores the retrieval task and the previous knowledge retrieval result;

[0035] The retrieval iteration module is specifically used to perform enhanced retrieval based on the generated results.

[0036] Preferably, the retrieval iteration module is further used to generate an initial reasoning chain based on the generated result;

[0037] The retrieval iteration module is also used to perform an extended retrieval based on the steps of the initial reasoning chain to extend and revise the initial reasoning chain;

[0038] The retrieval iteration module is further used to perform iterative retrieval until the reasoning chain is completed and / or the similarity of the content of the reasoning chain of adjacent steps is greater than a preset similarity threshold.

[0039] Preferably, the retrieval iteration module is further used to perform natural language understanding and question decomposition on the generated result based on the large language model to obtain a plurality of sub-questions;

[0040] The retrieval iteration module is further used to obtain the initial reasoning chain based on logical integration of the plurality of sub-questions.

[0041] Preferably, the retrieval iteration module is further used to obtain a reasoning template corresponding to the generated result as an initial reasoning chain; the reasoning template includes a number of preset reasoning steps.

[0042] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned retrieval text generation method based on self-memory enhancement.

[0043] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned retrieval text generation method based on self-memory enhancement when executing the computer program.

[0044] The present invention also provides a computer-readable medium on which computer instructions are stored. When the computer instructions are executed by a processor, the retrieval text generation method based on self-memory enhancement as described above is implemented.

[0045] The positive and progressive effects of the present invention are:

[0046] The retrieval text generation method based on self-memory enhancement provided by the present invention uses each output as the input of the next round of retrieval for iteration, repeatedly optimizes the generated content, gradually fills the knowledge gap, and ensures that each round of generation can utilize the latest knowledge and information, so that the quality of the generated text is significantly improved, and then the integrity and coherence of the generated content are significantly improved, which is particularly suitable for complex tasks requiring multi-hop reasoning; reduces the dependence on manual intervention, thereby improving the retrieval efficiency and reducing labor costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following is a brief introduction to the drawings required for the description of the embodiments. Obviously, the drawings described below are only some examples or embodiments of this specification. For ordinary technicians in this field, this specification can also be applied to other similar scenarios based on these drawings without creative work. Unless it is obvious from the language environment or otherwise explained, the same reference numerals in the figures represent the same structure or operation.

[0048] Figure 1This is a first flow chart of the method for generating retrieval text based on self-memory enhancement in Example 1 of the present invention.

[0049] Figure 2 This is a second flow chart of the method for generating retrieval text based on self-memory enhancement in Example 1 of the present invention.

[0050] Figure 3 It is a structural diagram of the retrieval text generation system based on self-memory enhancement in Example 2 of the present invention.

[0051] Figure 4 Schematic diagram of the structure of an electronic device in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0052] The present invention is further described below by way of examples, but the present invention is not limited to the scope of the examples.

[0053] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various places in the text does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0054] It should be understood that the "device", "system", "unit" and / or "module" used herein is a method for distinguishing different components, elements, parts, portions or assemblies at different levels. However, if other words can achieve the same purpose, the words can be replaced by other expressions.

[0055] As shown in this document, unless the context clearly indicates an exception, the words "a", "an", "an" and / or "the" do not refer to the singular and may also include the plural, unless the context clearly indicates an exception. Generally speaking, the terms "include" and "comprise" only indicate that the steps and elements that have been clearly identified are included, and these steps and elements do not constitute an exclusive list. The method or device may also include other steps or elements.

[0056] The definitions of inclusion in this document, such as the terms "having", "may have", "include" or "may include" used herein, indicate the existence of the corresponding functions, operations, elements, etc. herein, and do not limit the existence of one or more other functions, operations, elements, etc. In addition, it should be understood that the terms "including" or "having" used herein indicate the existence of the features, numbers, steps, operations, elements, components, or a combination thereof described in the specification, without excluding the existence or addition of one or more other features, numbers, steps, operations, elements, components, or a combination thereof.

[0057] Flowcharts are used herein to illustrate the operations performed by the systems of the embodiments of this invention. It should be understood that the preceding or following operations are not necessarily performed precisely in order. Instead, the various steps may be processed in reverse order or simultaneously. At the same time, other operations may also be added to these processes, or one or more operations may be removed from these processes.

[0058] Example 1

[0059] Please refer to Figure 1 , which is a first flow chart of the method for generating retrieval text based on self-memory enhancement in this embodiment. Specifically, Figure 1 As shown, the retrieval text generation method includes:

[0060] S11. Receive a retrieval task and obtain knowledge retrieval results from a large language model; specifically, receive a task input, perform an initial knowledge retrieval, obtain a set of relevant knowledge paragraphs from a fixed corpus, and generate an initial response using a large language model.

[0061] S12, analyzing the knowledge retrieval results to obtain corresponding knowledge gaps; the knowledge gaps include the missing information when the large language model fails to complete the retrieval task;

[0062] S13. Use the retrieval task, knowledge gap and the previous knowledge retrieval result as input for the next retrieval, and iterate until there is no knowledge gap in the knowledge retrieval result.

[0063] Specifically, in this embodiment, step S12 includes:

[0064] S121, guiding the large language model to identify and display knowledge gaps in the knowledge retrieval results when the retrieval is completed through a preset question template; the preset question template includes a knowledge gap prompt and a necessity analysis prompt;

[0065] Knowledge gap prompts are used to guide the language model to analyze and identify knowledge gaps in knowledge retrieval results; necessity analysis prompts are used to guide the language model to explain the necessity of knowledge gaps for retrieval tasks.

[0066] Specifically, in each iteration, the model first generates a response based on the currently available knowledge (including the retrieved documents and the generated output of the previous iteration). By analyzing the generated response, it is determined whether it contains all the information required to complete the task. If some details or information are missing in the response (when the model is guided to answer through the prompt template, it shows what information is needed to complete the task), this may indicate a knowledge gap. If the required information gap has been completed, another iteration is performed. If the consistency of the evaluation results (semantic and keyword matching) of the two most recent responses is high (reaching a certain similarity score threshold is used to determine whether logical convergence or content stability has been achieved.), it is considered that there is no knowledge gap. After the knowledge gap is identified, it will be used as the input for a new round of retrieval (original question + response generated after iteration), that is, the retrieval basis.

[0067] Furthermore, the large language model can be guided to think about and identify aspects that may be omitted in the answer through the preset question template, thereby improving the ability to identify knowledge gaps. The setting of the question template can refer to but is not limited to the following methods:

[0068] Template Examples

[0069] [Background Information]

[0070] Before you begin, consider the following background information:

[0071] -[The information retrieved]

[0072] [Problem presentation]

[0073] Please answer the following questions:

[0074] -Topic Question: [Place the specific question that you want the model to answer here]

[0075] [Knowledge gap tips]

[0076] When answering the above questions, please pay special attention to:

[0077] -If you discover during your response that key information or data is missing, point it out and try to explain why this information is necessary to fully answer the question.

[0078] [Answer format]

[0079] Please organize your response in the following format:

[0080] -Answer: [Directly answer the question]

[0081] -Knowledge Gaps: [If any, list the knowledge gaps identified in your response]

[0082] [Conclusion]

[0083] Once you have completed all sections, review your responses for comprehensiveness and ensure that any knowledge gaps have been identified and addressed.

[0084] In an optional implementation, step S13 includes:

[0085] S131, input the knowledge gap into a generator with a self-memory mechanism, and use the generated result as the input for the next retrieval; the generator stores the retrieval task and the previous knowledge retrieval result;

[0086] S132. Perform enhanced retrieval based on the generated results.

[0087] Specifically, the output of the generator is used as the input of a new round of retrieval, and the self-memory mechanism ensures that the generator uses the content generated by itself for the next round of knowledge retrieval and generation. In each round of generation, the self-memory mechanism combines the current response with the task input to perform knowledge retrieval and obtain new relevant knowledge paragraphs. Based on the current response and combined with the task input, a second knowledge retrieval is performed to obtain new relevant knowledge paragraphs. This new knowledge is used for the next round of generation to form a new response.

[0088] In an optional implementation, step S132 includes:

[0089] S1321, generating an initial reasoning chain based on the generated result;

[0090] S1322, performing an extended search on the steps of the initial reasoning chain to extend and revise the initial reasoning chain;

[0091] S1323, iteratively search until the reasoning chain is completed and / or the similarity of the reasoning chain contents of adjacent steps is greater than a preset similarity threshold.

[0092] Specifically, extended retrieval can usually be performed on data sources other than fixed corpora to obtain external knowledge. External knowledge refers to the intelligence obtained from data sources other than the large model training data, usually network retrieval information or professional knowledge bases, such as encyclopedia knowledge bases, medical books and other private data knowledge bases. Using the retrieved information, LLM (Large Language Model) revises each chain of thought (CoT) step to correct possible errors or illusions. It can be understood as the use of the understanding and reasoning capabilities of the large model combined with the iterative retrieval information to improve and rewrite the generated chain of thought information.

[0093] Repeat the enhanced retrieval steps and use the responses generated each time to perform a new round of knowledge retrieval. In each round of generation, the multi-hop reasoning steps are combined to gradually generate and verify the reasoning chain. After the initial reasoning chain is generated, the external knowledge related to the current step of the reasoning chain is retrieved, and the current step of the reasoning chain is revised using the retrieved knowledge. The above process is repeated until the step reasoning chain is completed or the content of the reasoning chain of adjacent steps is basically the same and terminated early. The final output response is the result generated by the last iteration.

[0094] In an optional implementation, step S1321 includes:

[0095] Use a large language model to perform natural language understanding and problem decomposition on the generated results to obtain several sub-questions;

[0096] Logically integrate several sub-problems to obtain an initial reasoning chain.

[0097] Specifically, during the processing, we will first determine whether the problem can be decomposed. The purpose of problem decomposition is to decompose the main problem into a series of systematic and specific sub-problems, such as how many years apart are A and B; decompose into sub-problems: A's age, B's age, and perform subsequent search generation logic respectively. The answer to the main question is the integration of the results of the two sub-problems. Models with natural language understanding and generation capabilities can be used, such as gpt2, bart, t5 and other conventional NLP (Natural Language Processing) models that can achieve this effect after training.

[0098] In another optional implementation, step S1321 includes:

[0099] Obtain the inference template corresponding to the generated result as the initial inference chain; the inference template includes several preset inference steps. For example, the inference template for tasks related to model training can be "Step 1: Select model, Step 2: Adjust hyperparameters, Step 3: Evaluate model performance."

[0100] The following is a further explanation of the method for generating retrieval text based on self-memory enhancement in this embodiment by taking an example. Figure 2 , which is a second flow chart of the method for generating retrieval text based on self-memory enhancement in this embodiment. Specifically, Figure 2 As shown in FIG. 1 , the retrieval text generation method based on self-memory enhancement includes the following steps:

[0101] S1: Initial retrieval and generation

[0102] 1. Receive task input

[0103] The system receives the task input q to be processed, which can be a question asked by the user or a text topic that needs to be generated.

[0104] 2. Conduct initial knowledge retrieval

[0105] The system retrieves a set D of knowledge passages related to the task input q from a fixed corpus. During the retrieval process, a semantic retrieval algorithm is used to ensure that the acquired knowledge passages are highly relevant.

[0106] 3. Generate initial response

[0107] Generate the initial response y_1 using the large language model. During the generation process, the model combines the input q with the retrieved knowledge paragraph D to generate a preliminary text response and identify knowledge gaps in the generated response.

[0108] S2: Self-memory mechanism

[0109] 1. Generator output as new retrieval input

[0110] The self-memory mechanism uses each output y_t of the generator as the input for a new round of knowledge retrieval and generation, ensuring that the generator uses the content generated by itself for the next round of knowledge retrieval and generation.

[0111] 2. Knowledge retrieval in self-memory mechanism

[0112] In each round of generation, the self-memory mechanism combines the current response y_t with the task input q to perform knowledge retrieval and obtain new relevant knowledge paragraphs D_(y_t|q).

[0113] S3: Generate enhanced retrieval

[0114] 1. Knowledge retrieval based on current response

[0115] Based on the current response y_t and combined with the task input q, a second knowledge retrieval is performed to obtain new relevant knowledge paragraphs D_(y_t|q).

[0116] 2. Generate using new knowledge

[0117] Use this new knowledge to perform the next round of generation and form a new response y_(t+1).

[0118] S4: Generation of retrieval enhancement

[0119] 1. Repeatedly perform enhanced search

[0120] The generation-enhanced retrieval step is repeatedly performed, and a new round of knowledge retrieval is performed using the response y_t generated each time.

[0121] 2. Combine multi-hop reasoning steps

[0122] In each round of generation, multi-hop reasoning steps are combined to gradually generate and verify the reasoning chain.

[0123] 3. Final output response

[0124] The final output response is y_T, which is the result generated by the last iteration (Tth time).

[0125] S5: Multi-hop reasoning steps

[0126] 1. Generate an initial reasoning chain

[0127] Generate the initial reasoning chain Chain_1 (y_1 content), including problem decomposition and preliminary reasoning steps.

[0128] 2. Retrieve external knowledge

[0129] Retrieve external knowledge related to the current step of the reasoning chain and acquire new information to support the extension and revision of the reasoning chain.

[0130] 3. Revise the chain of reasoning

[0131] The retrieved knowledge is used to revise the current step of the reasoning chain step Chain_t(y_t) to ensure the accuracy and coherence of each step of reasoning.

[0132] 4. Repeat

[0133] The above process is repeated until the reasoning chain is completed or the reasoning chain contents of adjacent steps are basically the same and terminated early.

[0134] Let’s take the complex question “How to optimize machine learning models in different environments?” as an example.

[0135] 1. Task input: The input is a dialog task containing complex questions, such as "How to optimize machine learning models in different environments?"

[0136] 2. Initial knowledge retrieval: Retrieve literature and materials related to "optimizing machine learning models" from a fixed corpus to obtain a set of basic knowledge paragraphs.

[0137] 3. Generate initial response: Generate initial response using large language model, such as "Methods for optimizing machine learning models in different environments include adjusting hyperparameters, using different feature engineering techniques, etc." and identify knowledge gaps, such as "Specific methods for adjusting hyperparameters."

[0138] 4. Generate enhanced retrieval: Based on the initial response and combined with the task input, perform a second knowledge retrieval to obtain new knowledge paragraphs about “specific methods for adjusting hyperparameters”.

[0139] 5. Generate new responses using new knowledge: Generate new responses using new knowledge, such as "specific methods for adjusting hyperparameters include grid search, random search, and Bayesian optimization."

[0140] 6. Multiple iterations: Repeat the above steps, using the responses generated each time to perform a new round of knowledge retrieval and generation, gradually filling in knowledge gaps and ultimately generating detailed dialogue responses.

[0141] 7. Multi-hop reasoning: In each round of generation, an initial reasoning chain is generated, such as “Step 1: Select model, Step 2: Adjust hyperparameters, Step 3: Evaluate model performance.” Then retrieve external knowledge related to each step and revise the current step of the reasoning chain until the reasoning chain is completed or the content of the reasoning chain of adjacent steps is basically the same and terminated early.

[0142] The retrieval text generation method based on self-memory enhancement provided in this embodiment uses the output of the generator itself as the input of a new round of retrieval to dynamically update and enrich the knowledge base, so that the generation process can timely reflect the latest knowledge and information, so that each output is iterated as the input of the next round of retrieval, repeatedly optimizes the generated content, gradually fills the knowledge gap, and ensures that each round of generation can use the latest knowledge and information, so that the quality of the generated text is significantly improved, and then significantly improves the integrity and coherence of the generated content, which is particularly suitable for complex tasks that require multi-hop reasoning; reduces dependence on manual intervention, thereby improving retrieval efficiency and reducing labor costs. In summary, this embodiment solves many limitations and problems in the prior art by dynamically updating the knowledge base, iterating retrieval and generation multiple times, improving generation quality, saving production costs and enhancing system efficiency, and has significant advantages and broad application prospects in the field of natural language processing.

[0143] Example 2

[0144] Please refer to Figure 3 , which is a schematic diagram of the structure of the retrieval text generation system based on self-memory enhancement in this embodiment. Specifically, Figure 3 As shown, the retrieval text generation system includes:

[0145] Knowledge retrieval module 1, used to receive retrieval tasks and obtain knowledge retrieval results of a large language model;

[0146] Gap analysis module 2, used to analyze the knowledge retrieval results to obtain corresponding knowledge gaps; the knowledge gaps include missing information when the large language model fails to complete the retrieval task;

[0147] The search iteration module 3 is used to use the search task, the knowledge gap and the previous knowledge search result as inputs for the next search, and iterate until there is no knowledge gap in the knowledge search result.

[0148] For the system embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The system embodiment described above is only schematic, in which the modules described as separate components may or may not be physically separated, and the modules displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the present application scheme. Ordinary technicians in this field can understand and implement it without paying creative work.

[0149] Example 3

[0150] Figure 4 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the method of Embodiment 1 is implemented when the processor executes the program. Figure 4 The electronic device 30 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0151] like Figure 4 As shown, the electronic device 30 may be in the form of a general-purpose computing device, for example, it may be a server device. The components of the electronic device 30 may include, but are not limited to: at least one processor 31, at least one memory 32, and a bus 33 connecting different system components (including the memory 32 and the processor 31).

[0152] The bus 33 includes a data bus, an address bus, and a control bus.

[0153] The memory 32 may include a volatile memory, such as a random access memory (RAM) 321 and / or a cache memory 322 , and may further include a read-only memory (ROM) 323 .

[0154] The memory 32 may also include a program / utility 325 having a set (at least one) of program modules 324, such program modules 324 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0155] The processor 31 executes various functional applications and data processing, such as the method of embodiment 1 of the present invention, by running the computer program stored in the memory 32 .

[0156] The electronic device 30 may also communicate with one or more external devices 34 (e.g., keyboards, pointing devices, etc.). Such communication may be performed via an input / output (I / O) interface 35. Furthermore, the model-generated device 30 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 36. As shown, the network adapter 36 communicates with other modules of the model-generated device 30 via a bus 33. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the model-generated device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (RAID) systems, tape drives, and data backup storage systems.

[0157] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.

[0158] Example 4

[0159] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method of Embodiment 1 is implemented.

[0160] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.

[0161] In a possible implementation manner, the present invention may also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the method for implementing Embodiment 1.

[0162] The program code for executing the present invention may be written in any combination of one or more programming languages, and may be executed entirely on a user device, partially on a user device, as an independent software package, partially on a user device and partially on a remote device, or entirely on a remote device.

[0163] Although the specific embodiments of the present invention are described above, it should be understood by those skilled in the art that this is only for illustration and the protection scope of the present invention is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.

Claims

1. A retrieval text generation method based on self-memory enhancement, characterized in that: The retrieval text generation method comprises: Receive retrieval tasks and obtain knowledge retrieval results of large language models; Analyzing the knowledge retrieval results to obtain corresponding knowledge gaps; the knowledge gaps include missing information when the large language model fails to complete the retrieval task; The retrieval task, the knowledge gap and the previous knowledge retrieval result are used as inputs for the next retrieval, and iterations are performed until there is no knowledge gap in the knowledge retrieval result.

2. The method for generating retrieval text based on self-memory enhancement according to claim 1, characterized in that: The step of analyzing the knowledge search results to obtain corresponding knowledge gaps includes: Guiding the large language model to identify and display knowledge gaps in knowledge retrieval results when the retrieval is completed through a preset question template; the preset question template includes a knowledge gap prompt and a necessity analysis prompt; The knowledge gap prompt is used to guide the language model to analyze and identify the knowledge gap of the knowledge retrieval result; the necessity analysis prompt is used to guide the language model to explain the necessity of the knowledge gap for the retrieval task.

3. The method for generating retrieval text based on self-memory enhancement according to claim 1, characterized in that: The step of using the search task, the knowledge gap and the previous knowledge search result as input for the next search includes: Input the knowledge gap into a generator with a self-memory mechanism to generate a result as input for the next search; the generator stores the search task and the previous knowledge search result; An enhanced search is performed based on the generated results.

4. The method for generating retrieval text based on self-memory enhancement as claimed in claim 3, characterized in that: The step of performing enhanced retrieval based on the generated result comprises: generating an initial reasoning chain based on the generated result; Performing an extended search on the steps of the initial chain of reasoning to extend and revise the initial chain of reasoning; The search is iterated until the reasoning chain is completed and / or the similarity of the content of the reasoning chain of adjacent steps is greater than a preset similarity threshold.

5. The method for generating retrieval text based on self-memory enhancement as claimed in claim 4, characterized in that: The step of generating an initial reasoning chain based on the generated result comprises: Using the large language model to perform natural language understanding and problem decomposition on the generated result to obtain a number of sub-problems; The plurality of sub-problems are logically integrated to obtain the initial reasoning chain.

6. The method for generating retrieval text based on self-memory enhancement as claimed in claim 4, characterized in that: The step of generating an initial reasoning chain based on the generated result comprises: A reasoning template corresponding to the generated result is obtained as an initial reasoning chain; the reasoning template includes a plurality of preset reasoning steps.

7. A retrieval text generation system based on self-memory enhancement, characterized in that: The retrieval text generation system comprises: A knowledge retrieval module, used to receive retrieval tasks and obtain knowledge retrieval results of a large language model; A gap analysis module, used to analyze the knowledge retrieval results to obtain corresponding knowledge gaps; the knowledge gaps include missing information when the large language model fails to complete the retrieval task; The retrieval iteration module is used to use the retrieval task, the knowledge gap and the previous knowledge retrieval result as input for the next retrieval, and iterate until there is no knowledge gap in the knowledge retrieval result.

8. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the retrieval text generation method based on self-memory enhancement as claimed in any one of claims 1 to 6.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for generating retrieval text based on self-memory enhancement according to any one of claims 1 to 6 is implemented.

10. A computer readable medium having computer instructions stored thereon, characterized in that: When the computer instructions are executed by a processor, the method for generating retrieval text based on self-memory enhancement according to any one of claims 1 to 6 is implemented.