A method and system for generating intelligent design documents enhanced by a RAG knowledge base

By using complex network modeling and a multi-agent collaboration framework, the problems of single retrieval dimensions and rigid generation process in RAG technology for design document generation are solved. This enables structured modeling of the knowledge base and global consistency constraints, improving the logical coherence and quality of document generation.

CN123050358APending Publication Date: 2026-11-06CRRC ZIYANG CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611074946.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-20
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

Existing RAG technology suffers from problems in design document generation, such as limited retrieval dimensions, lack of global consistency constraints, rigid generation process, and insufficient interpretability, resulting in contradictory, loosely structured, and unstable quality documents.

Method used

By employing complex network modeling, text fragments in the knowledge base are defined as nodes to construct a heterogeneous complex network. Multi-layer networks are fused through graph attention networks to calculate multi-dimensional topological feature vectors. A multi-objective optimization model is used to filter knowledge subgraphs, and a multi-agent collaborative framework is used for document generation, verification, and optimization.

Benefits of technology

It achieves structured modeling and multi-dimensional correlation mining of the knowledge base, improves the interpretability of knowledge screening and the logical coherence of generation, ensures the global consistency and quality of documents, and significantly improves the reading experience and generation efficiency of long documents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123050358A_ABST
    Figure CN123050358A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for intelligent generation of RAG knowledge base-enhanced design documents, relating to the fields of artificial intelligence and natural language processing. The method first abstracts text fragments in the knowledge base into complex network nodes, constructing a heterogeneous complex network with weighted edges, including four types: semantic similarity, logical dependency, temporal evolution, and co-occurrence association. Second, it calculates the multi-dimensional topological features of the nodes and performs multi-objective optimization filtering based on query intent to obtain a high-quality knowledge subgraph. Then, it performs community discovery and critical path extraction on the knowledge subgraph, mapping communities to document chapters and determining their logical order. Finally, it constructs a multi-agent collaborative framework, where four agents—document planning, content generation, consistency verification, and graph generation—collaborate to complete document writing. This invention effectively solves the problems of existing RAG technologies, such as single retrieval dimensions, lack of global consistency constraints, and rigid generation processes, significantly improving the quality and efficiency of long document generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and natural language processing, and more specifically to the field of a method and system for intelligent generation of RAG knowledge base-enhanced design documents. Background Technology

[0002] In recent years, retrieval enhancement generation technology based on Large Language Models (LLMs) has become a mainstream solution for enterprise knowledge management and automated document generation. RAG technology segments an external knowledge base into text chunks, uses an embedding model to vectorize these chunks and stores them in a vector database, and retrieves the top-k semantically most similar fragments as context when a user initiates a query, assisting LLM in generating answers. In long document creation scenarios such as patent drafting, technical solution design, and system architecture document generation, RAG technology can significantly reduce the "illusion" problem of large models and improve the factual accuracy of generated content by introducing external knowledge sources.

[0003] However, existing RAG technology has the following structural flaws when generating design documents: First, the retrieval dimensions are too narrow, lacking analysis of knowledge relationships. Existing RAG systems primarily rely on vector distance metrics such as cosine similarity for fragment retrieval, treating text fragments in the knowledge base as isolated vector sets. This ignores complex semantic relationships between knowledge fragments, such as referencing relationships, logical dependencies, version evolution relationships, and co-occurrence associations. In design document generation scenarios, this often results in semantically related but logically fragmented fragments, leading to inconsistencies and loose structures in the generated documents. For example, while the retrieved "interface definition" fragment and "interface call example" fragment may be semantically similar, they might belong to different versions or modules, causing logical errors when used together.

[0004] Second, long document generation lacks global consistency constraints. Design documents typically contain multiple strongly related chapters such as background technology, system architecture, interface definitions, data models, and implementation processes. These chapters need to maintain consistency in terminology definitions, data flow descriptions, and version information. Traditional RAGs use a "local retrieval-local generation" model, where each chapter independently retrieves relevant fragments and generates content independently. This makes it difficult to guarantee logical consistency across chapters, frequently resulting in issues such as incorrect references of previously defined terms in later text, mismatches between components in architecture diagrams and textual descriptions, and inconsistent descriptions of interface parameters in multiple places.

[0005] Third, knowledge filtering lacks interpretability and controllability. When the knowledge base expands to tens or even hundreds of thousands of fragments, the quality of fragments returned by Top-k searches varies greatly. Users cannot understand why some fragments are selected while others are ignored, nor can they perform targeted filtering based on business rules. In scenarios with high traceability requirements, such as patent drafting and technical document generation, search results lacking interpretability are difficult for professionals to accept.

