Federated learning method, system and medium based on multi-agent and knowledge distillation
Through the federated learning method of multi-agents and knowledge distillation, problems such as model drift and communication overhead in the medical Internet of Things are solved, efficient and secure knowledge sharing and personalized model training are achieved, and the performance and security of the model in a heterogeneous data environment are improved.
Patent Information
- Application Number
- CN202510855313.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2045-06-25
AI Technical Summary
In the medical IoT scenario, existing federated learning has model drift problems caused by non-independent and homogeneous distribution of data, large communication overhead, and risk of dependence on central servers, which affect model accuracy and security.
The federated learning method based on multi-agents and knowledge distillation is adopted to achieve adaptive selection and efficient sharing of knowledge through decoupling of knowledge distillation, blockchain decentralized sharing and large-language model-driven personalized knowledge management, which can reduce communication overhead and improve the convergence speed and personalization level of the model in a heterogeneous data environment.
It significantly improves the convergence speed and personalization level of the model in a heterogeneous data environment, reduces communication overhead, and enhances data security and user trust through decentralized mechanisms.
Smart Images

Figure CN120354255B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of federated learning technology, and in particular to a federated learning method, system, and medium based on multi-agent and knowledge distillation. Background Art
[0002] In consumer-facing medical IoT scenarios, patients increasingly rely on wearable devices, home health monitors, and remote diagnosis and treatment platforms for daily health management. These devices continuously generate a large amount of personal health data, including highly sensitive information such as heart rate, blood sugar, exercise trajectory, and medical history. Consumers are most concerned about whether this data, once uploaded to the cloud or third-party servers, could be misused by unauthorized parties. This is especially true during remote diagnosis and treatment or online consultations, where patients are often required to submit detailed health reports and real-time monitoring records. Inadequate platform security can lead to privacy breaches and identity theft. These concerns about data security and privacy protection have become a significant barrier to the widespread adoption of the medical IoT.
[0003] To balance data utilization and privacy protection, federated learning, as a distributed training paradigm, has gradually become a hot topic in the industry. Federated learning allows participating devices to complete model training locally, uploading only model updates rather than raw data, thereby reducing the risk of sensitive information exposure. In medical IoT scenarios, by storing patient data locally on devices (such as wearable devices or home monitoring gateways) and regularly uploading local model parameters to the cloud or collaborating with other devices, cross-institutional collaborative diagnosis and prediction can be achieved while alleviating patients' concerns about privacy leaks.
[0004] However, the diversity and variability of data collected by various terminal devices can lead to significant non-IID issues. Each user's physiological condition, lifestyle, device brand and model, and sensor calibration methods vary. When these devices independently train models locally, the model parameters become highly dependent on the sample distribution of the device. If these local model parameters, which are biased towards their own distribution, are simply averaged, the global model will struggle to maintain high accuracy across any data distribution, leading to inaccurate predictions for certain groups (such as those in specific age groups or with unique lifestyles).
[0005] Secondly, the communication overhead of federated learning is particularly significant in medical IoT scenarios. Devices like wearable devices and home monitoring gateways have limited bandwidth and require constant online monitoring. Frequently uploading model updates containing millions or even tens of millions of parameters consumes significant network resources, leading to bandwidth congestion and transmission delays. Because these devices often rely on home Wi-Fi or cellular networks, network fluctuations can make large-scale parameter synchronization more unstable, even leading to disconnections and retransmissions, further slowing model training progress.
[0006] Thirdly, the risks of relying on a centralized server for model aggregation are particularly pronounced in the context of the Medical IoT. Medical data is highly sensitive and private. If a centralized server is attacked or misconfigured, it could lead to the leakage of health records of thousands of users, potentially triggering serious legal and regulatory consequences. Furthermore, centralized processing of highly concurrent model aggregation tasks by a centralized server can easily become a performance bottleneck or a single point of failure. A downtime can disrupt the entire collaborative training and diagnosis process. Given the already strong consumer concerns about health privacy, the potential risks of this centralized architecture further exacerbate the lack of trust in Medical IoT services. Summary of the Invention
[0007] The technical problem to be solved by this application is to overcome the shortcomings of the existing technology. This application provides a federated learning method, system and medium based on multi-agent and knowledge distillation, which realizes personalized selection, adaptive filtering and efficient sharing of knowledge in the federated learning process, effectively alleviates the client drift phenomenon caused by the non-independent and identically distributed characteristics of data, significantly improves the convergence speed, overall performance and personalization level of the model in heterogeneous data environments, and is committed to optimizing the communication overhead between clients.
[0008] To achieve the above objectives, the first aspect of the present application provides a federated learning method based on multi-agent and knowledge distillation, comprising the following steps:
[0009] S1. Train local model:
[0010] Use the collected personal health data to independently train a local model to generate a teacher model that can be used for knowledge distillation and a student model for receiving external knowledge distillation learning;
[0011] S2. Knowledge distillation based on decoupling:
[0012] Extract standardized distilled knowledge fragments from the teacher model trained in S1. The knowledge distillation process decouples the knowledge production step from the knowledge learning step.
[0013] S3. Decentralized knowledge sharing based on blockchain:
[0014] The standardized distilled knowledge fragments extracted by S2 and their metadata are encapsulated into blockchain transactions and submitted to the blockchain network. The legitimacy of the transactions is verified and written into the blockchain ledger to achieve decentralized distribution.
[0015] S4. Multi-agent collaborative knowledge management based on a large language model to update the student model:
[0016] Through personalized demand analysis and knowledge evaluation agents, the student model status is evaluated to generate personalized learning demand vectors, and the value of external distilled knowledge fragments is analyzed to generate evaluation results.
[0017] Based on the evaluation results and personalized learning demand vector, the agent is guided by adaptive knowledge selection and fusion to complete the screening, weighting, and fusion strategy design of external distilled knowledge fragments. The selected external distilled knowledge fragments are jointly distilled with the output of the local model to construct a hybrid loss function that includes real label supervision terms and external knowledge soft label terms. Based on the constructed hybrid loss function, the student model is guided to update its parameters to achieve effective migration of external distilled knowledge fragments to the local model.
[0018] S5. Repeat S1-S4 until the training termination condition is met.
[0019] Optionally, the knowledge creation steps in S2 include:
[0020] Perform proxy dataset inference: The client uses the teacher model trained by S1 to infer each sample in the proxy dataset uniformly issued by the system, generating the original prediction results of the output layer. The proxy dataset is a publicly released non-sensitive health dataset.
[0021] Extract model prediction logits: The client uses the original prediction vector logits of the teacher model output layer as the initial knowledge representation and records the model's confidence level for each category;
[0022] Perform standardization: The client performs statistical standardization on the logits, calculates the mean and standard deviation, and normalizes the logits so that the logits have a uniform distribution on the numerical scale;
[0023] Encapsulating distilled knowledge fragments: The client organizes the standardized prediction results into distilled knowledge fragments in a unified format, namely external distilled knowledge fragments, and adds the client identifier, timestamp, and current training round information to construct a structured knowledge object for S3 knowledge sharing.
[0024] Optionally, the knowledge learning steps in S2 include:
[0025] Loading external distilled knowledge: The client receives and loads a set of external distilled knowledge fragments obtained from the blockchain network as distillation learning input;
[0026] Constructing a hybrid loss function: The client optimizes the student model using a hybrid loss function that includes a local label supervision term and an external knowledge KL divergence term. The fusion weight is specified by S4.
[0027] Perform knowledge distillation learning: The client performs backpropagation and parameter updates on the student model based on the constructed hybrid loss function to absorb and integrate external distillation knowledge.
[0028] Optionally, the knowledge sharing process in S3 includes:
[0029] Submitting knowledge fragments to the blockchain network: The client broadcasts the constructed distilled knowledge fragments as transaction records to the blockchain network;
[0030] Execute transaction legitimacy verification: The consensus nodes in the blockchain network verify the transaction content, checking the format, identity signature and data integrity of the transaction content;
[0031] Writing to the blockchain ledger: After verification, the transaction is packaged into a new block and recorded in the blockchain ledger, realizing the tamper-proof storage of knowledge objects.
[0032] Optionally, S4 uses a personalized needs analysis and knowledge assessment agent to evaluate the student model status and analyze the value of external knowledge, including:
[0033] Collecting model performance data: The personalized demand analysis and knowledge assessment agent monitors and collects statistics on the prediction loss and accuracy of the local student model on the proxy dataset;
[0034] Generate personalized learning needs vectors: Based on the collected model performance data, the personalized needs analysis and knowledge assessment agent generates personalized learning needs vectors that reflect knowledge shortcomings through large language model reasoning.
[0035] Retrieve external distilled knowledge: The personalized demand analysis and knowledge evaluation agent retrieves all knowledge objects accessible in the current round from the blockchain network to form a set of candidate knowledge objects;
[0036] Perform knowledge adaptation evaluation: The personalized demand analysis and knowledge evaluation agent evaluates the value of external distilled knowledge fragments based on predicted entropy, output consistency, and historical fusion records, and outputs a fitness score table.
[0037] Optionally, S4 generates a personalized learning demand vector, specifically including: after each round of local model training, the personalized demand analysis and knowledge evaluation agent collects key indicators of the model in each category, including The average loss for category c in the first communication step is expressed as:
[0038] ;
[0039] in, Indicates that the client is in category The average training loss on the class reflects the “learning difficulty” of the model in this category and reflects the recent The overall fit of the category within the communication rounds, is the communication round index, ranging from Start to ; The communication round number at the beginning of the current statistical period. is the statistical window width, which is the number of historical communication rounds used to calculate the average value; It means in In the communication round, the student model is Cross entropy loss on ;
[0040] It also includes collecting a randomly selected subset of data from the proxy dataset. The knowledge retention rate corresponding to the category accuracy on is expressed as:
[0041] ;
[0042] in, Representation category The knowledge retention rate, which measures the student model's The degree of forgetfulness; The proxy dataset is a public, non-private collection of health status samples with a unified feature structure and labeling specification. It is used to align and evaluate distilled knowledge across clients. Represents a data subset randomly extracted from the proxy dataset, which serves as the actual sample set used by the current client for model evaluation and knowledge retention calculation; Represents a specific sample in the proxy dataset; The sample The true label of When , it means that the sample belongs to the category ; is the student model s for the input If the predicted label , indicating that the model correctly identifies the category of the sample; It is an indicator function. It takes the value 1 when the condition in the brackets is met, otherwise it takes the value 0. It is used to calculate the number of correct predictions of the model for category c samples and the total number of category c samples. Is a very small positive number used to avoid the denominator being zero;
[0043] Used to reflect the recent difficulty of the model for category c, It is used to quantify the model's retention of old knowledge of category c. and The two indicators together form the basis of the personalized demand vector, which is used to guide subsequent knowledge evaluation and screening, and are expressed as:
[0044] ;
[0045] in, Represents the dimension value of category c in the personalized learning demand vector, quantifying the intensity of the current client's external knowledge demand for category c; Indicates the total number of health status categories predefined by the system; is a hyperparameter representing the relative contribution of learning difficulty and knowledge retention rate to demand, and the vector Used to intuitively reflect the intensity of the current client's external knowledge demand in each category.
[0046] Optionally, S4 guides the agent to formulate knowledge adoption strategies and update the student model through adaptive knowledge selection and fusion, including:
[0047] Loading the fitness score table and personalized learning demand vector: Adaptive knowledge selection and fusion guide the intelligent agent to read the fitness score table and personalized learning demand vector and build a fusion context environment;
[0048] Screening knowledge fragments and setting fusion weights: Based on the adaptability and the intensity of external knowledge demand, screen the set of knowledge objects that meet the teaching ability threshold and assign a fusion weight to each knowledge object;
[0049] Constructing a hybrid loss function: Adaptive knowledge selection and fusion guides the agent to construct a hybrid loss function consisting of a local supervision term and an external distillation term, where each part of the distillation term is regulated by the assigned fusion weight;
[0050] Guide the model to perform distillation learning updates: The client optimizes the parameters of the student model based on the constructed hybrid loss function to achieve effective absorption of external knowledge in this round.
[0051] Optionally, S4 guides the agent to formulate a knowledge adoption strategy and update the student model through adaptive knowledge selection and fusion, including:
[0052] For each teacher model Given distillation knowledge , the adaptive knowledge selection and fusion guidance agent first averages the number of samples of each category in the proxy data set to obtain the teacher model The average logits vector for class c , thus, adaptive knowledge selection and fusion guide the agent to obtain the teacher model The overall predicted tendency for each category c;
[0053] The average logits vector for class c Perform the softmax operation to obtain the corresponding probability distribution, which is expressed as:
[0054] ;
[0055] in, Represents the teacher model The predicted probability vector output on category c; It is a normalization operation used to map the logits vector to a probability distribution with a sum of 1; Respectively represent the normalized confidence scores of the model for each health status category; T represents vector transposition, so that the result is expressed in the form of a column vector;
[0056] The “centrality” of the distribution is measured by information entropy, which is expressed as:
[0057] ;
[0058] in, represents the information entropy of the probability distribution output by teacher model j on category c; Indicates the current category index; Indicates the total number of health status categories predefined by the system; represents the predicted probability of the kth category under category c by teacher model j; Represents the natural logarithm of the corresponding probability value;
[0059] Adaptive knowledge selection and fusion guides the agent to define the confidence of the teacher model j on category c, expressed as:
[0060] ;
[0061] in, Represents confidence. The lower the information entropy, the more concentrated the prediction, and thus the higher the confidence, indicating that the judgment of teacher model j on category c is more reliable.
[0062] Adaptive knowledge selection and fusion guides the agent to measure the prediction stability of the teacher model j on category c, including: statistically analyzing the variance of the teacher model j in the c-th dimension logits for all samples with label c in the agent dataset, expressed as:
[0063] ;
[0064] in, represents the output variance of the c-th dimension of logits of teacher model j on category c, represents the variance operation, represents the average logits vector of category c, Represents the component of the logits vector output by teacher model j for sample x on the cth class, Indicates that the sample comes from the proxy dataset, Indicates that the true label of the sample belongs to category c; the larger the variance, the greater the fluctuation of the logits of teacher model j on category c, and the more unstable the knowledge;
[0065] Adaptive knowledge selection and fusion guides the agent to integrate confidence and prediction stability to calculate the teaching ability score of teacher model j on category c, which is expressed as:
[0066] ;
[0067] in, and To adjust the hyperparameters of the relative importance of confidence and prediction stability, represents the teaching ability score of teacher model j on category c;
[0068] Score the teaching ability of all teacher models on the same category c Perform linear normalization to obtain .
[0069] To achieve the above objectives, the second aspect of the present application provides a federated learning system based on multi-agent and knowledge distillation, the federated learning system comprising:
[0070] The local model training module is deployed on each client device participating in federated learning. It uses the collected personal health data to independently train the local model, generating a teacher model that can be used for knowledge distillation and a student model for receiving external knowledge distillation learning.
[0071] The decoupled knowledge distillation module extracts standardized distilled knowledge fragments from the teacher model trained by the local model training module. The knowledge distillation process decouples the knowledge production step from the knowledge learning step.
[0072] The blockchain-based knowledge sharing module encapsulates the distilled knowledge fragments and their metadata extracted by the decoupled knowledge distillation module into blockchain transactions and submits them to the blockchain network. It verifies the legitimacy of the transactions and writes them into the blockchain ledger to achieve decentralized distribution.
[0073] The multi-agent driven knowledge management module is used to evaluate the student model status through personalized demand analysis and knowledge evaluation agents, generate personalized learning demand vectors, analyze the value of external knowledge, and generate evaluation results; based on the evaluation results and personalized learning demand vectors, the agent is guided through adaptive knowledge selection and fusion to complete the screening, weighting and fusion strategy design of external knowledge fragments; the selected external knowledge is jointly distilled with the output of the local model to construct a hybrid loss function that includes real label supervision items and external knowledge soft label items; based on the constructed hybrid loss function, the student model is guided to update parameters to achieve effective migration of external knowledge to the local model.
[0074] To achieve the above-mentioned purpose, the third aspect of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, is used to implement the method described above.
[0075] After adopting the above technical solution, this application has the following beneficial effects compared with the prior art:
[0076] This application first conducts personalized demand analysis at the "category level", allowing each client to calculate the demand vector based on the accuracy and loss in each category, and multiple agents will locally filter the distilled knowledge fragments that best meet the needs of each category to avoid a "one-size-fits-all" global distillation. Secondly, the client uploads the "knowledge" of the soft labels after regularization, category annotation, and encapsulation of metadata operations to the blockchain. All terminals can query on demand and dynamically filter and weight locally without the need for a central server (or even a master node), achieving fully decentralized collaboration. Finally, only these compact distilled knowledge fragments are transmitted in each round of communication, rather than the complete model parameters, and only small batches of knowledge that highly match the local "category-level needs" are downloaded, thereby significantly reducing communication overhead and improving the operating efficiency of resource-constrained terminals.
[0077] This application addresses the existing problems of federated learning with non-IID data, such as model drift, slow convergence, and insufficient personalized performance, by introducing a multi-agent collaborative mechanism driven by a large language model. The personalized learning needs of each client model are perceived in real time by the agent and expressed as a dynamic learning demand vector. This allows each client to intelligently select the most suitable distilled knowledge based on its own state, achieving more targeted knowledge transfer and personalized improvement, significantly enhancing the model's adaptability to heterogeneous data.
[0078] This application decouples knowledge production from knowledge learning, enabling distilled knowledge to be independently extracted, encapsulated, and shared after model training, significantly improving the modularity and flexibility of the federated learning architecture. Furthermore, by sharing only soft labels or compressed distilled knowledge, rather than complete model parameters, the communication load between clients is significantly reduced, effectively adapting to IoT environments where edge device computing power and network conditions are limited, and improving the overall system's deployment feasibility in real-world applications.
[0079] This application builds a decentralized knowledge-sharing mechanism based on blockchain, eliminating the reliance of traditional federated learning on centralized servers and addressing the performance bottlenecks and single points of failure that can arise from centralized nodes. The immutability, transparency, and traceability provided by blockchain ensure the security and trustworthiness of knowledge exchange, enhancing user confidence in the system's data control and providing a solid foundation for knowledge version management and reuse.
[0080] The specific implementation methods of the present application are further described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] The accompanying drawings are part of this application and are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application but do not constitute an undue limitation of this application. Obviously, the drawings described below are only some embodiments. For those of ordinary skill in the art, other drawings can be derived from these drawings without inventive effort.
[0082] In the attached figure:
[0083] Figure 1 This is a schematic diagram of the steps of the federated learning method in this specific implementation method;
[0084] Figure 2 Schematic diagram of the training process of the federated learning method in this specific implementation method;
[0085] Figure 3 This is a logical diagram of the federated learning system in this specific implementation manner;
[0086] Figure 4 2 is a schematic diagram showing a comparison of the test accuracy of the federated learning method and the existing algorithm when the standard image classification dataset is Fashion-MNIST and the heterogeneity parameter α is 0.1 in this specific embodiment;
[0087] Figure 5 2 is a schematic diagram showing a comparison of the test accuracy of the federated learning method and the existing algorithm when the standard image classification dataset is Fashion-MNIST and the heterogeneity parameter α is 0.3 in this specific embodiment;
[0088] Figure 6 2 is a schematic diagram showing a comparison of the test accuracy of the federated learning method and the existing algorithm when the standard image classification dataset is Fashion-MNIST and the heterogeneity parameter α is 0.05 in this specific embodiment;
[0089] Figure 7 2 is a schematic diagram showing a comparison of the test accuracy of the federated learning method and the existing algorithm when the standard image classification dataset is CIFAR-10 and the heterogeneity parameter α is 0.1 in this specific embodiment;
[0090] Figure 8 2 is a schematic diagram showing a comparison of the test accuracy of the federated learning method and the existing algorithm when the standard image classification dataset is CIFAR-10 and the heterogeneity parameter α is 0.3 in this specific embodiment;
[0091] Figure 9 2 is a schematic diagram showing a comparison of the test accuracy of the federated learning method and the existing algorithm when the standard image classification dataset is CIFAR-10 and the heterogeneity parameter α is 0.05 in this specific embodiment;
[0092] Figure 10 2 is a schematic diagram showing a comparison of the test accuracy of the federated learning method and the existing algorithm when the standard image classification dataset is CIFAR-100 and the heterogeneity parameter α is 0.1 in this specific embodiment;
[0093] Figure 11 2 is a schematic diagram showing a comparison of the test accuracy of the federated learning method and the existing algorithm when the standard image classification dataset is CIFAR-100 and the heterogeneity parameter α is 0.3 in this specific embodiment;
[0094] Figure 12 This is a schematic diagram comparing the test accuracy of the federated learning method and the existing algorithm when the standard image classification dataset is CIFAR-100 and the heterogeneity parameter α is 0.05 in this specific implementation. DETAILED DESCRIPTION
[0095] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application but are not used to limit the scope of the present application.
[0096] See Figure 1 、 Figure 2 and Figure 3 Based on this, this application provides a federated learning method based on multi-agent and knowledge distillation, which includes the following steps:
[0097] S1. Train local model:
[0098] Use the collected personal health data to independently train a local model to generate a teacher model that can be used for knowledge distillation and a student model for receiving external knowledge distillation learning;
[0099] S2. Knowledge distillation based on decoupling:
[0100] By extracting standardized distilled knowledge fragments from the teacher model trained by S1, the knowledge distillation process decouples the knowledge production step from the knowledge learning step;
[0101] S3. Decentralized knowledge sharing based on blockchain:
[0102] The standardized distilled knowledge fragments extracted by S2 and their metadata are encapsulated into blockchain transactions and submitted to the blockchain network. The legitimacy of the transaction is verified and written into the blockchain ledger to achieve decentralized distribution.
[0103] S4. Multi-agent collaborative knowledge management based on a large language model to update the student model:
[0104] Through personalized demand analysis and knowledge evaluation agents, the student model status is evaluated to generate personalized learning demand vectors, and the external distilled knowledge value is analyzed to generate evaluation results.
[0105] Based on the evaluation results and personalized learning demand vector, the agent is guided by adaptive knowledge selection and fusion to complete the screening, weighting, and fusion strategy design of external distilled knowledge fragments. The selected external knowledge is jointly distilled with the output of the local model to construct a hybrid loss function that includes real label supervision terms and external knowledge soft label terms. Based on the constructed hybrid loss function, the student model is guided to update its parameters to achieve effective transfer of external knowledge to the local model.
[0106] S5. Repeat S1-S4 until the training termination condition is met.
[0107] Specifically, personal health data is collected by the health monitoring terminal on the user side, and the model is independently trained in the local environment of the terminal to generate a local model. In the subsequent process, the local model serves as both a teacher model for knowledge production and a student model for knowledge learning, and is used to participate in knowledge distillation and model optimization in the federated learning process; the health monitoring terminal on the user side includes: wearable devices, such as smart watches, health bracelets, home medical monitoring equipment, such as electronic blood pressure monitors, blood glucose meters, sleep monitors, and home health control equipment with computing and communication capabilities.
[0108] See Figure 1 、 Figure 2 and Figure 3In an achievable implementation, training the local model in S1 includes: loading the local dataset and initializing the model structure: each federated learning client first loads the private dataset held locally by the client, and initializes the local model structure according to the predefined model architecture, and establishes the initial model parameters and weight matrix; executing the model training process: the client calls the standard optimization algorithm to perform iterative training on the local model, and repeatedly updates the model parameters based on the local data in multiple consecutive training rounds so that it can fully fit the data distribution characteristics of the client itself; determining the teacher model and the student model: after the training is completed, the client will save the current local model state as the teacher model in this round of knowledge distillation process, and at the same time as the initial student model for receiving external knowledge distillation learning.
[0109] It's important to note that local model training is a process performed independently on each client participating in federated learning. It aims to train and optimize the parameters of local machine learning models using each client's own private local dataset. This process uses standard machine learning algorithms, such as gradient descent and its variants, to iteratively update local model weights, enabling the model to learn and fit the unique patterns and distribution of local data while ensuring that the original sensitive data remains local to the client and prevents external leakage. The trained local model not only reflects the client's personalized capabilities but also serves as a "teacher" for the subsequent knowledge distillation process.
[0110] See Figure 1 、 Figure 2 and Figure 3 In a feasible implementation, the decoupling-based knowledge distillation in S2 is as follows: the local model trained by S1 is used as the teacher model to extract standardized distilled knowledge fragments on a home health control device with computing and communication capabilities. The knowledge distillation process decouples the knowledge production step from the knowledge learning step.
[0111] It's important to note that decoupled knowledge distillation is a key step performed after local model training on each client. Its core objective is to transform the complex knowledge learned by the local training model into one or more lightweight, easily transportable knowledge representations rich in core information, known as "distilled knowledge," through knowledge distillation techniques. A notable feature of this knowledge distillation process is its emphasis on decoupling the knowledge production and learning steps. This decoupling means that the extraction, representation, and encapsulation of knowledge (i.e., the knowledge production step) and the subsequent sharing, selection, evaluation, and integrated application of knowledge (i.e., the knowledge learning step) are mechanically independent of each other, thereby bringing greater flexibility, modularity, and scalability to the entire federated learning framework.
[0112] This knowledge distillation process emphasizes the "decoupling" feature. By first inferring and uploading the distilled knowledge of each client, it avoids the teacher-student dependency in traditional federated distillation methods. It avoids uploading and downloading teacher models and instead downloads lightweight distilled knowledge, reducing communication overhead. In addition, knowledge regularization operations are performed on logits to suppress overconfidence and extremely high confidence levels, while also avoiding overly flat low confidence levels, thereby improving the learnability and stability of distilled knowledge.
[0113] The teacher model is the machine learning model trained on each client using its local data during the local model training phase, or a snapshot of the model produced at a specific training iteration. In the decoupled knowledge distillation process, the teacher model serves as the source of knowledge, and its output is used as a "guidance signal" to train the student model. The selection and state of the teacher model are crucial to the quality of the distilled knowledge. In this embodiment, each client's local model can serve as a teacher model, contributing its unique knowledge learned based on local data.
[0114] See Figure 2 and Figure 3 In one feasible implementation, the knowledge production step in S2 includes: performing a proxy dataset inference operation: the client uses the teacher model trained in S1 to infer each sample in the proxy dataset uniformly issued by the system to generate the original prediction result of the output layer. The proxy dataset is a publicly released non-sensitive health dataset;
[0115] Extract model prediction logits: The client uses the original prediction vector logits of the teacher model output layer as the initial knowledge representation and records the model's confidence level for each category;
[0116] Perform standardization: The client performs statistical standardization on the logits, calculates the mean and standard deviation, and normalizes them to have a uniform distribution on the numerical scale;
[0117] Encapsulating distilled knowledge fragments: The client organizes the standardized prediction results into distilled knowledge fragments in a unified format, adds the client identifier, timestamp, and current training round information, and constructs a structured knowledge object for S3 knowledge sharing.
[0118] Specifically, perform inference operations on the proxy dataset: the proxy dataset is a publicly released non-sensitive health dataset that does not contain user privacy information and has predefined category labels and a unified feature format; extract model prediction logits: each dimension of the logits prediction vector corresponds to a set of health status categories predefined by the system, such as heart rate type, blood pressure level, sleep stage, exercise intensity level, blood oxygen risk level, etc.; perform standardization processing: the client performs statistical standardization on the logits, calculates the mean and standard deviation, and normalizes them to have uniform distribution characteristics on the numerical scale;
[0119] Encapsulate and distill knowledge fragments: The client identifier is generated based on the unique identifier of the home health control device (such as MAC address, device public key, etc.) and is used to mark the source of knowledge without exposing the user's identity; the timestamp is used to record the global time information when the knowledge is generated, which helps the client judge the timeliness of the knowledge; the training round information is used to distinguish the model training stage to which the knowledge belongs, supporting subsequent version control and knowledge screening.
[0120] Please continue to see Figure 2 and Figure 3 In one feasible implementation, the knowledge learning step in S2 includes: loading external distilled knowledge: the client receives and loads a set of external distilled knowledge fragments obtained from the blockchain network as distillation learning input; the knowledge fragments are generated by other home health control devices based on a unified proxy dataset and uploaded to the chain, representing the prediction results of their local models for typical health status samples; by loading these external distilled knowledge fragments, the client obtains model cognition information of other terminals in typical health scenarios without exposing the user's original health data, which is used to guide the personalized training of the local student model;
[0121] Constructing a hybrid loss function: The client optimizes the student model using a hybrid loss function. The hybrid loss function includes a local label supervision term and an external knowledge KL divergence term, with the fusion weight specified by S4. The local label supervision term is based on the labeled health data collected by the client's health monitoring terminal, such as known state samples from devices such as blood pressure monitors, heart rate monitors, and blood glucose monitors. The client calculates the cross-entropy loss between the model output and the true label to maintain the model's accurate fit to individual physiological characteristics. The external knowledge KL divergence term is based on the client's calculation of the KL divergence between the student model's predicted distribution for the proxy data sample and the corresponding logits distribution in the external distilled knowledge loaded from the blockchain. This is used to guide the model to absorb the cognitive experience of other terminal devices in the same health scenario.
[0122] Perform knowledge distillation learning: The client performs backpropagation and parameter updates on the student model based on the constructed loss function to absorb and integrate external distillation knowledge.
[0123] See Figure 2 and Figure 3 ,In a feasible implementation, S3, decentralized knowledge sharing based on blockchain: the ,distilled knowledge fragments extracted by S2 and their metadata are ,encapsulated into blockchain transactions and submitted to the blockchain network, ,the legitimacy of the transactions is verified, ,and written into the blockchain ledger to achieve decentralized ,distribution.
[0124] Specifically, the home health control device encapsulates the distilled knowledge fragments and their metadata extracted from S2 into a blockchain transaction and submits it to the blockchain network. The home health control device also acts as a participating node in the blockchain network, responsible for the transaction broadcast and consensus process.
[0125] Notably, blockchain-based decentralized knowledge sharing provides a secure, transparent, traceable, and trustless infrastructure for publishing, storing, discovering, and accessing the distilled knowledge fragments generated by the aforementioned decoupled knowledge distillation. This mechanism is built on a blockchain network. When a client generates a distilled knowledge fragment, it and its metadata, including the source client identifier and generation timestamp, are encapsulated as a blockchain transaction and submitted to the chain. After verification by the consensus mechanism, it is packaged into a new block and permanently and immutably recorded on the chain. This approach achieves secure knowledge storage and high data availability. Furthermore, since there is no single centralized storage server, any access and retrieval of the on-chain knowledge is performed directly by querying the blockchain network itself, ensuring the decentralized nature of knowledge acquisition. As a result, each distilled knowledge fragment can be shared and distributed securely, reliably, and truly decentralized among participating clients without relying on a trusted third party.
[0126] See Figure 2 and Figure 3In practical applications, S4, multi-agent collaborative knowledge management based on large language model, updates the student model: deploys a knowledge management module composed of multiple agents on the home health control device, which realizes intelligent reasoning and strategy generation by remotely calling the large language model API to guide the personalized update of the student model; evaluates the student model status through personalized demand analysis and knowledge evaluation agents, generates personalized learning demand vectors, and analyzes the external knowledge value to generate evaluation results; based on the evaluation results and personalized learning demand vectors, guides the agent through adaptive knowledge selection and fusion to complete the screening, weighting and fusion strategy design of external knowledge fragments; performs a joint distillation operation on the selected external knowledge and the output of the local model to construct a hybrid loss function containing real label supervision items and external knowledge soft label items; guides the student model to update parameters based on the constructed hybrid loss function to achieve effective migration of external knowledge to the local model.
[0127] It should be noted that the multi-agent system provided in this embodiment uses the reasoning capabilities of a large language model to perform personalized demand analysis and knowledge evaluation, adaptive knowledge selection, and knowledge fusion. Compared to traditional agent-based approaches in reinforcement learning, the decision-making logic of this method in a federated communication does not rely on repeated interaction with the external environment or trial-and-error updates. Instead, it directly obtains the demand vector, knowledge value score, and fusion weight by inputting the local model training state and candidate distilled knowledge into the large language model at a time. Reinforcement learning-based approaches must continuously interact with the environment, evaluate the rewards obtained after a certain action, and then update the policy network to gradually find the optimal decision. This environment interaction-reward feedback-policy update approach requires a large amount of sampling and multiple rounds of iterations to achieve convergence, which is time-consuming and computationally expensive. LLM-based agents, on the other hand, can leverage the reasoning capabilities of the LLM to quickly complete complex demand analysis and knowledge evaluation tasks, greatly improving decision-making efficiency.
[0128] In one feasible implementation, the personalized learning demand vector is generated in S4, specifically including: after each round of local model training, the personalized demand analysis and knowledge evaluation agent collects key indicators of the model in each category, including The average loss for category c in the first communication step is expressed as:
[0129] ;
[0130] in, Indicates that the client is in category The average training loss on the class reflects the “learning difficulty” of the model in this category and reflects the recent The overall fit of the category within the communication rounds, is the communication round index, ranging from Start to ; The communication round number at the beginning of the current statistical period. is the statistical window width, which is the number of historical communication rounds used to calculate the average value; It means in In the communication round, the student model is Cross entropy loss on ;
[0131] It also includes collecting a randomly selected subset of data from the proxy dataset. The knowledge retention rate corresponding to the category accuracy on is expressed as:
[0132] ;
[0133] in, Representation category The knowledge retention rate, which measures the student model's The degree of forgetfulness; The proxy dataset is a public, non-private collection of health status samples with a unified feature structure and labeling specification. It is used to align and evaluate distilled knowledge across clients. Represents a data subset randomly extracted from the proxy dataset, which serves as the actual sample set used by the current client for model evaluation and knowledge retention calculation; Represents a specific sample in the proxy dataset; The sample The true label of When , it means that the sample belongs to the category ; is the student model s for the input If the predicted label , indicating that the model correctly identifies the category of the sample; It is an indicator function. It takes the value 1 when the condition in the brackets is met, otherwise it takes the value 0. It is used to calculate the number of correct predictions of the model for category c samples and the total number of category c samples. Is a very small positive number used to avoid the denominator being zero;
[0134] Used to reflect the recent difficulty of the model for category c, It is used to quantify the model's retention of old knowledge of category c. and The two indicators together form the basis of the personalized demand vector, which is used to guide subsequent knowledge evaluation and screening, and are expressed as:
[0135] ;
[0136] in, Represents the dimension value of category c in the personalized learning demand vector, quantifying the intensity of the current client's external knowledge demand for category c; Indicates the total number of health status categories predefined by the system; is a hyperparameter representing the relative contribution of learning difficulty and knowledge retention rate to demand, and the vector It intuitively reflects the intensity of the current client's external knowledge demand in each category.
[0137] In one feasible implementation, in S4, adaptive knowledge selection and fusion are used to guide the agent to formulate a knowledge adoption strategy and update the student model, including: loading a fitness score table and a personalized learning demand vector: the adaptive knowledge selection and fusion guides the agent to read the fitness score table and the personalized learning demand vector and construct a fusion context environment;
[0138] Screening knowledge fragments and setting fusion weights: Based on the adaptability and the intensity of external knowledge demand, screen the set of knowledge objects that meet the teaching ability threshold and assign a fusion weight to each knowledge object;
[0139] Constructing a hybrid loss function: Adaptive knowledge selection and fusion guides the agent to construct a hybrid loss function consisting of a local supervision term and an external distillation term, where each part of the distillation term is regulated by the assigned fusion weight;
[0140] Guide the model to perform distillation learning updates: The client optimizes the parameters of the student model based on the constructed hybrid loss function to achieve effective absorption of external knowledge in this round.
[0141] In one feasible implementation, S4 guides the agent to formulate a knowledge adoption strategy and update the student model through adaptive knowledge selection and fusion, specifically including:
[0142] For each teacher model Given distillation knowledge , the adaptive knowledge selection and fusion guidance agent first averages the number of samples of each category in the proxy data set to obtain the teacher model The average logits vector for class c , thus, adaptive knowledge selection and fusion guide the agent to obtain the teacher model The overall predicted tendency for each category c;
[0143] The average logits vector for class c Perform the softmax operation to obtain the corresponding probability distribution, which is expressed as:
[0144] ;
[0145] in, Represents the teacher model The predicted probability vector output on category c; It is a normalization operation used to map the logits vector to a probability distribution with a sum of 1; Respectively represent the normalized confidence scores of the model for each health status category; T represents vector transposition, so that the result is expressed in the form of a column vector;
[0146] The “centrality” of the distribution is measured by information entropy, which is expressed as:
[0147] ;
[0148] in, represents the information entropy of the probability distribution output by teacher model j on category c; Indicates the current category index; Indicates the total number of health status categories predefined by the system; represents the predicted probability of the kth category under category c by teacher model j; Represents the natural logarithm of the corresponding probability value;
[0149] Adaptive knowledge selection and fusion guides the agent to define the confidence of the teacher model j on category c, expressed as:
[0150] ;
[0151] in, Represents confidence. The lower the information entropy, the more concentrated the prediction, and thus the higher the confidence, indicating that the judgment of teacher model j on category c is more reliable.
[0152] Adaptive knowledge selection and fusion guides the agent to measure the prediction stability of the teacher model j on category c, including: statistically analyzing the variance of the teacher model j in the c-th dimension logits for all samples with label c in the agent dataset, expressed as:
[0153] ;
[0154] in, represents the output variance of the c-th dimension of logits of teacher model j on category c, represents the variance operation, represents the average logits vector of category c, Represents the component of the logits vector output by teacher model j for sample x on the cth class, Indicates that the sample comes from the proxy dataset, Indicates that the true label of the sample belongs to category c; the larger the variance, the greater the fluctuation of the logits of teacher model j on category c, and the more unstable the knowledge;
[0155] Adaptive knowledge selection and fusion guides the agent to integrate confidence and prediction stability to calculate the teaching ability score of teacher model j on category c, which is expressed as:
[0156] ;
[0157] in, and To adjust the hyperparameters of the relative importance of confidence and prediction stability, represents the teaching ability score of teacher model j on category c;
[0158] Score the teaching ability of all teacher models on the same category c Perform linear normalization to obtain .
[0159] This embodiment is designed to solve the problem of "personalized knowledge learning in a decentralized environment and heterogeneous non-IID data scenarios": in applications such as the medical Internet of Things, each client has sensitive data with different distributions. Traditional federated learning is difficult to take into account both global performance and personalized needs under the conditions of no central server and limited bandwidth. The intelligent agent of this embodiment focuses on exploring the shortcomings of the local model in each category, and evaluating the compensation effect of the distilled knowledge from other ends on these shortcomings, thereby achieving dynamic weighting and fusion at the category level, greatly alleviating client drift. The reinforcement learning-based solutions in the existing technology are usually used for "resource allocation", "cache scheduling" or "aggregation strategy" optimization, focusing on the dynamic allocation of bandwidth, power, and cache space at the physical level, and are not directly aimed at "cross-node knowledge value evaluation and personalized distillation".
[0160] See Figure 2 and Figure 3 Based on the same inventive concept, this application also provides a federated learning system based on multi-agent and knowledge distillation, which includes:
[0161] The local model training module is deployed on each client device participating in federated learning. It uses the collected personal health data to independently train the local model, generating a teacher model that can be used for knowledge distillation and a student model for receiving external knowledge distillation learning.
[0162] The decoupled knowledge distillation module extracts standardized distilled knowledge fragments from the teacher model trained by the local model training module. The knowledge distillation process decouples the knowledge production step from the knowledge learning step.
[0163] The blockchain-based knowledge sharing module encapsulates the distilled knowledge fragments and their metadata extracted by the decoupled knowledge distillation module into blockchain transactions and submits them to the blockchain network. It verifies the legitimacy of the transactions and writes them into the blockchain ledger to achieve decentralized distribution.
[0164] The multi-agent driven knowledge management module is used to evaluate the student model status through personalized demand analysis and knowledge evaluation agents, generate personalized learning demand vectors, analyze the value of external knowledge, and generate evaluation results; based on the evaluation results and personalized learning demand vectors, the agent is guided through adaptive knowledge selection and fusion to complete the screening, weighting and fusion strategy design of external knowledge fragments; the selected external knowledge is jointly distilled with the output of the local model to construct a hybrid loss function that includes real label supervision items and external knowledge soft label items; based on the constructed hybrid loss function, the student model is guided to update parameters to achieve effective migration of external knowledge to the local model.
[0165] Specifically, a local model training module is deployed on each client device participating in federated learning. It is used to autonomously train and update the parameters of the local model based on the client's local private dataset. This module first loads the local dataset and initializes it according to a predefined model structure. It then performs an optimization process, iteratively updating the model weights using a stochastic gradient descent algorithm. Training is repeated for five epochs to ensure that the model fully fits the client's local data distribution. After training, the generated local model has dual functional properties: first, it participates in the distilled knowledge extraction process as a teacher model, generating local distilled knowledge fragments; second, it serves as a student model, receiving external distilled knowledge from other clients and completing self-updates and optimizations through a distilled learning mechanism. This module does not transmit any raw data during the federated learning process, strictly protecting data privacy. Through localized training, the model achieves autonomous learning capabilities within the individual data distribution, providing foundational support for the subsequent decoupled knowledge distillation module and multi-agent knowledge management module.
[0166] Specifically, the decoupled knowledge distillation module extracts representative knowledge content based on the reasoning capabilities of the client's local model after each round of local model training. It then converts these knowledge fragments into a unified format for subsequent knowledge sharing and integrated learning. The decoupled knowledge distillation module design emphasizes the complete decoupling of the knowledge generation and utilization processes, enabling knowledge extraction, standardization, and encapsulation to be performed independently of specific learning objectives. This enhances the modularity and operational flexibility of the federated learning system within a decentralized architecture. First, the client uses the selected teacher model to perform sample-by-sample inference on the proxy dataset distributed uniformly by the system and collects the raw prediction results generated at the output layer. These prediction results are unnormalized floating-point vectors representing the model's confidence in each category. Next, the client normalizes these extracted raw prediction results. Specifically, the mean and standard deviation of the vector set are calculated, and each item is normalized based on these statistics to achieve uniform distribution characteristics on the numerical scale. This step helps eliminate variability between client model outputs and improves the universality and integration of knowledge fragments across clients. The client then organizes the standardized prediction results into structured, distilled knowledge fragments, appending the client's unique identifier, the current system timestamp, and the training round information to form a complete knowledge object. These knowledge objects utilize predefined data structures, facilitating storage, verification, retrieval, and invocation in subsequent blockchain modules. These distilled knowledge fragments include both normalized logits from the teacher model's output layer and can be expanded to intermediate layer activation values or their transformed forms, offering pluggability and abstract expression capabilities.
[0167] Specifically, the blockchain-based knowledge sharing module facilitates the storage, publication, and access of distilled knowledge fragments between clients, building a trusted knowledge circulation environment without the need for a central server. Leveraging blockchain technology as its underlying infrastructure, the blockchain-based knowledge sharing module combines consensus mechanisms with immutable data structures to achieve decentralized registration, verification, and persistence of distilled knowledge objects, ensuring secure transmission, efficient sharing, and transparent use of knowledge in a multi-client environment. Specifically, after creating and packaging a distilled knowledge fragment, the client submits it to the blockchain network as a published knowledge object. This knowledge object contains standardized prediction data, the generating client's identity, the current timestamp, and fields corresponding to the training round. All fields are packaged according to a predefined format to generate a blockchain transaction record. The module first receives knowledge transaction broadcasts from clients and verifies their legitimacy. This verification process, coordinated by nodes participating in the blockchain consensus, ensures the integrity of the transaction data, the proper formatting, and the validity of the generating party's identity. Once verified, the transaction is packaged into the current block and permanently written to the blockchain ledger as part of the new block. The blockchain ledger is a publicly accessible distributed data structure maintained by all federated learning clients. Each client can query the blockchain through a standard interface for distilled knowledge fragments from a specific round, client, or category. Furthermore, the module supports high-frequency concurrent write and read operations, adapting to the knowledge sharing needs of large-scale federated learning scenarios. Without relying on any central scheduling node, each client can autonomously retrieve and select knowledge objects published by other nodes based on its own learning needs, improving the overall responsiveness, scalability, and fault resilience of the federated system.
[0168] Specifically, the multi-agent-driven knowledge management module is used to implement personalized client-side identification, evaluation, and integrated updates of external knowledge within a decentralized federated learning architecture. Based on a large language model deployed locally on the client, the multi-agent-driven knowledge management module constructs a knowledge management system composed of multiple agents with autonomous decision-making capabilities, and operates dynamically based on the current learning status of the student model. The multi-agent-driven knowledge management module contains two core sub-agents: a personalized demand analysis and knowledge evaluation agent and an adaptive knowledge selection and fusion guidance agent. These two agents work together to determine knowledge value and formulate distillation and integration strategies.
[0169] The personalized needs analysis and knowledge assessment agent comprehensively perceives the training performance of the current student model. By analyzing the learning loss, prediction accuracy, and retention capacity of each category on the proxy dataset, it generates a personalized learning needs vector reflecting knowledge gaps. This agent first performs category-by-category statistics on the local model's output on the proxy dataset, calculating the sliding average loss value for each category and the accuracy index for historical samples to quantify the model's current learning difficulty and retention level for each category. Based on these metrics, the agent generates a learning needs vector based on the reasoning capabilities of the large language model, characterizing the strength of each category's knowledge needs in the current round. After analyzing the local learning status, the agent retrieves currently available externally distilled knowledge objects from the blockchain and evaluates the applicability and potential value of each knowledge fragment in the current learning scenario based on its source category, confidence level, and prediction consistency. This evaluation process comprehensively considers the entropy of the knowledge confidence distribution, the output variance within the category, and the historical selection weights. Using the large language model, it performs contextual reasoning to generate a list of knowledge fragments suitable for the current client, providing a high-quality basis for subsequent knowledge selection.
[0170] The adaptive knowledge selection and fusion guidance agent, based on the aforementioned evaluation results and learning demand vector, completes the screening, weighting, and fusion strategy design of external knowledge fragments. The agent first sorts each knowledge fragment by category based on the teaching ability index and sets a dynamic threshold. Based on the client's current demand for the category and historical learning difficulty, it selects candidate knowledge with a teaching ability score above the threshold. Next, while satisfying the teaching diversity constraint, the agent selects knowledge sources with diverse distributions from the candidate set to avoid redundant overlap during fusion. The agent assigns a fusion weight to each selected knowledge fragment. The weight is generated by normalizing the teaching ability score and reflects the actual contribution of the knowledge fragment to the learning objective. The agent then performs a joint distillation operation on the selected knowledge fragment with the local model output, constructing a hybrid loss function that includes a true label supervision term and a soft label term for external knowledge. The external knowledge portion is weighted by the fusion weights. Based on this loss function, the agent guides the student model to update its parameters, achieving effective transfer of external knowledge to the local model.
[0171] In order to verify the effectiveness and practicality of the federated learning system based on large language model multi-agent and knowledge distillation proposed in this application in heterogeneous environments, this embodiment conducted systematic experiments on three standard image classification datasets (Fashion-MNIST, CIFAR-10 and CIFAR-100), and compared and evaluated it with the six current mainstream federated learning algorithms (FedAvg, MOON, ProxyFL, FedGKD, FedHKD).
[0172] To verify the robustness and adaptability of the system under different data heterogeneity conditions, this example constructed a variety of non-independent and identically distributed (Non-IID) scenarios and simulated heterogeneous environments by introducing Dirichlet distribution to perform data partitioning on three standard image classification datasets (Fashion-MNIST, CIFAR-10, and CIFAR-100). The experimental results are shown in Figure 2. Figures 4 to 12 This example sets different heterogeneity parameters α (values of 0.05, 0.1, and 0.3), where the smaller α is, the greater the difference in data distribution between clients, and the greater the learning challenge of the system. The experimental results are shown in Figures 4 to 12 As shown, the proposed system demonstrates excellent adaptability under various levels of data heterogeneity. In particular, in extremely heterogeneous scenarios, such as when α is 0.05, the system achieves accuracies of 96.66% and 90.96% on the Fashion-MNIST and CIFAR-10 datasets, respectively, significantly outperforming other compared methods. In contrast, traditional parameter averaging methods such as FedAvg and MOON experience significant accuracy degradation under heterogeneous conditions, demonstrating their sensitivity to differences in data distribution. Furthermore, the model's convergence trends under different α values show a smoother learning curve and faster convergence. In particular, the system maintains its lead in datasets with a large number of categories and greater learning difficulty, such as CIFAR-100. This demonstrates that the proposed method can effectively integrate heterogeneous knowledge from multiple sources while maintaining personalized learning capabilities, alleviating the performance degradation faced by traditional federated learning in highly heterogeneous environments.
[0173] In addition to demonstrating good generalization capabilities in highly heterogeneous data environments, this system also demonstrates outstanding advantages in communication efficiency and resource utilization. The evaluation of system efficiency focuses on two aspects: communication convergence rounds and communication and computational overhead per round. The experimental results are shown in Table 1:
[0174] Table 1: Comparison of the communication overhead and computational cost per round required for different methods to achieve 70% accuracy on CIFAR-10 (α=0.1)
[0175]
[0176] First, in terms of communication rounds, the system is able to achieve effective model convergence in significantly fewer rounds. Taking the CIFAR-100 dataset as an example, when the heterogeneity parameter α is 0.3, the system approaches final performance within approximately 50 rounds of communication, while other comparison methods such as FedAvg and MOON are still in the early stages of convergence within the same number of rounds. This accelerated convergence directly reduces the system's overall communication volume, which is particularly important in real-world scenarios with limited bandwidth or device energy consumption.
[0177] Secondly, regarding per-round communication overhead, this system replaces the direct exchange of large-scale model parameters in traditional federated learning with a knowledge distillation mechanism. Instead, it transmits only compressed, distilled knowledge fragments, significantly reducing the amount of data transmitted per round. In contrast, FedAvg requires full model parameter synchronization, while methods like MOON and FedHKD require additional model embedding or high-order feature representations, significantly increasing the communication burden. This system's structural design effectively circumvents this issue, making communication costs more manageable.
[0178] It's important to note that this system incorporates a large language model-based agent mechanism on the client side to perform knowledge evaluation and fusion strategy generation. While calling the remote agent does increase computational time during local training, it significantly reduces the total number of required communication rounds. Therefore, from an overall operational efficiency perspective, the system reduces communication without significantly increasing time costs.
[0179] In summary, the system and method provided in this embodiment have obvious advantages in processing heterogeneous data, realizing personalized modeling, and ensuring communication efficiency and system security. It has broad promotion value and strong engineering feasibility.
[0180] Based on the same inventive concept, the present application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the method described above is implemented.
[0181] The program product of the present application for implementing the above-mentioned method may be a portable compact disk read-only memory and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present application is not limited thereto. In the present application, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0182] It should be noted that a computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.
[0183] The above is only a preferred embodiment of the present application and does not constitute any form of limitation to the present application. Although the present application has been disclosed as above with preferred embodiments, it is not intended to limit the present application. Any technician familiar with the present application can make some changes or modifications to equivalent embodiments with equivalent changes using the technical content suggested above without departing from the scope of the technical solution of the present application. The implementation schemes in the above embodiments can also be further combined or replaced. However, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present application that do not depart from the content of the technical solution of the present application still fall within the scope of the solution of the present application.
Claims
1. A federated learning method based on multi-agent and knowledge distillation, characterized by: The following steps are involved: S1. Train local model: Use the collected personal health data to independently train a local model to generate a teacher model that can be used for knowledge distillation and a student model for receiving external knowledge distillation learning; S2. Knowledge distillation based on decoupling: Extract standardized distilled knowledge fragments from the teacher model trained in S1. The knowledge distillation process decouples the knowledge production step from the knowledge learning step. S3. Decentralized knowledge sharing based on blockchain: The standardized distilled knowledge fragments extracted by S2 and their metadata are encapsulated into blockchain transactions and submitted to the blockchain network. The legitimacy of the transactions is verified and written into the blockchain ledger to achieve decentralized distribution. S4. Multi-agent collaborative knowledge management based on a large language model to update the student model: Through personalized demand analysis and knowledge evaluation agents, the student model status is evaluated to generate personalized learning demand vectors, and the value of external distilled knowledge fragments is analyzed to generate evaluation results. Based on the evaluation results and personalized learning demand vector, the agent is guided by adaptive knowledge selection and fusion to complete the screening, weighting, and fusion strategy design of external distilled knowledge fragments. The selected external distilled knowledge fragments are jointly distilled with the output of the local model to construct a hybrid loss function that includes real label supervision terms and external knowledge soft label terms. Based on the constructed hybrid loss function, the student model is guided to update its parameters to achieve effective migration of external distilled knowledge fragments to the local model. S5. Repeat S1-S4 until the training termination condition is met.
2. The method according to claim 1, characterized in that The knowledge production steps in S2 include: Perform proxy dataset inference: The client uses the teacher model trained by S1 to infer each sample in the proxy dataset uniformly issued by the system, generating the original prediction results of the output layer. The proxy dataset is a publicly released non-sensitive health dataset. Extract model prediction logits: The client uses the original prediction vector logits of the teacher model output layer as the initial knowledge representation and records the model's confidence level for each category; Perform standardization: The client performs statistical standardization on the logits, calculates the mean and standard deviation, and normalizes the logits so that the logits have a uniform distribution on the numerical scale; Encapsulating distilled knowledge fragments: The client organizes the standardized prediction results into distilled knowledge fragments in a unified format, namely external distilled knowledge fragments, and adds the client identifier, timestamp, and current training round information to construct a structured knowledge object for S3 knowledge sharing.
3. The method according to claim 1, characterized in that The knowledge learning steps in S2 include: Loading external distilled knowledge: The client receives and loads a set of external distilled knowledge fragments obtained from the blockchain network as distillation learning input; Constructing a hybrid loss function: The client optimizes the student model using a hybrid loss function that includes a local label supervision term and an external knowledge KL divergence term. The fusion weight is specified by S4. Perform knowledge distillation learning: The client performs backpropagation and parameter updates on the student model based on the constructed hybrid loss function to absorb and integrate external distillation knowledge.
4. The method according to claim 1, wherein The knowledge sharing process in S3 includes: Submitting knowledge fragments to the blockchain network: The client broadcasts the constructed distilled knowledge fragments as transaction records to the blockchain network; Execute transaction legitimacy verification: The consensus nodes in the blockchain network verify the transaction content, checking the format, identity signature and data integrity of the transaction content; Writing to the blockchain ledger: After verification, the transaction is packaged into a new block and recorded in the blockchain ledger, realizing the tamper-proof storage of knowledge objects.
5. The method according to claim 1, wherein In S4, the personalized needs analysis and knowledge evaluation agent evaluates the student model status and analyzes the value of external distilled knowledge fragments, including: Collecting model performance data: The personalized demand analysis and knowledge assessment agent monitors and collects statistics on the prediction loss and accuracy of the local student model on the proxy dataset; Generate personalized learning needs vectors: Based on the collected model performance data, the personalized needs analysis and knowledge assessment agent generates personalized learning needs vectors that reflect knowledge shortcomings through large language model reasoning. Retrieve external distilled knowledge: The personalized demand analysis and knowledge evaluation agent retrieves all knowledge objects accessible in the current round from the blockchain network to form a set of candidate knowledge objects; Perform knowledge adaptation evaluation: The personalized demand analysis and knowledge evaluation agent evaluates the value of external distilled knowledge fragments based on predicted entropy, output consistency, and historical fusion records, and outputs a fitness score table.
6. The method according to claim 5, characterized in that S4 generates a personalized learning demand vector, specifically including: after each round of local model training, the personalized demand analysis and knowledge evaluation agent collects the key indicators of the model in each category, including the average training loss for category c in w-step communication, expressed as: Among them, L c L represents the average training loss of the client on category c, reflecting the "learning difficulty" of the model on this category and the overall fit of the model to this category in the last W communication rounds. k is the communication round index, ranging from t0 to t0+W-1; t0 is the communication round number at the beginning of the current statistical period, and W is the statistical window width, which is the number of historical communication rounds used to calculate the average value. s,c (k) refers to the cross entropy loss of the student model for category c in the kth communication round; It also includes collecting a randomly selected subset of data from the proxy dataset. The knowledge retention rate corresponding to the category accuracy on is expressed as: Among them, R c represents the knowledge retention rate of category c, which measures the degree of forgetting of the student model on category c; D proxy The proxy dataset is a public, non-private collection of health status samples with a unified feature structure and labeling specification. It is used to align and evaluate distilled knowledge across clients. represents a data subset randomly extracted from the proxy dataset, which is used as the actual sample set for model evaluation and knowledge retention calculation by the current client; x represents a specific sample in the proxy dataset; y x is the true label of sample x, when y x = c, it means that the sample belongs to category c; f s (x) is the predicted label of the student model s for the input x, if f s (x) = c, indicating that the model correctly identifies the category of the sample; 1[·] is an indicator function that takes the value 1 when the condition in the brackets is met and 0 otherwise. It is used to calculate the number of correct predictions of the model for samples of category c and the total number of samples of category c; ε is a very small positive number used to avoid the denominator being zero; L c Used to reflect the recent difficulty of the model for category c, R c It is used to quantify the model's retention of old knowledge of category c, L c and R c The two indicators together form the basis of the personalized demand vector, which is used to guide subsequent knowledge evaluation and screening, and are expressed as: d c =αL c +β(1-B c ),c=1,...,C; Among them, d c represents the dimension value of category c in the personalized learning demand vector, quantifying the intensity of the current client's external knowledge demand for category c; C represents the total number of health status categories predefined by the system; α, β>0 are hyperparameters, representing the relative contribution of learning difficulty and knowledge retention rate to demand degree, and the vector d-[d1, ..., d c ] T Used to intuitively reflect the intensity of the current client's external knowledge demand in each category.
7. The method according to claim 1, characterized in that Multi-agent collaborative knowledge management based on a large language model in S4, updating the student model, including: Loading the fitness score table and personalized learning demand vector: Adaptive knowledge selection and fusion guide the intelligent agent to read the fitness score table and personalized learning demand vector and build a fusion context environment; Screening knowledge fragments and setting fusion weights: Based on the adaptability and the intensity of external knowledge demand, screen the set of knowledge objects that meet the teaching ability threshold and assign a fusion weight to each knowledge object; Constructing a hybrid loss function: Adaptive knowledge selection and fusion guides the agent to construct a hybrid loss function consisting of a local supervision term and an external distillation term, where each part of the distillation term is regulated by the assigned fusion weight; Guide the model to perform distillation learning updates: The client optimizes the parameters of the student model based on the constructed hybrid loss function to achieve effective absorption of external knowledge in this round.
8. The method according to claim 7, characterized in that In S4, multi-agent collaborative knowledge management based on a large language model updates the student model, specifically including: For each teacher model j, the distilled knowledge Adaptive knowledge selection and fusion guidance agent first averages the number of samples of each category in the agent dataset to obtain the average logits vector of teacher model j for category c Thus, adaptive knowledge selection and fusion guide the agent to obtain the overall prediction tendency of the teacher model j on each category c; The average logits vector for class c Perform the softmax operation to obtain the corresponding probability distribution, which is expressed as: Among them, p j,c represents the predicted probability vector output by teacher model j on category c; softmax is a normalization operation used to map the logits vector to a probability distribution with a sum of 1; p j,c (1), p j,c (2), ..., p j,c (c) represents the normalized confidence score of the model for each health status category; T represents vector transposition, so that the result is expressed in the form of a column vector; The "centrality" of the distribution is measured by information entropy, which is expressed as: Among them, E(p j,e ) represents the information entropy of the probability distribution output by teacher model j on category c; k represents the current category index; C represents the total number of health status categories predefined by the system; p j,c (k) represents the predicted probability of the kth category under category c by teacher model j; log p j,c (k) represents the natural logarithm of the corresponding probability value; Adaptive knowledge selection and fusion guides the agent to define the confidence of the teacher model j on category c, expressed as: C j,c =1-H(p j,c ); Among them, C j,c Represents confidence. The lower the information entropy, the more concentrated the prediction, and thus the higher the confidence, indicating that the judgment of teacher model j on category c is more reliable. Adaptive knowledge selection and fusion guides the agent to measure the prediction stability of the teacher model j on category c, including: statistically analyzing the variance of the teacher model j in the c-th dimension logits for all samples with label c in the agent dataset, expressed as: Among them, U j,c Represents the output variance of the c-th dimension of logits of teacher model j on category c, Var represents the variance operation, represents the average logits vector of category c, Represents the component of the logits vector output by teacher model j for sample x on the cth class, x∈D prony Indicates that the sample comes from the proxy dataset, y x =c means that the true label of the sample belongs to category c; the larger the variance, the greater the fluctuation of the logits of teacher model j on category c, and the more unstable the knowledge; Adaptive knowledge selection and fusion guides the agent to integrate confidence and prediction stability to calculate the teaching ability score of teacher model j on category c, which is expressed as: T j,c =γC j,c -δU j,c ; Among them, γ and δ are hyperparameters that adjust the relative importance of confidence and prediction stability, T j,c represents the teaching ability score of teacher model j on category c; Score T the teaching ability of all teacher models on the same category c j,c Perform linear normalization to obtain 9. A federated learning system based on multi-agent and knowledge distillation, characterized by: The federated learning system includes: The local model training module is deployed on each client device participating in federated learning. It uses the collected personal health data to independently train the local model, generating a teacher model that can be used for knowledge distillation and a student model for receiving external knowledge distillation learning. The decoupled knowledge distillation module extracts standardized distilled knowledge fragments from the teacher model trained by the local model training module. The knowledge distillation process decouples the knowledge production step from the knowledge learning step. The blockchain-based knowledge sharing module encapsulates the distilled knowledge fragments and their metadata extracted by the decoupled knowledge distillation module into blockchain transactions and submits them to the blockchain network. It verifies the legitimacy of the transactions and writes them into the blockchain ledger to achieve decentralized distribution. The multi-agent driven knowledge management module is used to evaluate the student model status through personalized demand analysis and knowledge evaluation agents, generate personalized learning demand vectors, analyze the value of external knowledge, and generate evaluation results; based on the evaluation results and personalized learning demand vectors, the agent is guided through adaptive knowledge selection and fusion to complete the screening, weighting and fusion strategy design of external knowledge fragments; the selected external knowledge is jointly distilled with the output of the local model to construct a hybrid loss function that includes real label supervision items and external knowledge soft label items; based on the constructed hybrid loss function, the student model is guided to update parameters to achieve effective migration of external knowledge to the local model.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it is used to implement the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Multi-agent reinforcement learning method and system
CN113592100A
Personalized federal learning method based on decoupling knowledge distillation
CN117152480A