Large model memorizing method and device and computer readable storage medium

By setting up two-layer memory cache in the big model and using the big model question template, the latest question questions and related topic content are transmitted to the big model, and the problems of memory loss and confusion of big model in multiple rounds of conversations are solved, and the response speed and accuracy are improved.

CN119513129APending Publication Date: 2025-02-25CHINA UNITED NETWORK COMM GRP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The prior art has problems of large-model memory loss or confusion in multiple rounds of conversations, which leads to large-model responses becoming slower and slower or even downtime, or the inability to focus on the current conversation topic, resulting in situations where the answers are not answered.

Method used

通过在大模型中设置两层记忆缓存,第一层记忆缓存用于存储当前主题和主题内容,第二层记忆缓存用于存储历史主题和主题内容,并结合大模型提问模板,将最新提问问题和相关主题内容传输给大模型。

Benefits of technology

The memory retention of the large model in multiple rounds of sessions is realized, which avoids memory loss and confusion, improves the response speed and accuracy of the large model, and ensures that users can make flexible inquiries in each session.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119513129A_ABST
    Figure CN119513129A_ABST
Patent Text Reader

Abstract

The invention provides a large model memorizing method and device and a computer readable storage medium. The method comprises the steps of obtaining a current theme and corresponding theme content according to a current answer process of a user; storing the current theme and the corresponding theme content into a first layer of memory cache; storing the historical theme and the corresponding theme content into a second layer of memory cache; receiving a latest questioning question input by a user, and filling the latest questioning question, the current theme in the first-layer memory cache and the corresponding theme content, and at least one historical theme in the second-layer memory cache and the corresponding theme content into a preset large-model questioning template; and inputting the filled large model question template into the large model to obtain the content returned by the large model based on the large model question template. According to the method, the device and the computer readable storage medium, the problem of large model memory loss or confusion in multiple rounds of sessions in the prior art can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a large model memory method, device and computer-readable storage medium. Background Art

[0002] In the current use of large models (large natural language processing models), each request is independent. If you want to achieve multiple rounds of conversations, you usually transfer the entire historical record or the latest part of the question and answer record as part of the parameters to the large model for implementation. This will lead to some problems. Among them, the full recording method will increase the number of parameters for each call of the large model as the number of conversations increases, which will seriously affect the response of the large model, causing the answers to become slower and slower, and even causing the large model to crash. The method of intercepting part of the conversation record will make it impossible to focus on the current conversation topic and produce irrelevant answers. For example, a certain date is preset in the conversation. As the number of conversations increases, the date record is not transmitted to the large model as a parameter, resulting in the large model not accurately answering information according to the specified date.

[0003] In summary, the existing technology suffers from large model memory loss or confusion in multiple rounds of conversations. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a large model memory method, device and computer-readable storage medium in view of the above-mentioned shortcomings of the prior art, so as to solve the problem of large model memory loss or confusion in multiple rounds of conversations in the prior art.

[0005] In a first aspect, the present invention provides a large model memory method, comprising:

[0006] Get the current topic and corresponding topic content based on the user's answer process;

[0007] Storing the current topic and the corresponding topic content in the first-level memory cache of the large model;

[0008] The previous current topic matching the current topic in the first-layer memory cache is used as a historical topic, and the historical topic and the corresponding topic content are stored in the second-layer memory cache of the large model;

[0009] Receive the latest question input by the user, and fill the latest question, the current topic and the corresponding topic content in the first-layer memory cache, and at least one historical topic and the corresponding topic content in the second-layer memory cache into a preset large model question template;

[0010] The filled large model question template is input into the large model to obtain the content returned by the large model based on the large model question template.

[0011] Furthermore, the obtaining of the current topic and the corresponding topic content according to the user's answer process specifically includes:

[0012] The question and answer content corresponding to the user's answer process is summarized in the form of keywords and values ​​to obtain the current topic and the corresponding topic content.

[0013] Further, the current subject and the corresponding subject content include at least one current title and corresponding title content;

[0014] The storing of the current topic and the corresponding topic content into the first-layer memory cache of the large model specifically includes:

[0015] For each current title and corresponding title content in the current topic and corresponding topic content, searching and matching the current title in the first layer memory cache by using the user's session ID;