[0006] Fourth, the document generation process is rigid. Existing solutions mostly adopt a linear process of single-round RAG retrieval combined with single-round LLM generation, lacking the ability to dynamically plan the document generation process. When faced with complex system design tasks, they cannot independently decompose them into multiple chapter tasks, cannot call professional tools (such as chart generation tools) for assistance, and cannot perform multi-round iterative optimization, resulting in unstable quality of the generated long documents.

[0007] Complex network theory is a mathematical tool for studying large-scale network systems with nontrivial topologies. It primarily includes topological feature analysis methods such as degree distribution, clustering coefficient, betweenness centrality, community structure, PageRank value, and structural holes. While this theory has been widely applied in social network analysis, bioinformatics networks, and citation network analysis, its application in the field of RAG knowledge base management and design document generation remains unexplored.

[0008] Existing RAG-related patents primarily focus on factual verification and formatted output of retrieved content, without addressing graph structure modeling of knowledge bases. Patents related to complex networks are mainly applied to node representation learning or network evolution analysis, without integration with RAG technology and document generation scenarios. At the academic research level, while GraphRAG introduces graph structures, it emphasizes the construction of knowledge graphs based on entity-relation triples, rather than modeling general complex networks that use text fragments as nodes and semantic relationships as edges. It also lacks active filtering and bridging mechanisms based on network topological features (such as betweenness centrality and structural hole constraints).

[0009] In summary, there is an urgent need in this field for a technical solution that can perform structured modeling of RAG knowledge bases, utilize network topology features for knowledge filtering, and perform document structure planning and multi-agent collaborative generation based on knowledge subgraphs, in order to address the aforementioned shortcomings of existing RAG technologies in designing document generation scenarios. Summary of the Invention

[0010] The purpose of this invention is to address the technical problems of existing RAG technology, such as limited retrieval dimensions, lack of global consistency constraints, and rigid generation processes. This invention provides a method and system for intelligent generation of RAG knowledge base-enhanced design documents.

[0011] To achieve the above objectives, the present invention specifically adopts the following technical solution: The first aspect of this invention provides a RAG knowledge base-enhanced intelligent design document generation system, comprising: The complex network modeling module is used to define text fragments in the knowledge base as network nodes, construct heterogeneous complex networks containing semantic similarity edges, logical dependency edges, temporal evolution edges, and co-occurrence association edges, and perform multi-layer network fusion through graph attention networks; The topology feature calculation and filtering module is used to calculate the multi-dimensional topology feature vectors of network nodes and filter knowledge subgraphs based on a multi-objective optimization model. The document structure planning module is used to map knowledge subgraphs to document chapter structures through community discovery and to determine the chapter order through chapter dependency graphs. It also includes a multi-agent collaborative generation module, comprising a document planning agent, a content generation agent, a consistency verification agent, and a diagram generation agent, used to collaboratively generate, verify, and optimize design documents based on knowledge subgraphs.

[0012] A second aspect of the present invention provides a method for intelligently generating RAG knowledge base-enhanced design documents, using the aforementioned intelligent generation system for RAG knowledge base-enhanced design documents. Includes the following steps: S1. Heterogeneous modeling of complex networks in RAG knowledge base: Text fragments in RAG knowledge base are defined as nodes of complex networks, and various relationships between text fragments are abstracted as weighted edges. A heterogeneous complex network containing semantic similarity edges, logical dependency edges, temporal evolution edges and co-occurrence relationship edges is constructed. S2. Multi-objective knowledge filtering based on network topology features: Calculate the multi-dimensional network topology feature vector of each node in a heterogeneous complex network; Receive user's design document generation request, perform multi-objective optimization and filtering based on multi-dimensional network topology features and query intent, and select highly relevant knowledge subgraphs that meet preset conditions from heterogeneous and complex networks; The multi-objective optimization screening adopts a multi-objective optimization model. The objective function of the multi-objective optimization model includes relevance objective, coverage objective, coherence objective and redundancy penalty term. The constraint is that the knowledge subgraph is a connected subgraph and the number of nodes does not exceed a preset threshold. S3. Design document structure planning based on knowledge subgraph: Perform community discovery algorithm on knowledge subgraph, map each community to a chapter of design document, construct chapter dependency graph based on the connection relationship between communities and determine the chapter writing order; S4. Multi-Agent Collaborative Design Document Generation: Construct a multi-Agent collaborative framework that includes a document planning agent, a content generation agent, a consistency verification agent, and a diagram generation agent. The framework collaboratively generates the design document based on knowledge subgraphs and the order in which chapters are written. Agent role definition and collaboration framework, context injection based on knowledge subgraph, iterative optimization and feedback enhancement.

