Real-time health risk prediction method and system based on dynamic knowledge graph

By employing a hierarchical federated learning framework based on dynamic knowledge graphs and lightweight deployment, the privacy and real-time issues in medical data sharing are addressed. This enables cross-institutional health risk prediction, improving the accuracy and real-time performance of predictions, and is suitable for real-time health risk warnings on edge devices.

CN120280136BActive Publication Date: 2026-05-22GERIATRIC HOSPITAL AFFILIATED TO WUHAN UNIVERSITY OF SCIENCE & TECHNOLOGY
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GERIATRIC HOSPITAL AFFILIATED TO WUHAN UNIVERSITY OF SCIENCE & TECHNOLOGY
Filing Date
2025-03-05
Publication Date
2026-05-22

Smart Images

  • Figure CN120280136B_ABST
    Figure CN120280136B_ABST
Patent Text Reader

Abstract

The application discloses a kind of real-time health risk prediction method and system based on dynamic knowledge graph, it is related to medical information technology field.The method includes: multi-modal fusion and privacy protection preprocessing are carried out to medical care heterogeneous data, the semantic consistency of cross-institutional data is realized based on the entity alignment method of cross-modal graph neural network;Based on the hierarchical federated learning framework, the initial global model is generated by hierarchical encryption aggregation local model parameters through secure multi-party computation protocol, and the prediction distribution of global model is optimized in combination with the knowledge distillation of differential privacy constraint;Design noise robust gradient difference dynamic update trigger mechanism, smooth noise interference through sliding window mean, realize adaptive threshold calibration by linkage model performance verification;Redundant edge pruning based on confidence and 8-bit symmetric quantization realize lightweight deployment \ Real-time inference.The application significantly improves the real-time and accuracy of health risk prediction under the premise of protecting data privacy, and is suitable for cross-institutional medical care collaborative decision-making scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical information technology, and more specifically, to a method and system for real-time health risk prediction based on dynamic knowledge graphs. Background Technology

[0002] With the continuous advancement of science and technology, the service methods across all industries are undergoing tremendous changes. More and more intelligent devices are replacing manual services, providing people with more efficient and convenient smart services, and the medical field has always been a focus of attention in this area. Simultaneously, with the widespread adoption of IoT terminal devices in the medical field, various wearable body sensors and medical devices are being applied to medical services. These IoT terminal devices can collect vast amounts of medical data and upload it to remote cloud servers for processing and analysis, providing patients with accurate and rapid medical services. In recent years, with the rapid development of big data and artificial intelligence technologies, machine learning models, especially large-scale models, have demonstrated significant performance advantages in handling complex data analysis tasks. Artificial intelligence has achieved success in fields such as medicine. For example, well-trained machine learning models can assist medical personnel in providing faster and more accurate diagnoses and treatments for diseases. These models typically require large amounts of data for training, but these datasets often contain sensitive information, such as personal identification information, health records, or financial data. For example, patent CN119480112A provides a dynamic adaptive health monitoring method and system utilizing artificial intelligence, relating to the field of health monitoring technology. The method includes: using multi-source heterogeneous health data, employing a hierarchical diffusion probability model for noise reduction and combining it with an improved attention autoencoder to extract preliminary features; then learning discriminative features through a contrastive learning network; inputting the discriminative features into an adaptive wavelet neural network for multi-scale feature decomposition; inputting the decomposed features into a dynamic graph neural network to obtain a health feature tensor; using a hierarchical memory reinforcement network to acquire temporal features; and combining a dynamic routing capsule network and a causal reasoning network to generate a health knowledge graph; inputting the temporal features and the health knowledge graph into a deep Bayesian network for health risk assessment; and finally utilizing a hierarchical reinforcement learning network, combined with a multi-agent collaborative optimization system and a deep deterministic strategy. A gradient network is used to obtain an adaptive monitoring scheme through a model prediction control network. Although a health early warning system based on knowledge graphs is proposed, it does not solve the data privacy problem of multiple institutions. Patent CN119358035A provides a user opinion privacy protection method and system based on federated learning and privacy differential, which involves the field of privacy protection technology. It includes a server receiving client requests, dividing the dataset and distributing it; the client using a differential privacy machine learning algorithm for local training and perturbing the model parameters with Laplace noise; the server using secret sharing and homomorphic encryption technology to aggregate parameters and update the global model; the client receiving the privacy protection policy, processing the user opinions for privacy, and sending them to the server for analysis. Although hierarchical federated learning is used to integrate medical data, it does not combine edge computing, resulting in a serious inference delay problem.

[0003] In summary, existing training methods have several problems when applied in the field of digital healthcare:

[0004] 1. Data silos and privacy conflicts: Data sharing between medical institutions requires strict authorization, and centralized knowledge graphs rely on raw data transmission, which violates privacy regulations;

[0005] 2. Lagging updates: Static knowledge graphs struggle to capture dynamic changes in the health status of the elderly (such as the exacerbation of chronic diseases or sudden falls);

[0006] 3. Insufficient real-time performance: The cloud-based inference mode is affected by network latency and cannot meet the millisecond-level response requirements of emergency scenarios such as falls and heart attacks.

[0007] How to make health risk predictions that balance privacy, real-time performance, and accuracy is a problem that urgently needs to be solved. Summary of the Invention

[0008] The purpose of this invention is to provide a method and system for real-time health risk prediction based on dynamic knowledge graphs, which can improve the privacy, real-time performance and accuracy of health risk prediction.

[0009] This invention provides a real-time health risk prediction method based on dynamic knowledge graphs, comprising the following steps: S1: Preprocessing heterogeneous medical and elderly care data to obtain preprocessed data; S2: Obtaining a global dynamic knowledge graph based on the preprocessed data using a hierarchical federated learning framework; S3: Updating the local knowledge graph embedding models of each institution and the global model based on a noise-robust gradient difference dynamic update mechanism; S4: Performing lightweight deployment based on the global dynamic knowledge graph, the local knowledge graph embedding models of each institution, and the global model to obtain a lightweight knowledge graph model, and using the lightweight knowledge graph model for health risk prediction.

[0010] Further, step S2 specifically includes: S21: Based on the preprocessed data, train the local knowledge graph embedding model of each institution, add Laplace noise that satisfies differential privacy to the gradient, and use the SMPC protocol to encrypt and aggregate the parameters of the local knowledge graph embedding model of each institution in the hierarchical federated learning framework to obtain the initial global model parameters; S22: Based on the initial global model parameters, take the output distribution of the local knowledge graph embedding model of each institution as the teacher signal, use the loss function to minimize the KL divergence loss to optimize the prediction distribution of the global model, and obtain the global dynamic knowledge graph.

[0011] Further, step S21 specifically includes: training the local knowledge graph embedding model of each institution based on the preprocessed data, adding Laplacian noise that satisfies differential privacy to the gradient, and using the SMPC protocol to encrypt and aggregate the parameters of the local knowledge graph embedding model of each institution in a hierarchical federated learning framework to obtain the initial global model parameters, as shown in the formula:

