Large model reasoning method, medium and equipment

By updating the memory module after the deployment of the large model, using user question information and answers to select and update prompt words, the problem of difficult improvement of large model inference capabilities in the existing technology is solved, and the continuous optimization of model performance is achieved.

CN119443261APending Publication Date: 2025-02-14CHINA SOUTHERN POWER GRID ARTIFICIAL INTELLIGENCE TECHNOLOGY CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411414788.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

Existing large models are difficult to effectively and stably improve their inference capabilities after deployment, especially in real-time sample set updates and performance improvements.

Method used

By obtaining user's question information, selecting matching target prompt words from the pre-constructed memory module, calling the big model for reasoning, and updating the memory module using answers and question information to provide more accurate prompt words.

Benefits of technology

It can effectively and steadily improve the inference ability after the deployment of the large model, avoid problems such as disaster forgetting, and ensure the continuous improvement of model performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119443261A_ABST
    Figure CN119443261A_ABST
Patent Text Reader

Abstract

The invention discloses a large model reasoning method, a medium and equipment. The method comprises the following steps: acquiring question information of a user; n target prompt words matched with the question information are selected from a first prompt set stored in a pre-constructed memory module, N is a positive integer, and the first prompt set comprises a plurality of prompt words; based on the question information and the N target prompt words, a large model is called for reasoning to obtain answers for the question information, the answers and the question information of the user are jointly used for updating the memory module, the memory module can be updated through the subsequently obtained answers and the corresponding user questions, and the memory module can be updated according to the updated answers and the corresponding user questions. Therefore, the memory module can subsequently provide more accurate cue words to the large model for guiding reasoning, and the reasoning ability of the large model can still be effectively and stably improved after the large model is deployed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a large model reasoning method, medium and device. Background Art

[0002] In recent years, large models have led the rapid development of the field of artificial intelligence. The autoregressive paradigm, with models such as GPT (Generative Pre-Trained) as the mainstream, has made breakthrough progress in natural language understanding and generation tasks. These models demonstrate excellent understanding and generation capabilities, as well as the ability to answer natural language in the current context. For standard questions and answers, the model can often give correct responses quickly, but for complex questions, the model cannot directly output the correct answer, and needs to rely on the model's reasoning ability to infer the answer step by step. Therefore, the reasoning ability of the model has become an important indicator for evaluating artificial intelligence models. Reasoning ability has a series of evaluation angles, such as common sense reasoning, mathematical reasoning, logical reasoning, causal reasoning, etc. At the same time, reasoning also plays an important role in downstream fields, such as theorem proving, complex inquiry, decision making, etc.

[0003] In the existing technology, the main technologies to improve the model's reasoning ability include instruction fine-tuning technology, which collects a large number of manually pre-labeled samples, including questions, reasoning processes and answers, and allows the model to generate the expected reasoning process and answers based on the questions. The model is trained in a gradient descent manner, so that the model has the ability to reason and analyze on new tasks.

[0004] However, instruction fine-tuning technology requires a high number of samples during training, making it difficult to effectively update the sample set in real time. In addition, the model is prone to problems such as catastrophic forgetting after each training, and the model performance cannot be guaranteed. Therefore, retesting and evaluation are required, which results in the performance of the model being easily fixed after deployment, making it difficult to continuously improve performance based on subsequently learned samples. Summary of the invention

[0005] In order to solve the above technical problems, the embodiments of the present application propose a large model reasoning method, medium and device, which can effectively and stably improve the large model reasoning capability after the large model is deployed.

[0006] In a first aspect, an embodiment of the present application provides a large model reasoning method, including:

[0007] Get the user's question information;

[0008] Selecting N target prompt words matching the question information from a first prompt set stored in a pre-built memory module, wherein N is a positive integer, and the first prompt set includes a plurality of prompt words;

[0009] Based on the question information and the N target prompt words, a large model is called to perform reasoning to obtain an answer to the question information, wherein the answer and the user's question information are used together to update the memory module.

[0010] Optionally, the memory module is constructed by:

[0011] Obtain multiple historical questions of the user, and determine the historical reasoning results of the large model for each historical question and the model loss value corresponding to the historical reasoning results;

[0012] Filter out the historical reasoning results whose corresponding model loss value is lower than the first set loss threshold value from the historical reasoning results;

[0013] Based on the screened historical reasoning results and their corresponding historical problems, the memory module storing the first prompt set is constructed.

[0014] Optionally, constructing the memory module storing the first prompt set based on the screened historical reasoning results and their corresponding historical questions includes:

[0015] The selected historical reasoning results and their corresponding historical questions are constructed into a dictionary in the form of key-value pairs;

[0016] The dictionary is stored in a preset memory bank, and the information in the memory bank is encoded using an embedding model, thereby obtaining the memory module, wherein the first prompt set is at least part of the information in the encoded dictionary stored in the memory module.

[0017] Optionally, the memory module also stores a verification set;

[0018] The encoded dictionary stored in the memory module is divided into the first prompt set and the verification set, and the division method includes any one of the following:

[0019] A manual mode is used to indicate that the verification set is divided according to the required target from the encoded dictionary stored in the memory module;

[0020] The random method is used to indicate that the verification set is randomly divided from the encoded dictionary stored in the memory module.

[0021] Optionally, selecting N target prompt words matching the question information from the first prompt set stored in the pre-built memory module includes:

[0022] Encoding the question information using an embedding model;

[0023] Determining the similarity between each of the plurality of prompt words and the encoded question information;

[0024] The first N prompt words with the highest similarity are used as the N target prompt words.

[0025] Optionally, the method further comprises:

[0026] When the maximum value of the similarities is less than a set similarity threshold, the question information of the user is used as observation data, and a new memory sample is constructed according to the observation data and the answer;

[0027] Determine a model loss value corresponding to the answer in the new memory sample;

[0028] When the model loss value corresponding to the answer in the new memory sample is lower than a second set loss threshold, the memory module is updated according to the new memory sample.

[0029] Optionally, the memory module further stores a verification set, the verification set includes a plurality of verification samples and their corresponding verification labels, and updating the memory module according to the new memory sample includes:

[0030] For each verification sample, M first target prompt words matching the verification sample are selected from the first prompt set, and based on the verification sample and the M first target prompt words, the large model is called to perform reasoning, so as to determine a first verification loss value according to the reasoning result and the corresponding verification label, where M is a positive integer;

[0031] Calculate a first loss mean according to the first validation loss values ​​corresponding to each of the plurality of validation samples;

[0032] adding the new memory sample as a new prompt word to the first prompt set to form a second prompt set;

[0033] For each verification sample, M second target prompt words matching the verification sample are selected from the second prompt set, and based on the verification sample and the M second target prompt words, the large model is called to perform reasoning, so as to determine a second verification loss value according to the reasoning result and the corresponding verification label;

[0034] Calculating a second loss mean according to the second validation loss values ​​corresponding to each of the plurality of validation samples;

[0035] When the second loss mean is less than the first loss mean, the memory module is updated according to the second prompt set and the storage capacity of the memory module.

[0036] Optionally, calling a large model to perform reasoning based on the question information and the N target prompt words to obtain an answer to the question information includes:

[0037] Encoding the question information using an embedding model;

[0038] The encoded question information is concatenated with the N target prompt words to obtain relevant prompt information;

[0039] The relevant prompt information is input into the large model so that the large model performs inference according to the relevant prompt information and outputs an inference result as an answer to the question information.

[0040] In a second aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any of the methods described above are implemented.

[0041] In a third aspect, an embodiment of the present application provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the steps of any of the methods described above when executing the computer program.

[0042] In summary, the embodiments of the present application have at least the following beneficial effects:

[0043] According to an embodiment of the present application, the user's question information is obtained; N target prompt words matching the question information are selected from a first prompt set stored in a pre-built memory module, wherein N is a positive integer and the first prompt set includes a plurality of prompt words; based on the question information and the N target prompt words, a large model is called to perform reasoning to obtain an answer to the question information, wherein the answer and the user's question information are used together to update the memory module, and the memory module can be updated through the subsequently obtained answers and their corresponding user questions, so that the memory module can subsequently provide more accurate prompt words to the large model for guiding reasoning, and further after the large model is deployed, the large model reasoning capability can still be effectively and stably improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a flowchart of the large model reasoning method provided in the embodiment of the present application;