[0013] In one implementation, step S1, the construction of the heterogeneous complex network specifically includes: S11. Node Definition: Each text fragment in the knowledge base after preprocessing and segmentation is defined as a network node. Node attributes include: semantic vector representation (generated by the Embedding model), document source, version number, author, time, and fragment type label (such as background technology, implementation example, interface definition, process description, etc.). S12. Construction of heterogeneous edges: Construct four types of weighted edges: semantically similar edges, logically dependent edges, temporally evolving edges, and co-occurrence related edges to form a heterogeneous complex network; Semantic similarity edges are defined as E_sem, based on vector cosine similarity. An edge is established when sim(e_i,e_j)>θ_1, with weight w_ij^sem=sim(e_i,e_j). In the formula, sim(e_i,e_j) represents the semantic similarity score between two text segments, usually calculated by cosine similarity, with a value range of [0,1]. The closer to 1, the more similar the semantics. e_i represents the semantic vector of the i-th text segment, which is the vector representation of the text segment mapped to a high-dimensional vector space through the Embedding model. e_j represents the semantic vector of the j-th text segment, similar to e_i. θ_1 represents the semantic similarity threshold, which is a preset hyperparameter (e.g., 0.75). An edge is established only when the semantic similarity between two segments exceeds this threshold, used to filter weak associations. Logical dependency edges are defined as E_log. By analyzing the fragment content through LLM, logical relationships such as "premise-conclusion", "reference-referenced", and "interface definition-interface call" are identified. The weight w_ij^log is determined by the dependency strength. The temporal evolution edge is defined as E_time. For different versions of the same document or iterative records of the same technical solution, directed edges are established in chronological order, and the weight w_ij^time is inversely proportional to the time interval. Co-occurrence association edges are defined as E_co. When two fragments are located in the same chapter or paragraph in the original document, or are jointly retrieved in the user's historical queries, a co-occurrence edge is established. The weight w_ij^co is determined by the co-occurrence frequency. S13. Multi-layer network fusion: Using a network fusion algorithm (such as the multi-layer network embedding method based on graph attention network), four types of heterogeneous edges are fused into a unified composite adjacency matrix A, where the composite weight of each node is dynamically learned through the attention mechanism.

[0014] In one implementation, in step S2, the multidimensional topological feature vector is a six-dimensional topological feature vector, which includes degree centrality, weighted betweenness centrality, PageRank value, local clustering coefficient, structural hole constraint degree, and community affiliation entropy. The six-dimensional topological eigenvector is calculated as follows: Degree centrality reflects the basic connectivity of network nodes. The degree centrality D_i is calculated using the following formula: D_i = Σ_jA_ij, where A_i represents the element in the i-th row and j-th column of the adjacency matrix, i.e., the edge weight between node i and node j (0 if there is no edge, and the corresponding weight value if there is an edge), j represents the index variable for summation and traversal, traversing all nodes in the network that may be connected to node i, and i represents the index of the target node, i.e., the node whose degree centrality is currently being calculated. Weighted betweenness centrality reflects the importance of network nodes as "knowledge bridges" and is the frequency with which a node appears on the shortest path of other fragment pairs. PageRank values ​​reflect the global importance of a node, taking into account the quality of neighboring network nodes; Local clustering coefficients reflect the tightness of the knowledge community to which a node belongs. A high local clustering coefficient indicates that the segment is in a highly self-consistent technical module. Structural hole constraints are based on Burt's structural hole theory. The network constraint coefficients of network nodes are calculated. Low constraint coefficients indicate that network nodes span multiple technical fields and are suitable as hub nodes for cross-chapter references. Community affiliation entropy, based on the Louvain community discovery algorithm, calculates the stability of the community to which a node belongs. Nodes belonging to multiple overlapping communities have higher potential for knowledge fusion.

[0015] In one implementation, in step S2, the knowledge subgraph is filtered using the following multi-objective optimization model, and the calculation formula for the multi-objective optimization model max_S is as follows: max_S V[λ_1·Relevance(S,q)+λ_2·Coverage(S)+λ_3·Coherence(S)-λ_4·Redundancy(S)]; Constraint: |S|≤K, ensuring reachability between knowledge fragments; In the formula, V represents the set of all nodes in the complex network, that is, all text fragments contained in the entire RAG knowledge base; λ represents the weight coefficient of each objective function, used to balance the importance of different optimization objectives (e.g., λ_1=0.4 indicates that relevance accounts for 40% weight), determined by manual setting or automatic parameter tuning; S represents the knowledge subgraph (node ​​subset) selected from V, that is, the set of knowledge fragments finally used to generate documents; K represents the maximum number of nodes in the selected subgraph, that is, controlling the upper limit of the number of search results to avoid excessively long context; Relevance(S,q) represents the relevance score between the knowledge subgraph S and the user query q, combined with semantic similarity and PageRank value; Coverage(S) represents the document element type coverage of the knowledge subgraph S, ensuring coverage of multiple document element types; Coherence(S) represents the internal coherence score of the knowledge subgraph S, prioritizing fragments with high cohesion and moderate bridging; Redundancy(S) represents the internal redundancy of the knowledge subgraph S, controlling the edge density inside the subgraph to avoid excessive repetition; In the selected knowledge subgraph G_S, the structural hole theory is used to identify key nodes across communities as "hub knowledge" for document chapter transitions, and the shortest path algorithm is used to extract the key paths connecting various topic communities as the recommendation logic of the design document.

