A large model long-term memory method based on vector index
By performing structured and differential parsing on historical memory fragments, generating the associated states of memory units and constructing multiple indexes, the memory failure problem caused by conflicts between old and new systems in enterprise scenarios is solved, ensuring that the output of the large model is consistent with the new system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHENGDU MINGSHUYINGHE TECHNOLOGY CO LTD
- Filing Date
- 2026-04-24
- Publication Date
- 2026-06-12
AI Technical Summary
In enterprise scenarios, the historical memory of old systems or processes in long-term memory methods is prone to conflict with the new system due to version changes, resulting in memory failure. When existing technologies recall old memories based on semantic similarity, the output is inconsistent with the current system.
By performing structured parsing of historical memory fragments to generate memory units, differential parsing to generate a set of differential anchor points, memory states are divided according to the association results between anchor points and memory units, and a main retrieval index, a restricted retrieval index, and a historical reference index are constructed. Query semantic vectors are generated to perform retrieval, avoiding the output of conflicting memories.
It effectively alleviates the memory failure problem caused by the conflict between historical memory and the new version of the system when the large model changes the version of the system process text, and ensures that the output results are consistent with the new version of the system.
Smart Images

Figure CN122196094A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of large model technology, and in particular to a long-term memory method for large models based on vector indexing. Background Technology
[0002] Large-scale models, in scenarios such as enterprise knowledge Q&A, process-assisted decision-making, policy implementation guidance, and business operation suggestions, typically need to combine external long-term memory for reasoning. Existing long-term memory methods commonly involve converting historical text fragments into vectors and creating vector indexes. Upon receiving a query, candidate memories are retrieved from the vector index based on the similarity between the query vector and historical text vectors, and then these candidate memories are provided to the large-scale model to generate the output results.
[0003] Currently, in enterprise scenarios, the content corresponding to long-term memory is not always stable. Especially when approval processes are adjusted, roles and responsibilities change, default processing rules change, prohibitive constraints are updated, or exception clauses are revised, the historical memory corresponding to the old system or process, while still highly similar to the current query semantically, has changed its underlying premise. If retrieval is still performed solely based on semantic similarity, the old memory is likely to maintain a high ranking in the current search results and be cited by the large model as the current executable basis, thus outputting results inconsistent with the current system. This leads to the problem of memory invalidation in the large model when the system or process text is updated, due to the conflict between historical memory and the new system. Summary of the Invention
[0004] To address the technical problems existing in the background art, this invention proposes a long-term memory method for large models based on vector indexing.
[0005] This invention proposes a long-term memory method for large models based on vector indexing, comprising the following steps:
[0006] S1. Obtain historical memory fragments, old version of system and process texts, and new version of system and process texts of the target large model;
[0007] As an explanation, both the old and new versions of the system and process texts are texts that represent the content of the system and / or the content of the process;
[0008] The historical memory fragments are analyzed in a structured manner, and corresponding memory units are generated for each historical memory fragment;
[0009] S2. Perform differential parsing on the old and new versions of the policy and process texts to generate a set of differential anchor points.
[0010] Based on the differential anchor set and each memory unit, generate the association result of the memory unit;
[0011] S3. Based on the association results, generate the memory state of each memory unit;
[0012] Based on the memory status of each memory unit, a main search index, a restricted search index, and a historical reference index are generated;
[0013] S4. Receive the current query, perform structured parsing on the current query, and generate a query semantic vector and query premise fingerprint;
[0014] Based on the primary search index and the restricted search index, a primary evidence set is generated, and the primary evidence set is used as the current output result.
[0015] Preferably, in S1, each of the historical memory fragments is subjected to structured parsing, and a corresponding memory unit is generated for each historical memory fragment, as follows:
[0016] For any historical memory fragment, semantic encoding is performed on the historical memory fragment to obtain the semantic vector corresponding to the historical memory fragment;
[0017] Information extraction technology is used to extract structured information from this historical memory fragment, generating the premise description data corresponding to this historical memory fragment;
[0018] The prerequisite description data includes: process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier;
[0019] Semantic vectors and contextual description data form the memory unit corresponding to this historical memory fragment.
[0020] Preferably, in S2, differential parsing is performed on the old version of the system process text and the new version of the system process text to generate a set of differential anchor points, as follows:
[0021] The sequence alignment algorithm is used to perform clause-level and node-level alignment on the old and new versions of the system and process texts, resulting in aligned clause pairs, aligned node pairs within aligned clause pairs, unmatched clauses in the old version of the system and process text, and unmatched clauses in the new version of the system and process text.
[0022] For each unmatched clause in the old version of the system process text, generate a deletion node anchor;
[0023] For each unmatched clause in the new version of the system and process text, generate a new node anchor point;
[0024] The following fields are extracted from each alignment clause pair and the alignment node pair within the alignment clause pair using regular expressions: node number, role keyword, default term, prohibited term, and exception term;
[0025] For each alignment clause pair and the corresponding node number, role keyword, default terminology, prohibited terminology, and exception terminology of the alignment node pair within the alignment clause pair, perform the following field-by-field comparison:
[0026] If the node numbers are different, a node sequence change anchor point is generated;
[0027] If the character keywords are different, a character change anchor point is generated;
[0028] If the default terms are different, a default rule change anchor point is generated;
[0029] If the prohibited terms are different, a constraint change anchor point is generated;
[0030] If the exception terms are different, an exception clause change anchor point is generated;
[0031] For each deleted node anchor point, added node anchor point, node order change anchor point, role change anchor point, default rule change anchor point, constraint condition change anchor point, and exception clause change anchor point, record the source clause identifier, source node identifier, change direction identifier, and content identifier before and after the change.
[0032] Retrieve all anchor points for deleted nodes, newly added nodes, node order changes, role changes, default rule changes, constraint changes, and exception changes to form a differential anchor point set.
[0033] Preferably, in S2, the association result of the memory cells is generated based on the differential anchor point set and each memory cell, as follows:
[0034] The source node identifier, source clause identifier, and before-and-after content identifier of the node anchor points deleted, added, node order change, role change, default rule change, constraint condition change, and exception clause change in the differential anchor point set are compared field by field with the process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier of the premise description data in each memory unit.
[0035] If the source node identifier or source clause identifier of the deleted node anchor point, added node anchor point, node order change anchor point, role change anchor point, default rule change anchor point, constraint condition change anchor point, or exception clause change anchor point is equal to any one of the following identifiers in the context description data of each memory unit: flow node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier, then establish the association relationship between the corresponding associated anchor point and the memory unit.
[0036] Deleted node anchors, added node anchors, node order change anchors, role change anchors, default rule change anchors, constraint change anchors, or exception clause change anchors that are equal to any of the anchors in the premise description data.
[0037] Use the process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, or effective time interval identifier in the premise description data that are equal to the source node identifier or source clause identifier of the associated anchor point as the associated identifier.
[0038] If the changes in the content identifiers of the deleted node anchor, added node anchor, node order change anchor, role change anchor, default rule change anchor, constraint condition change anchor, and exception clause change anchor include any one of the following: process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier of the prerequisite description data in the memory unit, then an association relationship is established between the corresponding associated anchor and the memory unit.
[0039] The anchor points for the deleted nodes, added nodes, node order changes, role changes, default rule changes, constraint changes, or exception changes in the context description data are used as associated anchor points.
[0040] The process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, or effective time interval identifier included in the changes of the associated anchor points in the premise description data are used as the association identifier.
[0041] For each memory unit, based on the association relationship between the corresponding associated anchor and the memory unit, generate a list of affected fields, a list of differential anchor order, and a list of differential anchor source paths for each memory unit;
[0042] The association results for a memory cell are the list of affected fields, the list of differential anchor order, and the list of differential anchor source paths corresponding to that memory cell.
[0043] Preferably, in S2, for each memory cell, based on the association relationship between the corresponding associated anchor point and the memory cell, a list of affected fields, a list of differential anchor point order, and a list of differential anchor point source paths are generated for each memory cell, as follows:
[0044] For each memory cell, based on the association relationship between the corresponding associated anchor point and the memory cell, the association identifier of the premise description data in the memory cell is extracted and written into the list of affected fields of the memory cell;
[0045] For each memory cell, based on the association relationship between the corresponding associated anchor and the memory cell, the corresponding associated anchor in the differential anchor set is extracted and written into the differential anchor order list of that memory cell;
[0046] For each memory unit, based on the association between the corresponding associated anchor point and the memory unit, the source clause identifier, source node identifier, change direction identifier, and content identifier before and after change of the corresponding associated anchor point in the differential anchor point set are extracted to form a path record, which is then written into the differential anchor point source path list of that memory unit.
[0047] Preferably, in S3, based on the association results, the memory state of each memory unit is generated as follows:
[0048] Based on the association results, the following operations are performed on each of the memory units:
[0049] If the list of affected fields of a memory cell includes a prohibitive constraint identifier, then the memory state of that memory cell is recorded as a historical reference state.
[0050] If the list of affected fields of a memory cell does not include a prohibitive constraint identifier but includes a role identifier or a default parameter identifier, then the memory state of the memory cell is recorded as a conditional executable state.
[0051] Otherwise, the memory state of the memory unit is recorded as the current executable state.
[0052] Preferably, in S3, based on the association results, the memory state of each memory unit is generated as follows:
[0053] For each memory cell, each associated identifier in the list of affected fields for each memory cell;
[0054] Retrieve all associated anchors corresponding to the associated identifier from the differential anchor list of the corresponding memory unit; the number of associated anchors corresponding to the associated identifier;
[0055] Retrieve the source clause identifier, source node identifier, change direction identifier, and content identifier before and after change of the associated anchor point corresponding to the associated identifier from the differential anchor point source path list of the corresponding memory unit;
[0056] Extract the location of the related anchor in the new version of the system and process text from the source clause identifier of the related anchor;
[0057] Extract the content differences of the related anchor points before and after the changes in the old and new versions of the system and process text from the content identifiers of the related anchor points, and obtain the content differences of the related anchor points before and after the changes.
[0058] Get the error correction frequency of this associated identifier in the execution feedback;
[0059] Obtain the associated anchor point corresponding to each associated identifier, the number of associated anchor points, the position of the associated anchor point in the clause of the new version of the system process text, the content difference before and after the change of the associated anchor point, and the error correction frequency of the associated identifier;
[0060] For any associated identifier, based on the associated anchor point corresponding to the associated identifier, the number of associated anchor points, the position of the associated anchor point in the clause of the new version of the system process text, the content difference before and after the change of the associated anchor point, and the error correction frequency of the associated identifier, the fuzzy comprehensive evaluation method is used to generate the failure score of the associated identifier.
[0061] Obtain the failure scores for all associated identifiers. Specifically, if the associated identifier is a process node identifier, its failure score is recorded as the process node failure score; if the associated identifier is a role identifier, its failure score is recorded as the role failure score; if the associated identifier is a trigger condition identifier, its failure score is recorded as the trigger condition failure score; if the associated identifier is a prohibitive constraint identifier, its failure score is recorded as the prohibitive constraint failure score; if the associated identifier is a default parameter identifier, its failure score is recorded as the default parameter failure score; and if the associated identifier is an effective time interval identifier, its failure score is recorded as the time interval failure score.
[0062] For any memory unit, among all the associated identifiers corresponding to that memory unit:
[0063] If there is a prohibitive constraint failure score greater than 0, then the memory state of the memory unit is recorded as the historical reference state.
[0064] If there is no prohibitive constraint failure score greater than 0, and there is a role failure score greater than 0 or a default parameter failure score greater than 0, then the memory state of this memory unit is recorded as a conditional executable state.
[0065] Otherwise, record the memory state of the memory unit as the current executable state.
[0066] Preferably, in S3, based on the memory state of each memory unit, a main retrieval index, a restricted retrieval index, and a historical reference index are generated, as follows:
[0067] The main retrieval index is formed by using the semantic vectors in the memory units whose current executable state is remembered.
[0068] A restricted retrieval index is formed by using semantic vectors in memory units whose memory state is a conditionally executable state;
[0069] A historical reference index is formed by using the semantic vectors in memory units whose memory state is the historical reference state;
[0070] The main search index, restricted search index, and historical reference index are all vector indexes.
[0071] Preferably, in step S4, the current query is received, and the current query is parsed in a structured manner to generate a query semantic vector and a query premise fingerprint, as follows:
[0072] Semantically encode the current query to obtain a query semantic vector;
[0073] Information extraction technology is used to extract structured information from the current query and generate a query premise fingerprint;
[0074] The query prerequisite fingerprint includes: current process node identifier, current role identifier, current trigger condition identifier, current prohibitive constraint identifier, current default parameter identifier, and current effective time interval identifier.
[0075] Preferably, in step S4, a master evidence set is generated based on the main search index and the restricted search index. The master evidence set is used as the current output result, as follows:
[0076] In the main retrieval index, vector similarity retrieval is performed using the query semantic vector to obtain the cosine similarity between the query semantic vector and the semantic vector of each memory unit in the main retrieval index.
[0077] The first set of evidence is formed by selecting the K memory units with the highest cosine similarity, where K is a positive integer.
[0078] In the first set of evidence, the premise description data of each memory unit is matched with the query premise fingerprint;
[0079] If at least one memory unit has premise description data that is equal to the query premise fingerprint, then the memory units whose premise description data is equal to the query premise fingerprint form the master evidence set, and the historical comparison evidence set is recorded as empty.
[0080] If the premise description data of each memory unit is not equal to the fingerprint of the query premise, then the second search is performed;
[0081] The second retrieval is as follows: In the first evidence set, each of the current process node identifier, current role identifier, current trigger condition identifier, current prohibitive constraint identifier, current default parameter identifier, and current effective time interval identifier in the query premise fingerprint is matched with the process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier of the premise description data of each memory unit;
[0082] If any current process node identifier, current role identifier, current trigger condition identifier, current prohibitive constraint identifier, current default parameter identifier, or current effective time interval identifier exists in the query premise fingerprint that is not equal to the process node identifier, current role identifier, current trigger condition identifier, current prohibitive constraint identifier, current default parameter identifier, or current effective time interval identifier in the first evidence set, mark it as a missing identifier;
[0083] In the restricted retrieval index, vector similarity retrieval is performed again using the query semantic vector to obtain the cosine similarity between the query semantic vector and the semantic vector of each memory unit in the restricted retrieval index;
[0084] The first K memory units with the highest cosine similarity are selected to form the second set of evidence, where K is a positive integer.
[0085] From the second set of evidence, memory units whose premise description data contains an identifier equal to the missing identifier are selected as the third set of evidence;
[0086] Perform conflict checking on the memory units in the third set of evidence;
[0087] Conflict verification is performed as follows: In the third set of evidence, compare:
[0088] Condition 1: Is the role identifier in the memory unit equal to the current role identifier in the query prerequisite fingerprint?
[0089] Condition 2: Whether the prohibitive constraint identifier in the memory unit is equal to the current prohibitive constraint identifier in the query premise fingerprint;
[0090] Condition 3: Whether the default parameter identifier in the memory unit is equal to the current default parameter identifier in the query premise fingerprint;
[0091] Memory units that meet conditions one, two, and three are judged to have passed the conflict check, while memory units that do not meet conditions one, two, or three are judged to have failed the conflict check.
[0092] The memory units that pass the conflict verification are formed into the main evidence set, and the memory units that fail the conflict verification are formed into the historical comparison evidence set.
[0093] Use the main evidence set as the current output.
[0094] The large-scale long-term memory method based on vector indexing proposed in this invention has the following beneficial technical effects:
[0095] This application generates corresponding memory units from historical memory fragments. For both old and new versions of the system and process texts, it generates a set of differential anchor points. Each anchor point in the differential anchor point set is matched with the premise description data of each memory unit to establish an association result. Secondly, based on this association result, the memory units are divided into three memory states: historical reference state, conditional executable state, and current executable state. Then, a historical reference index, a restricted retrieval index, and a main retrieval index are formed according to the three memory states. Finally, during the retrieval phase, the current query is received, generating a query semantic vector and a query premise fingerprint. First, a retrieval is performed in the main retrieval index based on vector similarity. If at least one memory unit's premise description data is equal to the query premise fingerprint, then the premise description data and the query premise fingerprint are compared. Equal memory units form the master evidence set. If the query premise fingerprint has a missing identifier in the master retrieval index, the master evidence set is formed by searching based on vector similarity and conflict verification in the restricted retrieval index and the memory units that pass the conflict verification. Finally, the master evidence set is used as the current output result. By finely dividing the memory units into the current executable state, conditional executable state, and historical reference state, and constructing three independent vector indexes respectively, namely the historical reference index, the restricted retrieval index, and the master retrieval index, the most relevant memory source can be automatically selected based on the query premise fingerprint. This avoids directly using expired or potentially conflict-causing memories to generate the output, effectively mitigating the memory failure problem caused by the conflict between historical memories and the new version of the system when the system process text is changed in the large model. Attached Figure Description
[0096] Figure 1 This is a flowchart of a long-term memory method for large models based on vector indexing according to the present invention. Detailed Implementation
[0097] Embodiments of the present invention are described in detail below. Examples of these embodiments are illustrated in the accompanying drawings, wherein the same or similar symbols denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0098] like Figure 1 The large-scale long-term memory method based on vector indexing shown includes the following steps:
[0099] S1. Obtain historical memory fragments, old version of system and process text, and new version of system and process text of the target large model.
[0100] As an explanation, both the old and new versions of the system and process texts are texts that represent the content of the system and / or the content of the process;
[0101] The historical memory fragments are analyzed in a structured manner to generate memory units corresponding to the historical memory fragments;
[0102] In an optional embodiment, in S1, each of the historical memory fragments is subjected to structured parsing, and a corresponding memory unit is generated for each historical memory fragment, as follows:
[0103] For any historical memory fragment, semantic encoding is performed on the historical memory fragment to obtain the semantic vector corresponding to the historical memory fragment;
[0104] Information extraction technology is used to extract structured information from this historical memory fragment, generating the premise description data corresponding to this historical memory fragment;
[0105] The prerequisite description data includes: process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier;
[0106] Semantic vectors and contextual description data form the memory unit corresponding to this historical memory fragment;
[0107] S2. Perform differential parsing on the old and new versions of the policy and process texts to generate a set of differential anchor points.
[0108] Based on the differential anchor set and each memory unit, generate the association result of the memory unit;
[0109] In an optional embodiment, in S2, differential parsing is performed on the old version of the system process text and the new version of the system process text to generate a differential anchor point set, as follows:
[0110] The sequence alignment algorithm is used to perform clause-level and node-level alignment on the old and new versions of the system and process texts, resulting in aligned clause pairs, aligned node pairs within aligned clause pairs, unmatched clauses in the old version of the system and process text, and unmatched clauses in the new version of the system and process text.
[0111] For each unmatched clause in the old version of the system process text, generate a deletion node anchor;
[0112] For each unmatched clause in the new version of the system and process text, generate a new node anchor point;
[0113] The following fields are extracted from each alignment clause pair and the alignment node pair within the alignment clause pair using regular expressions: node number, role keyword, default term, prohibited term, and exception term;
[0114] For each alignment clause pair and the corresponding node number, role keyword, default terminology, prohibited terminology, and exception terminology of the alignment node pair within the alignment clause pair, perform the following field-by-field comparison:
[0115] If the node numbers are different, a node sequence change anchor point is generated;
[0116] If the character keywords are different, a character change anchor point is generated;
[0117] If the default terms are different, a default rule change anchor point is generated;
[0118] If the prohibited terms are different, a constraint change anchor point is generated;
[0119] If the exception terms are different, an exception clause change anchor point is generated;
[0120] For each deleted node anchor point, added node anchor point, node order change anchor point, role change anchor point, default rule change anchor point, constraint condition change anchor point, and exception clause change anchor point, record the source clause identifier, source node identifier, change direction identifier, and content identifier before and after the change.
[0121] Obtain all anchor points for deleted nodes, newly added nodes, node order changes, role changes, default rule changes, constraint changes, and exception changes to form a differential anchor point set.
[0122] In an optional embodiment, in S2, the association result of the memory cells is generated based on the differential anchor point set and each memory cell, as follows:
[0123] The source node identifier, source clause identifier, and before-and-after content identifier of the node anchor points deleted, added, node order change, role change, default rule change, constraint condition change, and exception clause change in the differential anchor point set are compared field by field with the process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier of the premise description data in each memory unit.
[0124] If the source node identifier or source clause identifier of the deleted node anchor point, added node anchor point, node order change anchor point, role change anchor point, default rule change anchor point, constraint condition change anchor point, or exception clause change anchor point is equal to any one of the following identifiers in the context description data of each memory unit: flow node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier, then establish the association relationship between the corresponding associated anchor point and the memory unit.
[0125] Deleted node anchors, added node anchors, node order change anchors, role change anchors, default rule change anchors, constraint change anchors, or exception clause change anchors that are equal to any of the anchors in the premise description data.
[0126] Use the process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, or effective time interval identifier in the premise description data that are equal to the source node identifier or source clause identifier of the associated anchor point as the associated identifier.
[0127] If the changes in the content identifiers of the deleted node anchor, added node anchor, node order change anchor, role change anchor, default rule change anchor, constraint condition change anchor, and exception clause change anchor include any one of the following: process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier of the prerequisite description data in the memory unit, then an association relationship is established between the corresponding associated anchor and the memory unit.
[0128] The anchor points for the deletion of nodes, addition of nodes, changes in node order, changes in roles, changes in default rules, changes in constraints, or changes in exceptions in the context description data are used as associated anchor points.
[0129] The process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, or effective time interval identifier included in the changes of the associated anchor points in the premise description data are used as the association identifier.
[0130] For each memory cell, based on the association between the corresponding associated anchor and the memory cell, generate a list of affected fields, a list of differential anchor order, and a list of differential anchor source paths for each memory cell;
[0131] In an optional embodiment, in S2, for each memory cell, based on the association relationship between the corresponding associated anchor point and the memory cell, a list of affected fields, a list of differential anchor point order, and a list of differential anchor point source paths are generated for each memory cell, as follows:
[0132] For each memory cell, based on the association relationship between the corresponding associated anchor point and the memory cell, the association identifier of the premise description data in the memory cell is extracted and written into the list of affected fields of the memory cell;
[0133] For each memory cell, based on the association relationship between the corresponding associated anchor and the memory cell, the corresponding associated anchor in the differential anchor set is extracted and written into the differential anchor order list of that memory cell;
[0134] For each memory unit, based on the association between the corresponding associated anchor and the memory unit, the source clause identifier, source node identifier, change direction identifier, and before and after content identifier of the corresponding associated anchor in the differential anchor set are extracted to form a path record, which is then written into the differential anchor source path list of the memory unit.
[0135] The association results for a memory cell are the list of affected fields, the list of differential anchor order, and the list of differential anchor source paths corresponding to that memory cell.
[0136] In an optional embodiment, S3, based on the association results, the memory state of each memory unit is generated;
[0137] Based on the memory status of each memory unit, a main search index, a restricted search index, and a historical reference index are generated;
[0138] In S3, based on the association results, the memory state of each memory unit is generated as follows:
[0139] Based on the association results, the following operations are performed on each of the memory units:
[0140] If the list of affected fields of a memory cell includes a prohibitive constraint identifier, then the memory state of that memory cell is recorded as a historical reference state.
[0141] If the list of affected fields of a memory cell does not include a prohibitive constraint identifier but includes a role identifier or a default parameter identifier, then the memory state of the memory cell is recorded as a conditional executable state.
[0142] Otherwise, the memory state of the memory unit is recorded as the current executable state;
[0143] In an optional embodiment, in S3, the memory state of each memory unit is generated based on the association result, as follows:
[0144] For each memory cell, each associated identifier in the list of affected fields for each memory cell;
[0145] Retrieve all associated anchors corresponding to the associated identifier from the differential anchor list of the corresponding memory unit; the number of associated anchors corresponding to the associated identifier;
[0146] Retrieve the source clause identifier, source node identifier, change direction identifier, and content identifier before and after change of the associated anchor point corresponding to the associated identifier from the differential anchor point source path list of the corresponding memory unit;
[0147] Extract the location of the related anchor in the new version of the system and process text from the source clause identifier of the related anchor;
[0148] Extract the content differences of the related anchor points before and after the changes in the old and new versions of the system and process text from the content identifiers of the related anchor points, and obtain the content differences of the related anchor points before and after the changes.
[0149] Get the error correction frequency of this associated identifier in the execution feedback;
[0150] Obtain the associated anchor point corresponding to each associated identifier, the number of associated anchor points, the position of the associated anchor point in the clause of the new version of the system process text, the content difference before and after the change of the associated anchor point, and the error correction frequency of the associated identifier;
[0151] For any associated identifier, based on the associated anchor point corresponding to the associated identifier, the number of associated anchor points, the position of the associated anchor point in the clause of the new version of the system process text, the content difference before and after the change of the associated anchor point, and the error correction frequency of the associated identifier, the fuzzy comprehensive evaluation method is used to generate the failure score of the associated identifier.
[0152] Obtain the failure scores for all associated identifiers. Specifically, if the associated identifier is a process node identifier, its failure score is recorded as the process node failure score; if the associated identifier is a role identifier, its failure score is recorded as the role failure score; if the associated identifier is a trigger condition identifier, its failure score is recorded as the trigger condition failure score; if the associated identifier is a prohibitive constraint identifier, its failure score is recorded as the prohibitive constraint failure score; if the associated identifier is a default parameter identifier, its failure score is recorded as the default parameter failure score; and if the associated identifier is an effective time interval identifier, its failure score is recorded as the time interval failure score.
[0153] For any memory unit, among all the associated identifiers corresponding to that memory unit:
[0154] If there is a prohibitive constraint failure score greater than 0, then the memory state of the memory unit is recorded as the historical reference state.
[0155] If there is no prohibitive constraint failure score greater than 0, and there is a role failure score greater than 0 or a default parameter failure score greater than 0, then the memory state of this memory unit is recorded as a conditional executable state.
[0156] Otherwise, record the memory state of the memory unit as the current executable state;
[0157] In an optional embodiment, in S3, based on the memory state of each memory unit, a main retrieval index, a restricted retrieval index, and a historical reference index are generated as follows:
[0158] The main retrieval index is formed by using the semantic vectors in the memory units whose current executable state is remembered.
[0159] A restricted retrieval index is formed by using semantic vectors in memory units whose memory state is a conditionally executable state;
[0160] A historical reference index is formed by using the semantic vectors in memory units whose memory state is a historical reference state;
[0161] The main search index, restricted search index, and historical reference index are all vector indexes.
[0162] S4. Receive the current query, perform structured parsing on the current query, and generate a query semantic vector and query premise fingerprint;
[0163] In an optional embodiment, in S4, the current query is received, and the current query is structured and parsed to generate a query semantic vector and a query premise fingerprint, as follows:
[0164] Semantically encode the current query to obtain a query semantic vector;
[0165] Information extraction technology is used to extract structured information from the current query and generate a query premise fingerprint;
[0166] The query prerequisite fingerprint includes: current process node identifier, current role identifier, current trigger condition identifier, current prohibitive constraint identifier, current default parameter identifier, and current effective time interval identifier;
[0167] Based on the main search index and the restricted search index, generate the main evidence set and use the main evidence set as the current output result;
[0168] In an optional embodiment, in S4, a master evidence set is generated based on the main retrieval index and the restricted retrieval index, and the master evidence set is used as the current output result, as follows:
[0169] In the main retrieval index, vector similarity retrieval is performed using the query semantic vector to obtain the cosine similarity between the query semantic vector and the semantic vector of each memory unit in the main retrieval index.
[0170] The first set of evidence is formed by selecting the K memory units with the highest cosine similarity, where K is a positive integer.
[0171] In the first set of evidence, the premise description data of each memory unit is matched with the query premise fingerprint;
[0172] If at least one memory unit has premise description data that is equal to the query premise fingerprint, then the memory units whose premise description data is equal to the query premise fingerprint form the master evidence set, and the historical comparison evidence set is recorded as empty.
[0173] If the premise description data of each memory unit is not equal to the fingerprint of the query premise, then the second search is performed;
[0174] The second retrieval is as follows: In the first evidence set, each of the current process node identifier, current role identifier, current trigger condition identifier, current prohibitive constraint identifier, current default parameter identifier, and current effective time interval identifier in the query premise fingerprint is matched with the process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier of the premise description data of each memory unit;
[0175] If any current process node identifier, current role identifier, current trigger condition identifier, current prohibitive constraint identifier, current default parameter identifier, or current effective time interval identifier exists in the query premise fingerprint that is not equal to the process node identifier, current role identifier, current trigger condition identifier, current prohibitive constraint identifier, current default parameter identifier, or current effective time interval identifier in the first evidence set, mark it as a missing identifier;
[0176] In the restricted retrieval index, vector similarity retrieval is performed again using the query semantic vector to obtain the cosine similarity between the query semantic vector and the semantic vector of each memory unit in the restricted retrieval index;
[0177] The first K memory units with the highest cosine similarity are selected to form the second set of evidence, where K is a positive integer.
[0178] From the second set of evidence, memory units whose premise description data contains an identifier equal to the missing identifier are selected as the third set of evidence;
[0179] Perform conflict checking on the memory units in the third set of evidence;
[0180] Conflict verification is performed as follows: In the third set of evidence, compare:
[0181] Condition 1: Is the role identifier in the memory unit equal to the current role identifier in the query prerequisite fingerprint?
[0182] Condition 2: Whether the prohibitive constraint identifier in the memory unit is equal to the current prohibitive constraint identifier in the query premise fingerprint;
[0183] Condition 3: Whether the default parameter identifier in the memory unit is equal to the current default parameter identifier in the query premise fingerprint;
[0184] Memory units that meet conditions one, two, and three are judged to have passed the conflict check, while memory units that do not meet conditions one, two, or three are judged to have failed the conflict check.
[0185] The memory units that pass the conflict verification are formed into the main evidence set, and the memory units that fail the conflict verification are formed into the historical comparison evidence set.
[0186] Use the main evidence set as the current output.
[0187] This application generates corresponding memory units from historical memory fragments. For both old and new versions of the system and process texts, it generates a set of differential anchor points. Each anchor point in the differential anchor point set is matched with the premise description data of each memory unit to establish an association result. Secondly, based on this association result, the memory units are divided into three memory states: historical reference state, conditional executable state, and current executable state. Then, a historical reference index, a restricted retrieval index, and a main retrieval index are formed according to the three memory states. Finally, during the retrieval phase, the current query is received, generating a query semantic vector and a query premise fingerprint. First, a retrieval is performed in the main retrieval index based on vector similarity. If at least one memory unit's premise description data is equal to the query premise fingerprint, then the premise description data and the query premise fingerprint are compared. Equal memory units form the master evidence set. If the query premise fingerprint has a missing identifier in the master retrieval index, the master evidence set is formed by searching based on vector similarity and conflict verification in the restricted retrieval index and the memory units that pass the conflict verification. Finally, the master evidence set is used as the current output result. By finely dividing the memory units into the current executable state, conditional executable state, and historical reference state, and constructing three independent vector indexes respectively, namely the historical reference index, the restricted retrieval index, and the master retrieval index, the most relevant memory source can be automatically selected based on the query premise fingerprint. This avoids directly using expired or potentially conflict-causing memories to generate the output, effectively mitigating the memory failure problem caused by the conflict between historical memories and the new version of the system when the system process text is changed in the large model.
[0188] Meanwhile, the supplementary retrieval mechanism based on missing identifiers and conflict verification realizes the security verification of conditionally available memories, thereby significantly improving the credibility of long-term memory retrieval of large models in dynamic institutional environments.
[0189] For clarification, "acquisition" in this application refers to obtaining the required content or data using existing technical means.
[0190] Furthermore, any content not described in detail in this specification is existing technology known to those skilled in the art.
[0191] In the embodiments provided by this invention, it should be understood that the disclosed system or method can be implemented in other ways. For example, the embodiments of the invention described above are merely illustrative; for instance, the division of modules is only a logical functional division, and there may be other division methods in actual implementation.
[0192] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0193] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or in the form of hardware plus software functional modules.
[0194] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the basic characteristics of the present invention.
[0195] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A long-term memory method for large models based on vector indexing, characterized in that, Includes the following steps: S1. Obtain historical memory fragments, old version of system and process text, and new version of system and process text of the target large model; perform structured parsing on each historical memory fragment and generate corresponding memory units for each historical memory fragment; S2. Perform differential parsing on the old and new versions of the system and process texts to generate a set of differential anchor points; based on the set of differential anchor points and each memory unit, generate the association results of the memory units; S3. Based on the association results, generate the memory state of each memory unit; based on the memory state of each memory unit, generate the main search index, the restricted search index, and the historical reference index. S4. Receive the current query, perform structured parsing on the current query, generate a query semantic vector and a query premise fingerprint; generate a main evidence set based on the main retrieval index and the restricted retrieval index, and use the main evidence set as the current output result.
2. The large model long-term memory method based on vector indexing according to claim 1, characterized in that, In S1, each of the historical memory fragments is subjected to structured parsing, and a corresponding memory unit is generated for each historical memory fragment, as follows: For any historical memory fragment, semantic encoding is performed on the historical memory fragment to obtain the semantic vector corresponding to the historical memory fragment; Information extraction technology is used to extract structured information from this historical memory fragment, generating the premise description data corresponding to this historical memory fragment; The prerequisite description data includes: process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier; Semantic vectors and contextual description data form the memory unit corresponding to this historical memory fragment.
3. The large model long-term memory method based on vector indexing according to claim 2, characterized in that, In S2, differential parsing is performed on the old version of the system and process text and the new version of the system and process text to generate a set of differential anchor points, as follows: The sequence alignment algorithm is used to perform clause-level and node-level alignment on the old and new versions of the system and process texts, resulting in aligned clause pairs, aligned node pairs within aligned clause pairs, unmatched clauses in the old version of the system and process text, and unmatched clauses in the new version of the system and process text. For each unmatched clause in the old version of the system process text, generate a deletion node anchor; For each unmatched clause in the new version of the system and process text, generate a new node anchor point; The following fields are extracted from each alignment clause pair and the alignment node pair within the alignment clause pair using regular expressions: node number, role keyword, default term, prohibited term, and exception term; For each alignment clause pair and the corresponding node number, role keyword, default terminology, prohibited terminology, and exception terminology of the alignment node pair within the alignment clause pair, perform the following field-by-field comparison: If the node numbers are different, a node sequence change anchor point is generated; If the character keywords are different, a character change anchor point is generated; If the default terms are different, a default rule change anchor point is generated; If the prohibited terms are different, a constraint change anchor point is generated; If the exception terms are different, an exception clause change anchor point is generated; For each deleted node anchor point, added node anchor point, node order change anchor point, role change anchor point, default rule change anchor point, constraint condition change anchor point, and exception clause change anchor point, record the source clause identifier, source node identifier, change direction identifier, and content identifier before and after the change. Retrieve all anchor points for deleted nodes, newly added nodes, node order changes, role changes, default rule changes, constraint changes, and exception changes to form a differential anchor point set.
4. The large model long-term memory method based on vector indexing according to claim 3, characterized in that, In step 2, based on the differential anchor set and each memory unit, the association result of the memory units is generated as follows: The source node identifier, source clause identifier, and before-and-after content identifier of the node anchor points deleted, added, node order change, role change, default rule change, constraint condition change, and exception clause change in the differential anchor point set are compared field by field with the process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier of the premise description data in each memory unit. If the source node identifier or source clause identifier of the deleted node anchor point, added node anchor point, node order change anchor point, role change anchor point, default rule change anchor point, constraint condition change anchor point, or exception clause change anchor point is equal to any one of the following identifiers in the context description data of each memory unit: flow node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier, then establish the association relationship between the corresponding associated anchor point and the memory unit. Deleted node anchors, added node anchors, node order change anchors, role change anchors, default rule change anchors, constraint change anchors, or exception clause change anchors that are equal to any of the anchors in the premise description data. Use the process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, or effective time interval identifier in the premise description data that are equal to the source node identifier or source clause identifier of the associated anchor point as the associated identifier. If the changes in the content identifiers of the deleted node anchor, added node anchor, node order change anchor, role change anchor, default rule change anchor, constraint condition change anchor, and exception clause change anchor include any one of the following: process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier of the prerequisite description data in the memory unit, then an association relationship is established between the corresponding associated anchor and the memory unit. The anchor points for the deletion of nodes, addition of nodes, changes in node order, changes in roles, changes in default rules, changes in constraints, or changes in exceptions in the context description data are used as associated anchor points. The process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, or effective time interval identifier included in the changes of the associated anchor points in the premise description data are used as the association identifier. For each memory cell, based on the association between the corresponding associated anchor and the memory cell, generate a list of affected fields, a list of differential anchor order, and a list of differential anchor source paths for each memory cell; The association results for a memory cell are the list of affected fields, the list of differential anchor order, and the list of differential anchor source paths corresponding to that memory cell.
5. The large model long-term memory method based on vector indexing according to claim 4, characterized in that, In S2, for each memory cell, based on the association relationship between the corresponding associated anchor and the memory cell, a list of affected fields, a list of differential anchor order, and a list of differential anchor source paths are generated for each memory cell, as follows: For each memory cell, based on the association relationship between the corresponding associated anchor point and the memory cell, the association identifier of the premise description data in the memory cell is extracted and written into the list of affected fields of the memory cell; For each memory cell, based on the association relationship between the corresponding associated anchor and the memory cell, the corresponding associated anchor in the differential anchor set is extracted and written into the differential anchor order list of that memory cell; For each memory unit, based on the association between the corresponding associated anchor point and the memory unit, the source clause identifier, source node identifier, change direction identifier, and content identifier before and after change of the corresponding associated anchor point in the differential anchor point set are extracted to form a path record, which is then written into the differential anchor point source path list of that memory unit.
6. The large model long-term memory method based on vector indexing according to claim 4, characterized in that, In S3, based on the association results, the memory state of each memory unit is generated as follows: Based on the association results, the following operations are performed on each of the memory units: If the list of affected fields of a memory cell includes a prohibitive constraint identifier, then the memory state of that memory cell is recorded as a historical reference state. If the list of affected fields of a memory cell does not include a prohibitive constraint identifier but includes a role identifier or a default parameter identifier, then the memory state of the memory cell is recorded as a conditional executable state. Otherwise, the memory state of the memory unit is recorded as the current executable state.
7. The large model long-term memory method based on vector indexing according to claim 4, characterized in that, In S3, based on the association results, the memory state of each memory unit is generated as follows: For each memory cell, each associated identifier in the list of affected fields for each memory cell; Retrieve all associated anchors corresponding to the associated identifier from the differential anchor list of the corresponding memory unit; the number of associated anchors corresponding to the associated identifier; Retrieve the source clause identifier, source node identifier, change direction identifier, and content identifier before and after change of the associated anchor point corresponding to the associated identifier from the differential anchor point source path list of the corresponding memory unit; Extract the location of the related anchor in the new version of the system and process text from the source clause identifier of the related anchor; Extract the content differences of the related anchor points before and after the changes in the old and new versions of the system and process text from the content identifiers of the related anchor points, and obtain the content differences of the related anchor points before and after the changes. Get the error correction frequency of this associated identifier in the execution feedback; Obtain the associated anchor point corresponding to each associated identifier, the number of associated anchor points, the position of the associated anchor point in the clause of the new version of the system process text, the content difference before and after the change of the associated anchor point, and the error correction frequency of the associated identifier; For any associated identifier, based on the associated anchor point corresponding to the associated identifier, the number of associated anchor points, the position of the associated anchor point in the clause of the new version of the system process text, the content difference before and after the change of the associated anchor point, and the error correction frequency of the associated identifier, the fuzzy comprehensive evaluation method is used to generate the failure score of the associated identifier. Obtain the failure scores for all associated identifiers. Specifically, if the associated identifier is a process node identifier, its failure score is recorded as the process node failure score; if the associated identifier is a role identifier, its failure score is recorded as the role failure score; if the associated identifier is a trigger condition identifier, its failure score is recorded as the trigger condition failure score; if the associated identifier is a prohibitive constraint identifier, its failure score is recorded as the prohibitive constraint failure score; if the associated identifier is a default parameter identifier, its failure score is recorded as the default parameter failure score; and if the associated identifier is an effective time interval identifier, its failure score is recorded as the time interval failure score. For any memory unit, among all the associated identifiers corresponding to that memory unit: If there is a prohibitive constraint failure score greater than 0, then the memory state of the memory unit is recorded as the historical reference state. If there is no prohibitive constraint failure score greater than 0, and there is a role failure score greater than 0 or a default parameter failure score greater than 0, then the memory state of this memory unit is recorded as a conditional executable state. Otherwise, record the memory state of the memory unit as the current executable state.
8. The large model long-term memory method based on vector indexing according to claim 6 or 7, characterized in that, In S3, based on the memory state of each memory unit, the main retrieval index, restricted retrieval index, and historical reference index are generated as follows: The main retrieval index is formed by using the semantic vectors in the memory units whose current executable state is remembered. A restricted retrieval index is formed by using semantic vectors in memory units whose memory state is a conditionally executable state; A historical reference index is formed by using the semantic vectors in memory units whose memory state is the historical reference state; The main search index, restricted search index, and historical reference index are all vector indexes.
9. The large-model long-term memory method based on vector indexing according to claim 8, characterized in that, In S4, the current query is received, and a structured parsing is performed on the current query to generate a query semantic vector and a query premise fingerprint, as follows: Semantically encode the current query to obtain a query semantic vector; Information extraction technology is used to extract structured information from the current query and generate a query premise fingerprint; The query prerequisite fingerprint includes: current process node identifier, current role identifier, current trigger condition identifier, current prohibitive constraint identifier, current default parameter identifier, and current effective time interval identifier.
10. The large model long-term memory method based on vector indexing according to claim 9, characterized in that, In S4, a master evidence set is generated based on the primary search index and the restricted search index. This master evidence set is used as the current output result, as follows: In the main retrieval index, vector similarity retrieval is performed using the query semantic vector to obtain the cosine similarity between the query semantic vector and the semantic vector of each memory unit in the main retrieval index. The first set of evidence is formed by selecting the K memory units with the highest cosine similarity, where K is a positive integer. In the first set of evidence, the premise description data of each memory unit is matched with the query premise fingerprint; If at least one memory unit has premise description data that is equal to the query premise fingerprint, then the memory units whose premise description data is equal to the query premise fingerprint form the master evidence set, and the historical comparison evidence set is recorded as empty. If the premise description data of each memory unit is not equal to the fingerprint of the query premise, then the second search is performed; The second retrieval is as follows: In the first evidence set, each of the current process node identifier, current role identifier, current trigger condition identifier, current prohibitive constraint identifier, current default parameter identifier, and current effective time interval identifier in the query premise fingerprint is matched with the process node identifier, role identifier, trigger condition identifier, prohibitive constraint identifier, default parameter identifier, and effective time interval identifier of the premise description data of each memory unit; If any current process node identifier, current role identifier, current trigger condition identifier, current prohibitive constraint identifier, current default parameter identifier, or current effective time interval identifier exists in the query premise fingerprint that is not equal to the process node identifier, current role identifier, current trigger condition identifier, current prohibitive constraint identifier, current default parameter identifier, or current effective time interval identifier in the first evidence set, mark it as a missing identifier; In the restricted retrieval index, vector similarity retrieval is performed again using the query semantic vector to obtain the cosine similarity between the query semantic vector and the semantic vector of each memory unit in the restricted retrieval index; The first K memory units with the highest cosine similarity are selected to form the second set of evidence, where K is a positive integer. From the second set of evidence, memory units whose premise description data contains an identifier equal to the missing identifier are selected as the third set of evidence; Perform conflict checking on the memory units in the third set of evidence; Conflict verification is performed as follows: In the third set of evidence, compare: Condition 1: Is the role identifier in the memory unit equal to the current role identifier in the query prerequisite fingerprint? Condition 2: Whether the prohibitive constraint identifier in the memory unit is equal to the current prohibitive constraint identifier in the query premise fingerprint; Condition 3: Whether the default parameter identifier in the memory unit is equal to the current default parameter identifier in the query premise fingerprint; Memory units that meet conditions one, two, and three are judged to have passed the conflict check, while memory units that do not meet conditions one, two, or three are judged to have failed the conflict check. The memory units that pass the conflict verification are formed into the main evidence set, and the memory units that fail the conflict verification are formed into the historical comparison evidence set. Use the main evidence set as the current output.