[0012]

[0013] Δf=max‖g i ||1,

[0014] in, The gradient after adding Laplacian noise; g i is the original gradient; Lap(·) represents Laplace distribution sampling, adding Laplace noise to the gradient for differential privacy noise injection to satisfy differential privacy constraints; Δf represents the sensitivity of the model gradient, which is the maximum L1 norm of the gradient of each local model, and ∈ represents the privacy budget.

[0015] Furthermore, the loss function described above is as follows:

[0016]

[0017] Among them, L KL Let P be the loss function, (h,r,t) represent the head entity-relation-tail entity triple in the knowledge graph, and P be the loss function. global and These are the predicted probability distributions of the global model and the i-th local model, respectively.

[0018] Further, step S3 specifically includes: S31: Based on the local knowledge graph embedding model of each institution and the global dynamic knowledge graph, obtain the difference between each local gradient and the global gradient; S32: Based on the difference between each local gradient and the global gradient, use the sliding window mean method to smooth noise interference and obtain the difference measure; S33: Use Bayesian optimization to dynamically adjust the data drift threshold. When the difference measure is greater than the data drift threshold, or when the average F1 score of the validation set in the last 3 rounds decreases by more than a preset proportion, update the global model; otherwise, do not update the global model, only update the local knowledge graph embedding model of each institution.

[0019] Further, step S31 specifically includes: obtaining the differences between each local gradient and the global gradient based on the local knowledge graph embedding model of each institution and the global dynamic knowledge graph, as shown in the formula:

[0020]

[0021] in, The difference between the local gradient and the global gradient of the current i-th mechanism. Let be the local gradient of the i-th institution, and be the global gradient. The gradient parameters are stored for the current global model, and ∥·∥2 represents the L2 norm.

[0022] Further, step S32 specifically includes: based on the differences between each local gradient and the global gradient, smoothing noise interference using the sliding window mean method to obtain a difference measure, as shown in the formula:

[0023]

[0024] Where δ is the difference measure; W is the window size. Let be the gradient difference of the i-th institution in the k-th round of training; t represents the number of training rounds.

[0025] Furthermore, the above-mentioned method of dynamically adjusting the data drift threshold using Bayesian optimization includes: defining the data drift threshold δ. threshold Search space: δ threshold ∈[0.05,0.15], the upper and lower bounds are determined based on the 95th percentile of the historical gradient difference distribution; a Gaussian process is used as a surrogate model, the radial basis function is selected as the kernel function, the expected improvement is used as the acquisition function, and Bayesian optimization is performed using the iteration termination condition and the objective function to obtain the data drift threshold.

[0026] Furthermore, the aforementioned lightweight deployment includes: calculating triple confidence using embedding similarity, pruning redundant edges with confidence values ​​less than a preset confidence value to obtain the pruned global model; compressing the pruned global model using 8-bit symmetric quantization, and dynamically adjusting the scaling factor s through a calibration set to minimize the KL divergence error, as shown in the formula:

[0027]

[0028] Among them, L quant Let P be the KL divergence error. PFP32 (x) and P INT8 (x) represents the floating-point and quantized distributions, respectively.

[0029] This invention also provides a real-time health risk prediction system based on a dynamic knowledge graph. The system includes the following modules: a multi-source data acquisition module, configured to preprocess heterogeneous medical and elderly care data to obtain preprocessed data; a federated knowledge graph construction module, configured to obtain a global dynamic knowledge graph based on the preprocessed data using a hierarchical federated learning framework; a dynamic update module, configured to update the local knowledge graph embedding models of each institution and the global model based on a noise-robust gradient difference dynamic update mechanism; and an edge reasoning module, configured to perform lightweight deployment based on the global dynamic knowledge graph, the local knowledge graph embedding models of each institution, and the global model to obtain a lightweight knowledge graph model, and use the lightweight knowledge graph model for health risk prediction.

[0030] The real-time health risk prediction method and system based on dynamic knowledge graph provided by this invention have the following beneficial effects:

[0031] This invention utilizes a federated knowledge distillation mechanism to achieve multi-institutional knowledge fusion through model parameter distillation while protecting the privacy of original data, thus solving the data silo problem. In particular, the innovative application of "differential privacy DP + knowledge distillation KD" in hierarchical federated learning of knowledge graphs ensures that the addition or subtraction of a single data sample does not significantly affect the model output through noise injection (Lap(·)), satisfying the approximate differential privacy protection requirements of (∈,δ)-DP. Minimizing KL divergence forces the global model to learn the "soft label" knowledge of the local model, avoiding direct sharing of original data or sensitive parameters, thereby achieving knowledge distillation optimization. While solving the problem of heterogeneity of multi-source data, it constructs a dynamic knowledge graph through the dual-engine drive of "federated learning + edge computing," achieving cross-domain data privacy protection and real-time health risk prediction.

[0032] This invention utilizes a dynamic update mechanism based on "L2 norm threshold + differential privacy" to address the issues of inaccurate data drift detection and insufficient privacy protection in existing technologies. Simultaneously, it achieves real-time health risk prediction through lightweight edge inference, forming a complete technological closed loop. Its dynamic event-triggered update mechanism measures data distribution shift using the L2 norm of gradient differences, triggering global model synchronization only when the shift exceeds a threshold. Experimental verification shows that communication overhead is reduced by 60% compared to fixed-period updates. Its core idea is data drift detection and dynamic update triggering. Data drift detection indirectly reflects changes in data distribution across institutions by comparing the gradient direction differences between the local and global models. Dynamic update triggering occurs when δ exceeds a preset threshold, indicating that the data distribution of some institutions has significantly deviated from the global model (e.g., a new disease outbreak, a change in equipment collection mode), requiring triggering. The global model is synchronized; otherwise, local models are updated independently. The theoretical support for this approach lies in the gradient similarity assumption in federated learning. Ideally, the gradient directions of each local model should converge to the global model. Changes in data distribution can cause gradient direction deviations, a phenomenon used in the literature to detect the impact of non-independent and identically distributed (Non-IID) data. A lightweight detection metric is used, leveraging the efficient computation of the L2 norm, which directly reflects vector differences. In contrast, most existing studies use statistics (such as mean / variance) or model performance (such as accuracy decline) to determine data drift, but this requires sharing data or labels, violating privacy requirements. This invention uses gradient difference as a proxy metric, without exposing the original data, and is directly related to model updates. By linking the L2 norm threshold with differential privacy, the risk of dynamic model updates and privacy leaks is balanced.

[0033] This invention utilizes 8-bit quantization and model pruning techniques to reduce the size of the knowledge graph model by 75%, supporting deployment on low-computing-power devices, thereby enabling lightweight edge inference. Its lightweight edge inference ensures real-time performance and forms a closed loop with the dynamic knowledge graph update mechanism.