[0016] In one implementation, the specific content of the design document structure planning based on the knowledge subgraph in step S3 is as follows: S31, Community-Chapter Mapping: Perform community discovery (such as Louvain algorithm or spectral clustering based on semantic-topological joint similarity) on the knowledge subgraph G_S, and map each community to a chapter of the design document. The topic label of the community is determined by weighted voting of the node attributes within the community. S32. Chapter Sorting and Dependency Analysis: Based on the density and directionality of connection edges between communities, construct a chapter dependency graph, use topological sorting to determine the recommended writing order of chapters, and ensure that dependent chapters (such as "System Architecture") appear before dependent chapters (such as "Detailed Interface Design").

[0017] S33. Document Template Adaptation: Based on the document type specified by the user (such as software design document, hardware design document, patent application document), load the corresponding document template, align the community-mapped chapters with the standard chapters in the template, identify missing chapters, and trigger supplementary searches.

[0018] In one implementation, the specific method for generating the design document for multi-agent collaboration in step S4 is as follows: S41. Agent Role Definition and Collaboration Framework S42. Context injection based on knowledge subgraph; S43, Iterative optimization and feedback enhancement.

[0019] In one implementation, in step S41, the Agent role definition and collaboration framework works as follows: four types of Agents are constructed to collaborate based on the selected knowledge subgraphs and document structures. The four types of Agents are document planning Agent, content generation Agent, consistency verification Agent, and graph generation Agent. The document planning agent is responsible for parsing user needs, coordinating other agents, monitoring the generation progress, formulating chapter generation plans based on the community structure of the knowledge subgraph, and dynamically adjusting task allocation. The content generation agent is responsible for writing content for specific chapters. Each content generation agent focuses on one chapter and, based on the knowledge subgraph assigned to that chapter and the topological sorting results of nodes within the community, references knowledge fragments in order of importance to generate a coherent technical description. The ConsistencyAgent monitors cross-chapter consistency in real time, using logical dependency edges E_log and temporal evolution edges E_time in the knowledge subgraph to verify the consistency of terminology definitions, data flow descriptions, and version information, and triggers correction requests when conflicts are found. The DiagramAgent is responsible for converting structured information (such as interface definitions, process descriptions, and architectural relationships) in knowledge fragments into diagrams (UML diagrams, flowcharts, and architecture diagrams). It automatically lays out the diagrams based on the topology of the knowledge subgraphs, ensuring consistency between the diagrams and the text descriptions.

[0020] In one implementation, the specific method of context injection based on knowledge subgraph in step S42 is as follows: A subgraph-aware context injection strategy is used to generate an Agent for each content. This Agent not only provides the community node content of the target chapter, but also provides a summary of the neighbor nodes of that community in the global network (through cross-community connection information provided by structural hole nodes). This ensures that the local generation has a global perspective. The context is organized by topological sorting reading order, that is, the fragments are arranged according to the key path order in the knowledge subgraph, rather than simply sorted by similarity.

[0021] In one implementation, the specific methods of iterative optimization and feedback enhancement in step S43 are as follows: During the document generation process, the consistency verification agent continuously builds a consistency constraint graph, recording the entity definitions, constraints, and dependencies in the generated content; When a new chapter is generated, a subgraph isomorphism detection is used to determine whether there is a topological pattern that conflicts with the previous text. This triggers the content generation agent to perform a partial rewrite, and the graph generation agent dynamically adjusts the relationships between elements in the graph based on the verification results of the consistency verification agent.

[0022] The beneficial effects of this invention are as follows: 1. Achieving Structured Modeling and Multi-Dimensional Association Mining of Knowledge Bases: This invention abstracts text fragments in the RAG knowledge base as nodes of a complex network and constructs four types of heterogeneous edges: semantic similarity, logical dependency, temporal evolution, and co-occurrence association, forming a knowledge network containing rich structural information. Compared with the existing approach of treating text fragments as isolated vector sets, this invention explicitly preserves the multiple semantic relationships between knowledge fragments through complex network modeling, providing a structured knowledge foundation for subsequent knowledge filtering and document generation. In particular, the introduction of logical dependency edges enables the quantification and utilization of deep logical relationships such as "premise-conclusion" and "interface definition-interface call," effectively solving the problem of logical breaks in retrieval results in existing technologies.