[0045] Figure 2 It is a schematic diagram of large model reasoning provided in an embodiment of the present application;

[0046] Figure 3 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0048] In the description of the present application, the terms "first", "second", "third", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, features defined as "first", "second", "third", etc. may explicitly or implicitly include one or more of the features. In the description of the present application, unless otherwise specified, the meaning of "multiple" is two or more. In the description of the present application, the term "including" and its variations are open inclusions, i.e., "including but not limited to". The term "based on" means "at least partially based on". The term "according to" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments".

[0049] In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0050] In the description of this application, it should be noted that, unless otherwise defined, all technical and scientific terms used in this application have the same meaning as those commonly understood by those skilled in the art. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood by specific circumstances.

[0051] First, see Figure 1 , shows a schematic flow chart of a large model reasoning method provided in an embodiment of the present application, the method includes steps S101-S103, which are as follows:

[0052] S101, obtaining user's question information;

[0053] In one example, the question information may be voice information and / or text information input by the user through a terminal device.

[0054] S102, selecting N target prompt words matching the question information from a first prompt set stored in a pre-built memory module, wherein N is a positive integer, and the first prompt set includes a plurality of prompt words;

[0055] In one example, N is 10, but it should be understood that N may also be other positive integers.

[0056] In one example, the memory module can be constructed by storing the first prompt set in a preset database, which can be an initialized database or a database that pre-stores other data, wherein at least some of the multiple prompt words can refer to preset prompt words for guiding the large model to perform reasoning.

[0057] It can be understood that the memory module can be a module for storing data that is independent of the large model.

[0058] S103, based on the question information and the N target prompt words, calling the large model to perform reasoning to obtain an answer to the question information, wherein the answer and the user's question information are used together to update the memory module.

[0059] In one example, the question information and N target prompt words can be directly input into the large model for inference so that the large model outputs the answer. Alternatively, the question information and N target prompt words can be first processed (eg, concatenated) and then input into the large model.

[0060] In this embodiment, the memory module can be updated through the subsequent answers and the corresponding user questions, so that the memory module can subsequently provide more accurate prompt words to the large model for guiding reasoning, and then after the large model is deployed, it can still effectively and stably improve the reasoning ability of the large model. In addition, it should be understood that the memory module in this embodiment can be independent of the large model in terms of construction and use, so this embodiment can be plug-and-play, support a wide range of large models, and have good versatility. And the update of this embodiment is stable, will not cause problems such as disaster forgetting, and has stability and reliability.

[0061] In an optional implementation, the memory module is constructed by:

[0062] Obtain multiple historical questions of the user, and determine the historical reasoning results of the large model for each historical question and the model loss value corresponding to the historical reasoning results;

[0063] Filter out the historical reasoning results whose corresponding model loss value is lower than the first set loss threshold value from the historical reasoning results;

[0064] Based on the screened historical reasoning results and their corresponding historical problems, the memory module storing the first prompt set is constructed.

[0065] In one example, see Figure 2 , the historical question is recorded as X1, and the corresponding historical reasoning result (i.e., the predicted output of the large model in response to the historical question) is recorded as When the large model outputs each historical reasoning result, the corresponding model loss needs to be calculated as the model loss value corresponding to the historical reasoning result. The samples consisting of historical reasoning results and their corresponding historical questions with model loss values ​​lower than the first set loss threshold can be determined as high-quality samples. In this way, the first prompt set stored in the constructed memory module is determined by the high-quality samples, and the target prompt words matched therefrom can more effectively guide the large model to perform accurate reasoning.

[0066] In an optional implementation, the memory module storing the first prompt set is constructed based on the screened historical reasoning results and their corresponding historical questions, including:

[0067] The selected historical reasoning results and their corresponding historical questions are constructed into a dictionary in the form of key-value pairs;

