A classification model training method based on federated learning, a storage medium and an equipment
Patent Information
- Application Number
- CN202610760969.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-29
- Publication Date
- 2026-10-09
AI Technical Summary
[0003]本发明的目的在于克服现有技术中的不足,提供一种基于联邦学习的分类模型训练方法、存储介质及设备,引入中继模型在客户端形成双模型协同更新体系,实现跨客户端的参数共享与聚合,使得全局共享参数能够更灵活地作用于本地模型,解决了当前方法采用单一全局模型难以同时适应各客户端的本地数据分布的问题
本发明采用客户端本地数据训练与全局模型共享模型参数的中继模型以及本地模型,通过本地模型与中继模型输出结果的表征能量差和本地模型与中继模型的中间特征输出对齐损失约束本地模型的更新方向,既使得客户端在训练初期具备稳定的特征提取能力,能增强本地模型在异质数据环境下的鲁棒性,又实现跨客户端的参数共享与聚合,使得全局共享参数能够更灵活地作用于本地模型,解决了当前方法采用单一全局模型难以同时适应各客户端本地数据分布的问题。
Smart Images

Figure CN122885486A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a classification model training method, storage medium, and device based on federated learning, belonging to the field of federated learning technology. Background Technology
[0002] Classic federated averaging algorithms are typically designed based on the assumption of independent and identically distributed (IOD). However, in real-world data environments, significant differences in data distribution are common among different clients, making it difficult for the single global model learned by the classic federated averaging algorithm to adapt to the local data distribution of each client simultaneously. Moreover, the way global model parameters are applied to local models remains relatively simplistic. Existing methods usually pre-determine the network structure components that need to be shared with the global model and apply global parameters directly to the local model by overriding or fusing them, making it difficult to dynamically adjust according to the data characteristics of different clients. Furthermore, the personalization of local models mainly relies on local training. When the amount of client data is limited and the distribution varies greatly, the local model tends to be biased towards local features, weakening the inheritance of cross-client common feature representations, thus affecting the personalization adaptation effect of the local model on heterogeneous datasets. Summary of the Invention
[0003] The purpose of this invention is to overcome the shortcomings of the prior art and provide a classification model training method, storage medium and device based on federated learning. It introduces a relay model to form a dual-model collaborative update system on the client side, realizes parameter sharing and aggregation across clients, and enables the globally shared parameters to be applied to the local model more flexibly. This solves the problem that the current method, which uses a single global model, is difficult to adapt to the local data distribution of each client at the same time.
[0004] To solve the above-mentioned technical problems, the present invention is implemented using the following technical solution: The first aspect of this invention provides a classification model training method based on federated learning, applied to a federated model training system, the federated model training system including a server and multiple clients communicating with the server; wherein, the server deploys a global model, the clients deploy relay models and local models, and the global model and the relay models share model parameters; The method includes: Divide the client's local data into a training set and a validation set; The relay model is trained using the training set to obtain the relay model update parameters; The validation set is input into the local model and the relay model respectively, and the representation energy difference between the outputs of the local model and the relay model and the intermediate feature output alignment loss between the local model and the relay model are calculated. Based on the difference in representation energy and the parameter update of the relay model, the parameters of the global model are updated to obtain the trained global model. The local model is trained using the training set, and the update direction of the local model parameters is constrained by the alignment loss based on the representation energy difference and intermediate features, thus obtaining the trained local model.
[0005] Furthermore, the step of training the relay model using the training set to obtain the relay model update parameters includes: The cross-entropy loss is used to determine the amount of model parameter updates in the relay model during training, using the following formula: ; in, Indicates client The amount of model parameter updates in the relay model. Indicates client Model parameters of the relay model Indicates the learning rate. Indicates client Cross-entropy loss in relay models express Compared to The partial derivatives; ; in, Indicates client The training set, This represents the total number of samples in the training set. Indicates the total number of categories. Indicates sample In the The values that a class can take. Indicates sample In the relay model, it is predicted to be the [number]. The probability of a class; The relay model is updated using the model parameter update values to obtain the relay model update parameters.
[0006] Further, the step of inputting the validation set into the local model and the relay model respectively, and calculating the representation energy difference between the outputs of the local model and the relay model, includes: The representation energy of the local model output is calculated using the following formula: ; in, Indicates client The representation energy of the local model output. Indicates client The validation set This represents the total number of samples in the validation set. Represents the samples in the validation set , Indicates the total number of categories. Indicates sample The first feature vector output by the local model One element, This represents an exponential function with the natural constant e as its base. The representation energy of the relay model output is calculated using the following formula: ; in, Indicates client The representation energy of the relay model output. Indicates sample In the relay model output feature vector of the th One element; The difference in representation energy between the outputs of the local model and the relay model is calculated using the following formula: ; in, Indicates client The difference in representation energy between the outputs of the relay model and the local model.
[0007] Furthermore, the step of updating the global model parameters based on the representation energy difference and the relay model update parameters to obtain the trained global model includes: Based on the representation energy difference, the slow update amount, used to measure the representation ability of the client relay model on local data, is calculated using the following formula: ; in, Indicates client In the The slow update rate of the training round. This represents the Sigmoid function. This represents the modulo operation. Indicates the process Rotation training, Indicates client In the Slow update rate during round training; Based on the slow update rate, the client-side aggregate weight for updating global model parameters is calculated using the following formula: ; in, Indicates client In the Client-side aggregated weights during round training. Indicates client The training set, This represents the total number of samples in the training set. Indicates client engagement rate. Indicates the total number of clients; The client-side aggregated weights are used to merge the relay model update parameters from each client, and then the global model parameters are updated using the following formula: ; in, Represents global model parameters. Indicates client In the Model parameters of the relay model during round training.
[0008] Further, the step of inputting the validation set into the local model and the relay model respectively, and calculating the intermediate feature output alignment loss between the local model and the relay model, includes: The intermediate features output by the local model feature extraction layer are calculated using the following formula: ; in, Indicates client Local model for samples The normalized intermediate features output by the feature extraction layer, Represents the samples in the validation set , Represents the L2 norm; Client The model parameters of the local model are represented as , , Indicates client The parameter matrix of the local model feature extraction layer. Indicates client The local model discriminant layer parameter matrix; The intermediate features output by the relay model feature extraction layer are calculated using the following formula: ; in, Indicates client Relay model for samples Normalized intermediate features output from the feature extraction layer; Client The model parameters of the relay model are expressed as follows: , , Indicates client The parameter matrix of the feature extraction layer in the relay model. Indicates client The parameter matrix of the discriminant layer in the relay model; Based on the intermediate features output by the local model feature extraction layer and the relay model feature extraction layer, the intermediate feature output alignment loss is calculated using the following formula: ; in, Indicates client Alignment loss of intermediate feature outputs between the local model and the relay model. Indicates client The validation set This represents the total number of samples in the validation set. Represents the samples in the validation set , express transpose, Indicates the temperature coefficient of comparison. express transpose, Indicates client Local model for samples The normalized intermediate features output by the feature extraction layer, Indicates client Relay model for samples Normalized intermediate features output from the feature extraction layer; This represents an exponential function with the natural constant e as its base.
[0009] Further, the step of training a local model using a training set and constraining the update direction of the local model parameters based on the representation energy difference and intermediate feature output alignment loss to obtain a trained local model includes: Based on the difference in representation energy, calculate the slow update amount used to measure the representation ability of the client relay model on local data and the fast update amount used to measure the representation ability of the client local model on local data. Based on slow and fast update rates, determine the migration variables for migrating update parameters from the relay model to the local model. We employ cross-entropy loss and intermediate feature output alignment loss to construct the optimization objective of the local model during training. The local model parameters are updated using transfer variables. When the optimization objective meets the preset threshold, the updated local model parameters for this round of training are output, and the trained local model is obtained.
[0010] Furthermore, the migration variables for determining the migration of relay model update parameters to the local model based on slow and fast update amounts include: The migration variables include the number of migration layers and the migration intensity; The number of migration layers is calculated using the following formula: ; in, Indicates client In the The number of transfer layers in each training round, This represents the function that takes the maximum value. This represents the floor function. Indicates the total number of feature extraction layers. Indicates client In the Slow update rate during round training; The migration intensity is calculated using the following formula: ; in, Indicates client In the In the first training round, the relay model updates parameters to the local model. The migration strength of the layer feature extraction layer migration. This represents an exponential function with base e. This represents the hyperparameter controlling the decay rate. Indicates client In the The baseline strength of the transfer of relay model update parameters to the local model feature extraction layer during round training; ; in, Represents the constraint function. Indicates client In the Rapid update volume in round training. express The weights; ; in, Indicates client The relay model in the first Cross-entropy loss during training rounds, This represents the Sigmoid function.
[0011] Furthermore, the step of updating the local model parameters using transfer variables, and outputting the updated local model parameters for this round of training when the optimization objective meets a preset threshold, to obtain the trained local model, includes: The optimization objective is expressed as: ; in, Indicates client Cross-entropy loss during local model training Indicates client Alignment loss of intermediate feature outputs between the local model and the relay model. Indicates the alignment loss weight; The method of updating local model parameters using migration variables is expressed as follows: ; Among them, the client The model parameters of the local model are represented as follows , , Indicates the client The parameter matrix of the local model feature extraction layer. Indicates the client The local model discriminant layer parameter matrix, Indicates the client The local model's first Layer feature extraction layer parameter vector; Client The model parameters of the relay model are expressed as follows: , , Indicates the client The parameter matrix of the feature extraction layer of the relay model. Indicates the client The parameter matrix of the discriminant layer of the relay model. Indicates the client The relay model Layer feature extraction layer parameter vector; when At that time, output the training results for this round. Corresponding model parameters This yields a well-trained local model.
[0012] A second aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the above-described federated learning-based classification model training method.
[0013] A third aspect of the present invention also provides a computer device, comprising: Memory, used to store instructions; A processor is configured to execute the instructions, causing the device to perform a federated learning-based classification model training method as described above.
[0014] Compared with the prior art, the beneficial effects achieved by the present invention are as follows: This invention employs a relay model and a local model that share model parameters with the global model and trains on local client data. By using the difference in representation energy between the outputs of the local model and the relay model, and the alignment loss of the intermediate feature outputs between the local model and the relay model, the update direction of the local model is constrained. This not only enables the client to have stable feature extraction capabilities in the early stages of training and enhances the robustness of the local model in heterogeneous data environments, but also achieves parameter sharing and aggregation across clients. This allows the globally shared parameters to be applied to the local model more flexibly, solving the problem that current methods using a single global model cannot simultaneously adapt to the distribution of local data on various clients. Attached Figure Description
[0015] Figure 1 This is a flowchart of a classification model training method based on federated learning provided in an embodiment of the present invention; Figure 2 This is a flowchart of local model parameter updating provided in an embodiment of the present invention. Detailed Implementation
[0016] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention. Example 1
[0017] This embodiment provides a classification model training method based on federated learning, which is applied to a federated model training system. The federated model training system includes a server and multiple clients that communicate with the server. The server deploys a global model, and the clients deploy relay models and local models. The global model and the relay models share model parameters. In this embodiment, the client The model parameters of the local model are represented as follows , , Indicates client The parameter matrix of the local model feature extraction layer. Indicates client The local model discriminant layer parameter matrix; , Indicates client The local model's first Layer feature extraction layer parameter vector, Indicates the total number of feature extraction layers; Client The model parameters of the relay model are expressed as follows: , , Indicates client The parameter matrix of the feature extraction layer of the relay model. Indicates client The parameter matrix of the discriminant layer in the relay model; , Indicates client The relay model Layer feature extraction layer parameter vector; like Figure 1 As shown, a classification model training method based on federated learning includes: Step 1: Set up the client The local data is divided into training sets. and verification set ; Step 2: Train the relay model using the training set to obtain the relay model update parameters; specifically: The cross-entropy loss is used to determine the amount of model parameter updates in the relay model during training, using the following formula: ; in, Indicates client The amount of model parameter updates in the relay model. Indicates the learning rate. Indicates client Cross-entropy loss in relay models express Compared to The partial derivatives; ; in, This represents the total number of samples in the training set. Indicates the total number of categories. Indicates sample In the The values that a class can take. Indicates sample In the relay model, it is predicted to be the [number]. The probability of a class; The relay model is updated using the model parameter update values to obtain the relay model update parameters.
[0018] Step 3: Input the validation set into the local model and the relay model respectively, and calculate the representation energy difference between the outputs of the local model and the relay model, as well as the alignment loss of the intermediate feature outputs between the local model and the relay model; specifically: The representation energy of the local model output is calculated using the following formula: ; in, Indicates client The representation energy of the local model output. This represents the total number of samples in the validation set. Represents the samples in the validation set , Indicates the total number of categories. Indicates sample The first feature vector output by the local model One element, This represents an exponential function with the natural constant e as its base. The representation energy of the relay model output is calculated using the following formula: ; in, Indicates client The representation energy of the relay model output. Indicates sample In the relay model output feature vector of the th One element; The difference in representation energy between the outputs of the local model and the relay model is calculated using the following formula: ; in, Indicates client The difference in representation energy between the outputs of the relay model and the local model; The intermediate features output by the local model feature extraction layer are calculated using the following formula: ; in, Indicates client Local model for samples The normalized intermediate features output by the feature extraction layer, Represents the L2 norm; The intermediate features output by the relay model feature extraction layer are calculated using the following formula: ; in, Indicates client relay model for samples Normalized intermediate features output from the feature extraction layer; Based on the intermediate features output by the local model feature extraction layer and the relay model feature extraction layer, the intermediate feature output alignment loss is calculated using the following formula: ; in, Indicates client Alignment loss of intermediate feature outputs between the local model and the relay model. Represents the samples in the validation set , express transpose, Indicates the temperature coefficient of comparison. express transpose, Indicates client Local model for samples The normalized intermediate features output by the feature extraction layer, Indicates client relay model for samples Normalized intermediate features output from the feature extraction layer; Step 4: Based on the representation energy difference and relay model update parameters, update the global model parameters to obtain the trained global model; specifically: Based on the representation energy difference, the slow update amount, used to measure the representation ability of the client relay model on local data, is calculated using the following formula: ; in, Indicates client In the The slow update rate of the training round. This represents the Sigmoid function. This represents the modulo operation. Indicates the process Rotation training, Indicates client In the Slow update rate during round training; Based on the slow update rate, the client-side aggregate weight for updating global model parameters is calculated using the following formula: ; in, Indicates client In the Client-side aggregated weights during round training. Indicates client engagement rate. Indicates the total number of clients; The client-side aggregated weights are used to merge the relay model update parameters from each client, and then the global model parameters are updated using the following formula: ; in, Represents global model parameters. Indicates client In the Model parameters of the relay model during round training.
[0019] Step 5, as follows Figure 2 As shown, a local model is trained using the training set, and the update direction of the local model parameters is constrained by the alignment loss based on the representation energy difference and intermediate features, resulting in a well-trained local model; specifically: Based on the difference in representation energy, calculate the slow update amount used to measure the representation ability of the client relay model on local data and the fast update amount used to measure the representation ability of the client local model on local data. The formula for calculating the fast update amount is: ; in, Indicates client In the Rapid update volume in round training. Indicates client The relay model in the first Cross-entropy loss during round training; Based on slow and fast update rates, the migration variables for migrating update parameters from the relay model to the local model are determined, including: Migration variables include the number of migration layers and the migration intensity; The formula for calculating the number of migration layers is: ; in, Indicates client In the The number of transfer layers in each training round, This represents the function that takes the maximum value. This represents the floor function; The formula for calculating migration strength is: ; in, Indicates client In the In the first training round, the relay model updates parameters to the local model. The migration strength of the layer feature extraction layer migration. This represents the hyperparameter controlling the decay rate. Indicates client In the The baseline strength of the transfer of relay model update parameters to the local model feature extraction layer during round training; ; in, Represents the constraint function. express The weights; We employ cross-entropy loss and intermediate feature output alignment loss to construct the optimization objective of the local model during training. , ; in, Indicates client Cross-entropy loss during local model training Indicates client The intermediate feature output of the local model and the relay model represents the alignment loss, which indicates the alignment loss weights. Updating local model parameters using migration variables is represented as: ; when At that time, output the training results for this round. Corresponding model parameters This yields a well-trained local model.
[0020] Example 2 This embodiment provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the following method steps: Divide the client's local data into a training set and a validation set; The relay model is trained using the training set to obtain the relay model update parameters; The validation set is input into the local model and the relay model respectively, and the representation energy difference between the outputs of the local model and the relay model and the intermediate feature output alignment loss between the local model and the relay model are calculated. Based on the difference in representation energy and the parameter update of the relay model, the parameters of the global model are updated to obtain the trained global model. The local model is trained using the training set, and the update direction of the local model parameters is constrained by the alignment loss based on the representation energy difference and intermediate features, thus obtaining the trained local model.
[0021] Example 3 This embodiment provides a computer device, including: Memory, used to store instructions; A processor, used to execute instructions that cause a device to perform the following method steps: Divide the client's local data into a training set and a validation set; The relay model is trained using the training set to obtain the relay model update parameters; The validation set is input into the local model and the relay model respectively, and the representation energy difference between the outputs of the local model and the relay model and the intermediate feature output alignment loss between the local model and the relay model are calculated. Based on the difference in representation energy and the parameter update of the relay model, the parameters of the global model are updated to obtain the trained global model. The local model is trained using the training set, and the update direction of the local model parameters is constrained by the alignment loss based on the representation energy difference and intermediate features, thus obtaining the trained local model.
[0022] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0023] This application is described with reference to flowchart illustrations of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each step in the flowchart can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the process. Figure 1 One or more processes or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0024] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 The function specified in one or more processes.
[0025] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 Steps of a specified function in one or more processes.
[0026] 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 classification model training method based on federated learning, characterized in that, This is applied to a federated model training system, which includes a server and multiple clients communicating with the server; wherein the server deploys a global model, and the clients deploy relay models and local models, and the global model and the relay models share model parameters; The method includes: Divide the client's local data into a training set and a validation set; The relay model is trained using the training set to obtain the relay model update parameters; The validation set is input into the local model and the relay model respectively, and the representation energy difference between the outputs of the local model and the relay model and the intermediate feature output alignment loss between the local model and the relay model are calculated. Based on the difference in representation energy and the parameter update of the relay model, the parameters of the global model are updated to obtain the trained global model. The local model is trained using the training set, and the update direction of the local model parameters is constrained by the alignment loss based on the representation energy difference and intermediate features, thus obtaining the trained local model.
2. The method for training a classification model based on federated learning according to claim 1, characterized in that, The relay model is trained using a training set to obtain the relay model update parameters, including: The cross-entropy loss is used to determine the amount of model parameter updates in the relay model during training, using the following formula: ; in, Indicates client The amount of model parameter updates in the relay model. Indicates client Model parameters of the relay model Indicates the learning rate. Indicates client Cross-entropy loss in relay models express Compared to The partial derivatives; ; in, Indicates client The training set, This represents the total number of samples in the training set. Indicates the total number of categories. Indicates sample In the The values that a class can take. Indicates sample In the relay model, it is predicted to be the [number]. The probability of a class; The relay model is updated using the model parameter update values to obtain the relay model update parameters.
3. The method for training a classification model based on federated learning according to claim 1, characterized in that, The step of inputting the validation set into the local model and the relay model respectively, and calculating the representation energy difference between the outputs of the local model and the relay model, includes: The representation energy of the local model output is calculated using the following formula: ; in, Indicates client The representation energy of the local model output. Indicates client The validation set This represents the total number of samples in the validation set. Represents the samples in the validation set , Indicates the total number of categories. Indicates sample The first feature vector output by the local model One element, This represents an exponential function with the natural constant e as its base. The representation energy of the relay model output is calculated using the following formula: ; in, Indicates client The representation energy of the relay model output. Indicates sample In the relay model output feature vector of the th One element; The difference in representation energy between the outputs of the local model and the relay model is calculated using the following formula: ; in, Indicates client The difference in representation energy between the outputs of the relay model and the local model.
4. The method for training a classification model based on federated learning according to claim 3, characterized in that, The process of updating global model parameters based on representation energy difference and relay model update parameters to obtain a trained global model includes: Based on the representation energy difference, the slow update amount, used to measure the representation ability of the client relay model on local data, is calculated using the following formula: ; in, Indicates client In the The slow update rate of the training round. This represents the Sigmoid function. This represents the modulo operation. Indicates the process Rotation training, Indicates the client is at the Slow update rate during round training; Based on the slow update rate, the client-side aggregate weight for updating global model parameters is calculated using the following formula: ; in, Indicates client In the Client-side aggregated weights during round training. Indicates client The training set, This represents the total number of samples in the training set. Indicates client engagement rate. Indicates the total number of clients; The client-side aggregated weights are used to merge the relay model update parameters from each client, and then the global model parameters are updated using the following formula: ; in, Represents global model parameters. Indicates client In the Model parameters of the relay model during round training.
5. The method for training a classification model based on federated learning according to claim 1, characterized in that, The step of inputting the validation set into the local model and the relay model respectively, and calculating the intermediate feature output alignment loss between the local model and the relay model includes: The intermediate features output by the local model feature extraction layer are calculated using the following formula: ; in, Indicates client Local model for samples The normalized intermediate features output by the feature extraction layer, Represents the samples in the validation set , Represents the L2 norm; Client The model parameters of the local model are represented as , , Indicates client The parameter matrix of the local model feature extraction layer. Indicates client The local model discriminant layer parameter matrix; The intermediate features output by the relay model feature extraction layer are calculated using the following formula: ; in, Indicates client relay model for samples Normalized intermediate features output from the feature extraction layer; Client The model parameters of the relay model are expressed as follows: , , Indicates client The parameter matrix of the feature extraction layer of the relay model. Indicates client The parameter matrix of the discriminant layer in the relay model; Based on the intermediate features output by the local model feature extraction layer and the relay model feature extraction layer, the intermediate feature output alignment loss is calculated using the following formula: ; in, Indicates client Alignment loss of intermediate feature outputs between the local model and the relay model. Indicates client The validation set This represents the total number of samples in the validation set. Represents the samples in the validation set , express transpose, Indicates the temperature coefficient of comparison. express transpose, Indicates client Local model for samples The normalized intermediate features output by the feature extraction layer, Indicates client relay model for samples Normalized intermediate features output from the feature extraction layer; This represents an exponential function with the natural constant e as its base.
6. The method for training a classification model based on federated learning according to claim 1, characterized in that, The process involves training a local model using a training set and constraining the update direction of the local model parameters based on the representation energy difference and intermediate feature output alignment loss, resulting in a trained local model, including: Based on the difference in representation energy, calculate the slow update amount used to measure the representation ability of the client relay model on local data and the fast update amount used to measure the representation ability of the client local model on local data. Based on slow and fast update rates, determine the migration variables for migrating update parameters from the relay model to the local model. We employ cross-entropy loss and intermediate feature output alignment loss to construct the optimization objective of the local model during training. The local model parameters are updated using transfer variables. When the optimization objective meets the preset threshold, the updated local model parameters for this round of training are output, and the trained local model is obtained.
7. The method for training a classification model based on federated learning according to claim 6, characterized in that, The migration variables for determining the migration of relay model update parameters to the local model based on slow and fast update amounts include: The migration variables include the number of migration layers and the migration intensity; The number of migration layers is calculated using the following formula: ; in, Indicates client In the The number of transfer layers in each training round, This represents the function that takes the maximum value. This represents the floor function. Indicates the total number of feature extraction layers. Indicates client In the Slow update rate during round training; The migration intensity is calculated using the following formula: ; in, Indicates client In the In the first training round, the relay model updates parameters to the local model. The migration strength of the layer feature extraction layer migration. This represents an exponential function with base e. This represents the hyperparameter controlling the decay rate. Indicates client In the The baseline strength of the transfer of relay model update parameters to the local model feature extraction layer during round training; ; in, Represents the constraint function. Indicates client In the Rapid update volume in round training. express The weights; ; in, Indicates client The relay model in the first Cross-entropy loss during training rounds, This represents the Sigmoid function.
8. The method for training a classification model based on federated learning according to claim 7, characterized in that, The process of updating local model parameters using transfer variables, and outputting the updated local model parameters for this round of training when the optimization objective meets a preset threshold, yields a trained local model, including: The optimization objective is expressed as: ; in, Indicates client Cross-entropy loss during local model training Indicates client Alignment loss of intermediate feature outputs between the local model and the relay model. Indicates the alignment loss weight; The method of updating local model parameters using migration variables is expressed as follows: ; Among them, the client The model parameters of the local model are represented as , , Indicates client The parameter matrix of the local model feature extraction layer. Indicates client The local model discriminant layer parameter matrix, Indicates client The local model's first Layer feature extraction layer parameter vector; Client The model parameters of the relay model are expressed as follows: , , Indicates client The parameter matrix of the feature extraction layer of the relay model. Indicates client The parameter matrix of the discriminant layer of the relay model. Indicates client The relay model Layer feature extraction layer parameter vector; when At that time, output the training results for this round. Corresponding model parameters This yields a well-trained local model.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the federated learning-based classification model training method as described in any one of claims 1 to 8.
10. A computer device, characterized in that, include: Memory, used to store instructions; A processor for executing the instructions, causing the device to perform a classification model training method based on federated learning as described in any one of claims 1 to 8.