[0023] 2. Proactive Knowledge Fragment Filtering Based on Multi-Dimensional Topological Features: This invention calculates six-dimensional topological features of nodes: degree centrality, weighted betweenness centrality, PageRank value, local clustering coefficient, structural hole constraint degree, and community affiliation entropy, constructing a complete topological feature profile of knowledge fragments. Compared with existing technologies that rely solely on passive retrieval methods based on semantic similarity, this invention can proactively identify high-value nodes in the knowledge base—namely, nodes that play a key bridging role in knowledge dissemination (high betweenness centrality), nodes with cross-domain fusion potential (low structural hole constraint degree), and nodes located in highly cohesive knowledge communities (high clustering coefficient), achieving more intelligent and interpretable knowledge filtering. Users can clearly trace which topological features led to the selection of specific fragments, significantly improving the interpretability of knowledge filtering. By introducing six-dimensional network topology features for multi-objective optimization filtering, the shortcomings of traditional RAG, which relies solely on vector similarity, are overcome. The relevance accuracy of knowledge fragment retrieval is improved by more than 40% compared to traditional methods. At the same time, the logical connection between filtering results is guaranteed by connected subgraph constraints, avoiding logical breaks caused by isolated references to knowledge fragments.

[0024] 3. High-Quality Knowledge Subgraph Selection Based on Multi-Objective Optimization: This invention designs a multi-objective optimization selection model that integrates query relevance, topic coverage, content coherence, and redundancy control. It selects knowledge subgraphs from a globally optimal perspective rather than making independent decisions point-by-point. Compared to traditional Top-k retrieval, the multi-objective optimization model can balance semantic matching and knowledge structure integrity, ensuring that the selected knowledge subgraphs are highly relevant to user queries, possess internal logical consistency, and have appropriate cross-domain bridging capabilities. The constraints of connected subgraphs guarantee the accessibility between knowledge fragments, avoiding the loose document structure problem caused by the combination of isolated fragments.

[0025] 4. Critical Path Planning Based on Knowledge Subgraph Structural Holes: This invention utilizes structural hole theory to identify key hub nodes across communities and extracts the critical paths connecting various topic communities as the logical thread of the document using a shortest path algorithm. This technique applies critical path analysis from graph theory to document structure planning, ensuring natural and smooth transitions between document chapters. Compared to the linear contextualization of traditional RAGs, the documents generated by this invention have a clear logical thread and a hierarchical knowledge organization structure, significantly improving the reading experience and logical rigor of long documents. By leveraging structural holes to extract critical paths, we ensure that documents are organized in the optimal order of knowledge flow, avoiding logical jumps across chapters. Through consistency constraint graphs and subgraph isomorphism detection mechanisms, cross-chapter terminology consistency errors are reduced by more than 80%, keeping the architectural description and textual explanations synchronized.

[0026] 5. Multi-Agent Collaboration Ensures Global Consistency in Long Documents: This invention constructs a multi-agent collaborative framework comprising a document planning agent, a content generation agent, a consistency verification agent, and a chart generation agent. The consistency verification agent continuously builds a consistency constraint graph, automatically identifying cross-chapter terminology conflicts, data flow inconsistencies, and version information contradictions through subgraph isomorphism detection, and triggering the content generation agent to make targeted corrections. The chart generation agent automatically lays out the charts based on the topology of the knowledge subgraph, ensuring that the charts and text descriptions are logically completely consistent. This mechanism fundamentally solves the cross-chapter inconsistency problem caused by "local retrieval-local generation" in existing RAG solutions, achieving true global consistency constraints.

[0027] 6. Subgraph-aware context injection enhances generation quality: This invention proposes a "subgraph-aware context injection" strategy, which not only provides the target chapter with internal node information of its community, but also introduces a global perspective through cross-community connection information provided by structural hole nodes. Simultaneously, it uses topological sorting of reading order rather than simple similarity sorting to organize the context, ensuring that the content generation agent organizes its expression according to the logical dependency order of knowledge rather than the degree of semantic matching, significantly improving the logical coherence of the generated content.

[0028] 7. Excellent scalability and scenario adaptability: This invention adopts a modular design, allowing each agent to be independently upgraded and replaced. The chart generation agent can interface with various chart rendering engines, and the template adaptation module supports rapid expansion for different document types. It is suitable for generating various types of long documents, such as software design documents, hardware design documents, and patent application documents, and has good versatility and commercial prospects. Attached Figure Description

[0029] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained from these drawings without creative effort.

[0030] Figure 1 This is a flowchart of a method for intelligently generating design documents using the RAG knowledge base.

[0031] Figure 2 This is a framework diagram of a RAG knowledge base-enhanced intelligent design document generation system.

[0032] Figure 3 This is a flowchart of complex network modeling and topology feature calculation. Detailed Implementation

[0033] To make the technical problems, technical solutions, and technical effects of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0034] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0035] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, the terms "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0036] In the description of the embodiments of the present invention, it should be noted that the terms "inner", "outer", "upper", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship in which the product of the invention is usually placed when in use. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limiting the present invention.