[0016] If a previous current title identical to the current title is matched in the first-layer memory cache through the session ID, the title content corresponding to the previous current title is replaced with the title content corresponding to the current title;

[0017] If the previous current title identical to the current title is not matched in the first-layer memory cache through the session ID, the current title and the corresponding title content are stored in the first-layer memory cache through the session ID.

[0018] Further, the previous current topic matching the current topic in the first-layer memory cache is used as a historical topic, and the historical topic and the corresponding topic content are stored in the second-layer memory cache of the large model, specifically including:

[0019] Using the previous current title of the previous current topic that is the same as the current title of the current topic in the first layer memory cache as a historical title;

[0020] For each of the historical titles, searching and matching the historical title in the second-layer memory cache by using the session ID;

[0021] If a previous historical title identical to the historical title is matched in the second-layer memory cache through the session ID, append the title content corresponding to the historical title to the title content corresponding to the previous historical title;

[0022] If the previous historical title identical to the historical title is not matched in the second-layer memory cache through the session ID, the historical title and the corresponding title content are stored in the second-layer memory cache through the session ID.

[0023] Furthermore, the method further comprises:

[0024] The question and answer content corresponding to the user's answer process is stored in the full memory cache of the large model through the session id.

[0025] Furthermore, before filling the latest question, the current topic and the corresponding topic content in the first-layer memory cache, and at least one historical topic and the corresponding topic content in the second-layer memory cache into the preset large model question template, the method also includes:

[0026] The intention of the latest question is identified, and the large model question template and the business interface that needs to be accessed are determined according to the result of the intention identification.

[0027] Furthermore, the content returned by the large model question template is the parameters required to access the business interface. After inputting the filled large model question template into the large model and obtaining the content returned by the large model based on the large model question template, the method further includes:

[0028] Calling the business interface through the content returned by the large model question template;

[0029] Receive the result returned by the business interface, and return the result returned by the business interface to the user.

[0030] In a second aspect, the present invention provides a large model memory device, comprising:

[0031] The acquisition module is used to obtain the current topic and the corresponding topic content according to the user's answer process;

[0032] A first storage module, connected to the acquisition module, for storing the current topic and the corresponding topic content in the first-level memory cache of the large model;

[0033] As a storage module, connected to the first storage module, used to take the previous current topic matching the current topic in the first layer memory cache as a historical topic, and store the historical topic and the corresponding topic content in the second layer memory cache of the large model;

[0034] A receiving and filling module, connected to the storage module, for receiving the latest question input by the user, and filling the latest question, the current topic and the corresponding topic content in the first-layer memory cache, and at least one historical topic and the corresponding topic content in the second-layer memory cache into a preset large model question template;

[0035] The input obtaining module is connected to the receiving filling module and is used to input the filled large model question template into the large model to obtain the content returned by the large model based on the large model question template.

[0036] In a third aspect, the present invention provides a large model memory device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the large model memory method described in the first aspect.

[0037] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the large model memorization method described in the first aspect is implemented.

[0038] The large model memory method, device and computer-readable storage medium provided by the present invention first obtain the current topic and the corresponding topic content according to the user's answer process; then store the current topic and the corresponding topic content in the first-layer memory cache of the large model; then use the previous current topic matching the current topic in the first-layer memory cache as the historical topic, and store the historical topic and the corresponding topic content in the second-layer memory cache of the large model; then receive the latest question input by the user, and fill the latest question, the current topic and the corresponding topic content in the first-layer memory cache, and at least one historical topic and the corresponding topic content in the second-layer memory cache into a preset large model question template; finally, input the filled large model question template into the large model to obtain the content returned by the large model based on the large model question template. The present invention caches the current topic and the corresponding topic content through the first layer memory cache and the second layer memory cache, thereby realizing full recording of key topics based on the two layers of memory cache, and utilizes the large model question template to transmit the latest question in combination with all topics and corresponding topic content in the first layer memory cache and the second layer memory cache to the large model, thereby facilitating users to conduct flexible inquiries in each session, and solving the problem of large model memory loss or confusion in multiple rounds of sessions in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 This is a flow chart of a large model memory method according to Embodiment 1 of the present invention;