[0034] The technical advantages of this invention are as follows: First, it features lightweight computation, requiring only the calculation of gradient differences without transmitting raw data or complex statistics, making it suitable for resource-constrained edge devices. Second, it offers privacy protection, as the gradient itself has been processed with differential privacy (DP) noise reduction to avoid leaking sensitive information. Third, it provides adaptive updates: experiments show that compared to fixed-period updates (e.g., once a day), communication overhead is reduced by an average of 60% (supported by experimental data). Experiments also demonstrate that this invention, in terms of privacy, can resist Member Inference Attacks (MIA) with a success rate of <5% (compared to 15% in traditional federated learning). Furthermore, in terms of real-time performance, the end-to-end latency from data input to alert output is <50%. 0ms; In terms of accuracy, the fall risk prediction F1-score reaches 92.3% (compared to 89.7% for centralized models); it can be seen that the present invention has obvious technical synergy: 1. Synergy between SMPC and differential privacy: SMPC protects the parameter transmission process, and differential privacy protects the parameter content, providing double protection for data privacy; 2. Synergistic optimization of pruning and quantization: pruning reduces parameter redundancy, quantization reduces storage and computational overhead, and jointly compresses the model to 10% to 20% of its original size; 3. Closed loop of dynamic threshold and edge inference: data drift detection triggers model updates, and lightweight inference ensures real-time response, forming an adaptive health monitoring system;

[0035] In summary, this invention achieves cross-institutional privacy data fusion through hierarchical federated learning, reduces communication overhead by combining dynamic event-triggered updates, and deploys a lightweight inference engine at the edge to meet real-time early warning requirements. It can improve the privacy, real-time performance, and accuracy of health risk prediction and is suitable for cross-institutional medical and elderly care data privacy protection and real-time risk prediction scenarios. Attached Figure Description

[0036] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings:

[0037] Figure 1 This is a flowchart of the real-time health risk prediction method based on dynamic knowledge graph provided by the present invention;

[0038] Figure 2 This is the overall architecture diagram of the real-time health risk prediction system based on dynamic knowledge graph provided by the present invention;

[0039] Figure 3 This is a graph showing the relationship between pruning rate and accuracy provided by the present invention;

[0040] Figure 4 This is a privacy budget versus leakage risk curve provided by the present invention. Detailed Implementation

[0041] To provide a clearer understanding of the technical features, objectives, and effects of the present invention, specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0042] Figure 1 A schematic diagram of the real-time health risk prediction method based on dynamic knowledge graphs in this embodiment is shown. In this embodiment, the real-time health risk prediction method based on dynamic knowledge graphs includes the following steps:

[0043] S1: Preprocess the heterogeneous medical and elderly care data to obtain preprocessed data;

[0044] In one exemplary embodiment, the sources of heterogeneous medical and elderly care data include hospital data sources, elderly care data sources, and wearable devices; preprocessing includes data anonymization, entity alignment, and multimodal fusion.

[0045] In one exemplary embodiment, data anonymization is performed using a k-anonymization-based privacy protection technique to ensure that individual data is untraceable; entity alignment is performed using a joint embedding learning method based on cross-modal graph neural networks to align medical entities from different institutions; and multimodal fusion is performed by fusing text, image, and sensor data through an attention mechanism to generate standardized structured data.

[0046] As an exemplary embodiment, in step S1, a cross-domain multimodal medical and elderly care data acquisition layer is constructed to receive heterogeneous data from hospitals, nursing homes, and wearable devices. The heterogeneous data includes structured electronic health records (EHRs), time-series sensor data, and unstructured nursing text. Data anonymization is performed using a privacy protection technology based on k-anonymization to ensure that individual data is untraceable. Entity alignment is performed using a joint embedding learning method based on cross-modal graph neural networks (Cross-MM-GNN) to align medical entities (such as "blood pressure" and "BP") from different institutions, with an alignment accuracy of ≥95%. Multimodal fusion is performed by fusing text, image, and sensor data through an attention mechanism to generate standardized structured data.

[0047] S2: Based on the preprocessed data, a global dynamic knowledge graph is obtained using a hierarchical federated learning framework;

[0048] In one exemplary embodiment, step S2 specifically includes:

[0049] S21: Based on the preprocessed data, train the local knowledge graph embedding model of each institution, add Laplacian noise that satisfies differential privacy to the gradient, and use the SMPC protocol to encrypt and aggregate the parameters of the local knowledge graph embedding model of each institution in the hierarchical federated learning framework to obtain the initial global model parameters.

[0050] In an exemplary embodiment, step S21 specifically includes: training the local knowledge graph embedding model of each institution based on the preprocessed data, adding Laplacian noise that satisfies differential privacy to the gradient, and using the SMPC protocol to encrypt and aggregate the parameters of the local knowledge graph embedding model of each institution in a hierarchical federated learning framework to obtain the initial global model parameters, as shown in the formula:

[0051]

[0052] Δf=max‖g i ||1,

[0053] in, The gradient after adding Laplacian noise; g i The original gradient is represented by Lap(·), which represents Laplace distribution sampling. Laplace noise is added to the gradient to perform differential privacy noise injection to meet differential privacy constraints. Δf represents the sensitivity of the model gradient, which is the maximum L1 norm of the gradient of each local model, and ∈ represents the privacy budget.

[0054] As an exemplary embodiment, the privacy budget is no greater than 1.0, i.e. ∈≤1.0; in step S21, each institution locally trains a knowledge graph embedding model (such as TransE), adds Laplacian noise (∈≤1.0) that satisfies differential privacy to the gradient, and uses the SMPC protocol to encrypt and aggregate local parameters in the hierarchical architecture (regional nodes → global nodes) to generate initial global model parameters;

[0055] S22: Based on the initial global model parameters, using the output distribution of the local knowledge graph embedding model of each institution as the teacher signal, the prediction distribution of the global model is optimized by minimizing the KL divergence loss using the loss function, and a global dynamic knowledge graph is obtained.

[0056] In one exemplary embodiment, the loss function is as follows:

[0057]

[0058] Among them, L KL Let P be the loss function, (h,r,t) represent the head entity-relation-tail entity triple in the knowledge graph, and P be the loss function. global and These are the predicted probability distributions of the global model and the i-th local model, respectively.

[0059] As an exemplary embodiment, in step S2, a horizontally layered federated learning framework is adopted. Secure Multi-Party Computation (SMPC) is used to aggregate the local knowledge graphs of each institution under privacy protection, generating a global dynamic knowledge graph. The layered federated learning framework includes a three-layer architecture: an edge node layer, a local server layer, and a global aggregation center. Laplace noise is added to the training gradients of the local knowledge graph embedding models of each institution to satisfy the differential privacy budget ∈ ≤ 1.0. Knowledge distillation technology is used to minimize the KL divergence between the global model and the outputs of each local model, achieving privacy-protected knowledge transfer. First, local model training is performed with differential privacy noise injection. When training the knowledge graph embedding model in a local institution (such as a hospital or nursing home), Laplace noise is added to the gradients to satisfy differential privacy constraints. It should be noted that Secure Multi-Party Computation (SMPC) allows multiple participants to collaboratively complete computational tasks without leaking local data. In federated learning, SMPC is mainly used to protect the parameter aggregation process and prevent gradient or model parameter leakage.

