Federated learning modeling optimization method, device, readable storage medium and program product
By distributing the initial global feature extraction model in federated learning for comparative learning and knowledge distillation, it solves the problem that samples of different data modalities cannot be jointly learned in horizontal federated learning, realizes multi-modal joint learning of samples, and improves the learning effect.
Patent Information
- Application Number
- CN202110860096.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-28
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2041-07-28
AI Technical Summary
The existing horizontal federated learning framework requires the samples of each participant to be aligned on the feature book, and can only combine samples of the same data modality for learning, resulting in strong limitations and the inability to effectively process samples of different data modalities.
By distributing the initial global feature extraction model corresponding to each data modality to the participating devices, comparative learning training is performed, the local feature extraction model is optimized, and based on the globally optimized model, feature extraction is performed on public samples of the target modality to perform selective Aggregation and knowledge distillation learning realize joint learning of samples from different data modalities.
It achieves the indirect union of samples from different data modalities, reduces the limitations of horizontal federated learning, and improves the prediction accuracy of the model and the richness of samples.
Smart Images

Figure CN113516255B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology in financial technology (Fintech), and in particular to a federated learning modeling optimization method, device, readable storage medium and program product. Background Art
[0002] With the continuous development of financial technology, especially Internet technology finance, more and more technologies (such as distributed, artificial intelligence, etc.) are applied in the financial field, but the financial industry also puts forward higher requirements on technology, such as higher requirements on the distribution of corresponding to-do items in the financial industry.
[0003] With the continuous development of computer software, artificial intelligence, and big data cloud service applications, at present, in the existing horizontal federated learning framework, one of the prerequisites of horizontal federated learning is that the samples of each participant need to be aligned in terms of the features themselves. The premise of aligning the features themselves usually requires that the samples of each participant are in the same data modality. For example, the samples of each participant are all images or all texts, etc. However, when the data modalities of the samples of each participant are different, horizontal federated learning cannot be performed between the participants. Therefore, the existing horizontal federated learning can only be performed by combining samples of the same data modality from different participants, and the existing horizontal federated learning has strong limitations. Summary of the invention
[0004] The main purpose of this application is to provide a federated learning modeling optimization method, device, readable storage medium and program product, aiming to solve the technical problem of strong limitations of horizontal federated learning in the prior art.
[0005] To achieve the above-mentioned purpose, the present application provides a federated learning modeling optimization method, which is applied to a federated server and includes:
[0006] Distribute the initial global feature extraction model corresponding to each data modality to the participant devices corresponding to each data modality, so that the participant devices can optimize the local feature extraction model based on the local private training samples by performing comparative learning training between the initial global feature extraction model and the local feature extraction model to obtain the globally optimized local feature extraction model, and extract features from the corresponding target modality public samples in the federal public data set based on the globally optimized local feature extraction model to obtain the target modality public sample representation;
[0007] Receive the target modality public sample representations sent by each of the participant devices, and perform selective aggregation on each of the target modality public sample representations based on the data modality to obtain the target modality aggregated sample representations corresponding to each of the data modalities;
[0008] Public training samples corresponding to each of the data modalities are obtained in the federal public dataset, and based on each of the public training samples, knowledge distillation learning and training based on the representation of aggregated samples of each of the target modalities are performed on each of the initial global feature extraction models, and comparative learning and training are performed between each of the initial global feature extraction models to obtain a target global feature extraction model corresponding to each of the initial model global feature extraction models.
[0009] The present application also provides a federated learning modeling optimization method, which is applied to a participant device and includes:
[0010] Receive the initial global feature extraction model sent by the federated server and extract local private training samples;
[0011] Based on the local private training samples, by performing comparative learning training between the initial global feature extraction model and the local feature extraction model, the local feature extraction model is optimized to obtain a globally optimized local feature extraction model;
[0012] Extracting target modality public samples belonging to the data modality corresponding to the globally optimized local feature extraction model from the federated public data set, and performing feature extraction on the target modality public samples based on the globally optimized local feature extraction model to obtain target modality public sample representations;
[0013] The target modality public sample representation is sent to the federal server, so that the federal server can perform selective aggregation based on the data modality on each of the target modality public sample representations to obtain the target modality aggregated sample representation corresponding to each of the data modalities, and obtain the public training samples corresponding to each of the data modalities in the federal public data set, and based on each of the public training samples, perform knowledge distillation learning training on each of the initial global feature extraction models based on the target modality aggregated sample representation, and perform comparative learning training between each of the initial global feature extraction models to obtain the target global feature extraction model corresponding to each of the initial model global feature extraction models.
[0014] The present application also provides a federated learning modeling optimization device, which is a virtual device and is applied to a federated server. The federated learning modeling optimization device includes:
[0015] A model distribution module is used to distribute the initial global feature extraction model corresponding to each data modality to the participant devices corresponding to each data modality, so that the participant devices can optimize the local feature extraction model based on local private training samples by performing comparative learning training between the initial global feature extraction model and the local feature extraction model to obtain a globally optimized local feature extraction model, and based on the globally optimized local feature extraction model, perform feature extraction on the corresponding target modality public samples in the federal public data set to obtain the target modality public sample representation;
[0016] A selective aggregation module, used to receive the target modality public sample representations sent by each of the participating devices, and perform selective aggregation on each of the target modality public sample representations based on the data modality to obtain the target modality aggregated sample representations corresponding to each of the data modalities;
[0017] A training module is used to obtain public training samples corresponding to each of the data modalities in the federal public dataset, and based on each of the public training samples, perform knowledge distillation learning training on each of the initial global feature extraction models based on the representation of the aggregated samples of each of the target modalities, and perform comparative learning training between each of the initial global feature extraction models to obtain a target global feature extraction model corresponding to the global feature extraction model of each of the initial models.
[0018] The present application also provides a federated learning modeling optimization device, which is a virtual device and is applied to a participant device. The federated learning modeling optimization device includes:
[0019] A receiving module, used to receive the initial global feature extraction model sent by the federal server and extract local private training samples;
[0020] A contrastive learning training module, used for optimizing the local feature extraction model by performing contrastive learning training between the initial global feature extraction model and the local feature extraction model based on the local private training samples, so as to obtain a globally optimized local feature extraction model;
[0021] A feature extraction module, used to extract target modality public samples belonging to the data modality corresponding to the globally optimized local feature extraction model from the federated public data set, and perform feature extraction on the target modality public samples based on the globally optimized local feature extraction model to obtain a representation of the target modality public samples;
[0022] A sending module is used to send the target modality public sample representation to a federal server, so that the federal server can perform selective aggregation based on the data modality on each of the target modality public sample representations to obtain the target modality aggregated sample representation corresponding to each of the data modalities, and obtain the public training samples corresponding to each of the data modalities in the federal public data set; based on each of the public training samples, perform knowledge distillation learning training on each of the initial global feature extraction models based on the target modality aggregated sample representation; and perform comparative learning training between each of the initial global feature extraction models to obtain the target global feature extraction model corresponding to each of the initial model global feature extraction models.
[0023] The present application also provides a federated learning modeling optimization device, which is a physical device, and includes: a memory, a processor, and a program of the federated learning modeling optimization method stored in the memory and executable on the processor. When the program of the federated learning modeling optimization method is executed by the processor, the steps of the federated learning modeling optimization method as described above can be implemented.
[0024] The present application also provides a readable storage medium, on which is stored a program for implementing the federated learning modeling optimization method. When the program of the federated learning modeling optimization method is executed by a processor, the steps of the federated learning modeling optimization method as described above are implemented.
[0025] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned federated learning modeling optimization method when executed by a processor.
[0026] The present application provides a federated learning modeling optimization method, device, readable storage medium and program product. Compared with the technical means adopted in the prior art to align the features of each participant to perform horizontal federated learning, the present application first distributes the initial global feature extraction model corresponding to each data modality to the participant devices corresponding to each data modality, so that the participant devices can optimize the local feature extraction model based on local private training samples by performing comparative learning and training between the initial global feature extraction model and the local feature extraction model, so that the local feature extraction model can learn the model knowledge of the global model, and then A globally optimized local feature extraction model is obtained, and then based on the globally optimized local feature extraction model, feature extraction is performed on the corresponding target modality public samples in the federated public data set to obtain the target modality public sample representation, the target modality public sample representation sent by each of the participating devices is received, and each of the target modality public sample representations is selectively aggregated based on the data modality to obtain the target modality aggregated sample representation corresponding to each of the data modalities, so as to achieve the purpose of respectively aggregating the target modality public sample representations belonging to the same data modality, and then obtain the target modality aggregated sample representation corresponding to each of the data modalities in the federated public data set. The corresponding public training samples are obtained, and based on each of the public training samples, the knowledge distillation learning training based on the aggregated sample representation of each target modality is performed on each of the initial global feature extraction models, and comparative learning training is performed between each of the initial global feature extraction models to obtain the target global feature extraction model corresponding to each of the initial model global feature extraction models. Since the public sample representation of each target modality is optimized based on the local private training samples of the participant device to obtain the output of the globally optimized local feature extraction model, each initial global feature extraction model can be indirectly combined with samples of multiple participants of the corresponding data modality through knowledge distillation for horizontal federated learning, and at the same time, the initial global feature extraction model corresponding to each data modality can use comparative learning to align samples of different data modalities in the feature space, thereby achieving the purpose of indirectly combining samples of different data modalities for horizontal federated learning, so that horizontal federated learning is no longer limited to samples of the same data modality of different participants, and overcomes the technical defect that the existing horizontal federated learning in the prior art is that it can only be combined with samples of the same data modality of different participants, so the limitations of horizontal federated learning are reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0028] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0029] Figure 1 This is a flowchart of the first embodiment of the federated learning modeling optimization method of the present application;
[0030] Figure 2 This is a flow chart of the second embodiment of the federated learning modeling optimization method of the present application;
[0031] Figure 3 A schematic diagram of the interactive process when performing horizontal federated learning modeling in the federated learning modeling optimization method of this application;
[0032] Figure 4 This is a schematic diagram of the device structure of the hardware operating environment involved in the federated learning modeling optimization method in the embodiment of the present application.
[0033] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0034] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0035] The present application embodiment provides a federated learning modeling optimization method, which is applied to a federated server. In the first embodiment of the federated learning modeling optimization method of the present application, refer to Figure 1 , the federated learning modeling optimization method includes:
[0036] Step S10, distributing the initial global feature extraction model corresponding to each data modality to the participant devices corresponding to each data modality, so that the participant devices can optimize the local feature extraction model based on the local private training samples by performing comparative learning training between the initial global feature extraction model and the local feature extraction model, and obtain the globally optimized local feature extraction model, and based on the globally optimized local feature extraction model, perform feature extraction on the corresponding target modality public samples in the federated public data set to obtain the target modality public sample representation;
[0037] In this embodiment, it should be noted that the federated learning modeling optimization method is applied to horizontal federated learning, wherein the framework of horizontal federated learning includes a federated server and multiple participant devices, wherein the federated server maintains a global model, the participant devices maintain their respective local models, and multiple data modalities correspond between each participant device, wherein one data modality corresponds to at least one participant device. For example, assuming that there are data modalities A and B, data modality A corresponds to participant device A and participant device b, that is, participant a and participant device b have samples belonging to data modality A, and data modality B corresponds to participant device c, that is, participant device c has samples belonging to data modality B.
[0038] In addition, it should be noted that the participating device has its own local private training samples, wherein the local private training samples may have corresponding local sample labels, and the data modality of the local private training samples is the data modality corresponding to the participating device. Each participating device and the federal server have the same federal public data set, and the federal public data set has public training samples belonging to the data modality corresponding to each of the participating devices. The federal server maintains a corresponding initial global feature extraction model for each data modality corresponding to each participating device, and the participating device maintains a local feature extraction model for its own corresponding data modality.
[0039] The initial global feature extraction model corresponding to each data modality is distributed to the participant devices corresponding to each of the data modalities, so that the participant devices can optimize the local feature extraction model based on the local private training samples by performing comparative learning and training between the initial global feature extraction model and the local feature extraction model to obtain the globally optimized local feature extraction model, and based on the globally optimized local feature extraction model, perform feature extraction on the corresponding target modality public samples in the federal public data set to obtain the target modality public sample representation. Specifically, the initial global feature extraction model corresponding to each data modality is distributed to the participant devices corresponding to the corresponding data modality, so that the participant devices obtain the locally held local private training samples and local feature extraction models, and perform feature extraction on the corresponding target modality public samples in the federal public data set based on the global optimized local feature extraction model to obtain the target modality public sample representation. A comparative learning training is performed between the model and the local feature extraction model to enable the local feature extraction model to learn the model knowledge of the initial global feature extraction model, optimize the local feature extraction model, and obtain the globally optimized local feature extraction model. Then, the participating device extracts the target modality public samples of the data modality corresponding to the participating device in the federal public data set, and uses the globally optimized local feature extraction model to perform feature extraction on the target modality public samples, and maps the target modality public samples to the target modality public sample representation. The specific implementation process of the participating device obtaining the globally optimized local feature extraction model and obtaining the target modality public sample representation can be specifically referred to the specific contents of steps A10 to A30 and their detailed steps, which will not be repeated here.
[0040] Step S20, receiving the target modality public sample representations sent by each of the participant devices, and performing selective aggregation on each of the target modality public sample representations based on the data modality to obtain the target modality aggregated sample representations corresponding to each of the data modalities;
[0041] In this embodiment, the target modality public sample representation sent by each of the participating devices is received, and each of the target modality public sample representations is selectively aggregated based on the data modality to obtain the target modality aggregated sample representation corresponding to each of the data modalities. Specifically, the target modality public sample representation sent by each of the participating devices is received, and then the target modality public sample representations corresponding to the same data modality in each of the target modality public sample representations are respectively aggregated to obtain the target modality aggregated sample representation corresponding to each of the data modalities. For example, assuming that there are three target modality public sample representations X1, X2 and X3 corresponding to data modality A, and there are three target modality public sample representations X4, X5 and X6 corresponding to data modality B, then X1, X2 and X3 are selected for aggregation to obtain the target modality aggregated sample representation Z1 corresponding to data modality A, and X4, X5 and X6 are selected for aggregation to obtain the target modality aggregated sample representation Z2 corresponding to data modality B.
[0042] The step of selectively aggregating the public sample representations of each target modality based on the data modality to obtain the target modality aggregated sample representations corresponding to each data modality includes:
[0043] Step S21, based on the correspondence between each of the participant devices and each of the data modalities, determining each to-be-aggregated sample representation corresponding to each of the data modalities in the public sample representations of each of the target modalities;
[0044] In this embodiment, it should be noted that one of the data modalities corresponds to at least one sample representation to be aggregated. Since the target modality public sample representation is sent by the participant device to the federal server, the target modality public sample representation has a one-to-one correspondence with the participant device. One of the participant devices has a data modality, and the data modalities of each participant device may be the same or different.
[0045] Based on the correspondence between each of the participant devices and each of the data modalities, the sample representations to be aggregated corresponding to each of the data modalities are determined in the public sample representations of the target modalities. Specifically, based on the correspondence between each of the participant devices and each of the data modalities, the sample representations to be aggregated corresponding to each data modality are determined in the public sample representations of the target modalities of each of the participant devices. For example, assuming that there are participant devices a1 and a2, corresponding to data modality A, and there are participant devices b1 and b2, corresponding to data modality B, then the target modality public sample representations sent by participant devices a1 and a2 to the federal server are both the sample representations to be aggregated corresponding to data modality A, and the target modality public sample representations sent by participant devices b1 and b2 to the federal server are both the sample representations to be aggregated corresponding to data modality B.
[0046] Step S22, respectively aggregate the sample representations to be aggregated corresponding to the data modalities to obtain the target modality aggregated sample representations corresponding to the data modalities.
[0047] In this embodiment, the sample representations to be aggregated corresponding to the data modalities are aggregated respectively to obtain the target modality aggregated sample representations corresponding to the data modalities. Specifically, based on the preset aggregation rules, the sample representations to be aggregated corresponding to each data modality are aggregated respectively to obtain the target modality aggregated sample representations corresponding to each data modality, wherein the preset aggregation rules include summing and averaging, etc. For example, assuming that data modality A corresponds to two sample representations to be aggregated, namely a1 and a2, and data modality B corresponds to two sample representations to be aggregated, namely b1 and b2, then a1 and a2 are aggregated into the target modality aggregated sample representation corresponding to data modality A, and b1 and b2 are aggregated into the target modality aggregated sample representation corresponding to data modality B.
[0048] Step S30, obtaining public training samples corresponding to each of the data modalities in the federal public dataset, and based on each of the public training samples, performing knowledge distillation learning training on each of the initial global feature extraction models based on the representation of the aggregated samples of each of the target modalities, and performing comparative learning training between each of the initial global feature extraction models to obtain a target global feature extraction model corresponding to each of the initial model global feature extraction models.
[0049] In this embodiment, it should be noted that the target modality aggregated sample representation is used to guide the optimization of the corresponding initial global feature extraction model so that the output of the initial global feature extraction model is as close as possible to the corresponding target modality aggregated sample representation.
[0050] Obtain public training samples corresponding to each of the data modalities in the federal public dataset, and based on each of the public training samples, perform knowledge distillation learning training based on the representation of aggregated samples of each target modality on each of the initial global feature extraction models, and perform comparative learning training between each of the initial global feature extraction models to obtain a target global feature extraction model corresponding to each of the initial model global feature extraction models. Specifically, obtain public training samples corresponding to each of the data modalities in the federal public dataset, and based on each of the public training samples, perform knowledge distillation learning training based on the representation of aggregated samples of each target modality on each of the initial global feature extraction models to transfer the model knowledge of the globally optimized local feature extraction model of each data modality in each participating device to the initial global feature extraction model corresponding to the corresponding data modality, and perform comparative learning training between each of the initial global feature extraction models to promote the alignment of samples of different data modalities in the feature space, thereby obtaining a target global feature extraction model corresponding to each of the initial model global feature extraction models.
[0051] In addition, it should be noted that the federal server can directly use the target modality public samples selected by each participating device in the federal public data set as public training samples. For example, assuming that participating device A selects multiple target modality public samples with data modality a, denoted as X1, participating device B selects multiple target modality public samples with data modality a, denoted as X2, and participating device C selects multiple target modality public samples with data modality b, denoted as X3, then X1 and X2 can be directly used as public training samples of the initial global feature extraction model corresponding to the data modality a selected by the federal server, and X3 can be directly used as the public training sample of the initial global feature extraction model corresponding to the data modality b selected by the federal server.
[0052] In addition, it should be noted that although the target modality aggregate sample representation is used to guide the optimization of the corresponding initial global feature extraction model so that the output of the initial global feature extraction model is as close as possible to the corresponding target modality aggregate sample representation, since the target modality aggregate sample representation is the aggregation result of the target modality public sample representations corresponding to several target modality public samples, the target modality aggregate sample representation to a certain extent represents the corresponding data modality rather than a single sample, and thus samples of the data modality corresponding to the initial global feature extraction model can be re-selected from the federal public dataset as public training samples of the initial global feature extraction model, rather than having to use the target modality public samples selected by each participating device in the federal public dataset as public training samples.
[0053] Among them, the steps of performing knowledge distillation learning training based on the representation of each target modality aggregate sample on each of the initial global feature extraction models based on each of the public training samples, and performing comparative learning training between each of the initial global feature extraction models to obtain the target global feature extraction model corresponding to each of the initial model global feature extraction models include:
[0054] Step S31, mapping the public training samples corresponding to each of the data modalities into prediction sample representations through the corresponding initial global feature extraction model;
[0055] In this embodiment, the public training samples corresponding to each of the data modalities are respectively mapped to predicted sample representations through the corresponding initial global feature extraction models. Specifically, each of the public training samples is respectively input into the initial global feature extraction model corresponding to the data modality corresponding to each of the public training samples, and feature extraction is performed on each of the public training samples to map each of the public training samples to a preset sample representation space to obtain the predicted sample representation corresponding to each of the public training samples, that is, each of the public training samples is mapped to the corresponding predicted sample representation.
[0056] Step S32, calculating the knowledge distillation loss between each of the predicted sample representations and the corresponding target modality aggregated sample representation, and calculating the contrastive learning loss between each of the predicted sample representations;
[0057] In this embodiment, the knowledge distillation loss between each of the predicted sample representations and the corresponding target modality aggregated sample representation is calculated, and the contrastive learning loss between each of the predicted sample representations is calculated. Specifically, the knowledge distillation loss is calculated based on the similarity between each of the predicted sample representations and the corresponding target modality aggregated sample representation, and the contrastive learning loss is calculated based on the similarity between each of the predicted sample representations.
[0058] The steps of calculating the knowledge distillation loss between each of the predicted sample representations and the corresponding target modality aggregated sample representation, and calculating the contrastive learning loss between each of the predicted sample representations include:
[0059] Step S321, based on the sample labels corresponding to the public training samples, respectively selecting the positive sample representation and the negative sample representation corresponding to each of the predicted sample representations;
[0060] In this embodiment, it should be noted that when public training samples of different modal data represent the same thing, the public training samples of different modal data representing the same thing have the same sample label, and the public training samples of different modal data representing the same thing constitute a public training sample group, that is, samples belonging to the same public training sample group have the same sample label, and samples that do not belong to the same public training sample group have different sample labels.
[0061] Based on the sample labels corresponding to the public training samples, positive sample representations and negative sample representations corresponding to the prediction sample representations are respectively selected from the prediction sample representations. Specifically, based on the sample labels corresponding to the public training samples, a public training sample group corresponding to the public training samples is determined, and then for each public training sample:
[0062] The other predicted sample representations corresponding to other public training samples in the public training sample group corresponding to the public training sample are used as the positive sample representation corresponding to the predicted sample representation corresponding to the public training sample, and the other predicted sample representations corresponding to other samples outside the public training sample group corresponding to the public training sample are used as the negative sample representation corresponding to the predicted sample representation corresponding to the public training sample, so as to obtain the positive sample representation and the corresponding negative sample representation corresponding to each of the predicted sample representations, wherein the number of the positive sample representations and the negative sample representations is at least 1.
[0063] In another implementation, if the number of participating devices is 2, and the data modalities corresponding to the two participating devices are different, then the public training samples include first public training samples belonging to the first data modality and second public training samples belonging to the second data modality.
[0064] The step of selecting the positive sample representation and the negative sample representation corresponding to each predicted sample representation based on the sample label corresponding to each public training sample comprises:
[0065] In each of the second public training samples, a sample having the same sample label as the first public training sample is determined as a first positive sample corresponding to the first public training sample, and a sample not having the same sample label as the first public training sample is determined as a first negative sample corresponding to the first public training sample; the predicted sample representation corresponding to the first positive sample is used as the positive sample representation of the predicted sample representation corresponding to the first public training sample, and the predicted sample representation corresponding to the first negative sample is used as the negative sample representation of the predicted sample representation corresponding to the first public training sample.
[0066] Similarly, in each of the first public training samples, a sample having the same sample label as the second public training sample is determined as a second positive sample corresponding to the second public training sample, and a sample not having the same sample label as the second public training sample is determined as a second negative sample corresponding to the second public training sample; the predicted sample representation corresponding to the second positive sample is used as the positive sample representation of the predicted sample representation corresponding to the second public training sample, and the predicted sample representation corresponding to the second negative sample is used as the negative sample representation of the predicted sample representation corresponding to the second public training sample.
[0067] Step S322, calculating the contrastive learning loss corresponding to each of the initial global feature extraction models based on each of the predicted sample representations and the positive sample representations corresponding to each of the predicted sample representations and the corresponding negative sample representations;
[0068] In this embodiment, based on each of the predicted sample representations and the positive sample representations corresponding to each of the predicted sample representations and the corresponding negative sample representations, the contrastive learning loss corresponding to each of the initial global feature extraction models is calculated. Specifically, the following steps are performed for each initial global feature extraction model:
[0069] Based on the similarity between each predicted sample representation output by the initial global feature extraction model and the corresponding positive sample representation, and the similarity between each predicted sample representation output by the initial global feature extraction model and the corresponding negative sample representation, the contrastive learning loss corresponding to the initial global feature extraction model is calculated, and then the contrastive learning loss corresponding to each of the initial global feature extraction models is obtained, wherein, in an practicable manner, the contrastive learning loss is calculated as follows:
[0070]
[0071] Among them, L N is the contrastive learning loss, N-1 is the number of negative sample representations, f(x) T is the predicted sample representation, f(x + ) is the positive sample representation corresponding to the predicted sample representation, The j-th negative sample representation corresponding to the predicted sample representation.
[0072] Step S323, based on the similarity between each of the predicted sample representations and the corresponding target modality aggregated sample representation, respectively calculate the knowledge distillation loss corresponding to each of the initial global feature extraction models.
[0073] In this embodiment, based on the similarity between each of the predicted sample representations and the corresponding target modal aggregate sample representations, the knowledge distillation loss corresponding to each of the initial global feature extraction models is calculated respectively. Specifically, based on the similarity between each of the predicted sample representations and the corresponding target modal aggregate sample representations, the cross entropy between each of the predicted sample representations and the corresponding target modal aggregate sample representations is calculated respectively to obtain the knowledge distillation loss corresponding to each of the initial global feature extraction models.
[0074] In another embodiment, based on the similarity between each of the predicted sample representations and the corresponding target modality aggregated sample representation, the knowledge distillation loss corresponding to each of the initial global feature extraction models is calculated respectively by using an L2 loss function.
[0075] Step S33, based on the knowledge distillation loss and the corresponding contrastive learning loss corresponding to each of the initial global feature extraction models, optimize each of the initial global feature extraction models to obtain each target global feature extraction model.
[0076] In this embodiment, it should be noted that if the initial global feature extraction model is optimized based on contrastive learning loss, each initial global feature extraction model will be prompted to output a sample representation with a similarity greater than the first preset similarity threshold for public training samples of each data modality with the same sample label, and each initial global feature extraction model will output a sample representation that is as similar as possible, and each initial global feature extraction model will be prompted to output a sample representation with a similarity less than the second preset similarity threshold for public training samples of each data modality with different sample labels, and each initial global feature extraction model will output a sample representation that is as dissimilar as possible. Therefore, optimizing the initial global feature extraction model based on contrastive learning loss can shorten the distance between the predicted sample representation output by the initial global feature extraction model and its corresponding positive sample representation, and increase the distance between the predicted sample representation output by the initial global feature extraction model and its corresponding negative sample representation, wherein the first preset similarity threshold is greater than the second preset similarity threshold.
[0077] Furthermore, since the knowledge distillation loss is a cross entropy loss or an L2 loss, the predicted sample representation output by the initial global feature extraction model will be as close as possible to the target modal aggregate sample representation corresponding to the initial global feature extraction model, so that the similarity between the predicted sample representation output by the initial global feature extraction model and the target modal aggregate sample representation corresponding to the initial global feature extraction model is greater than a preset third similarity threshold, thereby achieving the purpose of prompting the initial global feature extraction model to learn the model knowledge of the globally optimized local feature extraction model in each participating device corresponding to the corresponding data modality.
[0078] Based on the knowledge distillation loss and the corresponding contrastive learning loss corresponding to each of the initial global feature extraction models, optimize each of the initial global feature extraction models to obtain each target global feature extraction model. Specifically, aggregate the knowledge distillation loss and the corresponding contrastive learning loss corresponding to each of the initial global feature extraction models to obtain the total global model loss corresponding to each of the initial global feature extraction models, and then determine whether each of the initial global feature extraction models meets the preset training end condition. If so, use each of the initial global feature extraction models as the corresponding target global feature extraction model. If not, update the corresponding initial model global feature extraction model based on the model gradient calculated based on the total loss of each model, and return to the execution step: distribute the initial global feature extraction model corresponding to each data modality to the participant device corresponding to each of the data modalities, wherein the preset training end condition includes Including that the total loss of each model converges and the number of iterations of each of the initial global feature extraction models reaches the preset iteration number threshold, etc., thereby realizing the construction of global models corresponding to each data modality by combining data belonging to the same data modality through knowledge distillation based on the federated public data set, and at the same time aligning the sample representations generated by the global model for samples of different data modalities in the feature space through comparative learning, thereby achieving the purpose of horizontal federated learning on samples of different data modalities, and thus realizing the transition from horizontal federated learning based on samples of the same data modality to horizontal federated learning based on samples of multiple data modalities, solving the data island problem of participating devices with different data modalities, further improving the richness of samples used for horizontal federated learning, improving the effect of horizontal federated learning, and making the model prediction accuracy of horizontal federated learning higher.
[0079] Furthermore, after step S30, the method further includes:
[0080] According to the data modality corresponding to each target global feature extraction model, each target global feature extraction model is respectively sent to the participant device having the data modality corresponding to each target global feature extraction model, and then the participant device optimizes the local feature extraction model based on the local private training samples by performing comparative learning and training between the target global feature extraction model and the local feature extraction model, so as to obtain the target local feature extraction model. The specific implementation process of the participant device obtaining the target local feature extraction model by performing comparative learning and training between the target global feature extraction model and the local feature extraction model based on the local private training samples can refer to the specific contents in steps A10 to A20 and the detailed steps thereof, which will not be repeated here.
[0081] The embodiment of the present application provides a method for optimizing federated learning modeling. Compared with the technical means adopted in the prior art that aligns the features of each participant itself to perform horizontal federated learning, the embodiment of the present application first distributes the initial global feature extraction model corresponding to each data modality to the participant devices corresponding to each data modality, so that the participant devices can optimize the local feature extraction model based on local private training samples by performing comparative learning and training between the initial global feature extraction model and the local feature extraction model, so that the local feature extraction model can learn the model knowledge of the global model, and then obtain the globally optimized local feature extraction model, and then based on the globally optimized local feature extraction model, perform feature extraction on the corresponding target modality public samples in the federated public data set to obtain the target modality public sample representation, receive the target modality public sample representation sent by each of the participant devices, and perform selective aggregation of the target modality public sample representation based on the data modality to obtain the target modality aggregated sample representation corresponding to each of the data modalities, so as to achieve the purpose of respectively aggregating the target modality public sample representations belonging to the same data modality, and then obtain the public training corresponding to each of the data modalities in the federated public data set. Training samples, and based on each of the public training samples, respectively perform knowledge distillation learning training on each of the initial global feature extraction models based on the representation of the aggregated samples of each target modality, and perform comparative learning training between each of the initial global feature extraction models to obtain the target global feature extraction model corresponding to each of the global feature extraction models of the initial models. Since the representation of each target modality public sample is optimized based on the local private training samples of the participant's device to obtain the output of the globally optimized local feature extraction model, each initial global feature extraction model can indirectly combine the samples of multiple participants of the corresponding data modality through knowledge distillation for horizontal federated learning, and at the same time, the initial global feature extraction model corresponding to each data modality can use comparative learning to align the samples of different data modalities in the feature space, thereby achieving the purpose of indirectly combining samples of different data modalities for horizontal federated learning, so that horizontal federated learning is no longer limited to samples of the same data modality of different participants, and overcomes the technical defect that the existing horizontal federated learning in the prior art is that it can only combine samples of the same data modality of different participants, thereby reducing the limitations of horizontal federated learning.
[0082] Further, refer to Figure 2 In another embodiment of the present application, the federated learning modeling optimization method is applied to a participant device, and the federated learning modeling optimization method includes:
[0083] Step A10, receiving the initial global feature extraction model sent by the federal server, and extracting local private training samples;
[0084] In this embodiment, it should be noted that the initial global feature extraction model is a target global feature extraction model that is not optimized in the federal server, and the local private training samples are training sample data privately owned by the participating device, which is the privacy data of the participating device.
[0085] Step A20, based on the local private training samples, optimizing the local feature extraction model by performing comparative learning training between the initial global feature extraction model and the local feature extraction model to obtain a globally optimized local feature extraction model;
[0086] In this embodiment, it should be noted that the local feature extraction model is a feature extraction model maintained locally by the participating device, and the number of the local private training samples is at least 1.
[0087] Based on the local private training samples, by performing comparative learning training between the initial global feature extraction model and the local feature extraction model, the local feature extraction model is optimized to obtain a globally optimized local feature extraction model. Specifically, the initial global feature extraction model is used to perform feature extraction on all local private training samples to obtain first sample representations, and the local feature extraction model is used to perform feature extraction on all local private training samples to obtain second sample representations. Based on the similarity between each first sample representation and each second sample representation, the comparative learning loss is calculated. Based on the comparative learning loss, the local feature extraction model is optimized to obtain a globally optimized local feature extraction model.
[0088] The step of optimizing the local feature extraction model by performing comparative learning training between the initial global feature extraction model and the local feature extraction model based on the local private training sample to obtain the globally optimized local feature extraction model comprises:
[0089] Step A21, mapping all the local private training samples into a first sample representation through the initial global feature extraction model, and mapping all the local private training samples into a second sample representation through the local feature extraction model;
[0090] In this embodiment, feature extraction is performed on all local private training samples through the initial global feature extraction model, and all local private training samples are respectively mapped to corresponding first sample representations, and feature extraction is performed on all local private training samples through the local feature extraction model, and all local private training samples are respectively mapped to corresponding second sample representations.
[0091] Step A22, calculating contrastive learning loss based on the similarity between each of the first sample representations and each of the second sample representations;
[0092] In this embodiment, based on the similarity between each of the first sample representations and each of the second sample representations, the contrastive learning loss is calculated. Specifically, the following steps are performed for each of the second sample representations:
[0093] A target sample representation corresponding to the same local private training sample as the second sample representation is determined in each of the first sample representations, and the target sample representation is used as the local positive sample representation corresponding to the second sample representation, and other first sample representations except the target sample representation are used as the local negative sample representation corresponding to the second sample representation, and then based on the local positive sample representation corresponding to each second sample representation and the corresponding local negative sample representation, the contrastive learning loss is calculated.
[0094] The step of calculating the contrastive learning loss based on the similarity between each of the first sample representations and each of the second sample representations comprises:
[0095] Step A221, taking the sample representation of the same local private training sample as the second sample representation in each of the first sample representations as the local positive sample representation corresponding to the second sample representation;
[0096] Step A222, taking the sample representations in each of the second sample representations that do not correspond to the same local private training sample as the first sample representation as the local negative sample representation corresponding to the first sample representation;
[0097] Step A223: Calculate the contrastive learning loss based on the similarity between each of the second sample representations and the local positive sample representations corresponding to each of the second sample representations, and the similarity between each of the second sample representations and the local negative sample representations corresponding to each of the second sample representations.
[0098] In this embodiment, based on the similarity between each second sample representation and the corresponding local positive sample representation, and the similarity between each second sample representation and the corresponding local negative sample representation, the single sample contrastive learning loss corresponding to each second sample representation is calculated, and then the single sample contrastive learning losses are accumulated to obtain the contrastive learning loss, wherein the specific formula for calculating the contrastive learning loss is as follows:
[0099]
[0100] Among them, L N is the contrastive learning loss, N-1 is the number of local negative sample representations, f(x) TFor the second sample characterization, f(x + ) is the local positive sample representation corresponding to the second sample representation, The j-th local negative sample representation corresponding to the second sample representation.
[0101] Step A23: optimizing the local feature extraction model based on the contrastive learning loss to obtain a globally optimized local feature extraction model.
[0102] In this embodiment, based on the contrastive learning loss, the local feature extraction model is optimized to obtain a globally optimized local feature extraction model. Specifically, it is determined whether the contrastive learning loss converges. If so, the local feature extraction model is used as the globally optimized local feature extraction model. If not, the local feature extraction model is updated based on the model gradient calculated by the contrastive learning loss, and the execution step is returned to: extracting local private training samples, thereby achieving the purpose of prompting the local feature extraction model to learn the model knowledge of the initial global feature extraction model, so that the output of the local feature extraction model and the initial global feature extraction model for the same sample are as close as possible, thereby achieving global optimization of the corresponding local feature extraction.
[0103] The step of optimizing the local feature extraction model based on the contrastive learning loss to obtain a globally optimized local feature extraction model includes:
[0104] Step A231, converting each of the second sample representations into an output classification label corresponding to each of the local private training samples through a preset classification model;
[0105] In this embodiment, it should be noted that the local private training samples have corresponding preset true labels, wherein the preset true labels are identifiers of the local private training samples, which can be used to represent information such as categories, attributes and identities of the local private convergence samples.
[0106] Through a preset classification model, each of the second sample representations is converted into an output classification label corresponding to each of the local private training samples. Specifically, each of the second sample representations is input into a preset classification model, and each of the second sample representations is fully connected to obtain a fully connected vector corresponding to each of the second sample representations. Then, based on a preset activation function, each of the fully connected vectors is converted into an output classification label corresponding to each of the local private training samples.
[0107] Step A232, calculating the classification loss based on each of the output classification labels and the preset true labels corresponding to each of the local private training samples;
[0108] In this embodiment, the classification loss is calculated based on each of the output classification labels and the preset true labels corresponding to each of the local private training samples. Specifically, the cross entropy loss between each of the output classification labels and the preset true labels corresponding to the corresponding local private training samples is calculated, and then the cross entropy losses are accumulated to obtain the classification loss.
[0109] In another embodiment, step A232 includes: calculating the L2 loss between each of the output classification labels and a preset true label corresponding to the corresponding local private training sample, and then accumulating the L2 losses to obtain the classification loss.
[0110] Step A233, calculating the total model loss based on the contrastive learning loss and the classification loss;
[0111] In this embodiment, based on a preset aggregation rule, the contrastive learning loss and the classification loss are aggregated to obtain a total model loss, wherein the preset aggregation rule includes summing and averaging.
[0112] Step A234, based on the total loss of the model, optimize the local feature extraction model to obtain the globally optimized local feature extraction model.
[0113] In this embodiment, specifically, it is determined whether the total loss of the model converges. If it converges, the local feature extraction model is used as the globally optimized local feature extraction model. If it does not converge, the local feature extraction model is updated based on the model gradient calculated based on the total loss of the model, and the execution step is returned to: extracting local private training samples, thereby achieving the purpose of prompting the local feature extraction model to learn the model knowledge of the initial global feature extraction model, making the output of the local feature extraction model and the initial global feature extraction model for the same sample as close as possible, achieving global optimization of the corresponding local feature extraction, and at the same time making the output of the local feature extraction model as close as possible to the preset true label, thereby improving the accuracy of the local feature extraction model.
[0114] Step A30, extracting target modality public samples belonging to the data modality corresponding to the globally optimized local feature extraction model from the federated public data set, and performing feature extraction on the target modality public samples based on the globally optimized local feature extraction model to obtain target modality public sample representation;
[0115] In this embodiment, specifically, target modality public samples of the data modality corresponding to the globally optimized local feature extraction model are extracted from the federated public data set, that is, target modality public samples of the data modality corresponding to the participant device are extracted from the federated public data set, and then feature extraction is performed on all target modality public samples using the globally optimized local feature extraction model to obtain target modality public sample representations of all target modality public samples.
[0116] Step A40, sending the target modality public sample representation to the federal server, so that the federal server can perform selective aggregation based on the data modality on each of the target modality public sample representations to obtain the target modality aggregated sample representation corresponding to each of the data modalities, and obtain the public training samples corresponding to each of the data modalities in the federal public data set, and based on each of the public training samples, perform knowledge distillation learning training on each of the initial global feature extraction models based on the target modality aggregated sample representation, and perform comparative learning training between each of the initial global feature extraction models to obtain the target global feature extraction model corresponding to each of the initial model global feature extraction models.
[0117] In this embodiment, it should be noted that the federal server base will perform selective aggregation based on the data modality on the public sample representations of each target modality, obtain the target modality aggregated sample representations corresponding to each data modality, and obtain the public training samples corresponding to each data modality in the federal public data set. Based on each of the public training samples, each of the initial global feature extraction models will be respectively subjected to knowledge distillation learning training based on the aggregated sample representations of each target modality, and comparative learning training will be performed between each of the initial global feature extraction models. The specific implementation process of obtaining the target global feature extraction model corresponding to each of the initial model global feature extraction models can refer to the specific contents of steps S10 to S30, which will not be repeated here.
[0118] Furthermore, the target global feature extraction model sent by the federal server is received, and local private training samples are extracted, and then based on the local private training samples, the local feature extraction model is optimized by performing comparative learning and training between the target global feature extraction model and the local feature extraction model, so that the local feature extraction model can learn the model knowledge of the target local feature extraction model, and then the target local feature extraction model is obtained, wherein the specific implementation process of obtaining the target local feature extraction model is the same as the specific implementation process of obtaining the globally optimized local feature extraction model, and the specific contents of step A10 to step A20 may be referred to, which will not be repeated here.
[0119] Furthermore, if Figure 3The figure shows the interactive process diagram of horizontal federated learning modeling in the federated learning optimization method of the present application, wherein server is the federated server, Client is the participating device, N is the number of participating devices, base1 and head1 are the local feature extraction models in Client1, base N and head N To form the Client N The local feature extraction model in, classfier is the preset classification model, base g.a and Head g.a The initial global feature extraction model in Client1 is also called Model g.a , base g.b and Head g.b To form the Client N The initial global feature extraction model in is also called Model g.b , Y1 and Y N is the preset true label, X1 is the local private training sample in Client1, and X N For Client N Local private training samples in X pub.a is the target modality public sample in Client1, X pub.b For Client N The target modality public sample in Z agg.a is the predicted sample representation corresponding to the first public training sample, Z agg.b is the predicted sample representation corresponding to the second public training sample, cross-entropy loss is the cross entropy loss, contrastive loss is the contrastive learning loss, and at this time, the federal server directly uses the target modality public samples selected by each of the participating devices in the federal public data set as public training samples.
[0120] The embodiment of the present application provides a method for optimizing federated learning modeling, that is, first receiving an initial global feature extraction model issued by a federated server, and extracting local private training samples, and then optimizing the local feature extraction model by performing comparative learning and training between the initial global feature extraction model and the local feature extraction model based on the local private training samples, and obtaining a globally optimized local feature extraction model, thereby achieving the purpose of prompting the local feature extraction model to learn the model knowledge of the global model issued by the federated server, and achieving global optimization of the local feature extraction model, and then extracting target modality public samples belonging to the data modality corresponding to the globally optimized local feature extraction model from the federated public data set, and based on the globally optimized local feature extraction model, performing feature extraction on the target modality public samples to obtain target modality public sample representations, and then sending the target modality public sample representations to the federated server for the federated server to selectively aggregate the target modality public sample representations based on the data modality to obtain target modality aggregated sample representations corresponding to each data modality, and obtaining public training samples corresponding to each data modality in the federated public data set, based on Each of the public training samples is used to perform knowledge distillation learning training on each of the initial global feature extraction models based on the representation of the aggregated samples of each target modality, and comparative learning training is performed between each of the initial global feature extraction models to obtain the target global feature extraction model corresponding to each of the initial model global feature extraction models. Since each target modality public sample representation is optimized based on the local private training samples of the participant's device to obtain the output of the globally optimized local feature extraction model, each initial global feature extraction model can be indirectly combined with samples of multiple participants of the corresponding data modality through knowledge distillation for horizontal federated learning, and at the same time, the initial global feature extraction model corresponding to each data modality can use comparative learning to align samples of different data modalities in the feature space, thereby achieving the purpose of indirectly combining samples of different data modalities for horizontal federated learning, so that horizontal federated learning is no longer limited to samples of the same data modality of different participants, overcoming the technical defect that the existing horizontal federated learning in the prior art is that it can only be combined with samples of the same data modality of different participants, thereby reducing the limitations of horizontal federated learning.
[0121] Reference Figure 4 , Figure 4 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.
[0122] like Figure 4As shown, the federated learning modeling optimization device may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection and communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0123] Optionally, the federated learning modeling optimization device may also include a rectangular user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, etc. The rectangular user interface may include a display screen (Display), an input submodule such as a keyboard (Keyboard), and the optional rectangular user interface may also include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0124] Those skilled in the art will understand that Figure 4 The structure of the federated learning modeling optimization device shown in the figure does not constitute a limitation of the federated learning modeling optimization device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0125] like Figure 4 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, and a federated learning modeling optimization program. The operating system is a program that manages and controls the hardware and software resources of the federated learning modeling optimization device, and supports the operation of the federated learning modeling optimization program and other software and / or programs. The network communication module is used to realize communication between the components inside the memory 1005, and communication with other hardware and software in the federated learning modeling optimization system.
[0126] exist Figure 4 In the federated learning modeling optimization device shown, the processor 1001 is used to execute the federated learning modeling optimization program stored in the memory 1005 to implement the steps of any of the above-mentioned federated learning modeling optimization methods.
[0127] The specific implementation methods of the federated learning modeling optimization device of the present application are basically the same as the embodiments of the above-mentioned federated learning modeling optimization method, and will not be repeated here.
[0128] The embodiment of the present application also provides a federated learning modeling optimization device, which is applied to a federated server and includes:
[0129] A model distribution module is used to distribute the initial global feature extraction model corresponding to each data modality to the participant devices corresponding to each data modality, so that the participant devices can optimize the local feature extraction model based on local private training samples by performing comparative learning training between the initial global feature extraction model and the local feature extraction model to obtain a globally optimized local feature extraction model, and based on the globally optimized local feature extraction model, perform feature extraction on the corresponding target modality public samples in the federal public data set to obtain the target modality public sample representation;
[0130] A selective aggregation module, used to receive the target modality public sample representations sent by each of the participating devices, and perform selective aggregation on each of the target modality public sample representations based on the data modality to obtain the target modality aggregated sample representations corresponding to each of the data modalities;
[0131] A training module is used to obtain public training samples corresponding to each of the data modalities in the federal public dataset, and based on each of the public training samples, perform knowledge distillation learning training on each of the initial global feature extraction models based on the representation of the aggregated samples of each of the target modalities, and perform comparative learning training between each of the initial global feature extraction models to obtain a target global feature extraction model corresponding to the global feature extraction model of each of the initial models.
[0132] Optionally, the training module is further used to:
[0133] Mapping the public training samples corresponding to each of the data modalities into prediction sample representations through the corresponding initial global feature extraction model;
[0134] Calculating the knowledge distillation loss between each of the predicted sample representations and the corresponding target modality aggregated sample representation, and calculating the contrastive learning loss between each of the predicted sample representations;
[0135] Based on the knowledge distillation loss and the corresponding contrastive learning loss corresponding to each of the initial global feature extraction models, each of the initial global feature extraction models is optimized to obtain each target global feature extraction model.
[0136] Optionally, the training module is further used to:
[0137] Based on the sample labels corresponding to the public training samples, respectively selecting the positive sample representation and the negative sample representation corresponding to each of the predicted sample representations;
[0138] Calculating the contrastive learning loss corresponding to each of the initial global feature extraction models based on each of the predicted sample representations and the positive sample representations corresponding to each of the predicted sample representations and the corresponding negative sample representations;
[0139] Based on the similarity between each of the predicted sample representations and the corresponding target modality aggregated sample representation, the knowledge distillation loss corresponding to each of the initial global feature extraction models is calculated respectively.
[0140] Optionally, the selective aggregation module is further used for:
[0141] Based on the correspondence between each of the participant devices and each of the data modalities, determining each to-be-aggregated sample representation corresponding to each of the data modalities in each of the target modality public sample representations;
[0142] The sample representations to be aggregated corresponding to the data modalities are aggregated respectively to obtain the target modality aggregated sample representations corresponding to the data modalities.
[0143] The specific implementation of the federated learning modeling optimization device of the present application is basically the same as the various embodiments of the above-mentioned federated learning modeling optimization method, and will not be repeated here.
[0144] The embodiment of the present application further provides a federated learning modeling optimization device, which is applied to a participant device, and the federated learning modeling optimization device includes:
[0145] A receiving module, used to receive the initial global feature extraction model sent by the federal server and extract local private training samples;
[0146] A contrastive learning training module, used for optimizing the local feature extraction model by performing contrastive learning training between the initial global feature extraction model and the local feature extraction model based on the local private training samples, so as to obtain a globally optimized local feature extraction model;
[0147] A feature extraction module, used to extract target modality public samples belonging to the data modality corresponding to the globally optimized local feature extraction model from the federated public data set, and perform feature extraction on the target modality public samples based on the globally optimized local feature extraction model to obtain a representation of the target modality public samples;
[0148] A sending module is used to send the target modality public sample representation to a federal server, so that the federal server can perform selective aggregation based on the data modality on each of the target modality public sample representations to obtain the target modality aggregated sample representation corresponding to each of the data modalities, and obtain the public training samples corresponding to each of the data modalities in the federal public data set; based on each of the public training samples, perform knowledge distillation learning training on each of the initial global feature extraction models based on the target modality aggregated sample representation; and perform comparative learning training between each of the initial global feature extraction models to obtain the target global feature extraction model corresponding to each of the initial model global feature extraction models.
[0149] Optionally, the contrastive learning training module is further used for:
[0150] Mapping all the local private training samples into a first sample representation through the initial global feature extraction model, and mapping all the local private training samples into a second sample representation through the local feature extraction model;
[0151] Calculating a contrastive learning loss based on a similarity between each of the first sample representations and each of the second sample representations;
[0152] Based on the contrastive learning loss, the local feature extraction model is optimized to obtain a globally optimized local feature extraction model.
[0153] Optionally, the contrastive learning training module is further used for:
[0154] Using the sample representation of the same local private training sample as the second sample representation in each of the first sample representations as the local positive sample representation corresponding to the second sample representation;
[0155] Using the sample representations in each of the second sample representations that do not correspond to the same local private training sample as the first sample representation as the local negative sample representation corresponding to the first sample representation;
[0156] The contrastive learning loss is calculated based on the similarity between each of the second sample representations and the local positive sample representations corresponding to each of the second sample representations, and the similarity between each of the second sample representations and the local negative sample representations corresponding to each of the second sample representations.
[0157] Optionally, the contrastive learning training module is further used for:
[0158] By using a preset classification model, each of the second sample representations is converted into an output classification label corresponding to each of the local private training samples;
[0159] Calculating classification loss based on each of the output classification labels and a preset true label corresponding to each of the local private training samples;
[0160] Calculating the total model loss based on the contrastive learning loss and the classification loss;
[0161] Based on the total loss of the model, the local feature extraction model is optimized to obtain the globally optimized local feature extraction model.
[0162] The specific implementation of the federated learning modeling optimization device of the present application is basically the same as the various embodiments of the above-mentioned federated learning modeling optimization method, and will not be repeated here.
[0163] An embodiment of the present application provides a readable storage medium, and the readable storage medium stores one or more programs, and the one or more programs can also be executed by one or more processors to implement the steps of any of the above-mentioned federated learning modeling optimization methods.
[0164] The specific implementation methods of the readable storage medium of the present application are basically the same as the embodiments of the above-mentioned federated learning modeling optimization method, and will not be repeated here.
[0165] An embodiment of the present application provides a computer program product, and the computer program product includes one or more computer programs, and the one or more computer programs can also be executed by one or more processors to implement the steps of any of the above-mentioned federated learning modeling optimization methods.
[0166] The specific implementation methods of the computer program product of the present application are basically the same as the embodiments of the above-mentioned federated learning modeling optimization method, and will not be repeated here.
[0167] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.
Claims
1. A federated learning modeling optimization method, characterized in that: Applied to a federated server, the federated learning modeling optimization method includes: Distribute the initial global feature extraction model corresponding to each data modality to the participant devices corresponding to each data modality, so that the participant devices can optimize the local feature extraction model based on the local private training samples by performing comparative learning training between the initial global feature extraction model and the local feature extraction model to obtain the globally optimized local feature extraction model, and extract features from the corresponding target modality public samples in the federal public data set based on the globally optimized local feature extraction model to obtain the target modality public sample representation; Receive the target modality public sample representations sent by each of the participant devices, and perform selective aggregation on each of the target modality public sample representations based on the data modality to obtain the target modality aggregated sample representations corresponding to each of the data modalities; Obtaining public training samples corresponding to each of the data modalities in the federal public data set, and based on each of the public training samples, respectively performing knowledge distillation learning training based on the representation of aggregated samples of each of the target modalities on each of the initial global feature extraction models, and performing comparative learning training between each of the initial global feature extraction models to obtain a target global feature extraction model corresponding to each of the initial model global feature extraction models; Among them, the steps of performing knowledge distillation learning training based on the representation of each target modality aggregate sample on each of the initial global feature extraction models based on each of the public training samples, and performing comparative learning training between each of the initial global feature extraction models to obtain the target global feature extraction model corresponding to each of the initial model global feature extraction models include: Mapping the public training samples corresponding to each of the data modalities into prediction sample representations through the corresponding initial global feature extraction model; Calculating the knowledge distillation loss between each of the predicted sample representations and the corresponding target modality aggregated sample representation, and calculating the contrastive learning loss between each of the predicted sample representations; Based on the knowledge distillation loss and the corresponding contrastive learning loss corresponding to each of the initial global feature extraction models, each of the initial global feature extraction models is optimized to obtain each target global feature extraction model.
2. The federated learning modeling optimization method according to claim 1, characterized in that: The steps of calculating the knowledge distillation loss between each of the predicted sample representations and the corresponding target modality aggregated sample representation, and calculating the contrastive learning loss between each of the predicted sample representations include: Based on the sample labels corresponding to the public training samples, respectively selecting the positive sample representation and the negative sample representation corresponding to each of the predicted sample representations; Calculating the contrastive learning loss corresponding to each of the initial global feature extraction models based on each of the predicted sample representations and the positive sample representations corresponding to each of the predicted sample representations and the corresponding negative sample representations; Based on the similarity between each of the predicted sample representations and the corresponding target modality aggregated sample representation, the knowledge distillation loss corresponding to each of the initial global feature extraction models is calculated respectively.
3. The federated learning modeling optimization method according to claim 1, characterized in that: The step of performing selective aggregation based on the data modality on the public sample representations of each target modality to obtain the target modality aggregated sample representations corresponding to each data modality includes: Based on the correspondence between each of the participant devices and each of the data modalities, determining each to-be-aggregated sample representation corresponding to each of the data modalities in each of the target modality public sample representations; The sample representations to be aggregated corresponding to the data modalities are aggregated respectively to obtain the target modality aggregated sample representations corresponding to the data modalities.
4. A federated learning modeling optimization method, characterized in that: Applied to the devices of the participants, the federated learning modeling optimization method includes: Receive the initial global feature extraction model sent by the federated server and extract local private training samples; Based on the local private training samples, by performing comparative learning training between the initial global feature extraction model and the local feature extraction model, the local feature extraction model is optimized to obtain a globally optimized local feature extraction model; Extracting target modality public samples belonging to the data modality corresponding to the globally optimized local feature extraction model from the federated public data set, and performing feature extraction on the target modality public samples based on the globally optimized local feature extraction model to obtain target modality public sample representations; The target modality public sample representation is sent to the federal server, so that the federal server can selectively aggregate the target modality public sample representation based on the data modality to obtain the target modality aggregated sample representation corresponding to each data modality, and obtain the public training samples corresponding to each data modality in the federal public data set, and based on each public training sample, perform knowledge distillation learning training based on the target modality aggregated sample representation on each initial global feature extraction model, and perform comparative learning training between each initial global feature extraction model to obtain the target global feature extraction model corresponding to each initial model global feature extraction model; Among them, the steps of performing knowledge distillation learning training based on the representation of each target modality aggregate sample on each of the initial global feature extraction models based on each of the public training samples, and performing comparative learning training between each of the initial global feature extraction models to obtain the target global feature extraction model corresponding to each of the initial model global feature extraction models include: Mapping the public training samples corresponding to each of the data modalities into prediction sample representations through the corresponding initial global feature extraction model; Calculating the knowledge distillation loss between each of the predicted sample representations and the corresponding target modality aggregated sample representation, and calculating the contrastive learning loss between each of the predicted sample representations; Based on the knowledge distillation loss and the corresponding contrastive learning loss corresponding to each of the initial global feature extraction models, each of the initial global feature extraction models is optimized to obtain each target global feature extraction model.
5. The federated learning modeling optimization method according to claim 4, characterized in that: The step of optimizing the local feature extraction model by performing comparative learning training between the initial global feature extraction model and the local feature extraction model based on the local private training sample to obtain the globally optimized local feature extraction model comprises: Mapping all the local private training samples into a first sample representation through the initial global feature extraction model, and mapping all the local private training samples into a second sample representation through the local feature extraction model; Calculating a contrastive learning loss based on a similarity between each of the first sample representations and each of the second sample representations; Based on the contrastive learning loss, the local feature extraction model is optimized to obtain a globally optimized local feature extraction model.
6. The federated learning modeling optimization method according to claim 5, characterized in that: The step of calculating the contrastive learning loss based on the similarity between each of the first sample representations and each of the second sample representations comprises: Using the sample representation of the same local private training sample as the second sample representation in each of the first sample representations as the local positive sample representation corresponding to the second sample representation; Using the sample representations in each of the second sample representations that do not correspond to the same local private training sample as the first sample representation as the local negative sample representation corresponding to the first sample representation; The contrastive learning loss is calculated based on the similarity between each of the second sample representations and the local positive sample representations corresponding to each of the second sample representations, and the similarity between each of the second sample representations and the local negative sample representations corresponding to each of the second sample representations.
7. The federated learning modeling optimization method according to claim 5, characterized in that: The step of optimizing the local feature extraction model based on the contrastive learning loss to obtain a globally optimized local feature extraction model comprises: By using a preset classification model, each of the second sample representations is converted into an output classification label corresponding to each of the local private training samples; Calculating classification loss based on each of the output classification labels and a preset true label corresponding to each of the local private training samples; Calculating the total model loss based on the contrastive learning loss and the classification loss; Based on the total loss of the model, the local feature extraction model is optimized to obtain the globally optimized local feature extraction model.
8. A federated learning modeling optimization device, characterized in that: The federated learning modeling optimization device includes: a memory, a processor, and a program stored in the memory for implementing the federated learning modeling optimization method. The memory is used to store a program for implementing a federated learning modeling optimization method; The processor is used to execute a program for implementing the federated learning modeling optimization method to implement the steps of the federated learning modeling optimization method as described in any one of claims 1 to 3 or 4 to 7.
9. A readable storage medium, characterized in that: The readable storage medium stores a program for implementing the federated learning modeling optimization method, and the program for implementing the federated learning modeling optimization method is executed by a processor to implement the steps of the federated learning modeling optimization method as described in any one of claims 1 to 3 or 4 to 7.
10. A program product, the program product being a computer program product, comprising a computer program, characterized in that: When the computer program is executed by a processor, the steps of the federated learning modeling optimization method as described in any one of claims 1 to 3 or 4 to 7 are implemented.