[0040] Figure 2 A flowchart of a memory cache according to an embodiment of the present invention;

[0041] Figure 3 A schematic diagram of the structure of the first layer memory cache according to an embodiment of the present invention;

[0042] Figure 4 A schematic diagram of the structure of the second layer memory cache according to an embodiment of the present invention;

[0043] Figure 5 A schematic diagram of the structure of the full memory cache according to an embodiment of the present invention;

[0044] Figure 6 A flowchart for memory use of an embodiment of the present invention;

[0045] Figure 7 A schematic diagram of the structure of a large model memory device according to embodiment 2 of the present invention;

[0046] Figure 8 This is a schematic diagram of the structure of a large model memory device according to Example 3 of the present invention. DETAILED DESCRIPTION

[0047] In order to enable those skilled in the art to better understand the technical solution of the present invention, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0048] It should be understood that the specific embodiments and drawings described herein are only used to explain the present invention rather than to limit the present invention.

[0049] It can be understood that, in the absence of conflict, the various embodiments of the present invention and the various features in the embodiments can be combined with each other.

[0050] It can be understood that, for the convenience of description, the drawings of the present invention only show the parts related to the present invention, while the parts irrelevant to the present invention are not shown in the drawings.

[0051] It can be understood that each unit and module involved in the embodiments of the present invention may correspond to only one physical structure, or may be composed of multiple physical structures, or multiple units and modules may be integrated into one physical structure.

[0052] It can be understood that, without conflict, the functions and steps marked in the flowcharts and block diagrams of the present invention may occur in an order different from that marked in the drawings.

[0053] It is understood that the flowcharts and block diagrams of the present invention illustrate the possible architectures, functions, and operations of the systems, devices, equipment, and methods according to the various embodiments of the present invention. Each box in the flowchart or block diagram may represent a unit, module, program segment, or code, which contains executable instructions for implementing the specified functions. Moreover, each box or combination of boxes in the block diagram and flowchart may be implemented by a hardware-based system that implements the specified functions, or may be implemented by a combination of hardware and computer instructions.

[0054] It can be understood that the units and modules involved in the embodiments of the present invention can be implemented by software or hardware. For example, the units and modules can be located in a processor.

[0055] Embodiment 1:

[0056] This embodiment provides a large model memory method, such as Figure 1 As shown, the method includes:

[0057] Step S101: Obtain the current topic and corresponding topic content according to the user's answer process.

[0058] It should be noted that the user's answer process may refer to the process in which the user asks a question and obtains an answer result based on the big model.

[0059] In an optional embodiment, obtaining the current topic and the corresponding topic content according to the user's answer process specifically includes:

[0060] The question and answer content corresponding to the user's answer process is summarized in the form of keywords and values ​​to obtain the current topic and the corresponding topic content.

[0061] Specifically, the big model is used to summarize the topic of the question and answer content corresponding to the user's answer process, and the current topic and the corresponding topic content are summarized in the form of keywords and values. For example, if the user asks the question: What is the indicator of road B on January 1, 2024? The corresponding answer result is: The indicator is normal, which is C. Then the current topic and the corresponding topic content can be: Date: January 1, 2024, Road address: Road A, Indicator type: B indicator.

[0062] Step S102: store the current topic and the corresponding topic content into the first-level memory cache of the large model.

[0063] In this embodiment, the first-layer memory cache stores the latest memories of multiple rounds of conversations between the user and the large model.

[0064] In an optional embodiment, the current subject and the corresponding subject content include at least one current title and corresponding title content;

[0065] The storing of the current topic and the corresponding topic content into the first-layer memory cache of the large model specifically includes:

[0066] For each current title and corresponding title content in the current topic and corresponding topic content, searching and matching the current title in the first layer memory cache by using the user's session ID;

[0067] If a previous current title identical to the current title is matched in the first-layer memory cache through the session ID, the title content corresponding to the previous current title is replaced with the title content corresponding to the current title;

[0068] If the previous current title identical to the current title is not matched in the first-layer memory cache through the session ID, the current title and the corresponding title content are stored in the first-layer memory cache through the session ID.