[0060] S3: Based on a noise-robust gradient difference dynamic update mechanism, update the local knowledge graph embedding model and the global model of each institution;

[0061] In one exemplary embodiment, step S3 specifically includes:

[0062] S31: Based on the local knowledge graph embedding model of each institution and the global dynamic knowledge graph, obtain the differences between each local gradient and the global gradient;

[0063] In one exemplary embodiment, step S31 specifically includes: obtaining the difference between each local gradient and the global gradient based on the local knowledge graph embedding model of each institution and the global dynamic knowledge graph, as shown in the formula:

[0064]

[0065] in, The difference between the local gradient and the global gradient of the current i-th mechanism. Let be the local gradient of the i-th institution, and be the global gradient. The gradient parameters are stored for the current global model, where ∥·∥2 represents the L2 norm;

[0066] S32: Based on the differences between local gradients and global gradients, the sliding window mean method is used to smooth out noise interference and obtain a difference measure.

[0067] In one exemplary embodiment, step S32 specifically includes: smoothing noise interference using a sliding window mean method based on the differences between local gradients and global gradients to obtain a difference metric, as shown in the formula:

[0068]

[0069] Where δ is the difference measure; W is the window size. Let be the gradient difference of the i-th institution in the k-th round of training; t represents the number of training rounds;

[0070] As an exemplary embodiment, in this embodiment, the window size W = 5;

[0071] S33: Use Bayesian optimization to dynamically adjust the data drift threshold. When the difference metric is greater than the data drift threshold, or the average F1 score of the validation set in the last 3 rounds decreases by more than a preset proportion, update the global model; otherwise, do not update the global model, only update the local knowledge graph embedding model of each institution.

[0072] In one exemplary embodiment, dynamically adjusting the data drift threshold using Bayesian optimization includes:

[0073] Define the data drift threshold δ threshold Search space: δ threshold ∈[0.05,0.15], with upper and lower bounds determined based on the 95th percentile of the historical gradient difference distribution;

[0074] Using a Gaussian process as a surrogate model, a radial basis function as the kernel function, and the desired improvement as the acquisition function, Bayesian optimization is performed using the iterative termination condition and the objective function to obtain the data drift threshold.

[0075] As an exemplary embodiment, in step S33, dynamically adjusting the data drift threshold using Bayesian optimization includes:

[0076] (1) Define the search space: threshold δ threshold The search space is defined as δ threshold ∈[0.05,0.15], the upper and lower bounds are determined based on the 95th percentile (δ=0.1) of the historical gradient difference distribution;

[0077] (2) Bayesian optimization process:

[0078] 1) Surrogate Model: A Gaussian Process (GP) is used as the surrogate model, and the kernel function is chosen as the Radial Basis Function (RBF).

[0079]

[0080] Where l is the length scale parameter, with an initial value of l = 0.1;

[0081] 2) Acquisition Function: Expected Improvement (EI) is used as the acquisition function to balance exploration and exploitation.

[0082] EI(x)=E[max(f(x)-f(x + ),0],

[0083] Where, f(x) + () represents the current optimal objective function value;

[0084] 3) Iteration termination conditions: maximum number of iterations 50 rounds; or objective function change <1% (i.e., absolute difference between objective function values ​​in two consecutive iterations <0.01);

[0085] 4) The relevant pseudocode is as follows:

[0086]

[0087]

[0088] 5) Objective Function: The objective function is defined as maximizing model performance while constraining the communication frequency.

[0089]

[0090] Where λ = 0.3 is the penalty coefficient;

[0091] The dynamic update trigger condition is "δ>δ" threshold If the mean F1-score of the last 3 rounds of validation sets decreases by ≥5%, a global model update is triggered; otherwise, only the local model is updated.

[0092] The average F1 score of the last three rounds of validation sets refers to the average of the F1 scores obtained by evaluating the model's output using the validation set, the local knowledge graph embedding models of each institution, and the global dynamic knowledge graph.

[0093] S4: Based on the global dynamic knowledge graph, the local knowledge graph embedding models of each institution, and the global model, a lightweight deployment is carried out to obtain a lightweight knowledge graph model, which is then used for health risk prediction.

[0094] In one exemplary embodiment, lightweight deployment includes:

[0095] By using embedding similarity, the confidence of triples is calculated, and redundant edges with confidence less than the preset confidence are pruned to obtain the pruned global model.

[0096] The pruned global model is compressed using 8-bit symmetric quantization, and the scaling factor s is dynamically adjusted through a calibration set to minimize the KL divergence error, as shown in the formula:

[0097]

[0098] Among them, L quant Let P be the KL divergence error. PFP32 (x) and P INT8 (x) represents the floating-point and quantized distributions, respectively;

[0099] In one exemplary embodiment, the default confidence level is set to 0.7;

[0100] As an exemplary embodiment, in step S4, lightweight deployment of the global model includes:

[0101] S41: Based on the embedding similarity, the triple confidence C(h,r,t) = cos(h,t) is calculated. The experiment of pruning redundant edges with confidence <0.7 shows that the accuracy loss is ≤3% when the pruning rate is 40%.

[0102] S42: Employs an 8-bit symmetric quantization (INT8) compression model, dynamically adjusting the scaling factor s through a calibration set to minimize the KL divergence error.

[0103]

[0104] Where s is the scaling factor, and PFP32 and PINT8 are the floating-point and quantized distributions, respectively;

[0105] S43: Deploy lightweight models on edge devices (such as NVIDIA Jetson Nano) to enable real-time prediction of health risks with end-to-end latency of <500ms.

[0106] As another exemplary embodiment, the global model is subjected to 8-bit integer quantization and redundant edge pruning. First, redundant edges are pruned from the global model (confidence < 0.7), and then the pruned model is subjected to 8-bit symmetric quantization to reduce accuracy loss. A symmetric quantization method is used to map the FP32 parameters to the INT8 range (-128 to 127), and the quantization error is fine-tuned using a calibration set.

[0107] The pruning criteria and quantification method of this embodiment are described below. For the pruning criteria, structured channel pruning is adopted, and channels to be retained are selected based on weighted importance scores. The importance score is as follows:

[0108]

[0109] The above formula represents the sum of the absolute values ​​of the weights within a channel; generally, the k% channels with the lowest scores are removed (e.g., k = 30%).

[0110] Gradient significance pruning refers to optimizing pruning decisions by incorporating gradient information, as shown in the formula:

[0111]

[0112] The quantization method and calibration of this embodiment are described below. This embodiment uses symmetric quantization (INT8), and its calibration range is determined by scaling factors based on the maximum value max(|w|) statistically analyzed from the training data, as shown in the formula:

[0113]