[0068] The dictionary is stored in a preset memory bank, and the information in the memory bank is encoded using an embedding model, thereby obtaining the memory module, wherein the first prompt set is at least part of the information in the encoded dictionary stored in the memory module.

[0069] In one example, in a key-value pair manner, historical questions may be used as keys in a dictionary, and historical reasoning results may be used as values ​​in the dictionary, thereby constructing the dictionary.

[0070] It should be noted that, in this embodiment, after the dictionary is stored in the memory, all the information in the memory is encoded using an embedded model, so the dictionary stored in the memory is also encoded, and part or all of the information in the encoded dictionary can be used to determine the first prompt set. For example, any prompt word in the first prompt set may refer to: a key-value pair consisting of a historical reasoning result in the dictionary and its corresponding historical question, and the information obtained after encoding.

[0071] In an optional implementation, the memory module further stores a verification set;

[0072] The encoded dictionary stored in the memory module is divided into the first prompt set and the verification set, and the division method includes any one of the following:

[0073] A manual mode is used to indicate that the verification set is divided according to the required target from the encoded dictionary stored in the memory module;

[0074] The random method is used to indicate that the verification set is randomly divided from the encoded dictionary stored in the memory module.

[0075] It is understandable that the information in the memory module can be divided into a prompt set and a verification set, wherein the prompt set is used to guide the model to perform reasoning, and the verification set is used to ensure the reliability and stability of the prompt set update, wherein the verification set obtained by manual division can help determine the subsequent update optimization goals of the model. In one example, if the model is expected to have good mathematical reasoning and code generation capabilities, the verification set is constructed by collecting several mathematical and code problems by manually annotating or screening open source data. As the optimization goal of the model, the goal of the memory module is to find an optimal prompt set so that the model performs best on the verification set under the guidance of the prompt set.

[0076] In an optional implementation, selecting N target prompt words matching the question information from the first prompt set stored in the pre-built memory module includes:

[0077] Encoding the question information using an embedding model;

[0078] Determining the similarity between each of the plurality of prompt words and the encoded question information;

[0079] The first N prompt words with the highest similarity are used as the N target prompt words.

[0080] In one example, the similarity can be represented by calculating cosine similarity. Of course, other similarities can also be used for representation, which will not be described in detail here.

[0081] In an optional embodiment, the method further includes:

[0082] When the maximum value of the similarities is less than a set similarity threshold, the question information of the user is used as observation data, and a new memory sample is constructed according to the observation data and the answer;

[0083] Determine a model loss value corresponding to the answer in the new memory sample;

[0084] When the model loss value corresponding to the answer in the new memory sample is lower than a second set loss threshold, the memory module is updated according to the new memory sample.

[0085] It can be understood that if the maximum value of the determined similarities is less than the set similarity threshold, it means that there is no great similarity between the user's question information and each prompt word stored in the memory module at this time, indicating that the question corresponding to the question information can be preferably used to update the memory module, and the memory module can summarize and extract new knowledge from the question to guide the model to evolve; otherwise, it is not used to update the memory module to avoid frequent adjustments to the memory module, resulting in unnecessary waste of resources.

[0086] In an optional implementation, the memory module further stores a verification set, the verification set includes a plurality of verification samples and their corresponding verification labels, and updating the memory module according to the new memory sample includes:

[0087] For each verification sample, M first target prompt words matching the verification sample are selected from the first prompt set, and based on the verification sample and the M first target prompt words, the large model is called to perform reasoning, so as to determine a first verification loss value according to the reasoning result and the corresponding verification label, where M is a positive integer;

[0088] Calculate a first loss mean according to the first validation loss values ​​corresponding to each of the plurality of validation samples;

[0089] adding the new memory sample as a new prompt word to the first prompt set to form a second prompt set;

[0090] For each verification sample, M second target prompt words matching the verification sample are selected from the second prompt set, and based on the verification sample and the M second target prompt words, the large model is called to perform reasoning, so as to determine a second verification loss value according to the reasoning result and the corresponding verification label;