[0069] Specifically, each current title in the current topic is used as a keyword, and the title in the first-level memory cache is retrieved according to the session id corresponding to the multiple rounds of conversations between the user and the large model. For each current title, if the previous current title that is the same as the current title is matched in the first-level memory cache through the session id, the title content corresponding to the previous current title that is the same as the current title is replaced with the title content corresponding to the current title. Specifically, taking the current title as a date as an example, if the session id is 12346, the date is used as a keyword to retrieve the data corresponding to the session id 12346 in the first-level memory cache. If the keyword (date) is matched in the data corresponding to the session id 12346, the value of the keyword in the data corresponding to the session id 12346 is replaced with the title content corresponding to the current title being the date. If the previous current title that is the same as the current title is not matched in the first-level memory cache through the session id, the current title and the corresponding title content are directly stored in the first-level memory cache through the session id.

[0070] Step S103: The previous current topic matching the current topic in the first-layer memory cache is taken as a historical topic, and the historical topic and the corresponding topic content are stored in the second-layer memory cache of the large model.

[0071] In this embodiment, the second-layer memory cache stores historical memories of multiple rounds of conversations between the user and the large model.

[0072] In an optional embodiment, the process of taking the previous current topic matching the current topic in the first-layer memory cache as a historical topic, and storing the historical topic and the corresponding topic content in the second-layer memory cache of the large model specifically includes:

[0073] Using the previous current title of the previous current topic that is the same as the current title of the current topic in the first layer memory cache as a historical title;

[0074] For each of the historical titles, searching and matching the historical title in the second-layer memory cache by using the session ID;

[0075] If a previous historical title identical to the historical title is matched in the second-layer memory cache through the session ID, append the title content corresponding to the historical title to the title content corresponding to the previous historical title;

[0076] If the previous historical title identical to the historical title is not matched in the second-layer memory cache through the session ID, the historical title and the corresponding title content are stored in the second-layer memory cache through the session ID.

[0077] Specifically, the replaced title in the first-layer memory cache (that is, the previous current title of the previous current topic that is the same as the current title of the current topic) is taken as the historical title, and each of all historical titles is used as a keyword. The titles in the second-layer memory cache are retrieved according to the session id corresponding to the multiple rounds of conversations between the user and the large model. For each historical title, if the previous historical title that is the same as the historical title is matched in the second-layer memory cache through the session id, the title content corresponding to the historical title is appended to the title content corresponding to the previous historical title that is the same as the historical title. If the previous historical title that is the same as the historical title is not matched in the second-layer memory cache through the session id, the historical title and the corresponding title content are directly stored in the second-layer memory cache through the session id.

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

[0079] The question and answer content corresponding to the user's answer process is stored in the full memory cache of the large model through the session id.

[0080] In this embodiment, in order to extract all records of multiple rounds of conversations between the user and the big model when the big model needs to re-analyze and answer the user's questions, the question and answer content corresponding to the user's answer process is directly stored in the full memory cache through the session id.

[0081] Step S104: Receive the latest question input by the user, and fill the latest question, the current topic and corresponding topic content in the first layer memory cache, and at least one historical topic and corresponding topic content in the second layer memory cache into a preset large model question template.

[0082] It should be noted that the large model question template contains three reserved fields: current topic, historical topic and question.

[0083] Specifically, the user inputs the latest question, the system receives the latest question input by the user, obtains the current topic and the corresponding topic content in the first-level memory cache according to the session ID, and fills it into the current topic in the predetermined large model question template, obtains at least one historical topic and the corresponding topic content in the second-level memory cache according to the session ID, and fills it into the historical topic in the predetermined large model question template, and fills the latest question into the question in the predetermined large model question template.

[0084] It should be noted that before filling the three reserved fields of current topic, historical topic and question in the predetermined large model question template, the intent of the latest question is identified, and the large model question template and the business interface that needs to be accessed are determined based on the result of the intent identification.

[0085] Step S105: input the filled large model question template into the large model to obtain the content returned by the large model based on the large model question template.

[0086] It should be noted that the content returned by the large model question template is the parameters required to access the business interface.

[0087] In an optional embodiment, after inputting the filled large model question template into the large model and obtaining the content returned by the large model based on the large model question template, the method further includes:

[0088] Calling the business interface through the content returned by the large model question template;

[0089] Receive the result returned by the business interface, and return the result returned by the business interface to the user.