[0114] The quantification formula is as follows:

[0115] w int8 =round(w fp32 )·s,

[0116] Inverse quantization is shown in the formula:

[0117]

[0118] The calibration optimization uses KL divergence to minimize the difference in distribution before and after quantization, as shown in the formula:

[0119] min s KL(P fp32 ||P int8 );

[0120] In one exemplary embodiment, edge-lightweight inference, i.e., real-time optimization, is implemented through the following methods: First, model compression techniques are employed. Regarding pruning, its principle is to reduce the number of model parameters and computational cost by removing redundant neurons or connections in the neural network (such as channels with weights close to zero). The implementation methods are: structured pruning: removing the entire convolutional kernel or channel, maintaining a hardware-friendly computational structure; unstructured pruning: removing individual weight parameters, requiring sparse computation library support. A balance is struck between compression ratio and accuracy. In one experimental example, channel pruning was performed on the ResNet-18 model, removing 30% of the convolutional channels: the number of parameters decreased by 45% (from 11.7M to 6.4M); inference speed increased by 50% (CPU latency decreased from 120ms to 60ms); and accuracy loss was controlled within 3% (Top-1). Accuracy decreased from 70.2% to 68.5%. Quantization works by converting model parameters and activation values ​​from 32-bit floating-point numbers (FP32) to a lower-precision format (e.g., 8-bit integers INT8), reducing memory usage and computational overhead. Implementation methods include: Static quantization: offline calibration of the quantization range, suitable for deploying fixed models; Dynamic quantization: dynamic adjustment of quantization parameters at runtime to adapt to changes in input data; Compression ratio and accuracy are balanced: the formula for quantization bit width selection is based on signal-to-noise ratio (SNR) optimization. In one experimental example, quantizing an FP32 model to INT8 reduced the model size by 75% (from 100MB to 25MB); inference speed increased by 4x (GPU latency decreased from 50ms to 12ms); accuracy loss was ≤1% (classification task accuracy decreased from 92.1% to 91.5%).

[0121] It should be noted that the principle of knowledge distillation is as follows: a large teacher model (such as BERT) is used to guide the training of a small student model, and knowledge is transferred through soft labels to improve the performance of the small model. Considering the balance between compression ratio and accuracy, in one experimental example, BERT-base (110M parameters) was distilled into TinyBERT (14M parameters), reducing the model size by 87%; the inference speed was improved by 6 times (from 200ms to 33ms); and the accuracy was reduced by 8% (GLUE benchmark score decreased from 78.5 to 72.3).

[0122] The real-time inference process is described below. First, dynamic knowledge graph reception and preprocessing are performed. Data reception: Edge nodes receive the dynamic knowledge graph (JSON format) from the central server via MQTT / HTTP protocol. Local caching mechanisms include: Caching strategy: using the LRU (Least Recently Used) algorithm to retain frequently accessed sub-graphs; Cache capacity: dynamically adjusted according to device memory limitations (e.g., medical sensors retain the latest 100 health events). Data preprocessing includes: Entity alignment: matching local sensor data with knowledge graph entities (e.g., associating patient IDs); Feature normalization: standardizing numerical features (e.g., heart rate, blood pressure). Mean-variance normalization is performed; then lightweight model loading and inference are performed, including: Model loading: loading a pre-compressed lightweight model (such as a pruned and quantized ONNX format model) from local storage; Memory usage optimization: using memory mapping technology to avoid loading all model parameters; Parallel computing optimization: GPU acceleration, using CUDA cores to perform parallel computation of convolution and matrix operations (such as batch size = 16); Multi-threaded inference: splitting tasks into multiple threads on the CPU side (such as OpenMP parallelization); Inference execution: Input: pre-processed dynamic knowledge graph fragments (such as real-time patient vital signs data); Output: health risk prediction results (such as the probability of heart attack).

[0123] In one exemplary embodiment, real-time monitoring of a medical edge device, specifically a portable electrocardiogram (ECG) monitor (edge ​​node), is performed. The task is to predict the risk of arrhythmia in patients in real time. During model deployment, a lightweight CNN model (8MB in size) with pruning (removing 40% of channels) and INT8 quantization is used. During inference, real-time ECG signals (500Hz sampling rate) are received, and the most recent 10 seconds of data are retained through local caching. GPU-accelerated inference (NVIDIA Jetson Nano) has a latency of 15ms. The results are transmitted to the doctor's terminal via BLE with a latency of 5ms. Performance metrics are: end-to-end latency: 20ms; accuracy: 95% (compared to 97% of the original model); device temperature: ≤45℃ (no risk of overheating). The following technical effects can be observed: efficient compression, with a combination of pruning, quantization, and distillation strategies, achieving a model size reduction of over 80% with controllable accuracy loss; low-latency inference, with GPU acceleration and multi-threading optimization, achieving an end-to-end latency of ≤50ms; and resource adaptation, with dynamic caching and memory mapping technology, adapting to different edge hardware resources.

[0124] As an exemplary embodiment, in step S4, a lightweight knowledge graph inference module is deployed at the edge, which uses a temporal graph convolutional network (TGCN) to predict health risks from real-time sensor data and outputs risk levels and warning signals. This mainly includes: performing 8-bit integer quantization (INT8) and redundant edge pruning (confidence <0.7) on the global knowledge graph embedding to generate a lightweight graph model; and deploying a real-time warning interface based on the MQTT protocol. When the risk score Rt exceeds the dynamic calibration threshold θ, an alarm message is pushed to the nursing staff terminal, and the response latency has been verified to be less than 500ms.

[0125] This embodiment provides a real-time health risk prediction system based on dynamic knowledge graphs. The system includes the following modules:

[0126] The multi-source data acquisition module is configured to preprocess heterogeneous medical and elderly care data to obtain preprocessed data; the federated knowledge graph construction module is configured to obtain a global dynamic knowledge graph based on the preprocessed data using a hierarchical federated learning framework; the dynamic update module is configured to update the local knowledge graph embedding model of each institution and the global model based on a noise-robust gradient difference dynamic update mechanism; and the edge reasoning module is configured to perform lightweight deployment based on the global dynamic knowledge graph, the local knowledge graph embedding model of each institution, and the global model to obtain a lightweight knowledge graph model, and use the lightweight knowledge graph model for health risk prediction.

[0127] As an exemplary embodiment, the real-time health risk prediction system based on dynamic knowledge graphs can also be implemented in the following manner. In this embodiment, the overall architecture of the real-time health risk prediction system based on dynamic knowledge graphs is as follows: Figure 2 As shown, the edge node layer is responsible for local model training, the local server layer performs noise injection and gradient uploading, and the global aggregation center achieves parameter aggregation through secure multi-party computation. The system specifically includes: a multi-source data acquisition module for interfacing with hospital HIS systems, nursing home management platforms, and wearable device APIs; a federated knowledge graph construction module for supporting local model training, global parameter aggregation, and conflict resolution; an edge inference engine integrated into edge computing devices (such as Raspberry Pi and edge servers) for real-time risk prediction; and a visual interactive interface providing health status graph display, risk history backtracking, and early warning log management functions.

