Group chat robot system based on multi-layer memory module and data processing method
By introducing multi-layer memory modules and forgetting conversion modules into the group chat robot system, the problems of overloading and low effectiveness of memory information are solved, and efficient management and protection of memory information are achieved.
Patent Information
- Application Number
- CN202411679623.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-11-22
AI Technical Summary
In the prior art, the group chat robot system has insufficient long-term maintenance of memory and fails to effectively delete redundant memories and mark important memories, resulting in overloading of memory information, low effectiveness and low call efficiency.
The multi-layer memory module is adopted to manage and count memory information through cascading path generation modules, field addition modules, storage modules and statistics modules, and the forgetting and conversion modules are used to delete information with lower scores, convert the number of memory layers with higher scores, and realize the effective management of memory information.
Effectively prevent memory information overload and invalid information accumulation, improve processing efficiency, and simulate the human memory deepening process through layered management and forgetting to protect important information.
Smart Images

Figure CN119669401A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology, and relates to a group chat robot system and a data processing method, and specifically to a group chat robot system and a data processing method based on a multi-layer memory module. Background Art
[0002] LLM (Large Language Model) is a large-scale generative language model with interactive capabilities. The model can accept natural language input from users, understand its meaning and give corresponding feedback.
[0003] The patent application with the application publication number CN118233420A and the name of "Automatic reply method and related equipment for group chat messages" discloses a group chat robot system and data processing method. The invention first obtains the chat record information within the preset historical length in the chat room, and then determines the next speaking member from each member according to the description information, chat record information and member information of each member in the chat room. If the next speaking member is the current user, the relevant memory of the current user is determined from the preset memory pool according to the description information, member information of the current user and chat record information, and then generates the first prompt word text according to the description information, chat record information, member information of the current user and related memory, and parses the first prompt word text based on the preset large language model to generate the target chat information, and finally uses the target chat information as the message sent by the current user and replies to the chat room, thereby realizing the automatic and accurate reply of group chat messages in the real group chat process and improving the user experience. However, the invention has the disadvantage that it only stores the memory and does not perform long-term maintenance on the memory, but does not delete redundant memories or mark important memories, which leads to memory information overload caused by long-term accumulation of memory information, low validity of memory information and low efficiency in calling memory information. Summary of the invention
[0004] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and propose a group chat robot system and data processing method based on a multi-layer memory module to solve the technical problem of low processing efficiency in the prior art.
[0005] To achieve the above object, the technical solution adopted by the present invention is:
[0006] A group chat robot system based on a multi-layer memory module comprises a cascaded group chat message extraction module, a memory module, a forgetting and conversion module, an evaluation module and a reply module; the output end of the group chat message extraction module is also connected to the input ends of the evaluation module and the reply module, and the output end of the evaluation module is also connected to the input end of the memory module; the memory module comprises a cascaded path generation module, a field addition module, a storage module and a statistical module.
[0007] A data processing method for a group chat robot system based on a multi-layer memory module comprises the following steps:
[0008] (1) Initialization parameters:
[0009] Initialize the number of users chatting with the group chat robot system to be A, where A≥5, and the ath user is H a ;
[0010] (2) The group chat message extraction module converts the original chat message sent by each user:
[0011] The group chat message extraction module extracts each user’s H a N original chat messages sent E a , and for each original chat message The original memory text F is obtained by transforming it into a declarative sentence including N fields of "original memory text". a , where N ≥ 3;
[0012] (3) The memory module obtains the first memory information and counts the number of user memory information at different “memory levels”:
[0013] The memory module is used to store the original memory text F a Each statement in Add the "Number of memory layers" field to obtain N user memory information J with the same format as the two fields "Original memory text" and "Number of memory layers" contained in the original stored memory information a , and J a Together with the originally stored user memory information, the first memory information G containing X user memory information is formed a , and then count the amount of user memory information in each memory layer
[0014] (4) The forgetting and conversion module obtains the second memory information:
[0015] The forgetting and conversion modules are used to process the first memory information G a Each user in the memory information Perform a comprehensive score, delete the information with a lower score, and then add 1 to the value in the "Number of Memory Levels" field of each information with a higher score to obtain the second memory information T a ;
[0016] (5) The evaluation module obtains the third memory information:
[0017] For the second memory information T a Each memory information is comprehensively scored, and the information with higher scores is selected from the evaluation results to obtain the third memory information U a ;
[0018] (6) The reply module generates reply information:
[0019] The reply module sends the third memory information U a The original chat information with A users is used as the input of the large language model ModelA for semantic analysis to obtain the reply information Q.
[0020] Compared with the prior art, the present invention has the following advantages:
[0021] The memory module of the present invention includes a field adding module and a statistical module. The field adding module adds a "memory layer number" field to the declarative sentence in the original memory text, which is not only beneficial to the management of memory information, but also beneficial to the preservation of long-term effective memory information; the statistical module can realize the statistics of the number of first memory information corresponding to different layers, and the forgetting and conversion module deletes the information with lower scores and converts the "memory layer number" in each information with higher scores, thereby realizing effective management of memory information, preventing overload of memory information and excessive accumulation of invalid information, and effectively improving processing efficiency compared with the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 This is a schematic diagram of the overall structure of the group chat robot system of the present invention;
[0023] Figure 2 The data processing method of the present invention is implemented in the flowchart. DETAILED DESCRIPTION
[0024] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0025] Reference Figure 1The group chat robot system of the present invention includes a cascaded group chat message extraction module, a memory module, a forgetting and conversion module, an evaluation module and a reply module; the output end of the group chat message extraction module is also connected to the input end of the evaluation module and the reply module, and the output end of the evaluation module is also connected to the input end of the memory module; the memory module includes a cascaded path generation module, a field adding module, a storage module and a statistical module.
[0026] The group chat message extraction module is used to obtain chat record information within a set range in the group chat;
[0027] The memory module is used to convert chat record information into user memory information in the form of declarative sentences. In this process, the field "memory layer" is added to the original memory text to stratify the memory. Different layers represent different memory characteristics. Standardized classification of memory is conducive to the management of memory information. The statistics module counts the number of existing memories at different layers to provide data for the forgetting and conversion modules.
[0028] The forgetting and conversion module compares the existing memory quantity with the pre-set threshold to ensure that the memory information quantity is maintained within the threshold range. The forgetting operation is completed by deleting the memory with a lower score. This process simulates the human forgetting process, thereby preventing the overload of memory information and the excessive accumulation of invalid information. The conversion operation is completed by modifying the "memory layer number" field of the memory with a higher score. The long-term effective memory information is stored in the higher layer number, which will protect the memory from being easily deleted, facilitate the management of long-term effective memory information, and simulate the process of deepening human memory, thereby achieving the role of protecting important information;
[0029] The evaluation module obtains a comprehensive score of the memory information by importance, relevance, and latency, thereby selecting the memory information that best suits the current chat environment and helping the large language model understand the user;
[0030] The reply module uses a large model to perform semantic analysis on the current chat history and the corresponding user memory to understand the current chat context and user information, and then generate reply information.
[0031] Reference Figure 2 The data processing method of the present invention comprises the following steps:
[0032] Step 1) Initialize parameters:
[0033] Initialize the number of users chatting with the group chat robot system to be A, where A≥5, and the ath user is H a ;
[0034] A is not the number of all users in the group chat, but the number of users participating in the chat within a period of time. In this embodiment, A=5.
[0035] Step 2) The group chat message extraction module converts the original chat message sent by each user:
[0036] The group chat message extraction module extracts each user’s H a N original chat messages sent E a , and for each original chat message The original memory text F is obtained by transforming it into a declarative sentence including N fields of "original memory text". a , where N≥2, in this example N=2.
[0037] The group chat message extraction module removes each user’s H a Every raw chat message sent The colloquial content in Corresponding third-person declarative sentences including people, places, and events
[0038] If too many messages are extracted at one time, the operating efficiency will be reduced and the reply effect will be reduced. Therefore, the message extraction module extracts according to the number of new messages. When the number of messages exceeds the threshold set by itself, it extracts. If it does not exceed, it continues to wait until the number of messages exceeds the set threshold threshold. In this embodiment, threshold = 10.
[0039] In this embodiment, each user H a N original chat messages sent E a A piece of text, that is, the text content sent by the user in the group chat. The large language model ModelA refers to a generative deep neural network model based on the Transformer structure, which has super semantic understanding and multi-round dialogue capabilities. The large language model can be any of the models including GPT-4, GPT-3, LaMDA, etc.
[0040] Through prompt1, ModelA understands the current task, which is to "remove each user H a Every raw chat message sent The colloquial content in Corresponding third-person declarative sentences including people, places, and events ”.
[0041] A message sent by a member in a chat room, i.e.
[0042] prompt1 is "Please change the user's chat message Remove the colloquial content in this sentence and we get Corresponding third-person declarative sentences including people, places, and events ”
[0043] Will Input prompt1 into the large language model ModelA and get
[0044] At this time, "User H a I traveled to Xiamen in 2020 and was satisfied."
[0045] Step 3) The memory module obtains the first memory information and counts the number of user memory information at different "memory levels":
[0046] The memory module is used to store the original memory text F a Each statement in Add the "Number of memory layers" field to obtain N user memory information J with the same format as the two fields "Original memory text" and "Number of memory layers" contained in the original stored memory information a , and J a Together with the originally stored user memory information, the first memory information G containing X user memory information is formed a , and then count the amount of user memory information in each memory layer In this embodiment, X=40, and the implementation steps are:
[0047] (3a) The path generation module generates a path based on each user H a Name a Generate storage memory information including base address, Name a , and the file path P of the file format a :
[0048] According to H a Name a The file path P is composed of "jack", base address "C:\UsersMemory\", and file format ".json". a "C: / UsersMemory / jack.json", H a The corresponding memory is stored in this file.
[0049] The file path is an absolute file path, based on the format of the Windows platform. The storage file format is the JSON file format. The obtained path provides a path for subsequent information storage. The method of directly splicing and generating a path directly improves efficiency compared to the method of querying the path.
[0050] (3b) Field adding module to the original memory text F a Each statement in Add the "Number of Memory Layers" field to get the user memory information in the same format as the original stored user memory information
[0051] According to F a "User H a I traveled to Xiamen in 2020 and was satisfied." At this time, add the "Number of Memory Layers" field and assign a value to the memory field to obtain user memory information in the same format as the original stored user memory information.
[0052] "User H a Traveled to Xiamen in 2020 and was satisfied.
[0053] Memory layers: 1"
[0054] The field adding module serves the subsequent forgetting and conversion modules. The "number of memory layers" field added by this function enables memory to be managed in layers.
[0055] (3c) The storage module stores N user memory information J a Stored in file path P a and J a With P a The user memory information originally stored in the first memory information G a , in this example N=2.
[0056] Set N = 2 user memory information J a Stored in P a and J a With P a The user memory information originally stored in the memory constitutes the first memory information G of X user memory information. a , G a for
[0057] “
[0058] 1: "User H a I tried Roujiamo in Xi'an and loved it.
[0059] Memory layers: 1"
[0060] ...(contains more user memory information)
[0061] 40: "User H a Traveled to Xiamen in 2020 and was satisfied.
[0062] Memory layers: 1"
[0063] ”
[0064] When the storage module performs an update operation, the original memory information is not overwritten, so that the memory information is updated in real time, thereby ensuring the timeliness of the memory information.
[0065] (3d) The statistical module uses the first memory information G a The "Number of Memory Layers" field in the table below counts the number of G layers corresponding to different numbers of layers. a , get the value set where i∈[1,I], When the “memory level” is i, the corresponding amount of user memory information, I represents the total number of memory levels, I≥3, and in this embodiment, I=3.
[0066] The statistics module counts the G corresponding to different layers a The number of a is [21,12,7], that is There are 21 memories in the first layer. There are 12 memories in the second layer. There are 7 memories in the third layer.
[0067] Step 4) The forgetting and conversion module obtains the second memory information:
[0068] The forgetting and conversion modules are used to process the first memory information G a Each user in the memory information Perform a comprehensive score, delete the information with a lower score, and then add 1 to the value in the "Number of Memory Levels" field of each information with a higher score to obtain the second memory information T a .
[0069] (4a) Forgetting and switching module judgment Does it meet the preset threshold D? If yes, execute step (4b), otherwise set G a As the second memory information, in this embodiment, D=20.
[0070] In this embodiment, D=20, because Proceed to step (4b).
[0071] (4b) The forgetting and conversion modules calculate each user’s memory information Overall rating The memory information of B users with lower comprehensive scores is deleted, and the value in the "Number of Memory Layers" field of the memory information of R users with higher comprehensive scores is increased by 1 to obtain the second memory information T a , and T a Write P a among The calculation formula is:
[0072]
[0073] in, For G The x-th memory of the layer, For the The memory self-update parameter matrix of the layer memory, Respectively The scores of importance Y, relevance W, and latency P.
[0074] In this embodiment, the threshold D=20, B=5, R=3, C 1 =[3,4,3],C 2 =[4,5,1],C 3 =[5,4,1].
[0075] Importance Y reflects the importance of the event. In this embodiment, importance Y is obtained by inputting prompt2 into the large model ModelA. In this embodiment, prompt2 is
[0076] "Please rate the importance of the following memory content on a scale of 1 to 10, with 1 being the most common content, such as "I ate steamed buns today", and 10 being a very important event, such as "I finally got into ** University". Please rate the following memory: "User H a I traveled to Xiamen in 2020 and was satisfied. "Output requirements: Just output the numbers."
[0077] In this case, the importance Y is the number output by ModelA.
[0078] The correlation W reflects the correlation between the memory and the current chat content. The greater the correlation, the higher the score. The correlation is calculated by the following formula:
[0079]
[0080]
[0081]
[0082] R and S represent the latest chat content E, The embedding feature vector of dimension M, R z , S z Respectively represent E, The zth component of , ||·|| represents the modulo length operation.
[0083] The embedded feature vectors R and S are obtained by the GPT-Text-embedding model in this example.
[0084] The latency P reflects the degree of decay of the current memory. The shorter the memory exists, the less likely it is to decay. The higher the latency P score is, the calculation formula of P is as follows:
[0085] P=e -λt
[0086] e is a natural constant, λ is the forgetting speed, and t is the The time it exists in the memory module, λ=0.5.
[0087] By periodically detecting the amount of memory information, low-scoring memory information is deleted. This process directly deletes the memory from the corresponding file, simulating the human process of forgetting non-important information.
[0088] By regularly detecting the amount of memory information and converting high-scoring information, the "memory level" field of the memory information is increased. In higher memory levels, memories are more difficult to delete and are more frequently called upon, thereby achieving the function of deepening human memory of important information.
[0089] For the The memory self-update parameter matrix of the layer memory. The parameters in the matrix reflect the importance that different memory layers attach to the three indicators of importance, relevance, and latency. The higher the corresponding parameter, the more important the indicator is in this layer.
[0090] Through the deployment of these three indicators of importance, relevance, and latency and the parameter matrix, it is possible to ensure that different types of memories are stored in different memory layers. Through the forgetting and conversion modules, regular clearing of information can be achieved through forgetting, and important information can be protected through conversion. More important information can be protected in higher layers, thus ensuring that important information is not easily cleared.
[0091] Step 5) The evaluation module obtains the third memory information:
[0092] For the second memory information T a Each memory information is comprehensively scored, and the information with higher scores is selected from the evaluation results to obtain the third memory information U a ;
[0093] The comprehensive scoring process is the same as (4a), and the parameters are the same, but the parameter matrix can still be freely set to adapt to different chat environments. After the calculation results are completed, they are still sorted according to the scores. In this embodiment, the first 5 memory information in the first layer of memory, the first 3 memory information in the second layer of memory, and the first 2 memory information in the third layer of memory are taken as the fifth memory information U a .
[0094] Step 6) The reply module generates a reply message:
[0095] The reply module sends the third memory information U a The original chat information with A users is used as the input of the large language model ModelA for semantic analysis to obtain the reply information Q a .
[0096] In this embodiment, the reply is made by inputting the title prompt2 and the fifth memory information U to the large model ModelA. a In this embodiment, prompt 2 is "Now you play the role of a user in a group chat. Your job is to participate in the group chat and provide them with a better chat experience. Next, I will provide you with some recent chat information and some relevant experiences of the corresponding users to help you generate a better reply:
[0097] Group chat record: "E"
[0098] Corresponding memory information: U a
[0099] You can make multiple replies or just one reply. If the situation is special, you can choose not to reply. Use / n to separate sentences.
[0100] Please ensure your reply is fluent and coherent. "
[0101] Get the output of ModelA and input it into the group chat.
Claims
1. A group chat robot system based on a multi-layer memory module, comprising a cascaded group chat message extraction module, a memory module, an evaluation module and a reply module; the output end of the group chat message extraction module is also connected to the input end of the evaluation module and the reply module, and the output end of the evaluation module is also connected to the input end of the memory module; the memory module comprises a cascaded path generation module and a storage module, characterized in that: A field adding module is loaded between the path generating module and the storage module, and a statistics module is cascaded to the output end of the storage module; and a forgetting and conversion module is cascaded to the input end of the evaluation module.
2. A data processing method according to the system of claim 1, characterized in that: The steps include: (1) Initialization parameters: Initialize the number of users chatting with the group chat robot system to be A, where A≥5, and the ath user is H a ; (2) The group chat message extraction module converts the original chat message sent by each user: The group chat message extraction module extracts each user’s H a N original chat messages sent E a , and for each original chat message The original memory text F is obtained by transforming it into a declarative sentence including N fields containing "original memory text". a , where N ≥ 2; (3) The memory module obtains the first memory information and counts the number of user memory information at different "memory levels": The memory module is used to store the original memory text F a Each statement in Add the "Number of memory layers" field to obtain N user memory information with the same format as the "Original memory text" and "Number of memory layers" fields contained in the original stored memory information. a , and J a Together with the originally stored user memory information, the first memory information G containing X user memory information is formed a , and then count the amount of user memory information in each memory layer (4) The forgetting and conversion module obtains the second memory information: The forgetting and conversion modules are used to process the first memory information G a Each user in the memory information G a x Perform a comprehensive score, delete the information with a lower score, and then add 1 to the value in the "Number of Memory Levels" field of each information with a higher score to obtain the second memory information T a ; (5) The evaluation module obtains the third memory information: For the second memory information T a Each memory information is comprehensively scored, and the information with higher scores is selected from the evaluation results to obtain the third memory information U a ; (6) The reply module generates reply information: The reply module sends the third memory information U a The original chat information with A users is used as the input of the large language model ModelA for semantic analysis to obtain the reply information Q.
3. The method according to claim 2, characterized in that For each original chat message E described in step (2) a n The conversion is based on the large language model ModelA, and the generation method is: The group chat message extraction module removes each user’s H a Each original chat message sent a n The colloquial content in E a n Corresponding third-person declarative sentences including people, places, and events F a n .
4. The method according to claim 2, characterized in that: The memory module in step (3) obtains the first memory information and counts the number of user memory information of each "memory layer", and the implementation steps are: (3a) The path generation module generates a path based on each user H a Name a Generate storage memory information including base address, Name a , and the file path P of the file format a : (3b) Field adding module to the original memory text F a Each statement in Add the "Number of Memory Layers" field to get the user memory information in the same format as the original stored user memory information (3c) The storage module stores N user memory information J a Stored in file path P a and J a With P a The user memory information originally stored in the first memory information G a : (3d) The statistical module uses the first memory information G a The "Number of Memory Layers" field in the table counts the G corresponding to different numbers of layers. a , get the value set where i∈[1,I],L i a Indicates the amount of user memory information when the "memory level" is i. I represents the total number of memory levels, and I≥3.
5. The method of the system according to claim 2, characterized in that: The forgetting and conversion module described in step (4) obtains the second memory information T a , the implementation steps are: (4a) Forgetting and switching module judgment Does it meet the preset threshold D? If yes, execute step (4b), otherwise set G a As a second memory information; (4b) The forgetting and conversion modules calculate each user’s memory information Overall rating The memory information of B users with lower comprehensive scores is deleted, and the value in the "Number of Memory Layers" field of the memory information of R users with higher comprehensive scores is increased by 1 to obtain the second memory information T a , and T a Write P a among The calculation formula is: in, For G The x-th memory of the layer, For the The memory self-update parameter matrix of the layer memory, Respectively The scores of importance Y, relevance W, and latency P.
6. The method according to claim 5, characterized in that: The step (4a) The correlation W and delay P are calculated by the following formulas: P=e -λt Among them, R and S represent the latest chat content E, The embedding feature vector of dimension M, R z , S z Respectively represent E, The zth component of , ||·|| represents the modulus length operation, e is a natural constant, λ is the forgetting speed, and t is The time it exists in the memory module.
7. The method of the system according to claim 5, characterized in that: The step (4a) The importance of Y is generated by: Based on the large language model ModelA Perform semantic analysis on the "original memory text" in and generate the corresponding score Y.
Citation Information
Patent Citations
Human-computer interaction method and device used for robot and based on forgetting mechanism
CN109202921A
End-to-end intention recognition system and method based on memory forgetting device
CN111062220A
Automatic reply method of group chat message and related equipment
CN118233420A
Pogo pin with extended contact tolerance using a MEMS plunger
KR102170384B1
Translation chatting service providing device and method
WO2015133790A1