[0090] Specifically, after obtaining the content returned by the big model based on the big model question template, the specific method can be: update the content returned by the big model based on the big model question template to the first-level memory cache, and retrieve the keywords in the first-level memory cache according to the session id to obtain the parameters required to access the business interface, and call the interface to return the result to the client user.

[0091] It is worth mentioning that the large model memory method provided by this method realizes the full recording of key topics through two-layer memory cache and full conversation (that is, full memory cache) recording, and further satisfies the continuity of multiple rounds of conversations according to the key information in each conversation. For example, in the processing of dates, after the user asks multiple questions, he can still accurately answer that the current topic is the specified date of discussion, and the date memory is stored in the first-layer memory cache. When the date is updated again in this conversation, the old date will be placed in the second-layer memory to deal with the date that has been mentioned in the user's question. If the user is not satisfied with the current conversation topic, the return context of the large model is used to extract the key information in the full conversation, and re-analyze and answer the user's question.

[0092] In a specific embodiment, a large model memory method is provided to implement large model memory, so as to solve the problem of large model memory loss or confusion, and help the large model achieve a better multi-round conversation experience. The large model memory method includes two processes, namely, a memory cache process and a memory use process. Figure 2 As shown, the memory cache process specifically includes the following steps:

[0093] Step 1: Construct the theme of this conversation and the key extracted information content. The theme is the summary title of the question, and the content is the summary of the answer to the current question.

[0094] Specifically, after completing the answering process, use the big model to summarize the topics of this question and answer, extract and refine the summary titles, and refine and summarize the corresponding title contents in the form of keywords and values.

[0095] Step 2: Use the current title to search and match in the first-level memory cache. If a match is found, the current title content is replaced. If not found, the title and the corresponding refined summary content are stored in the first-level cache.

[0096] Specifically, the title is used as a keyword and the title in the first-level memory cache is retrieved according to the session id. If a match is found, the current value is used to replace the original title content. If a match is not found, the title is directly stored in the first-level memory cache. The overall structure of the first-level memory cache is as follows: Figure 3 shown.

[0097] Step three, append the replaced subject content to the second-level memory cache.

[0098] Specifically, the replaced title and value are stored in the second-level memory cache. If the title already exists, the value is directly appended to the historical value. The overall structure of the second-level memory cache is as follows: Figure 4 shown.

[0099] Step 4: Record the question and answer of this conversation in the storage medium (i.e., the full memory cache) according to the original question and answer.

[0100] Specifically, the original value of the question and answer content is stored in the full memory cache, where the overall structure of the full memory cache is as follows: Figure 5 shown.

[0101] like Figure 6 As shown, the memory usage process specifically includes the following steps:

[0102] In step 1, the question-answering system determines the access business interface and the large model question template through intent recognition. The template contains three reserved fields: current topic, historical topic, and question.

[0103] Step 2: Get the first-level memory (ie, the first-level memory cache) according to the session ID and fill it into the current topic in the large model access template (ie, the large model question template).

[0104] Step three, obtain the second-layer memory (also known as the second-layer memory cache) according to the session ID and fill it into the historical topic in the large model access template.

[0105] Step 4: Put the content of this question into the question in the large model access template.

[0106] Step 5. After filling in the template, request the large model general model and enter the memory cache process.

[0107] Step 6: The question-answering system retrieves the keywords in the first-level memory based on the session ID to obtain the parameters required to access the business interface, and calls the interface to return the result to the client user.

[0108] For example, when a user asks a question, after intent recognition, the large model question prompt template is confirmed as follows:

[0109] Large model template:

[0110] The current conversation topic is: {

First level memory

Second level memory

[0111] And fill in the content as follows:

[0112] The populated large model request template:

[0113] The current conversation topic is: {"date":"2024-06-11 00:00:00","addr":"Jiangsu Province","appName":"Chat software"}, and the historical topic is: {"date":"2024-05-1100:00:00","addr":"Hebei Province","appName":"Video software"}. Please discuss the above, only give specific conclusions, and only return the results in json format. No other replies are required: Please parse the road information and indicator names in the following sentence, and return the current date and province: What is the traffic indicator of Changning Road?

[0114] The large model returns the following content:

[0115] The general model answers:

[0116] {"date":"2024-10-15","province":"Jiangsu Province","road":"Changning Road","indicator":"Flow indicator"}

[0117] According to the memory cache process, update the above key-value pairs into the memory cache.

[0118] After obtaining the data, the question-answering system directly uses the session ID to obtain the specified data according to its own business needs. The code sample of the question-answering system is as follows:

[0119] / / Get the memory in the memory layer

[0120] data = firstMemory("session ID");

[0121] String date=data.get("date");

[0122] String province=data.get("province");

[0123] String road=data.get("road");

[0124] String indicator=data.get("indicator");

[0125] / / Request business to obtain specific indicators

[0126] body=

[0127] HttpRequest.get(url).form(date,province,road,indicator).timeout(timeout).execute().body();

[0128] / / Return indicator data

[0129] return body;

[0130] It is worth mentioning that the large model memory method provided by the present invention helps to realize that the large model has human-like memory ability in specific user scenarios, and extracts public facts with correct conclusions based on user inquiries, and all memories are for the current session, so as to ensure that the user can complete a round of discussion with the large model with accurate context. Finally, the large model has sustainable interactive output capabilities to ensure the continuity of business scenarios. This method uses caching technology to cache question records three times, namely, a first-layer memory cache, a second-layer memory cache, and a full-memory cache. The first-layer memory cache is the latest memory, which is a common topic in the current conversation, such as: current topic, latest time, address and other key information; the second cache is to extract historical discussion topics, historical events, addresses and other key information; the full memory cache is the cache after the full conversation content of this session is refined. It is convenient for users to ask and answer questions flexibly in each conversation. The key point of the present invention is to divide the external memory of the large model into three layers for recording, use the large model template, and combine the addition, deletion, modification and query of the multi-layer memory cache to solve the industry's pain point of removing parameters in the large model in multiple rounds of conversations. The system can freely obtain the key parameters focused on in the current conversation from the memory layer. For example, in some scene applications, it is necessary to conduct multiple rounds of questioning on a certain scene, a certain time, and a certain address, and it is necessary to query the address with multiple indicators, or query for multiple time periods. By applying this method, the address in the question can be fixed, and the address will not be forgotten or the large model will respond slowly due to the increase in the number of questions.

[0131] The big model memory method provided by the embodiment of the present invention first obtains the current topic and the corresponding topic content according to the user's answer process; then stores the current topic and the corresponding topic content in the first-layer memory cache of the big model; then uses the previous current topic matching the current topic in the first-layer memory cache as the historical topic, and stores the historical topic and the corresponding topic content in the second-layer memory cache of the big model; then receives the latest question input by the user, and fills the latest question, the current topic and the corresponding topic content in the first-layer memory cache, and at least one historical topic and the corresponding topic content in the second-layer memory cache into a preset big model question template; finally, inputs the filled big model question template into the big model to obtain the content returned by the big model based on the big model question template. The present invention caches the current topic and the corresponding topic content through the first layer memory cache and the second layer memory cache, thereby realizing full recording of key topics based on the two layers of memory cache, and utilizes the large model question template to transmit the latest question in combination with all topics and corresponding topic content in the first layer memory cache and the second layer memory cache to the large model, thereby facilitating users to conduct flexible inquiries in each session, and solving the problem of large model memory loss or confusion in multiple rounds of sessions in the prior art.

[0132] Embodiment 2:

[0133] like Figure 7 As shown, this embodiment provides a large model memory device, which is used to execute the above-mentioned large model memory method, including:

[0134] Acquisition module 11, used to acquire the current topic and corresponding topic content according to the user's answer process;

[0135] A first storage module 12, connected to the acquisition module 11, is used to store the current topic and the corresponding topic content in the first layer memory cache of the large model;

[0136] As a storage module 13, connected to the first storage module 12, used to take the previous current topic matching the current topic in the first layer memory cache as a historical topic, and store the historical topic and the corresponding topic content in the second layer memory cache of the large model;

[0137] A receiving and filling module 14 is connected to the storing module 13, and is used to receive the latest question input by the user, and fill the latest question, the current topic and the corresponding topic content in the first-layer memory cache, and at least one historical topic and the corresponding topic content in the second-layer memory cache into a preset large model question template;

[0138] The input obtaining module 15 is connected to the receiving filling module 14, and is used to input the filled large model question template into the large model to obtain the content returned by the large model based on the large model question template.

[0139] Furthermore, the acquisition module 11 specifically includes:

[0140] The summarizing unit is used to summarize the question and answer content corresponding to the user's answer process in the form of keywords and values ​​to obtain the current topic and the corresponding topic content.

[0141] Further, the current subject and the corresponding subject content include at least one current title and corresponding title content;

[0142] The first storage module 12 specifically includes:

[0143] A first search and matching unit, for searching and matching each current title and corresponding title content in the current topic and corresponding topic content, the current title in the first layer memory cache by using the user's session ID;

[0144] a replacement unit, configured to replace the title content corresponding to the previous current title with the title content corresponding to the current title if a previous current title identical to the current title is matched in the first layer memory cache through the session ID;

[0145] The first storage unit is used to store the current title and the corresponding title content in the first layer memory cache through the session ID if the previous current title identical to the current title is not matched in the first layer memory cache through the session ID.

[0146] Furthermore, the storage module 13 specifically includes:

[0147] as a unit, for taking the previous current title of the previous current topic that is the same as the current title of the current topic in the first layer memory cache as a historical title;

[0148] A second search and matching unit, configured to search and match each of all the historical titles in the second-layer memory cache by using the session ID;

[0149] an appending unit, configured to append the title content corresponding to the historical title to the title content corresponding to the previous historical title if a previous historical title identical to the historical title is matched in the second-layer memory cache through the session ID;

[0150] The second storage unit is used to store the historical title and the corresponding title content in the second-layer memory cache through the session ID if no previous historical title identical to the historical title is matched in the second-layer memory cache through the session ID.

[0151] Furthermore, the device also includes:

[0152] The second storage module is used to store the question and answer content corresponding to the user's answer process into the full memory cache of the large model through the session id.

[0153] Furthermore, the device also includes:

[0154] A determination module is used to identify the intent of the latest question and determine the large model question template and the business interface that needs to be accessed based on the result of the intent identification.

[0155] Furthermore, the content returned by the large model question template is the parameters required to access the business interface, and the device further includes:

[0156] A calling module, used to call the business interface through the content returned by the large model question template;

[0157] The receiving and returning module is used to receive the result returned by the business interface and return the result returned by the business interface to the user.

[0158] Embodiment 3:

[0159] refer to Figure 8 This embodiment provides a large model memory device, including a memory 21 and a processor 22, wherein the memory 21 stores a computer program, and the processor 22 is configured to run the computer program to execute the large model memory method in Example 1.

[0160] The memory 21 is connected to the processor 22. The memory 21 may be a flash memory, a read-only memory or other memory. The processor 22 may be a central processing unit or a single-chip microcomputer.

[0161] Embodiment 4:

[0162] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the large model memory method in the above-mentioned embodiment 1 is implemented.

[0163] The computer-readable storage medium includes volatile or non-volatile, removable or non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, computer program modules or other data). Computer-readable storage media include, but are not limited to, RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable read only memory), flash memory or other memory technology, CD-ROM (Compact Disc Read-Only Memory), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer.