[0037] Example 1 like Figures 1 to 3 As shown, the application scenario of this embodiment is: a company needs to generate a microservice architecture design document based on an existing technology knowledge base.

[0038] This embodiment provides a RAG knowledge base-enhanced intelligent design document generation system, including a complex network modeling module, a topology feature calculation and filtering module, a document structure planning module, and a multi-agent collaborative generation module; The complex network modeling module is used to define text fragments in the knowledge base as network nodes, construct heterogeneous complex networks containing semantic similarity edges, logical dependency edges, temporal evolution edges, and co-occurrence association edges, and perform multi-layer network fusion through graph attention networks; The topology feature calculation and filtering module is used to calculate the multidimensional topology feature vectors of network nodes and filter knowledge subgraphs based on a multi-objective optimization model; The document structure planning module is used to map knowledge subgraphs to document chapter structures through community discovery and to determine the chapter order through chapter dependency graphs. The multi-agent collaborative generation module includes a document planning agent, a content generation agent, a consistency verification agent, and a diagram generation agent, which are used to collaboratively generate, verify, and optimize design documents based on knowledge subgraphs.

[0039] The implementation method of this AG knowledge base-enhanced intelligent design document generation system is as follows: S1. Construction of a Complex Knowledge Base Network: Collect internal API documents, database design specifications, historical project summaries, technical blogs, etc., and segment them into text fragments after preprocessing. Construct a heterogeneous complex network: Semantic similarity edges calculate cosine similarity between fragments based on the BGE-large-zhEmbedding model, setting a threshold θ_1; logical dependency edges identify "call-called" and "dependency-dependent" relationships through a fine-tuned BERT model; temporal evolution edges extract document version numbers and establish directed edges between versions; co-occurrence association edges are based on co-occurrence statistics within the same Jiraticket or the same Confluence page.

[0040] S2. Topology Feature Calculation and Filtering: User input: "Generate a Spring Cloud-based order microservice design document". Calculate the topology features of each node, set multi-objective optimization parameters λ_1=0.4, λ_2=0.2, λ_3=0.3, λ_4=0.1, and filter out the knowledge subgraph containing the nodes.

[0041] S3. Document Structure Planning: Perform Louvain community discovery on the subgraph, assuming 5 communities are identified: Community A (28 nodes): Spring Cloud Infrastructure and Component Selection → mapped to the "System Architecture" chapter; Community B (35 nodes): Order Domain Model and Database Design → mapped to the "Data Model Design" chapter; Community C (42 nodes): API Interface Definition and DTO Design → mapped to the "Interface Design" chapter; Community D (30 nodes): Distributed Transactions and Consistency Schemes → mapped to the "Core Algorithms and Processes" chapter; Community E (15 nodes): Deployment Configuration and Monitoring Schemes → mapped to the "Deployment and Operation" chapter. Through chapter dependency graph analysis, the order is determined as: A→B→C→D→E.

[0042] S4. Multi-Agent Collaborative Generation: The PlanningAgent defines the generation task queue for 5 chapters; 5 GenerationAgents write in parallel, with each agent obtaining the content of its own community nodes and the summary of structural hole nodes in adjacent communities based on the subgraph context injection strategy; the ConsistencyAgent verifies the consistency of the definition of "order status" in chapters A, B, and C in real time; the DiagramAgent generates a Swagger interface diagram based on the API definition of community C and a microservice architecture diagram based on the service relationships of community A.

[0043] Output: Generates a structured design document with 5 main chapters, including automatically generated technical charts, with cross-chapter terminology consistency exceeding 95%.

Claims

1. A RAG knowledge base-enhanced intelligent design document generation system, characterized in that, include: The complex network modeling module is used to define text fragments in the knowledge base as network nodes, construct heterogeneous complex networks containing semantic similarity edges, logical dependency edges, temporal evolution edges, and co-occurrence association edges, and perform multi-layer network fusion through graph attention networks; The topology feature calculation and filtering module is used to calculate the multi-dimensional topology feature vectors of network nodes and filter knowledge subgraphs based on a multi-objective optimization model. The document structure planning module is used to map knowledge subgraphs to document chapter structures through community discovery and to determine the chapter order through chapter dependency graphs. It also includes a multi-agent collaborative generation module, comprising a document planning agent, a content generation agent, a consistency verification agent, and a diagram generation agent, used to collaboratively generate, verify, and optimize design documents based on knowledge subgraphs.