[0128] In an exemplary embodiment, the above-described real-time health risk prediction system based on dynamic knowledge graphs can be implemented in the following manner; in this embodiment, the collaboration between hierarchical federated learning and knowledge distillation includes:

[0129] (1) Federation Aggregation (SMPC): Local model parameters are aggregated in layers through secure multi-party computation protocol to ensure privacy of parameter transmission; regional nodes use Shamir secret sharing fragmentation (threshold t=3), and global nodes recover complete parameters through Beaver triplet protocol. In this embodiment, communication overhead is reduced by 40% (from 1200MB / month to 720MB / month).

[0130] (2) Using the noisy output distribution of each local model as the teacher signal, the global model prediction distribution is optimized by minimizing the KL divergence loss, as shown in the formula:

[0131]

[0132] In this embodiment, the risk of privacy leakage after noise distillation is reduced from 15% to 2%, and the F1-score is improved by 3.2% (89.7% → 92.3%).

[0133] (3) Noise injection and secure aggregation: Laplace noise (∈=0.5) is added to the gradient, combined with Rényi differential privacy (RDP) noise (α=2, ∈=0.3, δ=10). -5 ), ensuring the total privacy budget ∈ total =0.8≤1.0; where α∈(0,1)∪(1,+∞) is the order parameter, used to control the sensitivity to distribution differences;

[0134] In this embodiment, the noise-robust dynamic update mechanism includes:

[0135] (1) Gradient difference metric: Calculate the local gradients. With global gradient The L2 norm difference is shown in the formula:

[0136]

[0137] (2) Sliding window smoothing: A sliding window mean method with a window size W=5 is used to smooth noise interference and calculate the difference metric, as shown in the formula:

[0138]

[0139] (3) Bayesian optimization dynamic adjustment: maximizing model performance and constraining communication frequency, as shown in the formula:

[0140]

[0141] Where λ = 0.3 is the penalty coefficient; the maximum number of iterations is 50 rounds, or the objective function change is <1%;

[0142] (4) Triggering condition priority: When the mean F1-score of the validation set in the last 3 rounds decreases by ≥5%, the global model update is triggered immediately with an end-to-end delay of <200ms;

[0143] In this embodiment, lightweight edge deployment includes:

[0144] (1) Redundant edge pruning: Dynamic pruning based on triplet confidence C(h,r,t)=cos(h,t) with a threshold of 0.7 achieves the optimal balance between pruning rate (40%), accuracy loss (≤2.8%) and critical path retention rate (98%).

[0145] (2) INT8 quantization: The scaling factor s is dynamically adjusted through the calibration set to minimize the KL divergence error between the FP32 and INT8 distributions.

[0146]

[0147] In this embodiment, the number of model parameters is reduced by 45% after quantization (1.2M→0.66M), the inference speed is increased by 4 times (60ms→15ms), and the end-to-end latency is <30ms.

[0148] In an exemplary embodiment, the above-described real-time health risk prediction system based on dynamic knowledge graphs can be implemented in the following manner; in this embodiment, the federated learning and knowledge distillation collaborative process is as follows: During the cross-institutional data alignment and privacy enhancement process, it includes:

[0149] (1) Cross-modal entity alignment and collaborative k-anonymization: A cross-institutional coordination mechanism is adopted: each medical institution (A / B / C) adopts a unified equivalence class partitioning rule and defines core sensitive fields (such as age ±5 years, blood pressure ±10 mmHg) as anonymization benchmarks to ensure that cross-institutional data meets semantic consistency after k-anonymization (k=5); for example, the data of "hypertension" patients from different institutions are uniformly divided into the equivalence class of age: 50-60 years old, systolic blood pressure: 140-160 mmHg, age: 50-60 years old; Anti-re-identification attack test: Re-identification attack is simulated by generative adversarial network (GAN). In this embodiment, after injecting 10% adversarial samples, the re-identification probability of the secondary desensitized data increases from 0.8% to 1.2%, which is significantly lower than the baseline method (12%→15%).

[0150] (2) Local Training and Privacy Budget Management: Gradient Noise Injection: Each institution trains the TransE model locally, adding Laplacian noise (∈=0.5) to the gradient. The sensitivity Δf is defined as the maximum value of the L1 norm of the gradient: Δf=max‖g i1. The noise intensity is Lap(Δf / ∈), ensuring that the privacy leakage risk of a single training session is ≤1%; cumulative privacy budget control is implemented: for gradient noise, the privacy budget for a single training session ∈ gradient = 0.5; for knowledge distillation noise, the privacy budget for a single distillation session ∈ distillation = 0.3; for the total budget, after 100 training sessions, the total privacy budget is calculated using the Moments Accountant method: ∈total = ∈ gradient + ∈ distillation = 0.5 + 0.3 = 0.8 ≤ 1.0; for compliance proof, the differential privacy constraint (∈ ≤ 1.0) is satisfied.

[0151] In this embodiment, the hierarchical secure aggregation and privacy-enhancing distillation includes:

[0152] (1) Hierarchical federated aggregation and Byzantine fault tolerance: Secure aggregation of regional nodes: The parameters of each institution are shared in secret fragments through Shamir (threshold t=3). Regional nodes adopt the BFT-SMaRt protocol to achieve Byzantine fault tolerance aggregation, which can tolerate malicious nodes with f=1 (such as parameter tampering). Experiments show that after introducing BFT-SMaRt, the communication latency increases by 12% (from 230ms to 258ms), but the success rate of malicious attacks decreases from 18% to 0%. Global aggregation optimization: Global nodes recover the complete model parameters based on intermediate parameters through the Beaver triplet protocol, and the computational efficiency is improved by 15% (from 320ms to 272ms).

[0153] (2) Differential Privacy Knowledge Distillation: Teacher Signal Noiseing: Adding Rényi Differential Privacy (RDP) noise (α=2, ∈=0.3, δ=10) to the local model output distribution. -5 The noise intensity σ = 0.1 satisfies the (∈,δ)-differential privacy constraint; global model optimization: optimize the global model by minimizing the KL divergence loss. Experiments show that after noise distillation, the risk of privacy leakage decreased from 15% to 2%, and the F1-score improved by 3.2% (89.7% → 92.3%), as shown in Table 1:

[0154] Table 1: Privacy-Performance Balance Verification Table

[0155]

[0156] This embodiment conducts a dynamic threshold calibration experiment, including:

[0157] (1) Forced triggering mechanism and response time verification: The dynamic update trigger condition is "F1-score decrease priority", that is, when the mean F1-score of the validation set decreases by ≥5% in the last 3 rounds, the global model update is triggered immediately, regardless of whether the gradient difference (δ) reaches the threshold; if only δ>δ thresholdIf the F1-score does not decrease, updates are performed as needed to avoid invalid communication; model performance degradation due to noise interference or gradient difference delays is avoided, prioritizing the prediction accuracy of high-risk medical events; real-time monitoring data streams of myocardial infarction patients are simulated, injecting sudden abnormal signs (such as ST-segment elevation, sudden drop in heart rate), and the end-to-end latency from F1-score decline detection to model update is tested. The forced triggering mechanism compresses the response time to <200ms, while improving the F1-score by 2.9%, meeting the needs of emergency scenarios, as shown in Table 2;

[0158] Table 2: Comparison of Latency and F1 Score

[0159] Scene Triggering conditions End-to-end delay F1 score Heart attack warning (mandatory trigger) F1 decreased by ≥5% 182ms 93.10% Heart attack warning (not mandatory) δ>0.1 and F1 decreases by ≥5% 245ms 90.20%

[0160] (2) Dynamic adjustment optimization: Perform objective function and Bayesian optimization: maximize model performance and constrain communication frequency. The objective function is defined as: Where λ = 0.3 is the penalty coefficient, balancing accuracy and efficiency; experiments show that in the search space δ threshold ∈

[0161] Within the range of [0.05, 0.15], the Gaussian process surrogate model is iterated for 50 rounds until it converges to the optimal threshold δ. threshold =0.08, as shown in Table 3;

[0162] Table 3: Performance Comparison Table

[0163] index Historical data method (δ = 0.1) Dynamic adjustment method (λ=0.3) Communication frequency Once a day On average once every 3 days Communication overhead (MB / month) 1200 480(↓60%) F1 score (normal) 89.70% 92.3% (loss ≤ 3.4%) F1-score (Heart Attack Warning) 90.20% 93.10% End-to-end delay (forced trigger) 245ms 182ms

[0164] The robustness test results for multiple scenarios are shown in Table 4.

[0165] Table 4: Multi-scenario Robustness Test Results

[0166]

[0167]

[0168] Extreme scenario testing: Under high noise (σ=0.2) and network jitter (packet loss rate of 10%), the forced triggering mechanism still maintains an end-to-end latency of <200ms and a false trigger rate of ≤12%;

[0169] Validation in resource-constrained environments: In Jetson Nano's low-power mode, the dynamic adjustment method maintained an F1-score ≥ 90%, and the communication frequency was reduced to once every 3 days;

[0170] The effects of lightweight deployment are as follows:

[0171] (1) Pruning Threshold Optimization and Critical Path Protection: Redundant edges are dynamically pruned based on triplet confidence (C(h,r,t)=cos(h,t)). The confidence threshold is optimized through ablation experiments. A threshold of 0.7 achieves the optimal balance between pruning rate (40%), accuracy loss (≤2.8%), and critical edge retention rate (98%). A lower confidence limit (C≥0.8) is set for high-risk medical-related edges (such as "hypertension → myocardial infarction") to force the retention of such edges. Experiments show that this mechanism reduces the critical edge loss rate from 15% to 2%. Threshold ablation experimental data are shown in Table 5.

[0172] Table 5: Threshold Ablation Experimental Data Table

[0173]

[0174] Knowledge graph topology analysis: Based on medical expert annotations, 10 high-risk paths (such as "hypertension → myocardial infarction") were defined, and the integrity of the paths after pruning was evaluated. Experiments show that a threshold of 0.7 achieves the optimal balance between pruning efficiency and retention of key medical associations, as shown in Table 6.

[0175] Table 6: Comparison Table of Threshold, Pruning Rate, and Critical Path Retention Rate

[0176] threshold Pruning rate Critical path retention rate 0.6 52% 92% 0.7 40% 98% 0.8 30% 99%

[0177] (2) Stability testing of the quantization model under extreme data

[0178] Extreme data injection experiment: 10% of abnormal vital signs data (such as systolic blood pressure >200 mmHg, heart rate <30 beats / min) were injected into the test set to evaluate the robustness of the quantification model; the results show that KL divergence calibration is more stable under extreme data, and the accuracy loss is significantly lower than that of the maximum calibration method (1.4% vs. 8.7%), as shown in Table 7.

[0179] Table 7: Stability Test Table of Quantization Model under Extreme Data

[0180] Model version Normal data F1 score Abnormal data F1 score Accuracy loss FP32 (Original) 92.30% 85.60% 6.70% INT8 (KL calibration) 89.10% 84.20% 1.40% INT8 (Maximum Calibration) 88.50% 79.80% 8.70%

[0181] Dynamic range adjustment strategy: The 99.9th percentile cutoff method is used to avoid the amplification of quantization error caused by extreme values ​​(such as systolic blood pressure >200mmHg); the calibration set includes 5% outlier data to ensure the dynamic adaptability of the scaling factor s.

[0182] (3) The performance comparison of joint optimization is shown in Table 8;

[0183] Table 8: Performance Comparison of Joint Optimization

[0184] index Original model (FP32) Pruning + Quantization Model (INT8) Parameters 1.2M 0.66M(↓45%) Inference speed (ms / sample) 60 15(↑4 times) F1 score (normal) 92.30% 89.1% (loss ≤ 3.4%) F1 score (abnormal) 85.60% 84.2% (loss ≤ 1.4%) End-to-end delay 75ms 30ms Critical path retention rate 100% 98%

[0185] (4) INT8 quantization: The scaling factor s is dynamically adjusted through the calibration set, and the objective function is to minimize the KL divergence error between the FP32 and INT8 distributions: L quant =∑ x P PFP32 (x)log(P PFP32 (x) / P INT8 (x)), experiments show that when L quant When the value is <0.1, the accuracy loss of the quantized model is controllable (≤3.4%); percentile calibration (99.9% cutoff) is used to avoid the amplification of quantization error caused by extreme values ​​(such as abnormal blood pressure values); 10% of abnormal vital sign data (such as systolic blood pressure >200 mmHg or heart rate <30 beats / min) are injected into the test set, as shown in Table 9;

[0186] Table 9: Comparison of F1 scores for different models

[0187] Model version Normal data F1 score Abnormal data F1 score FP32 (Original) 92.30% 85.60% INT8 (KL calibration) 89.10% 84.2% (loss ≤ 1.4%) INT8 (Maximum Calibration) 88.50% 79.8% (loss ≥ 5.8%)

[0188] KL divergence calibration is more stable under abnormal data, and the accuracy loss is significantly lower than that of the maximum calibration method, as shown in Table 10.

[0189] Table 10: Performance Comparison of Joint Optimization

[0190]

[0191]

[0192] The relationship between pruning rate and accuracy is shown in the figure below. Figure 3 As shown, the privacy budget and leakage risk curves are as follows: Figure 4 As shown, this embodiment achieves a 4x increase in inference speed (60ms → 15ms) and a 50% reduction in power consumption on Jetson Nano, making it suitable for resource-constrained medical edge devices.

[0193] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims. All of these forms are within the protection scope of the present invention.

Claims