[0164] In summary, the big model memory method, device and computer-readable storage medium provided by the embodiments of the present invention first obtain the current topic and the corresponding topic content according to the user's answer process; then store the current topic and the corresponding topic content in the first-layer memory cache of the big model; then use the previous current topic matching the current topic in the first-layer memory cache as the historical topic, and store the historical topic and the corresponding topic content in the second-layer memory cache of the big model; then receive the latest question input by the user, and fill the latest question, the current topic and the corresponding topic content in the first-layer memory cache, and at least one historical topic and the corresponding topic content in the second-layer memory cache into the preset big model question template; finally, input the filled big model question template into the big model to obtain the content returned by the big model based on the big model question template. The present invention caches the current topic and the corresponding topic content through the first layer memory cache and the second layer memory cache, thereby realizing full recording of key topics based on the two layers of memory cache, and utilizes the large model question template to transmit the latest question in combination with all topics and corresponding topic content in the first layer memory cache and the second layer memory cache to the large model, thereby facilitating users to conduct flexible inquiries in each session, and solving the problem of large model memory loss or confusion in multiple rounds of sessions in the prior art.

[0165] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present invention, but the present invention is not limited thereto. For those skilled in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.

Claims

1. A large model memory method, characterized in that: The method comprises: Get the current topic and corresponding topic content based on the user's answer process; Storing the current topic and the corresponding topic content in the first-level memory cache of the large model; The previous current topic matching the current topic in the first-layer memory cache is used as a historical topic, and the historical topic and the corresponding topic content are stored in the second-layer memory cache of the large model; Receive the latest question input by the user, and fill the latest question, the current topic and the corresponding topic content in the first-layer memory cache, and at least one historical topic and the corresponding topic content in the second-layer memory cache into a preset large model question template; The filled large model question template is input into the large model to obtain the content returned by the large model based on the large model question template.