[0091] Calculating a second loss mean according to the second validation loss values ​​corresponding to each of the plurality of validation samples;

[0092] When the second loss mean is less than the first loss mean, the memory module is updated according to the second prompt set and the storage capacity of the memory module.

[0093] In one example, the first prompt set without adding new memory samples is recorded as m1, and the second prompt set with adding new memory samples is recorded as m2. M1 and m2 are used to perform verification on the validation set to calculate the corresponding loss means, where the first loss mean of m1 on the validation set is recorded as L1, and the second loss mean of m2 on the validation set is recorded as L2. If the second loss mean is smaller than the first loss mean, it means that the verification result on the validation set shows that the inference result obtained by guiding the large model to reason with the second prompt set will be more accurate, and the second prompt set can replace the first prompt set (equivalent to the memory module At the same time, the storage capacity limitation of the memory module needs to be considered. If the replacement will reach or exceed the upper limit of the storage capacity, the new memory sample can be compared with each prompt word in the first prompt set for similarity, and the prompt word with the highest similarity to the new memory sample can be selected. At this time, the above-mentioned method of comparing the loss mean can be used to judge the effect of guided reasoning between the new memory sample and the prompt word with the highest similarity, so as to retain one of the new memory sample and the prompt word with the highest similarity based on the comparison result, and remove the other from the memory module.

[0094] In an optional implementation, the calling of the large model for reasoning based on the question information and the N target prompt words to obtain an answer to the question information includes:

[0095] Encoding the question information using an embedding model;

[0096] The encoded question information is concatenated with the N target prompt words to obtain relevant prompt information;

[0097] The relevant prompt information is input into the large model so that the large model performs inference according to the relevant prompt information and outputs an inference result as an answer to the question information.

[0098] In one example, N target prompt words may be concatenated before the encoded question information.

[0099] In a second aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any of the methods described above are implemented.

[0100] In a third aspect, an embodiment of the present application provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the steps of any of the methods described above when executing the computer program.

[0101] See also Figure 3The computer device of this embodiment includes: a processor 301, a memory 302, and a computer program stored in the memory 302 and executable on the processor 301, such as a large model reasoning program. When the processor 301 executes the computer program, the steps in the above-mentioned large model reasoning method embodiments are implemented, such as Figure 1 Steps S101-S103 are shown.

[0102] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 302 and executed by the processor 301 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the computer device.

[0103] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may include, but is not limited to, a processor 301 and a memory 302. Those skilled in the art will appreciate that the schematic diagram is merely an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than shown in the diagram, or may combine certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.

[0104] The processor 301 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor 301 may also be any conventional processor, etc. The processor 301 is the control center of the computer device, and uses various interfaces and lines to connect various parts of the entire computer device.

[0105] The memory 302 can be used to store the computer program and / or module. The processor 301 implements various functions of the computer device by running or executing the computer program and / or module stored in the memory 302 and calling the data stored in the memory 302. The memory 302 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.). In addition, the memory 302 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0106] Wherein, if the module / unit integrated in the computer device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor 301. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0107] In summary, the embodiments of the present application have at least the following beneficial effects:

[0108] According to an embodiment of the present application, the user's question information is obtained; N target prompt words matching the question information are selected from a first prompt set stored in a pre-built memory module, wherein N is a positive integer and the first prompt set includes a plurality of prompt words; based on the question information and the N target prompt words, a large model is called to perform reasoning to obtain an answer to the question information, wherein the answer and the user's question information are used together to update the memory module, and the memory module can be updated through the subsequently obtained answers and their corresponding user questions, so that the memory module can subsequently provide more accurate prompt words to the large model for guiding reasoning, and further after the large model is deployed, the large model reasoning capability can still be effectively and stably improved.

[0109] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary hardware platform, and of course, it can also be implemented entirely by hardware. Based on such an understanding, all or part of the contribution of the technical solution of the present application to the background technology can be embodied in the form of a software product, and the computer software product can be stored in a storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application or some parts of the embodiments.

[0110] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications are also considered to be within the scope of protection of the present application.

Claims