1. A real-time health risk prediction method based on dynamic knowledge graph, characterized in that, Includes the following steps: S1: Preprocess the heterogeneous medical and elderly care data to obtain preprocessed data. The sources of the heterogeneous medical and elderly care data include hospital data sources, elderly care data sources, and wearable devices. S2: Based on the preprocessed data, a global dynamic knowledge graph is obtained using a hierarchical federated learning framework, specifically including: S21: Based on the preprocessed data, train the local knowledge graph embedding model of each institution, add Laplace noise that satisfies differential privacy to the gradient, and use the SMPC protocol to encrypt and aggregate the parameters of the local knowledge graph embedding model of each institution in the hierarchical federated learning framework to obtain the initial global model parameters. S22: Based on the initial global model parameters, using the output distribution of the local knowledge graph embedding model of each institution as the teacher signal, the prediction distribution of the global model is optimized by minimizing the KL divergence loss using the loss function, and a global dynamic knowledge graph is obtained. S3: A noise-robust gradient difference dynamic update mechanism is used to update the local knowledge graph embedding model and the global model of each institution, specifically including: S31: Based on the local knowledge graph embedding model of each institution and the global dynamic knowledge graph, obtain the differences between each local gradient and the global gradient; S32: Based on the differences between the local gradients and the global gradients, the noise interference is smoothed using the sliding window mean method to obtain the difference measure; S33: Use Bayesian optimization to dynamically adjust the data drift threshold. When the difference metric is greater than the data drift threshold, or the average F1 score of the validation set in the last 3 rounds decreases by more than a preset proportion, update the global model; otherwise, do not update the global model, only update the local knowledge graph embedding model of each institution. S4: Based on the global dynamic knowledge graph, the local knowledge graph embedding models of each institution, and the global model, a lightweight deployment is performed to obtain a lightweight graph model. The lightweight graph model is then used for health risk prediction, including: firstly, receiving and preprocessing the knowledge graph, including entity alignment and feature normalization; then loading and inferring the lightweight model to output the health risk prediction results.

2. The real-time health risk prediction method based on dynamic knowledge graph according to claim 1, characterized in that, Step S21 specifically includes: training the local knowledge graph embedding model of each institution based on the preprocessed data, adding Laplacian noise that satisfies differential privacy to the gradient, and using the SMPC protocol to encrypt and aggregate the parameters of the local knowledge graph embedding model of each institution in a hierarchical federated learning framework to obtain the initial global model parameters, as shown in the following formula: , , in, The gradient after adding Laplacian noise; This is the original gradient; ( () indicates Laplace distribution sampling, and differential privacy noise injection is performed by adding Laplace noise to the gradient to satisfy differential privacy constraints; This represents the sensitivity of the model gradient, which is the maximum L1 norm of the gradients of each local model. Budget for privacy.

3. The real-time health risk prediction method based on dynamic knowledge graph according to claim 1, characterized in that, The formula for calculating the loss function in step S22 is as follows: , in, For loss function, This represents the head entity-relation-tail entity triple in a knowledge graph. and The global model and the first The predicted probability distribution of a local model.

4. The real-time health risk prediction method based on dynamic knowledge graph according to claim 1, characterized in that, Step S31 specifically includes: obtaining the differences between local gradients and global gradients based on the local knowledge graph embedding models of each institution and the global dynamic knowledge graph, as shown in the following formula: , in, For the current number The difference between local and global gradients for each institution For the first Local gradient of an institution, global gradient The gradient parameters saved for the current global model. This represents the L2 norm.

5. The real-time health risk prediction method based on dynamic knowledge graph according to claim 1, characterized in that, Step S32 specifically includes: based on the differences between the local gradients and the global gradients, smoothing out noise interference using the sliding window mean method to obtain a difference metric, as shown in the following formula: , in, For measuring differences; For window size, For the first The gradient difference of the k-th round of training for each institution; Indicates the number of training rounds.

6. The real-time health risk prediction method based on dynamic knowledge graph according to claim 1, characterized in that, Step S33, which involves dynamically adjusting the data drift threshold using Bayesian optimization, includes: Define data drift threshold Search space: The upper and lower bounds are determined based on the 95th percentile of the historical gradient difference distribution; Using a Gaussian process as a surrogate model, a radial basis function as the kernel function, and the desired improvement as the acquisition function, Bayesian optimization is performed using the iterative termination condition and the objective function to obtain the data drift threshold.

7. The real-time health risk prediction method based on dynamic knowledge graph according to claim 1, characterized in that, The lightweight deployment described in step S4 includes: By using embedding similarity, the confidence of triples is calculated, and redundant edges with confidence less than the preset confidence are pruned to obtain the pruned global model. The pruned global model is compressed using 8-bit symmetric quantization, and the scaling factor s is dynamically adjusted using a calibration set to minimize the KL divergence error, as shown in the following formula: , in, For KL divergence error, and These are the floating-point and quantized distributions, respectively.

8. A real-time health risk prediction system based on dynamic knowledge graph, characterized in that, The system is used for the real-time health risk prediction method based on dynamic knowledge graph as described in any one of claims 1-7, and includes the following modules: The multi-source data acquisition module is configured to preprocess heterogeneous medical and elderly care data to obtain preprocessed data. The federated knowledge graph construction module is configured to: obtain a global dynamic knowledge graph based on the preprocessed data using a hierarchical federated learning framework, specifically including: Based on the preprocessed data, the local knowledge graph embedding models of each institution are trained, Laplace noise that satisfies differential privacy is added to the gradient, and the parameters of the local knowledge graph embedding models of each institution are encrypted and aggregated in a hierarchical federated learning framework using the SMPC protocol to obtain the initial global model parameters. Based on the initial global model parameters, using the output distribution of the local knowledge graph embedding model of each institution as the teacher signal, the prediction distribution of the global model is optimized by minimizing the KL divergence loss using the loss function, thus obtaining the global dynamic knowledge graph; The dynamic update module is configured as follows: Based on a noise-robust gradient difference dynamic update mechanism, it updates the local knowledge graph embedding model and the global model for each institution, specifically including: Based on the local knowledge graph embedding model of each institution and the global dynamic knowledge graph, the differences between each local gradient and the global gradient are obtained; Based on the differences between the local gradients and the global gradients, the noise interference is smoothed using the sliding window mean method to obtain the difference measure; The data drift threshold is dynamically adjusted using Bayesian optimization. When the difference metric is greater than the data drift threshold, or when the average F1 score of the validation set in the last three rounds decreases by more than a preset proportion, the global model is updated; otherwise, the global model is not updated, and only the local knowledge graph embedding model of each institution is updated. The edge reasoning module is configured to: perform lightweight deployment based on the global dynamic knowledge graph, the local knowledge graph embedding models of each institution, and the global model to obtain a lightweight knowledge graph model; and use the lightweight knowledge graph model to perform health risk prediction, including: first, receiving and preprocessing the knowledge graph, including entity alignment and feature normalization; then, loading and reasoning the lightweight model to output the health risk prediction result.