2. A method for intelligently generating RAG knowledge base-enhanced design documents, using the RAG knowledge base-enhanced design document intelligent generation system described in claim 1. Its features are, Includes the following steps: S1. Heterogeneous modeling of complex networks in RAG knowledge base: Text fragments in RAG knowledge base are defined as nodes of complex networks, and various relationships between text fragments are abstracted as weighted edges. A heterogeneous complex network containing semantic similarity edges, logical dependency edges, temporal evolution edges and co-occurrence relationship edges is constructed. S2. Multi-objective knowledge filtering based on network topology features: Calculate the multi-dimensional network topology feature vector of each node in the heterogeneous complex network; Receive user's design document generation request, perform multi-objective optimization and filtering based on multi-dimensional network topology features and query intent, and select highly relevant knowledge subgraphs that meet preset conditions from heterogeneous and complex networks; The multi-objective optimization screening adopts a multi-objective optimization model. The objective function of the multi-objective optimization model includes relevance objective, coverage objective, coherence objective and redundancy penalty term. The constraint is that the knowledge subgraph is a connected subgraph and the number of nodes does not exceed a preset threshold. S3. Design document structure planning based on knowledge subgraph: Execute community discovery algorithm on the knowledge subgraph, map each community to a chapter of the design document, construct chapter dependency graph based on the connection relationship between communities and determine the chapter writing order; S4. Multi-Agent Collaborative Design Document Generation: Construct a multi-Agent collaborative framework that includes a document planning agent, a content generation agent, a consistency verification agent, and a diagram generation agent. Based on the knowledge subgraph and the chapter writing order, the framework collaboratively generates the design document. Agent role definition and collaboration framework, context injection based on knowledge subgraph, iterative optimization and feedback enhancement.

3. The method according to claim 2, characterized in that, In step S1, the construction of the heterogeneous complex network specifically includes: S11. Node Definition: Each text fragment in the knowledge base after preprocessing and segmentation is defined as a network node. Node attributes include: semantic vector representation, document source, version number, author, time, and fragment type label. S12. Construction of heterogeneous edges: Construct four types of weighted edges: semantically similar edges, logically dependent edges, temporally evolving edges, and co-occurrence related edges to form a heterogeneous complex network; Semantic similarity edges are defined as E_sem, based on vector cosine similarity. An edge is established when sim(e_i,e_j)>θ_1, with weight w_ij^sem=sim(e_i,e_j). In the formula, sim(e_i,e_j) represents the semantic similarity score between two text segments, usually calculated by cosine similarity, with a value range of [0,1]. The closer to 1, the more similar the semantics. e_i represents the semantic vector of the i-th text segment, which is the vector representation of the text segment mapped to a high-dimensional vector space through the Embedding model. e_j represents the semantic vector of the j-th text segment, and is similar to e_i. θ_1 represents the semantic similarity threshold, which is a preset hyperparameter. An edge is established only when the semantic similarity between two segments exceeds this threshold, and is used to filter weak associations. Logical dependency edges are defined as E_log. By analyzing the fragment content through LLM, logical relationships such as "premise-conclusion", "reference-referenced", and "interface definition-interface call" are identified. The weight w_ij^log is determined by the dependency strength. The temporal evolution edge is defined as E_time. For different versions of the same document or iterative records of the same technical solution, directed edges are established in chronological order, and the weight w_ij^time is inversely proportional to the time interval. Co-occurrence association edges are defined as E_co. When two fragments are located in the same chapter or paragraph in the original document, or are jointly retrieved in the user's historical queries, a co-occurrence edge is established. The weight w_ij^co is determined by the co-occurrence frequency. S13, Multi-layer network fusion: A network fusion algorithm is used to fuse four types of heterogeneous edges into a unified composite adjacency matrix A, where the composite weight of each node is dynamically learned through an attention mechanism.

4. The method according to claim 2, characterized in that, In step S2, the multidimensional topological feature vector is a six-dimensional topological feature vector, which includes degree centrality, weighted betweenness centrality, PageRank value, local clustering coefficient, structural hole constraint degree, and community affiliation entropy. The six-dimensional topological feature vector is calculated as follows: Degree centrality reflects the basic connectivity of network nodes. The degree centrality D_i is calculated as follows: D_i=Σ_jA_ij, where A_i represents the element in the i-th row and j-th column of the adjacency matrix, i.e., the edge weight between node i and node j, j represents the index variable for summation and traversal, traversing all nodes in the network that may be connected to node i, and i represents the index of the target node, i.e., the node whose degree centrality is currently being calculated. Weighted betweenness centrality reflects the importance of network nodes as "knowledge bridges" and is the frequency with which a node appears on the shortest path of other fragment pairs. PageRank values ​​reflect the global importance of a node, taking into account the quality of neighboring network nodes; Local clustering coefficients reflect the tightness of the knowledge community to which a node belongs. A high local clustering coefficient indicates that the segment is in a highly self-consistent technical module. Structural hole constraints are based on Burt's structural hole theory. The network constraint coefficients of network nodes are calculated. Low constraint coefficients indicate that network nodes span multiple technical fields and are suitable as hub nodes for cross-chapter references. Community affiliation entropy is based on the Louvain community discovery algorithm, which calculates the stability of the community to which a node belongs. Nodes belonging to multiple overlapping communities have higher potential for knowledge fusion.

