Multi-agent based medical instrument multi-file long text generation method
By constructing a medical device knowledge graph and performing multi-level heterogeneous graph encoding and semantic dependency graph construction, the problems of professionalism and consistency in medical device document generation are solved, achieving efficient and professional document content generation that meets industry standards.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 钰兔科技集团有限公司
- Filing Date
- 2025-10-23
- Publication Date
- 2026-05-12
AI Technical Summary
Existing medical device documentation generation technologies struggle to effectively handle complex knowledge structures, resulting in content that is not professional enough, lacks relevance, has logical breaks, and contains duplicate information. This makes it difficult to meet compliance standards and increases the workload of manual review.
We collect source information on medical devices to construct a knowledge graph, perform multi-level heterogeneous graph encoding and comparative learning, retrieve document paragraphs through hierarchical semantic indexing, perform bilinear transformation and singular value decomposition, extract key semantic units, and construct a directed semantic dependency graph to ensure the logical coherence and consistency of documents.
It has achieved professionalism and consistency in the generation of medical device documents, improved the relevance of the generated content and its ability to meet industry standards, and reduced the workload of manual review.
Smart Images

Figure CN121279274B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical device technology, and in particular to a method for generating long texts from multiple files in medical devices based on multi-agent systems. Background Technology
[0002] With the rapid development of the medical device industry, the demand for generating medical device-related documents is increasing. Medical device documents include various types such as instructions for use, technical white papers, and clinical evaluation reports. These documents not only need to comply with strict regulatory requirements, but also need to contain a large number of professional terms and technical details. Traditional medical device document generation mainly relies on manual writing, which is time-consuming, labor-intensive, and makes it difficult to ensure the consistency and completeness of the content.
[0003] With the development of artificial intelligence technology, especially the application of large-scale language models, text automatic generation technology has made significant progress. However, existing medical device document generation technologies still have problems such as difficulty in effectively handling the complex knowledge structure of the medical device field, difficulty in accurately capturing the complex relationships between different entities, resulting in insufficient professionalism and relevance of the generated content, difficulty in maintaining global consistency, and frequent logical breaks, information duplication, or contradictions between different parts of the content. These problems affect the overall quality and usability of the document and cannot ensure that the generated content meets compliance standards, increasing the workload of subsequent manual review and modification. Summary of the Invention
[0004] This invention provides a method for generating long texts from multiple files of medical devices based on multi-agent technology, which can at least solve some of the problems existing in the prior art.
[0005] A first aspect of this invention provides a method for generating long text for multiple medical device documents based on multi-agent systems, comprising:
[0006] Collect source information of medical devices and extract entities and relationships to construct a knowledge graph. Perform multi-level heterogeneous graph encoding on the knowledge graph, calculate the neighborhood weighted representation of each node and combine it with contrastive learning to determine the node embedding vector set. Perform cluster analysis on the node embedding vector set to obtain the clustering results and construct a hierarchical semantic index.
[0007] The system receives document generation requirements and decomposes the content of the document to be generated into multiple document paragraph tasks. Based on the document paragraph tasks, it retrieves cluster subsets from the hierarchical semantic index and extracts the task node vectors corresponding to the cluster subsets. It performs bilinear transformation on the task node vectors and the semantic representation of the document paragraph tasks to obtain an interaction feature matrix. It performs singular value decomposition on the interaction feature matrix to extract principal component vectors and performs residual connection with the task node vectors to obtain a task-specific embedding representation.
[0008] Task-specific embedding representations and preset global constraint vectors are added to the preset generation execution path to generate document paragraph content and extract key semantic units. Syntactic dependency analysis is performed on the key semantic units to extract syntactic structure features and calculate the semantic relevance between different key semantic units. Based on the semantic relevance, a directed semantic dependency graph is constructed and topologically sorted to determine the semantic dependency relationship between different key semantic units. Finally, the document paragraph content is serialized and fused to obtain a complete medical device document.
[0009] In one alternative implementation,
[0010] Collect source information on medical devices and extract entities and relationships to construct a knowledge graph. Perform multi-level heterogeneous graph encoding on the knowledge graph, calculate the neighborhood-weighted representation of each node, and combine contrastive learning to determine the node embedding vector set, including:
[0011] Medical device source information is collected from medical device technical documents. The source information is segmented to obtain word sequence. Named entity recognition is performed on the word sequence to extract entity set. Relationship extraction is performed on the entities in the entity set to obtain the relationship between entities. A knowledge graph is constructed based on the entity set and the relationship.
[0012] The nodes in the knowledge graph are hierarchically grouped according to node type to obtain multiple node levels. Graph convolution operation is performed on the nodes in each node level to obtain the node representation within the layer. The node representations of different node levels are aggregated across layers to obtain multi-level heterogeneous graph encoding results.
[0013] Extract the set of neighboring nodes for each node in the multi-level heterogeneous graph encoding result, perform a weighted summation of the node representations in the set of neighboring nodes to obtain the neighborhood weighted representation of each node, use the neighborhood weighted representation as a positive sample, randomly sample nodes in the knowledge graph to obtain negative samples, calculate the contrast loss between the positive and negative samples and perform backpropagation optimization to obtain the set of node embedding vectors.
[0014] In one alternative implementation,
[0015] Cluster analysis of the node embedding vector set is performed to obtain clustering results and construct a hierarchical semantic index, including:
[0016] The node embedding vectors in the node embedding vector set are normalized to obtain normalized node embedding vectors. The semantic similarity matrix between normalized node embedding vectors is calculated. Based on the semantic similarity matrix, an adjacency graph between nodes is constructed and the adjacency graph is spectral decomposed to obtain a feature subspace. The normalized node embedding vectors are projected into the feature subspace to obtain low-dimensional projection vectors. The density of the low-dimensional projection vectors is estimated to obtain the local density value of each node. Nodes with local density values higher than a preset density threshold are selected as candidate cluster center nodes.
[0017] Calculate the distance metric between candidate cluster center nodes, perform hierarchical merging of candidate cluster center nodes based on the distance metric to obtain a multi-level cluster center set, and assign the node embedding vectors in the node embedding vector set to the nearest cluster center in the multi-level cluster center set to obtain the clustering result;
[0018] The semantic center representation of each cluster is calculated based on the node embedding vector of each cluster in the clustering results. The semantic correlation between the semantic center representations is calculated and the hierarchical relationship between the clusters is constructed. The clusters in the hierarchical relationship are arranged in layers from coarse to fine semantic granularity to obtain a hierarchical semantic index.
[0019] In one alternative implementation,
[0020] The system receives document generation requests and decomposes the content of the documents to be generated into multiple document paragraph tasks. Based on the document paragraph tasks, it retrieves cluster subsets from a hierarchical semantic index and extracts the task node vectors corresponding to the cluster subsets. A bilinear transformation is then performed on the task node vectors and the semantic representations of the document paragraph tasks to obtain the interaction feature matrix, which includes:
[0021] Receive document generation requirements and extract document type identifiers. Determine document structure templates based on document type identifiers and divide the content of the document to be generated into multiple paragraph areas. Extract paragraph topics and paragraph functional attributes for each paragraph area and combine paragraph topics and paragraph functional attributes to form document paragraph tasks.
[0022] Semantic encoding is performed on the document paragraph task to obtain the task query vector. The similarity between the task query vector and the semantic center representation of each level in the hierarchical semantic index is calculated. Starting from the top of the hierarchical semantic index, clusters with similarity higher than the level threshold are filtered layer by layer. The hierarchical semantic index is traversed downward until the bottom cluster is reached to obtain the cluster subset. The node embedding vector contained in the cluster subset is extracted and marked as the task node vector.
[0023] Text encoding is performed on the document paragraph task to obtain the semantic representation of the document paragraph task. Tensor multiplication is performed on the task node vector and the semantic representation through a preset bilinear transformation matrix to obtain the interaction feature matrix.
[0024] In one alternative implementation,
[0025] Singular value decomposition is performed on the interaction feature matrix to extract principal component vectors, and residual concatenation is performed with the task node vectors to obtain a task-specific embedding representation, including:
[0026] The interaction feature matrix is expanded by rows and columns to obtain a three-dimensional tensor structure. Each slice of the three-dimensional tensor structure is decomposed into low-rank matrices to obtain multiple low-rank approximation matrices. The reconstruction error between each low-rank approximation matrix and the interaction feature matrix is calculated. The low-rank approximation matrix with the smallest reconstruction error is selected as the optimized interaction matrix and then decomposed into singular value matrix to obtain the left singular vector matrix, the singular value diagonal matrix and the right singular vector matrix.
[0027] The sum of squares of the singular values in the singular value diagonal matrix is calculated as the total energy. The sum of the squares of each singular value is accumulated to obtain the cumulative energy sequence. The position where the ratio of the cumulative energy to the total energy first exceeds the preset retention threshold is selected as the end position. The left and right singular vectors corresponding to the singular values before the end position are extracted and concatenated to obtain the principal component vector.
[0028] A reference vector set is constructed based on a cluster subset that shares the same origin as the task node vectors. The similarity between the principal component vector and each vector in the reference vector set is calculated and normalized to obtain the attention weight distribution. The reference vector set is then weighted and aggregated based on the attention weight distribution to obtain an adaptive reference vector. Finally, the principal component vector and the adaptive reference vector are residually concatenated to obtain a task-specific embedding representation.
[0029] In one alternative implementation,
[0030] Task-specific embedding representations and preset global constraint vectors are added to the preset generation execution path to generate document paragraph content and extract key semantic units. Syntactic dependency analysis is performed on these key semantic units to extract syntactic structural features, and the semantic relevance between different key semantic units is calculated, including:
[0031] The task-specific embedding representation and the preset global constraint vector are gated and fused to obtain a conditional guidance vector. The conditional guidance vector is decomposed into a semantic control component and a structural control component. The semantic control component is added to the semantic decoding layer of the generated execution path to generate a semantic candidate sequence, and the structural control component is added to the structural decoding layer of the generated execution path to generate a structural candidate sequence. The semantic candidate sequence and the structural candidate sequence are cross-validated to obtain a consistency score. The semantic candidate sequence and the structural candidate sequence with the highest consistency score are selected and combined to obtain the document paragraph content. The document paragraph content is subjected to part-of-speech tagging and named entity recognition. Phrase that simultaneously meets the part-of-speech requirements and entity type requirements corresponding to the document generation requirements is extracted as a key semantic unit.
[0032] Syntactic dependency analysis is performed on key semantic units to obtain a dependency tree. The dependency tree is traversed to extract the dependency triples corresponding to the key semantic units. Vector encoding is performed on the dependency triples to obtain local syntactic features. Graph convolution aggregation is performed on the local syntactic features of all key semantic units in the document paragraph content to obtain global syntactic features. The local syntactic features and the global syntactic features are fused to obtain syntactic structure features. The vector distance between the syntactic structure features of different key semantic units is calculated and the vector distance is output as the semantic relevance.
[0033] In one alternative implementation,
[0034] Based on semantic relevance, a directed semantic dependency graph is constructed and topologically sorted to determine the semantic dependencies between different key semantic units. Then, the document paragraph content is serialized and fused to obtain a complete medical device document, including:
[0035] The key semantic units are used as nodes to construct an initial semantic dependency graph. Connection edges are established between nodes according to the semantic relevance. The initial semantic dependency graph is encoded by a graph neural network to obtain a node representation matrix. The causal influence strength between any two node representations in the node representation matrix is calculated, and a direction is assigned to each connection edge based on the causal influence strength to obtain directed edges and a directed semantic dependency graph. The information flow contribution corresponding to each directed edge is calculated, and low contribution edges are determined by combining a preset contribution threshold. The low contribution edges are removed from the directed semantic dependency graph, and loop detection is performed. The detected loops are eliminated to obtain a simplified directed semantic dependency graph.
[0036] A linear permutation sequence is obtained by performing topological sorting on the simplified directed semantic dependency graph. The semantic dependency relationship between two key semantic units directly connected by directed edges in the simplified directed semantic dependency graph is marked as a direct semantic dependency relationship.
[0037] A hierarchical structure tree is constructed based on the linear permutation sequence. The document paragraphs containing key semantic units with direct semantic dependencies are assigned to the same parent node in the hierarchical structure tree. A parent node summary representation is generated and input into the child node document paragraph content for semantic enhancement. The semantically enhanced document paragraph content is extracted by combining the depth-first traversal order of the hierarchical structure tree and serialized and spliced to obtain the complete medical device document.
[0038] A second aspect of the present invention provides a multi-agent-based long text generation system for medical devices, comprising:
[0039] The first unit is used to collect source information of medical devices and extract entities and relationships to construct a knowledge graph. The knowledge graph is encoded in a multi-level heterogeneous graph, the neighborhood weighted representation of each node is calculated and the node embedding vector set is determined by contrastive learning, the node embedding vector set is clustered to obtain the clustering results, and a hierarchical semantic index is constructed.
[0040] The second unit is used to receive document generation requirements and decompose the content of the document to be generated into multiple document paragraph tasks. Based on the document paragraph tasks, it retrieves cluster subsets from the hierarchical semantic index and extracts the task node vectors corresponding to the cluster subsets. It performs bilinear transformation on the task node vectors and the semantic representation of the document paragraph tasks to obtain an interaction feature matrix. It performs singular value decomposition on the interaction feature matrix to extract principal component vectors and performs residual connection with the task node vectors to obtain a task-specific embedding representation.
[0041] The third unit is used to add task-specific embedded representations and preset global constraint vectors to the preset generation execution path, generate document paragraph content and extract key semantic units, perform syntactic dependency analysis on key semantic units to extract syntactic structure features and calculate the semantic relevance between different key semantic units, construct a directed semantic dependency graph based on semantic relevance and perform topological sorting, determine the semantic dependency relationship between different key semantic units, and perform serialization fusion of document paragraph content to obtain a complete medical device document.
[0042] A third aspect of the present invention provides an electronic device, comprising:
[0043] A processor and a memory for storing processor-executable instructions, wherein the processor is configured to invoke instructions stored in the memory to perform the aforementioned method.
[0044] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0045] In this invention, a knowledge graph is constructed by collecting source information of medical devices and performing multi-level heterogeneous graph encoding. A hierarchical semantic index is constructed by combining contrastive learning and cluster analysis, realizing the structured representation and efficient retrieval of knowledge in the field of medical devices. This provides systematic knowledge support for the generation of long texts. Based on the document paragraph task, cluster subsets are retrieved from the hierarchical semantic index. Principal component vectors are extracted through bilinear transformation and singular value decomposition, which improves the relevance and professionalism of document content generation, making the generated content more in line with the standards and requirements of the medical device industry. By extracting key semantic units and performing syntactic dependency analysis, a directed semantic dependency graph is constructed based on semantic relevance and topological sorting is performed, ensuring the logical coherence and content consistency between different document paragraphs. Attached Figure Description
[0046] Figure 1 This is a flowchart illustrating the method for generating long text from multiple files in medical devices based on a multi-agent approach, as described in an embodiment of the present invention.
[0047] Figure 2 This is a flowchart illustrating the task-specific embedding representation generation process of the multi-agent medical device long text generation method according to an embodiment of the present invention. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of the embodiments 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. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0049] The technical solution of the present invention will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0050] Figure 1 This is a flowchart illustrating the multi-agent-based long text generation method for medical devices based on an embodiment of the present invention, as shown below. Figure 1 As shown, the method includes:
[0051] Collect source information of medical devices and extract entities and relationships to construct a knowledge graph. Perform multi-level heterogeneous graph encoding on the knowledge graph, calculate the neighborhood weighted representation of each node and combine it with contrastive learning to determine the node embedding vector set. Perform cluster analysis on the node embedding vector set to obtain the clustering results and construct a hierarchical semantic index.
[0052] The system receives document generation requirements and decomposes the content of the document to be generated into multiple document paragraph tasks. Based on the document paragraph tasks, it retrieves cluster subsets from the hierarchical semantic index and extracts the task node vectors corresponding to the cluster subsets. It performs bilinear transformation on the task node vectors and the semantic representation of the document paragraph tasks to obtain an interaction feature matrix. It performs singular value decomposition on the interaction feature matrix to extract principal component vectors and performs residual connection with the task node vectors to obtain a task-specific embedding representation.
[0053] Task-specific embedding representations and preset global constraint vectors are added to the preset generation execution path to generate document paragraph content and extract key semantic units. Syntactic dependency analysis is performed on the key semantic units to extract syntactic structure features and calculate the semantic relevance between different key semantic units. Based on the semantic relevance, a directed semantic dependency graph is constructed and topologically sorted to determine the semantic dependency relationship between different key semantic units. Finally, the document paragraph content is serialized and fused to obtain a complete medical device document.
[0054] In one alternative implementation,
[0055] Collect source information on medical devices and extract entities and relationships to construct a knowledge graph. Perform multi-level heterogeneous graph encoding on the knowledge graph, calculate the neighborhood-weighted representation of each node, and combine contrastive learning to determine the node embedding vector set, including:
[0056] Medical device source information is collected from medical device technical documents. The source information is segmented to obtain word sequence. Named entity recognition is performed on the word sequence to extract entity set. Relationship extraction is performed on the entities in the entity set to obtain the relationship between entities. A knowledge graph is constructed based on the entity set and the relationship.
[0057] The nodes in the knowledge graph are hierarchically grouped according to node type to obtain multiple node levels. Graph convolution operation is performed on the nodes in each node level to obtain the node representation within the layer. The node representations of different node levels are aggregated across layers to obtain multi-level heterogeneous graph encoding results.
[0058] Extract the set of neighboring nodes for each node in the multi-level heterogeneous graph encoding result, perform a weighted summation of the node representations in the set of neighboring nodes to obtain the neighborhood weighted representation of each node, use the neighborhood weighted representation as a positive sample, randomly sample nodes in the knowledge graph to obtain negative samples, calculate the contrast loss between the positive and negative samples and perform backpropagation optimization to obtain the set of node embedding vectors.
[0059] Medical device source information is collected from medical device technical documents, including but not limited to product manuals, technical specifications, clinical trial reports, and other documents. The collected medical device source information is then processed through word segmentation, using a professional medical-domain word segmentation tool to divide the text into word sequences. This tool has the ability to recognize medical device terminology, accurately identifying terms such as "blood pressure monitor," "ventilator," and "electrocardiogram monitor." For example, the phrase "electrocardiogram monitor can monitor a patient's heart rate, blood pressure, and blood oxygen" is segmented into ["electrocardiogram monitor," "can," "monitor," "patient," "of," "heart rate," "," "blood pressure," "," "blood oxygen"].
[0060] Named entity recognition is performed on lexical sequences to identify and extract entity sets. Using a pre-trained medical entity recognition model, it can identify various entities such as medical device names, functional parameters, and applicable scopes. Employing a bidirectional long short-term memory network combined with a conditional random field architecture, it accurately identifies specialized terms in the medical device field. For example, from the aforementioned lexical sequence, "ECG monitor" is identified as a device entity, while "heart rate," "blood pressure," and "blood oxygen" are identified as monitoring indicator entities.
[0061] Relationships are extracted from entities in the entity set to obtain the associations between entities. Through attention mechanisms and graph pattern matching, various relationships such as "monitoring", "applicable to", and "component" are identified between entities. For example, triplet relationships such as "ECG monitor - monitoring - heart rate", "ECG monitor - monitoring - blood pressure", and "ECG monitor - monitoring - blood oxygen" are established.
[0062] A knowledge graph is constructed based on entity sets and relationships. The knowledge graph uses entities as nodes and relationships as edges, forming a multi-relation directed graph. For example, an electrocardiogram monitor can be used as the central node, and the nodes connected to it include monitoring indicators such as heart rate, blood pressure, and blood oxygen, as well as entities such as applicable departments and manufacturers, forming a local knowledge graph with a star topology.
[0063] The nodes in the knowledge graph are hierarchically grouped according to node type, resulting in multiple node levels. Node types include medical device type, functional parameter type, and scope of application type, with each type constituting a level. For example, medical devices such as electrocardiogram monitors, ventilators, and infusion pumps are classified into the medical device level; monitoring indicators such as heart rate, blood pressure, and blood oxygen are classified into the functional parameter level; and internal medicine, surgery, and emergency medicine are classified into the scope of application level.
[0064] Graph convolution operations are performed on nodes within each node level to obtain the node representation within the layer. The graph convolution operation updates the node representation by aggregating the neighbor information of each node. The convolution kernel size is set to 1, and the features of the first-order neighbor nodes of each node are weighted and averaged. The new representation of the node is obtained by processing through an activation function. For example, the representation of the ECG monitor node will integrate the feature information of its connected functional parameter nodes such as heart rate and blood pressure, thereby enriching its semantic representation.
[0065] Multi-level heterogeneous graph encoding results are obtained by cross-layer aggregation of intra-layer node representations at different node levels. Cross-layer aggregation calculates the association strength between nodes at different levels through an attention mechanism, and weightedly fuses node representations at different levels. For example, the ECG monitor node in the medical device level will perform cross-layer attention calculation with the heart rate and blood pressure nodes in the functional parameter level, and the node representation with the high attention score will be incorporated into the final representation of the ECG monitor node.
[0066] Extract the set of adjacent nodes for each node in the multi-level heterogeneous graph encoding results. For each node, collect all nodes directly connected to it in the knowledge graph to form an adjacent node set. For example, the adjacent node set of the ECG monitor node includes monitoring indicator nodes such as heart rate, blood pressure, and blood oxygen, as well as nodes such as its manufacturer and applicable departments.
[0067] The neighborhood-weighted representation of each node is obtained by weighted summation of the node representations in the set of adjacent nodes. The weighting method adopts an attention-based weighting strategy, which assigns weights based on the semantic similarity between the central node and its neighboring nodes. For example, the neighborhood-weighted representation of an ECG monitor node will incorporate more information from core functional parameter nodes such as heart rate and blood pressure, while giving lower weights to secondary attributes.
[0068] Neighborhood-weighted representations are used as positive samples, while negative samples are obtained by randomly sampling nodes in the knowledge graph. The random sampling strategy employs stratified sampling, randomly selecting nodes that are not directly connected to the current node as negative samples within each node level. For example, for an ECG monitor node, nodes at the same level but not directly connected, such as CT scanners and ultrasound machines, might be selected as negative samples.
[0069] The contrastive loss between positive and negative samples is calculated and optimized through backpropagation to obtain the set of node embedding vectors. The contrastive loss is calculated using the InfoNCE loss function, which maximizes the mutual information of positive sample pairs while minimizing the mutual information of negative sample pairs, thus bringing semantically similar nodes closer together in the embedding space and distancing semantically different nodes. The node embedding vectors are then optimized using a gradient descent algorithm, ensuring that the final node representation accurately reflects the semantic relationships and structural information in the knowledge graph.
[0070] In this embodiment, by collecting medical device source information from medical device technical documents and performing word segmentation, the structuring level of text data can be effectively improved, making subsequent semantic analysis and entity recognition more accurate and complete. This avoids the problems of information omission and ambiguity in traditional manual extraction methods. By performing named entity recognition on the word sequence, the automatic identification of key entities related to medical devices can be achieved, improving the efficiency and accuracy of medical device knowledge extraction. By extracting relationships from entities in the entity set, the semantic associations between different entities can be identified, improving the interpretability and completeness of the knowledge structure and providing a richer semantic foundation for subsequent knowledge reasoning. By extracting the set of neighboring nodes of each node in the multi-level heterogeneous graph encoding result and performing weighted summation to obtain a neighborhood weighted representation, the importance of key neighbor nodes can be highlighted, the influence of irrelevant neighborhood noise can be effectively reduced, and the accuracy and robustness of node feature expression can be improved.
[0071] In one alternative implementation,
[0072] Cluster analysis of the node embedding vector set is performed to obtain clustering results and construct a hierarchical semantic index, including:
[0073] The node embedding vectors in the node embedding vector set are normalized to obtain normalized node embedding vectors. The semantic similarity matrix between normalized node embedding vectors is calculated. Based on the semantic similarity matrix, an adjacency graph between nodes is constructed and the adjacency graph is spectral decomposed to obtain a feature subspace. The normalized node embedding vectors are projected into the feature subspace to obtain low-dimensional projection vectors. The density of the low-dimensional projection vectors is estimated to obtain the local density value of each node. Nodes with local density values higher than a preset density threshold are selected as candidate cluster center nodes.
[0074] Calculate the distance metric between candidate cluster center nodes, perform hierarchical merging of candidate cluster center nodes based on the distance metric to obtain a multi-level cluster center set, and assign the node embedding vectors in the node embedding vector set to the nearest cluster center in the multi-level cluster center set to obtain the clustering result;
[0075] The semantic center representation of each cluster is calculated based on the node embedding vector of each cluster in the clustering results. The semantic correlation between the semantic center representations is calculated and the hierarchical relationship between the clusters is constructed. The clusters in the hierarchical relationship are arranged in layers from coarse to fine semantic granularity to obtain a hierarchical semantic index.
[0076] Each node embedding vector in the set of node embedding vectors is normalized to obtain a normalized node embedding vector. The normalization process uses the L2 norm normalization method, which divides each vector by its Euclidean norm to make the length of all vectors uniform to 1. For example, for the 512-dimensional embedding vector representing the "ECG monitor" node, the Euclidean norm of the vector is calculated, and each component of the vector is divided by the norm to obtain a normalized vector of unit length.
[0077] The semantic similarity matrix between normalized node embedding vectors is calculated. The semantic similarity is calculated using cosine similarity, directly obtained through the dot product of normalized vectors. For all nodes in the medical device knowledge graph, pairwise semantic similarity is calculated to construct a complete similarity matrix. For example, the cosine similarity between the embedding vectors of "ECG monitor" and "blood pressure monitor" is 0.72, indicating a high correlation between these two medical devices in terms of function or application; while the similarity between "ECG monitor" and "surgical knife" is only 0.35, indicating a low correlation.
[0078] An adjacency graph is constructed based on a semantic similarity matrix, and spectral decomposition is performed on the adjacency graph to obtain a feature subspace. The adjacency graph construction uses the K-nearest neighbor method, retaining the connections between each node and its K most similar nodes; K is set to 15. Eigenvalue decomposition is performed on the Laplacian matrix of the constructed adjacency graph, and the eigenvectors corresponding to the D smallest non-zero eigenvalues are selected as the feature subspace; D is set to 128. For example, a medical device knowledge graph containing approximately 5000 nodes can be mapped from a high-dimensional space to a 128-dimensional feature subspace through spectral decomposition, preserving the main topological information of the graph structure.
[0079] The normalized node embedding vector is projected onto the feature subspace to obtain a low-dimensional projection vector. The projection operation is achieved by taking the inner product of the normalized vector and the basis vectors of the feature subspace. For example, projecting the 512-dimensional "ventilator" node embedding vector onto a 128-dimensional feature subspace yields a more compact low-dimensional representation.
[0080] Density estimation is performed on the low-dimensional projection vectors to obtain the local density values of each node. The density estimation uses kernel density estimation, calculating the number of neighbors for each node within a specific radius, with the radius parameter set to 0.2. For example, the "infusion pump" node has 24 neighboring nodes within this radius, resulting in a local density value of 24; while the "surgical robot" node has only 8 neighbors within the same radius, resulting in a local density value of 8. This indicates that the "infusion pump" node has a denser region in the semantic space, suggesting it may be a common category of medical devices.
[0081] Nodes with local density values higher than a preset density threshold are selected as candidate cluster centers. The preset density threshold is set based on the statistical characteristics of the local density value distribution, taking the upper quartile of the local density value distribution, which is approximately 15. For example, in the medical device knowledge graph, approximately 1200 nodes have local density values exceeding 15, and these nodes are selected as candidate cluster centers, including typical medical device nodes such as "ECG monitor," "ventilator," and "infusion pump."
[0082] Calculate the distance metric between candidate nodes for cluster centers. The distance metric uses Euclidean distance to calculate the distance between each candidate node in the low-dimensional projected space. For example, the distance between "ECG monitor" and "heart rate monitor" is 0.31, while the distance between "orthopedic traction bed" and "ECG monitor" is 0.85, indicating that the heart rate monitor is semantically closer to "ECG monitor" than the orthopedic traction bed.
[0083] A multi-level cluster center set is obtained by hierarchically merging candidate nodes based on distance metrics. The hierarchical merging employs a bottom-up aggregation strategy, initially forming a cluster for each candidate node and gradually merging the two closest clusters. Three merging thresholds are set: 0.3, 0.5, and 0.7, corresponding to fine-grained, medium-grained, and coarse-grained clustering levels, respectively. For example, "ECG monitor" and "heart rate monitor" with a distance less than 0.3 are merged at the fine-grained level; "ECG monitor" and "pulse oximeter" with a distance of 0.6 are merged at the medium-grained level; and "ECG monitor" and "infusion pump" with a distance of 0.75 are merged at the coarse-grained level, forming approximately 800 fine-grained clusters, 300 medium-grained clusters, and 100 coarse-grained clusters.
[0084] The clustering result is obtained by assigning the node embedding vectors in the set of node embedding vectors to the nearest cluster center in the set of multi-level cluster centers. The assignment strategy is based on the Euclidean distance between the vector and the cluster center, assigning each node to the nearest cluster center. For example, the distance between the "portable electrocardiograph" node and the "ECG monitor" cluster center is 0.28, and the distances to other cluster centers are all greater than 0.4, so it is assigned to the "ECG monitor" cluster.
[0085] The semantic center representation of a cluster is calculated based on the node embedding vectors of each cluster in the clustering results. The semantic center representation is obtained by calculating the weighted average of the node embedding vectors within the cluster, with the weights based on the importance scores of the nodes. For example, the "cardiovascular monitoring equipment" cluster includes nodes such as "ECG monitor", "heart rate monitor", and "portable ECG machine". The semantic center representation of this cluster is obtained by calculating the weighted average of the node embedding vectors.
[0086] The semantic association degree between semantic center representations is calculated, and a hierarchical relationship between clusters is constructed. The semantic association degree is calculated using the cosine similarity between semantic center representations. Based on the inclusion relationship between cluster centers at different granularities, a hierarchical structure of clusters is established. For example, the fine-grained clusters "ECG monitor" and "heart rate monitor" both belong to the medium-grained cluster "cardiovascular monitoring equipment," while "heart rate monitor" belongs to the coarse-grained cluster "vital sign monitoring equipment."
[0087] The hierarchical semantic index is obtained by arranging the clusters in the hierarchical relationship according to the semantic granularity from coarse to fine. The top layer is coarse-grained clusters such as "vital sign monitoring equipment", "treatment equipment", and "auxiliary equipment"; the middle layer is medium-grained clusters such as "cardiovascular monitoring equipment" and "respiratory monitoring equipment"; and the bottom layer is fine-grained clusters such as "electrocardiogram monitor" and "blood pressure monitor".
[0088] In this embodiment, by normalizing the set of node embedding vectors, the representations of different nodes are compared in the same scale space, reducing the bias caused by differences in feature scales and improving the stability and comparability of subsequent similarity calculations. By calculating the semantic similarity matrix between normalized node embedding vectors and constructing an adjacency graph between nodes based on this matrix, the semantic relationships between nodes can be explicitly modeled, enabling the semantic similarity structure to be quantitatively represented and improving the accuracy of semantic structure expression. By performing spectral decomposition on the adjacency graph to obtain a feature subspace, and then projecting the node embedding vectors into this subspace, dimensionality reduction can be effectively achieved while maintaining the global semantic structure, avoiding the loss of high-order semantic information in traditional linear dimensionality reduction methods such as PCA, thereby improving the fidelity of the expression after feature compression. By assigning the node embedding vectors to the nearest cluster center in the multi-level cluster center set, hierarchical clustering of nodes can be achieved in the semantic space, improving the interpretability and organization of the clustering results.
[0089] In one alternative implementation,
[0090] The system receives document generation requests and decomposes the content of the documents to be generated into multiple document paragraph tasks. Based on the document paragraph tasks, it retrieves cluster subsets from a hierarchical semantic index and extracts the task node vectors corresponding to the cluster subsets. A bilinear transformation is then performed on the task node vectors and the semantic representations of the document paragraph tasks to obtain the interaction feature matrix, which includes:
[0091] Receive document generation requirements and extract document type identifiers. Determine document structure templates based on document type identifiers and divide the content of the document to be generated into multiple paragraph areas. Extract paragraph topics and paragraph functional attributes for each paragraph area and combine paragraph topics and paragraph functional attributes to form document paragraph tasks.
[0092] Semantic encoding is performed on the document paragraph task to obtain the task query vector. The similarity between the task query vector and the semantic center representation of each level in the hierarchical semantic index is calculated. Starting from the top of the hierarchical semantic index, clusters with similarity higher than the level threshold are filtered layer by layer. The hierarchical semantic index is traversed downward until the bottom cluster is reached to obtain the cluster subset. The node embedding vector contained in the cluster subset is extracted and marked as the task node vector.
[0093] Text encoding is performed on the document paragraph task to obtain the semantic representation of the document paragraph task. Tensor multiplication is performed on the task node vector and the semantic representation through a preset bilinear transformation matrix to obtain the interaction feature matrix.
[0094] The system receives document generation requests and extracts document type identifiers. These requests are structured inputs containing information such as the generation objective, the category of medical device involved, and the document's purpose. Document type identifiers are extracted through rule matching and semantic understanding. Common document types include product manuals, user manuals, maintenance guidelines, and clinical evaluation reports. For example, for the input request "Generate a portable blood glucose meter product manual, including product description, technical parameters, usage methods, and precautions," the extracted document type identifier is "product manual."
[0095] The document structure template is determined based on the document type identifier, and the content to be generated is divided into multiple paragraph areas. The document structure template is retrieved from a preset template library; different document types have different structure templates. Taking a "product instruction manual" as an example, its template includes paragraph areas such as "Product Overview," "Technical Parameters," "Scope of Application," "Usage Method," "Precautions," "Maintenance," and "Troubleshooting." For a portable blood glucose meter product instruction manual, it is divided into the above seven paragraph areas according to the template. Each paragraph area is an independent generation unit, facilitating subsequent segmentation processing.
[0096] For each paragraph area, extract the paragraph topic and paragraph functional attributes. The paragraph topic is obtained by extracting keywords from the paragraph title and document requirements, while the paragraph functional attributes are selected from a preset set of functional attributes based on the paragraph type. Functional attributes include descriptive, explanatory, enumerating, and warning attributes. For example, for the "Product Overview" paragraph area, the extracted paragraph topic is "Portable Blood Glucose Meter," and the functional attribute is "Descriptive"; for the "How to Use" paragraph area, the extracted paragraph topic is "Portable Blood Glucose Meter Usage," and the functional attribute is "Explanatory"; for the "Precautions" paragraph area, the extracted paragraph topic is "Portable Blood Glucose Meter Precautions," and the functional attribute is "Warning."
[0097] Paragraph topics and functional attributes are combined to form document paragraph tasks. A document paragraph task is a structured representation of the paragraph generation goal, including attributes such as keywords, functional type, and generation length. For example, for the "Product Overview" paragraph, the resulting document paragraph task would be: "Generate a product overview of a portable blood glucose meter, descriptive type, approximately 300 words long"; for the "Usage Instructions" paragraph, the resulting document paragraph task would be: "Generate instructions for using a portable blood glucose meter, explanatory type, approximately 500 words long, including operating steps."
[0098] Semantic encoding is performed on document paragraphs to obtain task query vectors. The semantic encoding uses a pre-trained medical domain text encoder to transform the document paragraph task into a 512-dimensional dense vector representation. The text encoder, based on a bidirectional transformer architecture and fine-tuned with medical domain text data, accurately captures professional terminology and semantic content in the medical device field. For example, encoding the task "Generate a product overview of a portable blood glucose meter, descriptive type, approximately 300 words long" yields a 512-dimensional task query vector reflecting the task's semantics.
[0099] The similarity between the task query vector and the semantic center representations at each level of the hierarchical semantic index is calculated. Cosine similarity is used to measure the semantic closeness between the task query vector and the semantic center representation. For example, the semantic center representation of the "Portable Blood Glucose Meter Product Overview" task query vector has a similarity of 0.78 with the semantic center representation of the "Detection Devices" cluster and 0.32 with the semantic center representation of the "Therapeutic Devices" cluster, indicating that the task is more relevant to the detection device category.
[0100] Starting from the top layer of the hierarchical semantic index, clusters with similarity higher than the level threshold are filtered layer by layer. The level thresholds for the top, middle, and bottom layers are set to 0.6, 0.7, and 0.8, respectively, and these thresholds were determined through experimental optimization. Starting with the coarse-grained clustering at the top layer, clusters with similarity greater than 0.6 are selected, such as the "detection equipment" cluster. Then, in the middle layer, clusters with similarity greater than 0.7 are selected from the sub-clusters of "detection equipment," such as the "blood testing equipment" cluster. Finally, at the bottom layer, clusters with similarity greater than 0.8 are selected, such as the "blood glucose meter" cluster.
[0101] The hierarchical semantic index is traversed downwards until the bottom-level clusters are reached, resulting in a subset of clusters. The node embedding vectors contained in these subsets are extracted and labeled as task node vectors. This traversal process proceeds top-down, filtering layer by layer to obtain a set of bottom-level clusters highly relevant to the task. For example, for the task "Portable Blood Glucose Meter Product Overview," relevant clusters such as "blood glucose meter" and "portable medical device" are selected. From these selected clusters, the embedding vectors of all nodes, such as those for "portable blood glucose meter," "blood glucose test strip," and "lancet," are extracted and labeled as task node vectors, totaling approximately 50 vectors, each with a dimension of 512.
[0102] Text encoding is performed on the document paragraph task to obtain its semantic representation. The text encoding uses the same pre-trained encoder as before, but with different encoding parameters to capture the overall semantics of the task rather than the retrieval intent. The resulting semantic representation is a 512-dimensional vector. For example, the semantic representation obtained from encoding the task "Generate instructions on how to use a portable blood glucose meter, type: explanatory, length: approximately 500 words, including operational steps" reflects the characteristics of generating explanatory text.
[0103] An interaction feature matrix is obtained by performing tensor product operations on task node vectors and semantic representations using a pre-defined bilinear transformation matrix. The bilinear transformation matrix, with a dimension of 512×512, is obtained through training on a large number of medical document generation tasks and is capable of capturing complex interaction patterns between node vectors and task semantics. For each task node vector, it interacts with the semantic representation of the document paragraph task using the bilinear transformation matrix to obtain a feature vector reflecting relevance. The interaction results of all task node vectors are combined to form the interaction feature matrix, with a dimension of node number × feature dimension (e.g., 50×512).
[0104] In this embodiment, by dividing the content of the document to be generated into multiple paragraph regions and extracting the paragraph theme and paragraph functional attributes for each paragraph region, the semantic units of the document can be refined. The document content generation task is decomposed into paragraph tasks with independent semantic objectives, avoiding the problems of chaotic paragraph themes and poor logical connection in traditional overall generation methods. This improves the accuracy and orderliness of the document's semantic organization. By combining paragraph themes and paragraph functional attributes to form document paragraph tasks and semantically encoding the document paragraph tasks to obtain task query vectors, the vectorized expression of paragraph-level semantic objectives can be realized. This provides a computable semantic representation for subsequent semantic retrieval and content matching, improving the understanding and retrieval capabilities of deep semantic associations. By calculating the similarity between the task query vector and the semantic center representations at each level in the hierarchical semantic index, and by filtering clusters with similarity higher than the level threshold layer by layer from the top level, semantic filtering and hierarchical positioning can be performed from top to bottom in the global semantic space. This ensures the hierarchical accuracy of semantic matching and avoids the computational redundancy caused by searching directly in all nodes, significantly improving retrieval efficiency and semantic positioning accuracy.
[0105] In one alternative implementation,
[0106] Singular value decomposition is performed on the interaction feature matrix to extract principal component vectors, and residual concatenation is performed with the task node vectors to obtain a task-specific embedding representation, including:
[0107] The interaction feature matrix is expanded by rows and columns to obtain a three-dimensional tensor structure. Each slice of the three-dimensional tensor structure is decomposed into low-rank matrices to obtain multiple low-rank approximation matrices. The reconstruction error between each low-rank approximation matrix and the interaction feature matrix is calculated. The low-rank approximation matrix with the smallest reconstruction error is selected as the optimized interaction matrix and then decomposed into singular value matrix to obtain the left singular vector matrix, the singular value diagonal matrix and the right singular vector matrix.
[0108] The sum of squares of the singular values in the singular value diagonal matrix is calculated as the total energy. The sum of the squares of each singular value is accumulated to obtain the cumulative energy sequence. The position where the ratio of the cumulative energy to the total energy first exceeds the preset retention threshold is selected as the end position. The left and right singular vectors corresponding to the singular values before the end position are extracted and concatenated to obtain the principal component vector.
[0109] A reference vector set is constructed based on a cluster subset that shares the same origin as the task node vectors. The similarity between the principal component vector and each vector in the reference vector set is calculated and normalized to obtain the attention weight distribution. The reference vector set is then weighted and aggregated based on the attention weight distribution to obtain an adaptive reference vector. Finally, the principal component vector and the adaptive reference vector are residually concatenated to obtain a task-specific embedding representation.
[0110] A three-dimensional tensor structure is obtained by row and column expansion of the interaction feature matrix. Row and column expansion is achieved by copying and transforming the row and column elements of the interaction feature matrix, expanding the original two-dimensional matrix into a three-dimensional tensor. For example, for an interaction feature matrix of size 50×512, a three-dimensional tensor structure of size 50×512×10 is obtained by applying a sliding window operation in different dimensions. Each slice represents the representation of the interaction feature matrix from different semantic perspectives. For example, for the interaction feature matrix of the "portable blood glucose meter product overview" task, the expanded three-dimensional tensor contains 10 slices, each capturing the semantic association between the blood glucose meter and the product overview task from a different angle.
[0111] Low-rank decomposition is performed on each slice of the 3D tensor structure to obtain multiple low-rank approximate matrices. The low-rank decomposition employs truncated singular value decomposition (SVD), retaining the top K largest singular values and their corresponding singular vectors for each slice matrix. K is set to 20, approximating each slice as a low-rank matrix, filtering out noise information and preserving the main semantic structure. For example, for the first slice matrix of the "Portable Blood Glucose Meter Product Overview" task tensor, the original singular value sequence is [15.7, 12.3, 8.6, 7.2, 5.9, ...]. After truncation, the top 20 singular values and their corresponding singular vectors are retained, resulting in a low-rank approximate matrix of size 50×512.
[0112] Calculate the reconstruction error between each low-rank approximation matrix and the interaction characteristic matrix. The reconstruction error is calculated as the sum of the squared differences of the matrix elements, reflecting the degree of fit of the low-rank approximation to the original matrix. For each low-rank approximation matrix, calculate its reconstruction error with the original interaction characteristic matrix. For example, the reconstruction errors of the low-rank approximation matrices corresponding to the 10 slices are [0.375, 0.412, 0.298, 0.461, 0.327, 0.386, 0.402, 0.356, 0.423, 0.378], with the third slice having the smallest reconstruction error of 0.298.
[0113] The low-rank approximation matrix with the smallest reconstruction error is selected as the optimization interaction matrix, and singular value decomposition is performed to obtain the left singular vector matrix, the singular value diagonal matrix, and the right singular vector matrix. For the "Portable Blood Glucose Meter Product Overview" task, the low-rank approximation matrix corresponding to the third slice with a reconstruction error of 0.298 is selected as the optimization interaction matrix, with a size of 50×512. A complete singular value decomposition is performed on the optimization interaction matrix to obtain a left singular vector matrix of size 50×50, a singular value diagonal matrix of size 50×50, and a right singular vector matrix of size 512×50. The singular values are arranged in descending order, for example, the first few singular values are [14.2, 11.8, 8.1, 6.9, 5.5, ...].
[0114] The sum of squares of the singular values in the singular value diagonal matrix is calculated as the total energy. The sum of squares of the singular values reflects the total amount of information contained in the matrix. For the singular values of the aforementioned optimized interaction matrix, the sum of the squares of all singular values is calculated, yielding a total energy value of 685.41. The square of each singular value represents the variance explained by the corresponding principal component; the larger the square value, the more important the principal component.
[0115] The cumulative energy sequence is obtained by summing the squares of each singular value. Starting from the first singular value, the squares of the singular values are summed sequentially to form the cumulative energy sequence. For example, the cumulative energy sequence of the squares of the first five singular values [14.2, 11.8, 8.1, 6.9, 5.5] is [201.64, 341.08, 406.65, 454.26, 484.51, ...], which reflects the variance explained by the cumulative summation of the first k principal components.
[0116] The position where the ratio of cumulative energy to total energy in the cumulative energy sequence first exceeds a preset retention threshold is selected as the ending position. The retention threshold is set to 0.85, meaning that principal components explaining more than 85% of the variance are retained. The cumulative energy to total energy ratio sequence is calculated as [0.294, 0.498, 0.593, 0.663, 0.707, ...]. The position where the ratio first exceeds 0.85 is 12, meaning that the principal components corresponding to the first 12 singular values are selected. These 12 principal components can explain more than 85% of the information in the original matrix.
[0117] The left and right singular vectors corresponding to the singular values before the end position are extracted and concatenated to obtain the principal component vectors. The left and right singular vectors corresponding to the first 12 singular values are then taken; the left singular vector matrix has a dimension of 50×12, and the right singular vector matrix has a dimension of 512×12. These two vectors are concatenated column-wise to obtain a principal component vector matrix of dimension (50+512)×12. Average pooling is then performed on the principal component vector matrix to obtain a 562-dimensional principal component vector, which contains the core semantic information of the interaction feature matrix.
[0118] A reference vector set is constructed based on cluster subsets that share the same source as the task node vectors. The reference vector set consists of the original embedding vectors of the nodes in the cluster subsets and is used to enhance the semantic representation of the principal component vectors. For example, for the task "Overview of Portable Blood Glucose Meter Products", the original embedding vectors of the nodes are extracted from clusters such as "Blood Glucose Meter" and "Portable Medical Devices" to form a reference vector set containing 50 512-dimensional vectors.
[0119] The similarity between the principal component vector and each vector in the reference vector set is calculated and normalized to obtain the attention weight distribution. The similarity is calculated using cosine similarity and normalized using the Softmax function to obtain a weight distribution with a sum of 1. For example, if the similarity between the principal component vector and each vector in the reference vector set is [0.72, 0.68, 0.65, 0.81, 0.59, ...], the normalized weight distribution is [0.15, 0.13, 0.12, 0.19, 0.09, ...], indicating that the fourth reference vector is most relevant to the principal component vector and has the highest weight.
[0120] An adaptive reference vector is obtained by weighted aggregation of the reference vector set based on the attention weight distribution. Weighted aggregation is achieved by summing the results after multiplying each reference vector by its corresponding attention weight. For the aforementioned weight distribution and reference vector set, a weighted sum is calculated to obtain a 512-dimensional adaptive reference vector. This adaptive reference vector integrates information from all reference vectors, but places greater emphasis on reference vectors semantically similar to the principal component vectors.
[0121] Task-specific embeddings are obtained by residually concatenating the principal component vectors and the adaptive reference vectors. The residual concatenation is achieved through feature-level fusion of the principal component vectors and the adaptive reference vectors, including concatenation, linear transformation, and activation function operations. For example, a 562-dimensional principal component vector and a 512-dimensional adaptive reference vector are concatenated to obtain a 1074-dimensional vector, which is then projected onto a 1074×768 linear transformation matrix to form a 768-dimensional task-specific embedding. This task-specific embedding integrates refined information from the interaction feature matrix and supplementary information from the reference vector, providing a rich semantic foundation for subsequent medical device documentation content generation. For example, for the task of "portable blood glucose meter product overview," the obtained task-specific embedding includes information such as the basic functions, technical features, and application scenarios of the blood glucose meter, facilitating the generation of accurate and professional product overview content.
[0122] In this embodiment, by expanding the rows and columns of the interaction feature matrix to construct a three-dimensional tensor structure, an additional dimension can be introduced for multi-view feature expression while maintaining the integrity of task semantics and node semantic interaction information. This enhances the ability to capture semantic interaction relationships and improves the richness and structural expressiveness of semantic interaction information. By performing low-rank decomposition on each slice of the three-dimensional tensor, the high-dimensional tensor representation can be effectively compressed, redundant features can be removed, and the main information components can be highlighted. This reduces computational complexity and improves the stability of feature decomposition, thereby improving the accuracy of feature reconstruction. By calculating the reconstruction error between each low-rank approximation matrix and the original interaction feature matrix and selecting the one with the smallest error as the optimized interaction matrix, the optimal feature approximation form can be adaptively selected, achieving a balance between compression accuracy and information preservation in feature representation. This improves the adaptability and robustness of feature optimization. By constructing a reference vector set based on a cluster subset with the same source as the task node vectors and calculating the similarity between the principal component vectors and the reference vectors to generate the attention weight distribution, the principal component vectors can be adaptively strengthened in a specific semantic context, improving the aggregation accuracy of task-related features.
[0123] Figure 2 This is a flowchart illustrating the task-specific embedding representation generation process of the multi-agent medical device long text generation method according to an embodiment of the present invention.
[0124] In one alternative implementation,
[0125] Task-specific embedding representations and preset global constraint vectors are added to the preset generation execution path to generate document paragraph content and extract key semantic units. Syntactic dependency analysis is performed on these key semantic units to extract syntactic structural features, and the semantic relevance between different key semantic units is calculated, including:
[0126] The task-specific embedding representation and the preset global constraint vector are gated and fused to obtain a conditional guidance vector. The conditional guidance vector is decomposed into a semantic control component and a structural control component. The semantic control component is added to the semantic decoding layer of the generated execution path to generate a semantic candidate sequence, and the structural control component is added to the structural decoding layer of the generated execution path to generate a structural candidate sequence. The semantic candidate sequence and the structural candidate sequence are cross-validated to obtain a consistency score. The semantic candidate sequence and the structural candidate sequence with the highest consistency score are selected and combined to obtain the document paragraph content. The document paragraph content is subjected to part-of-speech tagging and named entity recognition. Phrase that simultaneously meets the part-of-speech requirements and entity type requirements corresponding to the document generation requirements is extracted as a key semantic unit.
[0127] Syntactic dependency analysis is performed on key semantic units to obtain a dependency tree. The dependency tree is traversed to extract the dependency triples corresponding to the key semantic units. Vector encoding is performed on the dependency triples to obtain local syntactic features. Graph convolution aggregation is performed on the local syntactic features of all key semantic units in the document paragraph content to obtain global syntactic features. The local syntactic features and the global syntactic features are fused to obtain syntactic structure features. The vector distance between the syntactic structure features of different key semantic units is calculated and the vector distance is output as the semantic relevance.
[0128] A conditional guidance vector is obtained by gating and fusing the task-specific embedding representation and a pre-defined global constraint vector. The pre-defined global constraint vector is a 768-dimensional vector containing general specifications and style requirements for medical device documentation. Gating and fusion uses a gating unit, which consists of a two-layer neural network. The input is the concatenation of the task-specific embedding representation and the global constraint vector, and the output is a scalar gating value ranging from 0 to 1. For example, for the task "Overview of Portable Blood Glucose Meter Products," the global constraint vector contains the specifications for medical device documentation, and the calculated gating value is 0.65, indicating that the fusion process tends to retain information from the task-specific embedding representation. The gating and fusion calculation process involves weighting the task-specific embedding representation and the global constraint vector according to the gating value to obtain a conditional guidance vector with the same 768-dimensional dimension.
[0129] The conditional guidance vector is decomposed into semantic control components and structural control components. This decomposition is achieved using two dedicated linear projection matrices: one projects the conditional guidance vector into the semantic control components, and the other projects it into the structural control components. The semantic control components have a dimension of 512 and are responsible for guiding the generation of semantic content in the text; the structural control components have a dimension of 256 and are responsible for guiding the structural organization of the text. For example, for the conditional guidance vector of a portable blood glucose meter product overview, the resulting semantic control components contain semantic information about the blood glucose meter's functions and features, while the structural control components contain the structural framework information of the product overview.
[0130] Semantic control components are added to the semantic decoding layer of the generated execution path to generate semantic candidate sequences. The generated execution path is based on a pre-trained decoder model, employing a multi-layer transformer architecture with 12 layers of self-attention mechanisms. Semantic control components are injected into layers 3, 6, and 9 of the decoder via a cross-attention mechanism, guiding the decoder to generate text content that meets semantic requirements. The generation process uses an autoregressive approach, predicting the probability distribution of the next word at each step, and employing a beam search algorithm to retain the five candidate sequences with the highest probabilities. For example, the semantic candidate sequences generated for a portable blood glucose meter product overview include five different versions of the product description, covering aspects such as device uses, core functions, and technical features.
[0131] Structural control components are added to the structural decoding layer of the execution path to generate candidate structural sequences. The structural decoding layer employs a similar transformer architecture but focuses more on the text's organizational structure, incorporating eight layers of self-attention mechanisms. Structural control components are injected into layers 2, 4, and 6 of the decoder via cross-attention mechanisms, guiding the decoder to generate text organization that meets structural requirements. A beam search is used to retain five candidate sequences. For example, the candidate structural sequences generated for a portable blood glucose meter product overview include five different structural organization versions, such as a "general-specific" structure, a "feature listing" structure, and a "problem-solving" structure.
[0132] A consistency score is obtained by cross-validating semantic and structural candidate sequences. Cross-validation is achieved by calculating the compatibility of each pair of semantic and structural sequences, based on two metrics: semantic consistency and structural matching. Semantic consistency is calculated using cosine similarity, while structural matching is calculated using the overlap rate of structural markers. For example, for 5 semantic and 5 structural candidate sequences, the compatibility of 25 combinations is calculated to obtain a consistency score matrix, with scores ranging from 0 to 1. For the portable blood glucose meter product overview, the combination of the second semantic and third structural candidate sequences achieved the highest consistency score of 0.87.
[0133] The document paragraph content is obtained by combining the semantic candidate sequence and the structural candidate sequence with the highest consistency score. Based on the consistency score matrix, the combination with the highest score is selected, and the semantic candidate sequences are rearranged according to the organizational framework of the structural candidate sequences to obtain the final document paragraph content. For example, the final content of the portable blood glucose meter product overview is: "A portable blood glucose meter is a medical testing device for monitoring blood glucose levels. It uses electrochemical biosensor technology to quickly and accurately measure the glucose concentration in human blood. The device is small in size (typical dimensions are 95mm × 60mm × 20mm) and lightweight (not exceeding 100 grams), making it convenient for patients to carry and use. Key features include: high measurement accuracy (error range within ±10%), simple operation (only a small blood sample is needed), fast response speed (measurement time 5-10 seconds), data storage function (can save the most recent 500 measurement results), and low power consumption design (one set of batteries can be used continuously for 3-6 months). It is suitable for daily blood glucose monitoring for diabetic patients, helping them to understand blood glucose changes in a timely manner and providing a basis for insulin injection and dietary adjustments."
[0134] The document paragraphs are tagged with part-of-speech (POS) and named entity recognition (NAME) are performed to extract phrases that simultaneously meet the POS and entity type requirements corresponding to the document generation needs as key semantic units. POS tagging uses a statistical model to identify the part of speech of each word, such as nouns, verbs, and adjectives. Named entity recognition uses a deep learning model to identify entities such as technical terms, device names, and parameter indicators. The extraction criteria for key semantic units are based on the POS and entity type requirements implicit in the document generation needs. For example, for a portable blood glucose meter product overview, the document generation needs include the device name, functional description, technical features, and scope of application. Therefore, the extracted key semantic units include: "portable blood glucose meter" (device name, noun), "monitoring blood glucose levels" (functional description, verb-object phrase), "electrochemical biosensor technology" (technical features, noun phrase), "high measurement accuracy" (technical features, subject-predicate phrase), and "diabetic patients" (scope of application, noun phrase), etc.
[0135] Syntactic dependency parsing is performed on key semantic units to obtain a dependency tree. The dependency parsing uses a graph attention network-based algorithm to analyze each sentence containing key semantic units and construct a dependency tree between words. For example, for the sentence "A portable blood glucose meter is a medical testing device used to monitor blood glucose levels," the dependency parsing results show that "portable blood glucose meter" is the subject, "is" is the predicate, "medical testing device" is the object, and "used to monitor blood glucose levels" is a post-modifier modifying "device."
[0136] The dependency tree is traversed to extract dependency triples corresponding to key semantic units. Each dependency triple consists of (source word, relation type, target word), describing the syntactic relationship between words. The traversal process starts from the key semantic unit and collects the dependency relations directly related to it. For example, for the key semantic unit "portable blood glucose meter," the extracted dependency triples include: (portable blood glucose meter, subject-verb relation, is), (portable blood glucose meter, modifier-head relation, portable), etc.
[0137] Dependency triples are vector-encoded to obtain local syntactic features. The vector encoding uses a pre-trained syntactic encoder based on a graph neural network architecture, which transforms dependency triples into dense vector representations. Each triple is encoded as a 256-dimensional vector, capturing both the syntactic relation and semantic content of the triple. For example, for the triple (portable blood glucose meter, subject-verb relation, yes), the encoded result is a 256-dimensional vector representing the subject-verb relation feature.
[0138] Global syntactic features are obtained by aggregating the local syntactic features of all key semantic units in a document paragraph using graph convolution. Graph convolution aggregation constructs a graph structure based on the co-occurrence relationships between key semantic units, where nodes represent key semantic units and edges represent the correlation strength between units. The graph convolutional network consists of three graph convolutional layers, each followed by a non-linear activation function. Through a message-passing mechanism, the local syntactic features of each node exchange and aggregate information on the graph structure, resulting in a 256-dimensional vector representation containing global syntactic information. For example, after aggregating all key semantic units in a portable blood glucose meter product overview using graph convolution, a global feature reflecting the syntactic structure of the entire paragraph is obtained.
[0139] Syntactic structure features are obtained by fusing local and global syntactic features. The fusion employs a gating mechanism to adaptively combine local details and global information. The calculated syntactic structure features have a dimension of 256, encompassing the syntactic features of the key semantic unit itself and the structural information of the entire paragraph. For example, for the key semantic unit "portable blood glucose meter," the syntactic structure features not only reflect its syntactic role in the local sentence but also include its structural position information within the overall product overview.
[0140] The vector distance between the syntactic structural features of different key semantic units is calculated, and the vector distance is output as the semantic relevance. The vector distance is calculated using cosine distance, with a value range of 0 to 1. The smaller the value, the higher the relevance. For example, the vector distance between the syntactic structural features of "portable blood glucose meter" and "monitor blood glucose level" is 0.25, indicating that these two semantic units are closely related syntactically and semantically; while the vector distance between "portable blood glucose meter" and "low-power design" is 0.68, indicating a lower relevance.
[0141] In this embodiment, by gating and fusing the task-specific embedded representation with the preset global constraint vector, task context information and global generation constraints can be introduced simultaneously during the document generation stage. This achieves a dynamic balance between the generated semantics and the overall document specification, improving the controllability and global consistency of the generation process and avoiding the problem of local content deviating from the document topic. By decomposing the conditional guidance vector into semantic control components and structural control components, the decoupled expression of semantic and structural information can be achieved, allowing semantic generation and structural generation to be optimized independently in different channels. This improves the coordination between semantic content and document layout. By injecting the semantic control components into the semantic decoding layer of the generation execution path to generate semantic candidate sequences, the semantic consistency and contextual logical coherence in the generation process can be strengthened. By cross-validating the semantic candidate sequences and structural candidate sequences and calculating the consistency score, the degree of collaborative matching between semantics and structure can be quantified, effectively improving the semantic-structural consistency and text quality of the generated content.
[0142] In one alternative implementation,
[0143] Based on semantic relevance, a directed semantic dependency graph is constructed and topologically sorted to determine the semantic dependencies between different key semantic units. Then, the document paragraph content is serialized and fused to obtain a complete medical device document, including:
[0144] The key semantic units are used as nodes to construct an initial semantic dependency graph. Connection edges are established between nodes according to the semantic relevance. The initial semantic dependency graph is encoded by a graph neural network to obtain a node representation matrix. The causal influence strength between any two node representations in the node representation matrix is calculated, and a direction is assigned to each connection edge based on the causal influence strength to obtain directed edges and a directed semantic dependency graph. The information flow contribution corresponding to each directed edge is calculated, and low contribution edges are determined by combining a preset contribution threshold. The low contribution edges are removed from the directed semantic dependency graph, and loop detection is performed. The detected loops are eliminated to obtain a simplified directed semantic dependency graph.
[0145] A linear permutation sequence is obtained by performing topological sorting on the simplified directed semantic dependency graph. The semantic dependency relationship between two key semantic units directly connected by directed edges in the simplified directed semantic dependency graph is marked as a direct semantic dependency relationship.
[0146] A hierarchical structure tree is constructed based on the linear permutation sequence. The document paragraphs containing key semantic units with direct semantic dependencies are assigned to the same parent node in the hierarchical structure tree. A parent node summary representation is generated and input into the child node document paragraph content for semantic enhancement. The semantically enhanced document paragraph content is extracted by combining the depth-first traversal order of the hierarchical structure tree and serialized and spliced to obtain the complete medical device document.
[0147] An initial semantic dependency graph is constructed using key semantic units as nodes. For each extracted key semantic unit in the generated document paragraph content, it serves as a node in the graph. Taking a portable blood glucose meter product manual as an example, the nodes in the initial semantic dependency graph include key semantic units such as "portable blood glucose meter," "electrochemical biosensor," "blood glucose monitoring," "measurement accuracy," "ease of operation," "response speed," "data storage function," "low-power design," and "diabetic patients," totaling approximately 25 nodes. Each node initially retains its word vector representation with a dimension of 300.
[0148] Connections are established between nodes based on semantic relevance. For any two nodes, if the semantic relevance is higher than a preset threshold of 0.6, an undirected connection is established between them. The weight of the edge is set to the corresponding semantic relevance value. For example, the semantic relevance between "portable blood glucose meter" and "blood glucose monitoring" is 0.82, which is higher than the threshold, so a connection with a weight of 0.82 is established between these two nodes; while the semantic relevance between "portable blood glucose meter" and "diabetic patient" is 0.58, which is lower than the threshold, so no direct connection is established. The initial semantic dependency graph forms a weighted undirected graph structure containing approximately 60 connection edges.
[0149] A node representation matrix is obtained by encoding the initial semantic dependency graph using a graph neural network. The graph neural network adopts a graph attention network architecture, containing three graph attention layers, each with eight attention heads, and a hidden layer dimension of 256. The input consists of the initial word vector representation of the node and the edge weight information. Through a message passing mechanism, each node aggregates information from its neighbors to update its own representation. After processing by the three graph attention layers, a context-enhanced representation of each node is obtained, forming a node representation matrix with a dimension of 25×256. For example, the representation of the "portable blood glucose meter" node, after being encoded by the graph neural network, incorporates information from related nodes such as "electrochemical biosensor" and "blood glucose monitoring," forming a richer semantic representation.
[0150] The causal influence strength between any two node representations in the node representation matrix is calculated, and directions are assigned to each connection edge based on the causal influence strength to obtain directed edges and a directed semantic dependency graph. The calculation of causal influence strength employs an intervention-based causal inference method. For example, for each pair of connected nodes A and B, a small perturbation is made to the representation of node A, and the degree of change in the representation of node B is observed; simultaneously, a small perturbation is made to the representation of node B, and the degree of change in the representation of node A is observed. The direction with the larger degree of change is considered the direction of the causal influence. For example, perturbing the "electrochemical biosensor" node representation results in a change of 0.35 in the "measurement accuracy" node representation, while perturbing the "measurement accuracy" node representation results in a change of 0.12 in the "electrochemical biosensor" node representation, indicating that the causal influence mainly points from "electrochemical biosensor" to "measurement accuracy," therefore the edge direction is set from the former to the latter. In this way, all undirected edges in the initial semantic dependency graph are converted into directed edges, forming a directed semantic dependency graph.
[0151] The information flow contribution of each directed edge is calculated, and low-contribution edges are determined by combining this with a preset contribution threshold. The information flow contribution is calculated using the mutual information represented by the nodes at both ends of the edge. For example, for a directed edge from node A to node B, the information flow contribution is defined as the contribution of node A to the information gain of node B. The contribution value ranges from 0 to 1; a larger value indicates a more important information flow. A contribution threshold of 0.25 is set, and edges below this threshold are marked as low-contribution edges. For example, the directed edge from "low-power design" to "data storage function" has an information flow contribution of 0.18, which is below the threshold and is marked as a low-contribution edge; while the directed edge from "electrochemical biosensor" to "measurement accuracy" has an information flow contribution of 0.42, which is above the threshold and is retained.
[0152] In the directed semantic dependency graph, low-contribution edges are removed and loop detection is performed. Eliminating the detected loops yields a simplified directed semantic dependency graph. All directed edges marked as low-contribution, approximately 30% of the total edges, are removed. Then, loop detection is performed on the remaining directed graph using a depth-first search algorithm. For each detected loop, the edge with the lowest contribution within the loop is removed until all loops are eliminated. For example, a loop formed by "portable blood glucose meter" → "blood glucose monitoring" → "diabetic patient" → "portable blood glucose meter" is detected, where "diabetic patient" → "portable blood glucose meter" has the lowest contribution (0.28), so this edge is removed, breaking the loop. After removing low-contribution edges and eliminating loops, a simplified directed semantic dependency graph is obtained, containing approximately 15 nodes and 25 directed edges.
[0153] A linear permutation sequence is obtained by topologically sorting a simplified directed semantic dependency graph. Topological sorting is based on the dependencies between nodes in the directed graph, ensuring that for any directed edge, the starting point always appears before the ending point in the sorting. The Karn algorithm is used to implement topological sorting, adding all nodes with an in-degree of 0 to a queue, removing these nodes one by one and updating the in-degree of their neighbors, repeating this process until all nodes in the graph have been removed. For the simplified directed semantic dependency graph of a portable blood glucose meter product manual, the resulting linear permutation sequence is: ["Portable Blood Glucose Meter", "Electrochemical Biosensor", "Blood Glucose Monitoring", "Measurement Accuracy", "Easy Operation", "Response Speed", "Data Storage Function", "Low Power Consumption Design", "Diabetic Patients", ...].
[0154] Semantic dependencies between two key semantic units directly connected by directed edges in a simplified directed semantic dependency graph are labeled as direct semantic dependencies. Direct semantic dependencies are an important basis for document structure organization, indicating that two semantic units should remain closely related within the document. For example, there is a direct semantic dependency between "portable blood glucose meter" and "electrochemical biosensor," indicating that these two concepts should be adjacent or closely related in the document; similarly, there is a direct semantic dependency between "electrochemical biosensor" and "measurement accuracy," indicating that the description of measurement accuracy should follow the introduction of sensor technology. This approach provides fine-grained dependency constraints for document structure organization.
[0155] A hierarchical structure tree is constructed based on a linear permutation sequence. This structure tree is built using a bottom-up hierarchical clustering method, grouping semantically similar nodes with direct semantic dependencies into the same subtree. Specifically, initially, each node is an independent subtree. Following the linear permutation sequence, each pair of adjacent nodes is examined sequentially. If a direct semantic dependency exists, they are merged into a single subtree, and a parent node is created for that subtree. For example, the nodes "electrochemical biosensor," "measurement accuracy," and "reaction rate" have a direct semantic dependency and are therefore merged into a single subtree, with the parent node representing "sensor performance characteristics." This results in a three-level hierarchical structure tree: the root node represents the entire document, the second-level nodes represent main chapters, and the third-level nodes represent specific semantic units.
[0156] Document paragraphs containing key semantic units with direct semantic dependencies are assigned to the same parent node in the hierarchical structure tree. Related document paragraphs are then organized into their corresponding positions within the structure tree based on these established direct semantic dependencies. For example, document paragraphs about "electrochemical biosensors," "measurement accuracy," and "reaction speed" are assigned to the parent node "sensor performance characteristics," forming a subsection of the document.
[0157] A parent node summary representation is generated and input into the document paragraph content of child nodes for semantic enhancement. The parent node summary representation is generated by extracting summaries from the document paragraph content of all its child nodes, using an attention-based text summarization model. For example, for the parent node "sensor performance characteristics," the generated summary is "Portable blood glucose meters employ electrochemical biosensor technology, featuring high measurement accuracy and rapid response characteristics." The summary representation is then injected into the document paragraph content of each child node using a cross-attention mechanism, allowing the child node content to better reflect the contextual semantics of the parent node. For instance, in paragraphs related to "measurement accuracy," the reference to "electrochemical biosensor technology" is enhanced, improving content coherence.
[0158] By combining the depth-first traversal order of the hierarchical structure tree, semantically enhanced document paragraph content is extracted and serialized and concatenated to obtain a complete medical device document. The depth-first traversal starts from the root node, prioritizing the first child node of each node until a leaf node is reached, then backtracking to other child nodes. Following this traversal order, the semantically enhanced document paragraph content corresponding to each node is extracted sequentially, and chapter titles and transitional statements are added, concatenating them into a complete medical device document. For example, the final document structure of a portable blood glucose meter product manual includes chapters such as "Product Overview," "Technical Principles," "Performance Characteristics," "Usage Method," and "Precautions." Each chapter contains multiple semantically coherent paragraphs, forming a clear, professionally structured, and complete product manual with approximately 5000 words, meeting the standard requirements and usage needs of medical device documents.
[0159] In this embodiment, by constructing an initial semantic dependency graph of key semantic units and introducing a graph neural network for encoding, the potential relationships between semantic nodes can be effectively modeled. By calculating the information flow contribution of directed edges and removing low-contribution edges, redundant connections are significantly reduced, improving the structural simplicity of the semantic graph and the effectiveness of information transmission. Topological sorting and hierarchical modeling of the simplified graph not only obtains the hierarchical dependencies between semantic units but also makes the document content structurally interpretable and hierarchically coherent. By using parent node summaries to semantically enhance the content of lower-level document paragraphs, top-down transmission and fine-grained fusion of semantic information are achieved, improving the integrity and consistency of the semantic expression of medical device documents. While maintaining semantic accuracy, it can significantly improve the structural quality of documents and the logic of content generation, and improve the semantic coherence and readability of automatically generated medical device documents.
[0160] A second aspect of the present invention provides a multi-agent-based long text generation system for medical devices, comprising:
[0161] The first unit is used to collect source information of medical devices and extract entities and relationships to construct a knowledge graph. The knowledge graph is encoded in a multi-level heterogeneous graph, the neighborhood weighted representation of each node is calculated and the node embedding vector set is determined by contrastive learning, the node embedding vector set is clustered to obtain the clustering results, and a hierarchical semantic index is constructed.
[0162] The second unit is used to receive document generation requirements and decompose the content of the document to be generated into multiple document paragraph tasks. Based on the document paragraph tasks, it retrieves cluster subsets from the hierarchical semantic index and extracts the task node vectors corresponding to the cluster subsets. It performs bilinear transformation on the task node vectors and the semantic representation of the document paragraph tasks to obtain an interaction feature matrix. It performs singular value decomposition on the interaction feature matrix to extract principal component vectors and performs residual connection with the task node vectors to obtain a task-specific embedding representation.
[0163] The third unit is used to add task-specific embedded representations and preset global constraint vectors to the preset generation execution path, generate document paragraph content and extract key semantic units, perform syntactic dependency analysis on key semantic units to extract syntactic structure features and calculate the semantic relevance between different key semantic units, construct a directed semantic dependency graph based on semantic relevance and perform topological sorting, determine the semantic dependency relationship between different key semantic units, and perform serialization fusion of document paragraph content to obtain a complete medical device document.
[0164] A third aspect of the present invention provides an electronic device, comprising:
[0165] A processor and a memory for storing processor-executable instructions, wherein the processor is configured to invoke instructions stored in the memory to perform the aforementioned method.
[0166] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0167] This invention can be a method, apparatus, system, and / or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing various aspects of the invention.
[0168] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for generating long text from multiple documents related to medical devices based on multi-agent technology, characterized in that: include: Collect source information of medical devices and extract entities and relationships to construct a knowledge graph. Perform multi-level heterogeneous graph encoding on the knowledge graph, calculate the neighborhood weighted representation of each node and combine it with contrastive learning to determine the node embedding vector set. Perform cluster analysis on the node embedding vector set to obtain the clustering results and construct a hierarchical semantic index. The system receives document generation requirements and decomposes the content of the document to be generated into multiple document paragraph tasks. Based on the document paragraph tasks, it retrieves cluster subsets from the hierarchical semantic index and extracts the task node vectors corresponding to the cluster subsets. It performs bilinear transformation on the task node vectors and the semantic representation of the document paragraph tasks to obtain an interaction feature matrix. It performs singular value decomposition on the interaction feature matrix to extract principal component vectors and performs residual connection with the task node vectors to obtain a task-specific embedding representation. Task-specific embedding representations and preset global constraint vectors are added to the preset generation execution path to generate document paragraph content and extract key semantic units. Syntactic dependency analysis is performed on the key semantic units to extract syntactic structure features and calculate the semantic relevance between different key semantic units. Based on the semantic relevance, a directed semantic dependency graph is constructed and topologically sorted to determine the semantic dependency relationship between different key semantic units. Finally, the document paragraph content is serialized and fused to obtain a complete medical device document.
2. The method according to claim 1, characterized in that, Collect source information on medical devices and extract entities and relationships to construct a knowledge graph. Perform multi-level heterogeneous graph encoding on the knowledge graph, calculate the neighborhood-weighted representation of each node, and combine contrastive learning to determine the node embedding vector set, including: Medical device source information is collected from medical device technical documents. The source information is segmented to obtain word sequence. Named entity recognition is performed on the word sequence to extract entity set. Relationship extraction is performed on the entities in the entity set to obtain the relationship between entities. A knowledge graph is constructed based on the entity set and the relationship. The nodes in the knowledge graph are hierarchically grouped according to node type to obtain multiple node levels. Graph convolution operation is performed on the nodes in each node level to obtain the node representation within the layer. The node representations of different node levels are aggregated across layers to obtain multi-level heterogeneous graph encoding results. Extract the set of neighboring nodes for each node in the multi-level heterogeneous graph encoding result, perform a weighted summation of the node representations in the set of neighboring nodes to obtain the neighborhood weighted representation of each node, use the neighborhood weighted representation as a positive sample, randomly sample nodes in the knowledge graph to obtain negative samples, calculate the contrast loss between the positive and negative samples and perform backpropagation optimization to obtain the set of node embedding vectors.
3. The method according to claim 1, characterized in that, Cluster analysis of the node embedding vector set is performed to obtain clustering results and construct a hierarchical semantic index, including: The node embedding vectors in the node embedding vector set are normalized to obtain normalized node embedding vectors. The semantic similarity matrix between normalized node embedding vectors is calculated. Based on the semantic similarity matrix, an adjacency graph between nodes is constructed and the adjacency graph is spectral decomposed to obtain a feature subspace. The normalized node embedding vectors are projected into the feature subspace to obtain low-dimensional projection vectors. The density of the low-dimensional projection vectors is estimated to obtain the local density value of each node. Nodes with local density values higher than a preset density threshold are selected as candidate cluster center nodes. Calculate the distance metric between candidate cluster center nodes, perform hierarchical merging of candidate cluster center nodes based on the distance metric to obtain a multi-level cluster center set, and assign the node embedding vectors in the node embedding vector set to the nearest cluster center in the multi-level cluster center set to obtain the clustering result; The semantic center representation of each cluster is calculated based on the node embedding vector of each cluster in the clustering results. The semantic correlation between the semantic center representations is calculated and the hierarchical relationship between the clusters is constructed. The clusters in the hierarchical relationship are arranged in layers from coarse to fine semantic granularity to obtain a hierarchical semantic index.
4. The method according to claim 1, characterized in that, The system receives document generation requests and decomposes the content of the documents to be generated into multiple document paragraph tasks. Based on the document paragraph tasks, it retrieves cluster subsets from a hierarchical semantic index and extracts the task node vectors corresponding to the cluster subsets. A bilinear transformation is then performed on the task node vectors and the semantic representations of the document paragraph tasks to obtain the interaction feature matrix, which includes: Receive document generation requirements and extract document type identifiers. Determine document structure templates based on document type identifiers and divide the content of the document to be generated into multiple paragraph areas. Extract paragraph topics and paragraph functional attributes for each paragraph area and combine paragraph topics and paragraph functional attributes to form document paragraph tasks. Semantic encoding is performed on the document paragraph task to obtain the task query vector. The similarity between the task query vector and the semantic center representation of each level in the hierarchical semantic index is calculated. Starting from the top of the hierarchical semantic index, clusters with similarity higher than the level threshold are filtered layer by layer. The hierarchical semantic index is traversed downward until the bottom cluster is reached to obtain the cluster subset. The node embedding vector contained in the cluster subset is extracted and marked as the task node vector. Text encoding is performed on the document paragraph task to obtain the semantic representation of the document paragraph task. Tensor multiplication is performed on the task node vector and the semantic representation through a preset bilinear transformation matrix to obtain the interaction feature matrix.
5. The method according to claim 1, characterized in that, Singular value decomposition is performed on the interaction feature matrix to extract principal component vectors, and residual concatenation is performed with the task node vectors to obtain a task-specific embedding representation, including: The interaction feature matrix is expanded by rows and columns to obtain a three-dimensional tensor structure. Each slice of the three-dimensional tensor structure is decomposed into low-rank matrices to obtain multiple low-rank approximation matrices. The reconstruction error between each low-rank approximation matrix and the interaction feature matrix is calculated. The low-rank approximation matrix with the smallest reconstruction error is selected as the optimized interaction matrix and then decomposed into singular value matrix to obtain the left singular vector matrix, the singular value diagonal matrix and the right singular vector matrix. The sum of squares of the singular values in the singular value diagonal matrix is calculated as the total energy. The sum of the squares of each singular value is accumulated to obtain the cumulative energy sequence. The position where the ratio of the cumulative energy to the total energy first exceeds the preset retention threshold is selected as the end position. The left and right singular vectors corresponding to the singular values before the end position are extracted and concatenated to obtain the principal component vector. A reference vector set is constructed based on a cluster subset that shares the same origin as the task node vectors. The similarity between the principal component vector and each vector in the reference vector set is calculated and normalized to obtain the attention weight distribution. The reference vector set is then weighted and aggregated based on the attention weight distribution to obtain an adaptive reference vector. Finally, the principal component vector and the adaptive reference vector are residually concatenated to obtain a task-specific embedding representation.
6. The method according to claim 1, characterized in that, Task-specific embedding representations and preset global constraint vectors are added to the preset generation execution path to generate document paragraph content and extract key semantic units. Syntactic dependency analysis is performed on these key semantic units to extract syntactic structural features, and the semantic relevance between different key semantic units is calculated, including: The task-specific embedding representation and the preset global constraint vector are gated and fused to obtain a conditional guidance vector. The conditional guidance vector is decomposed into a semantic control component and a structural control component. The semantic control component is added to the semantic decoding layer of the generated execution path to generate a semantic candidate sequence, and the structural control component is added to the structural decoding layer of the generated execution path to generate a structural candidate sequence. The semantic candidate sequence and the structural candidate sequence are cross-validated to obtain a consistency score. The semantic candidate sequence and the structural candidate sequence with the highest consistency score are selected and combined to obtain the document paragraph content. The document paragraph content is subjected to part-of-speech tagging and named entity recognition. Phrase that simultaneously meets the part-of-speech requirements and entity type requirements corresponding to the document generation requirements is extracted as a key semantic unit. Syntactic dependency analysis is performed on key semantic units to obtain a dependency tree. The dependency tree is traversed to extract the dependency triples corresponding to the key semantic units. Vector encoding is performed on the dependency triples to obtain local syntactic features. Graph convolution aggregation is performed on the local syntactic features of all key semantic units in the document paragraph content to obtain global syntactic features. The local syntactic features and the global syntactic features are fused to obtain syntactic structure features. The vector distance between the syntactic structure features of different key semantic units is calculated and the vector distance is output as the semantic relevance.
7. The method according to claim 1, characterized in that, Based on semantic relevance, a directed semantic dependency graph is constructed and topologically sorted to determine the semantic dependencies between different key semantic units. Then, the document paragraph content is serialized and fused to obtain a complete medical device document, including: The key semantic units are used as nodes to construct an initial semantic dependency graph. Connection edges are established between nodes according to the semantic relevance. The initial semantic dependency graph is encoded by a graph neural network to obtain a node representation matrix. The causal influence strength between any two node representations in the node representation matrix is calculated, and a direction is assigned to each connection edge based on the causal influence strength to obtain directed edges and a directed semantic dependency graph. The information flow contribution corresponding to each directed edge is calculated, and low contribution edges are determined by combining a preset contribution threshold. The low contribution edges are removed from the directed semantic dependency graph, and loop detection is performed. The detected loops are eliminated to obtain a simplified directed semantic dependency graph. A linear permutation sequence is obtained by performing topological sorting on the simplified directed semantic dependency graph. The semantic dependency relationship between two key semantic units directly connected by directed edges in the simplified directed semantic dependency graph is marked as a direct semantic dependency relationship. A hierarchical structure tree is constructed based on the linear permutation sequence. The document paragraphs containing key semantic units with direct semantic dependencies are assigned to the same parent node in the hierarchical structure tree. A parent node summary representation is generated and input into the child node document paragraph content for semantic enhancement. The semantically enhanced document paragraph content is extracted by combining the depth-first traversal order of the hierarchical structure tree and serialized and spliced to obtain the complete medical device document.
8. A multi-agent-based medical device multi-file long text generation system, used to implement the method of any one of claims 1-7, characterized in that, include: The first unit is used to collect source information of medical devices and extract entities and relationships to construct a knowledge graph. The knowledge graph is encoded in a multi-level heterogeneous graph, the neighborhood weighted representation of each node is calculated and the node embedding vector set is determined by contrastive learning, the node embedding vector set is clustered to obtain the clustering results, and a hierarchical semantic index is constructed. The second unit is used to receive document generation requirements and decompose the content of the document to be generated into multiple document paragraph tasks. Based on the document paragraph tasks, it retrieves cluster subsets from the hierarchical semantic index and extracts the task node vectors corresponding to the cluster subsets. It performs bilinear transformation on the task node vectors and the semantic representation of the document paragraph tasks to obtain an interaction feature matrix. It performs singular value decomposition on the interaction feature matrix to extract principal component vectors and performs residual connection with the task node vectors to obtain a task-specific embedding representation. The third unit is used to add task-specific embedded representations and preset global constraint vectors to the preset generation execution path, generate document paragraph content and extract key semantic units, perform syntactic dependency analysis on key semantic units to extract syntactic structure features and calculate the semantic relevance between different key semantic units, construct a directed semantic dependency graph based on semantic relevance and perform topological sorting, determine the semantic dependency relationship between different key semantic units, and perform serialization fusion of document paragraph content to obtain a complete medical device document.
9. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 7.