CN-121981225-A - Structured memory system, method, storage medium and electronic equipment based on knowledge tree
Abstract
The invention relates to a generating type artificial intelligence context management technology, and discloses a structured memory system, a structured memory method, a computer readable storage medium and electronic equipment based on a knowledge tree. The system stores the structured memory with father-son relation through a knowledge tree, determines a search strategy according to the current input, recalls related nodes or branches, generates memory contexts for model call after carrying out duplication removal, truncation, pruning, layering abstract and preferential reservation processing under the constraint of context budget, and simultaneously supports node addition, deletion and modification and combination, conflict marking, version management and clipping control so as to improve the accuracy, consistency and long-term task stability of generated contents. The knowledge tree construction module is used for acquiring external information, executing node generation, updating, deleting and branch maintenance, writing back the knowledge tree after output, executing version management when conflict exists, and cutting according to relevance, reliability, redundancy and the like.
Inventors
- DONG TAO
Assignees
- 重庆明度科技有限责任公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260115
Claims (19)
- 1. A structured memory system based on a knowledge tree is used for providing context related to current input for a generated artificial intelligent model and is characterized by comprising a knowledge tree module, a knowledge tree management module and a knowledge tree construction module, wherein the knowledge tree module is used for storing structured memory in a tree structure, the tree structure comprises a plurality of nodes and father-son relations among the nodes, the knowledge tree management module is used for determining a retrieval strategy aiming at the current input, carrying out relevance matching on the nodes or branches in the knowledge tree module, recalling at least one tree branch related to the current input, assembling the tree branches into the memory context under the preset context budget constraint, providing the memory context for the generated artificial intelligent model to generate output content, and the knowledge tree construction module is used for acquiring external information and carrying out at least one maintenance operation on the knowledge tree module, and the maintenance operation comprises generating nodes, updating nodes, combining nodes, deleting nodes and deleting tree branches, wherein the knowledge tree management module is further used for writing back and updating the knowledge tree module based on the output content after the generated by the generated artificial intelligent model.
- 2. The system of claim 1, wherein the nodes include at least two or more of a node identification field, a parent node identification field, a hierarchy field, a node content field, a source field, a time field, a reliability field, a version field, and a semantic index field.
- 3. The system of claim 2, wherein the semantic index field comprises a node vector representation, and wherein the knowledge tree management module implements relevance matching by computing a similarity of a currently input vector representation to the node vector representation.
- 4. The system of claim 1, wherein the knowledge tree management module scores relevance of tree branches based on at least one or more of semantic similarity, keyword coverage, node level weight, time decay weight, confidence weight, user/task constraint matching.
- 5. The system of claim 1, wherein the tree branch comprises a target node and at least a portion of a chain of ancestor nodes thereof, and/or at least a portion of a set of descendant nodes of the target node.
- 6. The system of claim 1, wherein the context budget is expressed in any of a number of tokens, a number of characters, or a number of bytes, and wherein the knowledge tree management module performs at least one operation on the recall content that includes deduplication, truncation, pruning, hierarchical summarization, evidence priority preservation, constraint priority preservation, and satisfying the context budget.
- 7. The system of claim 1, wherein the knowledge tree construction module performs a compressive generalization on external information to generate nodes, the compressive generalization comprising at least one of extracting facts points, extracting entity relationships, extracting task steps, extracting conclusions, and bases.
- 8. The system of claim 1, wherein the knowledge tree construction module performs conflict handling upon detecting a conflict of new information with existing node content, the conflict handling including at least one of tagging conflicts, establishing a version chain, retaining multiple versions, selecting a master version based on trustworthiness.
- 9. The system of claim 1, wherein the knowledge tree construction module is configured with pruning policies to prune nodes or tree branches based on hit frequency, relevance, relative content location in the source far and near, time interval, confidence or redundancy to suppress knowledge tree expansion and promote recall relevance.
- 10. The system of claim 1, wherein the source field is used to indicate that the node content originated from at least one of a dialog text, a document, a web page, a database, or an external tool to return results, and includes corresponding source location information to support retrospection.
- 11. A structured memorization method based on a knowledge tree is used for providing context related to current input for a generated artificial intelligent model and is characterized by comprising the steps of S1) obtaining the current input and extracting at least one task feature, wherein the task feature comprises a subject word, an entity, a constraint condition or a target output form, S2) carrying out correlation calculation on nodes or branches in the knowledge tree based on the task feature to obtain a candidate node or candidate branch set, S3) selecting at least one tree branch with correlation meeting a threshold value from the candidate node or candidate branch set, S4) carrying out context assembly on the tree branch under the constraint of a preset context budget to obtain a memorization context, S5) providing the memorization context and the current input together for the generated artificial intelligent model to generate output content, and S6) executing write-back update based on the output content to write new or correction information into the knowledge tree.
- 12. The method of claim 11, wherein the correlation calculation in S2 includes mapping the current input to a vector representation and performing a similarity calculation with the node vector representation to obtain a correlation score.
- 13. The method of claim 11, wherein selecting a tree branch in S3 comprises selecting at least one target node having a highest relevance score and incorporating an ancestor node chain and/or a set of descendant nodes of the target node into the tree branch.
- 14. The method of claim 11, wherein S4 context assembly comprises performing at least one of deduplication, pruning, hierarchical summarization on the tree branches, causing assembled memory contexts to meet the context budget, and retaining constraint or evidence information matching current inputs.
- 15. The method of claim 11, wherein the write-back update in S6 comprises extracting at least one of a fact point, a conclusion, a step, or a user preference from the output content, generating a new node or updating an existing node, and updating a semantic index field of the node.
- 16. The method of claim 11, wherein upon a write-back update or external information write, if a conflict with an existing node is detected, a version chain is established and a conflict flag is recorded, a plurality of versions are maintained or a master version is determined based on reliability.
- 17. The method of claim 11, further comprising performing a pruning or tree branch deletion maintenance operation on the knowledge tree based on hit frequency, relative content location in the source distance, time interval, confidence level, or redundancy.
- 18. A computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any of claims 11 to 17.
- 19. An electronic device comprising a processor and a memory, the memory having stored therein a computer program which, when executed by the processor, causes the electronic device to implement the system of any one of claims 1 to 10 or to implement the method of any one of claims 11 to 17.
Description
Structured memory system, method, storage medium and electronic equipment based on knowledge tree Technical Field The invention belongs to the technical field of computer technology and artificial intelligence, in particular to a structured memory construction, maintenance and calling technology of a generated artificial intelligence/Large Language Model (LLM), and particularly relates to a method and a system for knowledge representation and organization (such as knowledge tree/tree-shaped knowledge structure), semantic retrieval and correlation matching, context assembly and budget control, writing update of memory, conflict version management and pruning and the like of a large language model, which can be used for recalling branches most relevant to a current task from the structured memory as controllable contexts in the content generation process so as to enhance the generation quality and consistency. Further, the invention relates to a "search-assemble-generate" paradigm such as search enhancement generation (RAG), involving extraction compression of external information sources (conversations, documents, web pages, databases, tool results, etc.), semantic indexing, and branch-level recall, and context injection, to achieve evolvable long-term memory enhancement under limited context window constraints. Background In recent years, the generated artificial intelligence, particularly the large language model, is widely applied to scenes such as dialogue questions and answers, text generation, code generation, content summarization, intelligent assistants, tool calls and the like. However, in engineering practice, the large language model still has significant limitations in terms of 'long-term interactive memory' and 'continuous utilization of external knowledge', and is mainly characterized in that 1) a context window is limited, so that available memory space is limited, historical information is easy to be truncated or coarse-granularity abstracted when multiple rounds of dialogues or a large amount of external data are cited, key information is lost, cross-round consistency is reduced, 2) a simple stacking long context has cost and performance bottlenecks, calculation and storage overhead can be remarkably improved due to increase of sequence length, 3) pure text splicing is easy to introduce noise and difficult to ensure relevance, information redundancy, subject drift and key constraint are diluted to reduce generation quality, 4) typical retrieval enhancement generation is organized in terms of 'text block+vector retrieval', recall fragments are discrete, hierarchical dependency is difficult to be expressed, branch-level compression and conflict versions are difficult to be carried out, writable and maintainable memory support is insufficient formed for long-term interaction, and 5) the existing dialog memory/proxy memory framework mainly adopts abstracted or list storage, evolutionable structural capability is lacking, memory expansion, accumulation, conflict, expiration information is easy to exist for a long term, relevance is reduced, and the like. Therefore, it is necessary to provide a long-term memory mechanism capable of organizing and storing external information and interactive knowledge points in a structured manner, selecting, assembling and compressing the external information and interactive knowledge points into controllable contexts according to relevance during generation, and supporting continuous writing, conflict management and pruning maintenance at the same time, so as to improve accuracy, consistency and traceability of generated content. Disclosure of Invention The invention aims to provide a structured memory system, a structured memory method, a structured memory storage medium and electronic equipment based on a knowledge tree, which are used for organizing and storing knowledge points in the external information and interaction process in the form of the knowledge tree (tree-shaped knowledge structure) and recalling tree branches most relevant to current input from the knowledge tree as controllable contexts when new contents are generated, so that the defects of small available memory space, easy loss of history information, insufficient relevance to the current problems and the like are relieved under the constraint of a limited context window, and the accuracy, consistency and traceability of the generated contents are improved. In order to achieve the above purpose, the present invention provides the following technical solutions: (1) A knowledge tree-based structured memory system comprises a knowledge tree module, a knowledge tree management module and a knowledge tree construction module, wherein the knowledge tree module stores structured memory in a tree structure, the knowledge tree management module executes context assembly under the constraint of correlation matching, branch recall and budget and write-back updating after outputting, the knowledge tree c