1. A large model reasoning method, characterized in that: include: Get the user's question information; Selecting N target prompt words matching the question information from a first prompt set stored in a pre-built memory module, wherein N is a positive integer, and the first prompt set includes a plurality of prompt words; Based on the question information and the N target prompt words, a large model is called to perform reasoning to obtain an answer to the question information, wherein the answer and the user's question information are used together to update the memory module.

2. The method according to claim 1, characterized in that The construction method of the memory module includes: Obtain multiple historical questions of the user, and determine the historical reasoning results of the large model for each historical question and the model loss value corresponding to the historical reasoning results; Filter out the historical reasoning results whose corresponding model loss value is lower than the first set loss threshold value from the historical reasoning results; Based on the screened historical reasoning results and their corresponding historical problems, the memory module storing the first prompt set is constructed.

3. The method according to claim 2, characterized in that The step of constructing the memory module storing the first prompt set based on the screened historical reasoning results and the corresponding historical questions includes: The selected historical reasoning results and their corresponding historical questions are constructed into a dictionary in the form of key-value pairs; The dictionary is stored in a preset memory bank, and the information in the memory bank is encoded using an embedding model, thereby obtaining the memory module, wherein the first prompt set is at least part of the information in the encoded dictionary stored in the memory module.

4. The method according to claim 3, characterized in that The memory module also stores a verification set; The encoded dictionary stored in the memory module is divided into the first prompt set and the verification set, and the division method includes any one of the following: A manual mode is used to indicate that the verification set is divided according to the required target from the encoded dictionary stored in the memory module; The random method is used to indicate that the verification set is randomly divided from the encoded dictionary stored in the memory module.

5. The method according to claim 1, characterized in that The step of selecting N target prompt words matching the question information from the first prompt set stored in the pre-built memory module includes: Encoding the question information using an embedding model; Determining the similarity between each of the plurality of prompt words and the encoded question information; The first N prompt words with the highest similarity are used as the N target prompt words.

6. The method according to claim 5, characterized in that The method further comprises: When the maximum value of the similarities is less than a set similarity threshold, the question information of the user is used as observation data, and a new memory sample is constructed according to the observation data and the answer; Determine a model loss value corresponding to the answer in the new memory sample; When the model loss value corresponding to the answer in the new memory sample is lower than a second set loss threshold, the memory module is updated according to the new memory sample.

7. The method according to claim 6, characterized in that The memory module further stores a verification set, which includes a plurality of verification samples and their corresponding verification labels. The updating of the memory module according to the new memory sample includes: For each verification sample, M first target prompt words matching the verification sample are selected from the first prompt set, and based on the verification sample and the M first target prompt words, the large model is called to perform reasoning, so as to determine a first verification loss value according to the reasoning result and the corresponding verification label, where M is a positive integer; Calculate a first loss mean according to the first validation loss values ​​corresponding to each of the plurality of validation samples; adding the new memory sample as a new prompt word to the first prompt set to form a second prompt set; For each verification sample, M second target prompt words matching the verification sample are selected from the second prompt set, and based on the verification sample and the M second target prompt words, the large model is called to perform reasoning, so as to determine a second verification loss value according to the reasoning result and the corresponding verification label; Calculating a second loss mean according to the second validation loss values ​​corresponding to each of the plurality of validation samples; When the second loss mean is less than the first loss mean, the memory module is updated according to the second prompt set and the storage capacity of the memory module.

8. The method according to claim 1, characterized in that The step of calling the large model to perform reasoning based on the question information and the N target prompt words to obtain an answer to the question information includes: Encoding the question information using an embedding model; The encoded question information is concatenated with the N target prompt words to obtain relevant prompt information; The relevant prompt information is input into the large model so that the large model performs inference according to the relevant prompt information and outputs an inference result as an answer to the question information.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

10. A computer device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the method according to any one of claims 1 to 8 when executing the computer program.

Citation Information

Cited By

  • Conversation processing method and computer equipment

    CN121212379A

  • Data extraction method, content generation method, device, equipment and program product

    CN121278082A

  • Data extraction method, content generation method, device, equipment and program product

    CN121278082B