5. The method according to claim 4, characterized in that, In step S2, the knowledge subgraph is selected using the following multi-objective optimization model. The formula for calculating max_S in the multi-objective optimization model is as follows: max_S V[λ_1·Relevance(S,q)+λ_2·Coverage(S)+λ_3·Coherence(S)-λ_4·Redundancy(S)]; Constraint: |S|≤K; In the formula, V represents the set of all nodes in the complex network, i.e., all text fragments contained in the entire RAG knowledge base; λ represents the weight coefficient of each objective function, used to balance the importance of different optimization objectives, determined by manual setting or automatic parameter tuning; S represents the knowledge subgraph selected from V, i.e., the set of knowledge fragments finally used to generate documents; K represents the maximum number of nodes in the selected subgraph, i.e., controlling the upper limit of the number of search results to avoid excessively long context; Relevance(S,q) represents the relevance score between the knowledge subgraph S and the user query q, combined with semantic similarity and PageRank value; Coverage(S) represents the document element type coverage of the knowledge subgraph S, ensuring coverage of multiple document element types; Coherence(S) represents the internal coherence score of the knowledge subgraph S, prioritizing fragments with high cohesion and moderate bridging; Redundancy(S) represents the internal redundancy of the knowledge subgraph S, controlling the edge density within the subgraph to avoid excessive repetition; In the selected knowledge subgraph G_S, the structural hole theory is used to identify key nodes across communities as "hub knowledge" for document chapter transitions, and the shortest path algorithm is used to extract the key paths connecting various topic communities as the recommendation logic of the design document.

6. The method according to claim 1, characterized in that, In step S3, the specific details of the design document structure planning based on the knowledge subgraph are as follows: S31, Community-Chapter Mapping: Perform community discovery on the knowledge subgraph G_S, mapping each community to a chapter in the design document. The topic tags of a community are determined by weighted voting of node attributes within the community. S32. Chapter Sorting and Dependency Analysis: Based on the density and directionality of connection edges between communities, a chapter dependency graph is constructed. Topological sorting is used to determine the recommended writing order of chapters, ensuring that dependent chapters appear before dependent chapters. S33. Document Template Adaptation: Based on the document type specified by the user, load the corresponding document template, align the chapters mapped by the community with the standard chapters in the template, identify missing chapters, and trigger supplementary searches.

7. The method according to claim 1, characterized in that, In step S4, the specific method for generating the design document for multi-agent collaboration is as follows: S41. Agent Role Definition and Collaboration Framework S42. Context injection based on knowledge subgraph; S43, Iterative optimization and feedback enhancement.

8. The method according to claim 7, characterized in that, In step S41, the Agent role definition and collaboration framework works as follows: four types of Agents are constructed to collaborate based on the selected knowledge subgraph and document structure. The four types of Agents are document planning Agent, content generation Agent, consistency verification Agent, and graph generation Agent. The document planning agent is responsible for parsing user needs, coordinating other agents, monitoring the generation progress, formulating chapter generation plans based on the community structure of the knowledge subgraph, and dynamically adjusting task allocation; The content generation agent is responsible for writing the content of specific chapters. Each content generation agent focuses on one chapter and, based on the knowledge subgraph assigned to that chapter and the topological sorting results of nodes within the community, references knowledge fragments in order of importance to generate a coherent technical description. The consistency verification agent monitors cross-chapter consistency in real time, using logical dependency edges E_log and temporal evolution edges E_time in the knowledge subgraph to verify the consistency of terminology definitions, data flow descriptions, and version information, and triggers correction requests when conflicts are found. The chart generation agent is responsible for transforming structured information in knowledge fragments into charts, automatically laying them out based on the topological structure of the knowledge subgraphs, and ensuring consistency between the charts and the text descriptions.

9. The method according to claim 7, characterized in that, In step S42, the specific method of context injection based on knowledge subgraph is as follows: A subgraph-aware context injection strategy is used to generate an Agent for each piece of content. This Agent not only provides the community node content of the target chapter, but also provides a summary of the neighbor nodes of the community in the global network, ensuring that the local generation has a global perspective. The context is organized by topological sorting reading order.

10. The method according to claim 7, characterized in that, In step S43, the specific methods of iterative optimization and feedback enhancement are as follows: During the document generation process, the consistency verification agent continuously builds a consistency constraint graph, recording the entity definitions, constraints, and dependencies in the generated content; When a new chapter is generated, a subgraph isomorphism detection is used to determine whether there is a topological pattern that conflicts with the previous text. This triggers the content generation agent to perform a partial rewrite, and the graph generation agent dynamically adjusts the relationships between elements in the graph based on the verification results of the consistency verification agent.