2. The method according to claim 1, characterized in that The obtaining of the current topic and the corresponding topic content according to the user's answer process specifically includes: The question and answer content corresponding to the user's answer process is summarized in the form of keywords and values ​​to obtain the current topic and the corresponding topic content.

3. The method according to claim 1, characterized in that The current subject and the corresponding subject content include at least one current title and corresponding title content; The storing of the current topic and the corresponding topic content into the first-layer memory cache of the large model specifically includes: For each current title and corresponding title content in the current topic and corresponding topic content, searching and matching the current title in the first layer memory cache by using the user's session ID; If a previous current title identical to the current title is matched in the first-layer memory cache through the session ID, the title content corresponding to the previous current title is replaced with the title content corresponding to the current title; If the previous current title identical to the current title is not matched in the first-layer memory cache through the session ID, the current title and the corresponding title content are stored in the first-layer memory cache through the session ID.

4. The method according to claim 3, characterized in that The method of taking the previous current topic matching the current topic in the first-layer memory cache as a historical topic, and storing the historical topic and the corresponding topic content in the second-layer memory cache of the large model specifically includes: Using the previous current title of the previous current topic that is the same as the current title of the current topic in the first layer memory cache as a historical title; For each of the historical titles, searching and matching the historical title in the second-layer memory cache by using the session ID; If a previous historical title identical to the historical title is matched in the second-layer memory cache through the session ID, append the title content corresponding to the historical title to the title content corresponding to the previous historical title; If the previous historical title identical to the historical title is not matched in the second-layer memory cache through the session ID, the historical title and the corresponding title content are stored in the second-layer memory cache through the session ID.

5. The method according to claim 3, characterized in that: The method further comprises: The question and answer content corresponding to the user's answer process is stored in the full memory cache of the large model through the session id.

6. The method according to claim 1, characterized in that Before filling the latest question, the current topic and the corresponding topic content in the first-layer memory cache, and at least one historical topic and the corresponding topic content in the second-layer memory cache into the preset large model question template, the method further includes: The intention of the latest question is identified, and the large model question template and the business interface that needs to be accessed are determined according to the result of the intention identification.

7. The method according to claim 6, characterized in that The content returned by the large model question template is the parameters required to access the business interface. After inputting the filled large model question template into the large model and obtaining the content returned by the large model based on the large model question template, the method further includes: Calling the business interface through the content returned by the large model question template; Receive the result returned by the business interface, and return the result returned by the business interface to the user.

8. A large model memory device, characterized in that: The device comprises: The acquisition module is used to obtain the current topic and the corresponding topic content according to the user's answer process; A first storage module, connected to the acquisition module, for storing the current topic and the corresponding topic content in the first-level memory cache of the large model; As a storage module, connected to the first storage module, used to take the previous current topic matching the current topic in the first layer memory cache as a historical topic, and store the historical topic and the corresponding topic content in the second layer memory cache of the large model; A receiving and filling module, connected to the storage module, for receiving the latest question input by the user, and filling the latest question, the current topic and the corresponding topic content in the first-layer memory cache, and at least one historical topic and the corresponding topic content in the second-layer memory cache into a preset large model question template; The input obtaining module is connected to the receiving filling module and is used to input the filled large model question template into the large model to obtain the content returned by the large model based on the large model question template.

9. A large model memory device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the large model memory method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the large model memory method according to any one of claims 1 to 7 is implemented.