CN117648981A - Reasoning method and related device - Google Patents
Reasoning method and related device Download PDFInfo
- Publication number
- CN117648981A CN117648981A CN202210962642.4A CN202210962642A CN117648981A CN 117648981 A CN117648981 A CN 117648981A CN 202210962642 A CN202210962642 A CN 202210962642A CN 117648981 A CN117648981 A CN 117648981A
- Authority
- CN
- China
- Prior art keywords
- federated learning
- features
- feature
- local
- client
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/04—Inference or reasoning models
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N20/00—Machine learning
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Computation (AREA)
- Mathematical Physics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Signal Processing (AREA)
- Computer Networks & Wireless Communication (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Life Sciences & Earth Sciences (AREA)
- Biophysics (AREA)
- Biomedical Technology (AREA)
- Health & Medical Sciences (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Medical Informatics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Information Transfer Between Computers (AREA)
Abstract
Description
技术领域Technical Field
本申请涉及计算机技术领域,尤其涉及一种推理方法及相关装置。The present application relates to the field of computer technology, and in particular to a reasoning method and related devices.
背景技术Background Art
联邦学习是一种在不汇聚多方(不同组织或者用户)原始数据的情况下,多方利用各自所有的数据协同训练人工智能模型的分布式机器学习范式。传统的机器学习范式需要汇聚大量的原始数据用于模型的训练,而用于训练的原始数据很有可能来自多个不同的组织或者用户。将多个不同组织或者不同用户的原始数据汇聚在一起,极有可能造成数据泄露的风险,对组织来说会暴露信息资产,对个人用户来说可能泄露个人隐私。上述问题的存在对人工智能模型的训练提出了严峻的挑战,为解决上述问题,联邦学习技术应运而生。联邦学习允许多方原始数据保留在本地不进行多方数据汇聚,多方之间通过协同计算(安全的)交互中间计算结果的方式来共同训练人工智能模型。通过联邦学习技术,即保护了多方用户数据,又可以充分利用多方数据来协同训练模型,从而得到更强大的模型。Federated learning is a distributed machine learning paradigm that allows multiple parties to collaboratively train artificial intelligence models using their own data without aggregating the original data of multiple parties (different organizations or users). The traditional machine learning paradigm requires the aggregation of a large amount of original data for model training, and the original data used for training is likely to come from multiple different organizations or users. Aggregating the original data of multiple different organizations or users is very likely to cause the risk of data leakage, which will expose information assets for organizations and may leak personal privacy for individual users. The existence of the above problems poses a severe challenge to the training of artificial intelligence models. In order to solve the above problems, federated learning technology came into being. Federated learning allows the original data of multiple parties to be retained locally without multi-party data aggregation, and multiple parties can jointly train artificial intelligence models by collaboratively computing (securely) interacting with intermediate calculation results. Through federated learning technology, the data of multiple users is protected, and the data of multiple parties can be fully utilized to collaboratively train models, thereby obtaining a more powerful model.
典型的联邦学习按照场景可以分为横向联邦,纵向联邦,联邦迁移(联邦域自适应) 三种范式,上述三种范式分别解决三种典型的场景。Typical federated learning can be divided into three paradigms according to the scenario: horizontal federation, vertical federation, and federated migration (federated domain adaptation). The above three paradigms solve three typical scenarios respectively.
在横向联邦学习架构中,通常存在一个服务端以及参与横向联邦的不同客户端。在训练阶段,客户端使用本地数据进行训练,并将训练后的模型上传服务端;服务端会对所有客户端上传的模型进行加权平均,从而得到全局模型。该全局模型会下发到客户端,用于客户端的推理。In a horizontal federated learning architecture, there is usually a server and different clients participating in the horizontal federation. During the training phase, the client uses local data for training and uploads the trained model to the server; the server performs a weighted average of the models uploaded by all clients to obtain a global model. The global model is sent to the client for reasoning.
在推理阶段,客户端基于服务端下发的全局模型进行推理,并根据推理结果管理所在的设备的资源;但由于仅使用本地数据进行推理,所以会导致客户端的推理结果不够准确,进而造成设备的资源管理混乱。During the inference phase, the client performs inference based on the global model sent by the server and manages the resources of the device based on the inference results. However, since only local data is used for inference, the client's inference results are not accurate enough, which in turn causes confusion in the device's resource management.
发明内容Summary of the invention
本申请提供了一种推理方法及相关装置,该方法在推理过程中利用了除本地数据外其他客户端的数据的信息,用于提高推理结果的准确性。The present application provides an inference method and related devices, which utilize information of data of other clients in addition to local data during the inference process to improve the accuracy of the inference results.
本申请第一方面提供了一种推理方法,该方法包括:第一联邦学习客户端向所述联邦学习服务端发送第一局部特征,所述第一局部特征是从第一网络数据中提取出的,所述第一网络数据为所述第一联邦学习客户端在第一时隙获取的与目标网络资源有关的数据,所述目标网络资源为所述第一联邦学习客户端管理的网络资源;所述第一联邦学习客户端接收来自所述联邦学习服务端的全局先验特征,所述全局先验特征是根据所述第一局部特征和第二局部特征得到的,所述第二局部特征是由第二联邦学习客户端提供;所述第一联邦学习客户端根据所述全局先验特征和第二网络数据进行推理,以得到推理结果,所述第二网络数据为所述第一联邦学习客户端在第二时隙获取的与所述目标网络资源有关的数据,所述推理结果用于管理目标网络资源,其中,第二时隙与第一时隙相同或在第一时隙之后。In a first aspect, the present application provides an inference method, which includes: a first federated learning client sends a first local feature to the federated learning server, where the first local feature is extracted from first network data, where the first network data is data related to a target network resource obtained by the first federated learning client in a first time slot, and the target network resource is a network resource managed by the first federated learning client; the first federated learning client receives a global prior feature from the federated learning server, where the global prior feature is obtained based on the first local feature and a second local feature, and the second local feature is provided by a second federated learning client; the first federated learning client performs inference based on the global prior feature and the second network data to obtain an inference result, where the second network data is data related to the target network resource obtained by the first federated learning client in a second time slot, and the inference result is used to manage the target network resource, wherein the second time slot is the same as the first time slot or after the first time slot.
上述方面中,第一联邦学习客户端采集第一时隙的与目标网络资源有关的第一网络数据,并提取该第一网络数据的第一局部特征发送给联邦学习服务端,联邦学习服务端收集多个客户端上传的局部特征计算全局先验特征,并下发给各客户端,第一联邦学习客户端可以根据该全局先验特征对第二时隙的第二网络数据进行推理,在推理过程中利用了除本地数据外其他客户端的数据的信息,用于提高推理结果的准确性。In the above aspect, the first federated learning client collects the first network data related to the target network resource in the first time slot, extracts the first local feature of the first network data and sends it to the federated learning server. The federated learning server collects the local features uploaded by multiple clients to calculate the global prior feature, and sends it to each client. The first federated learning client can infer the second network data in the second time slot based on the global prior feature. In the inference process, the information of the data of other clients in addition to the local data is used to improve the accuracy of the inference results.
一种可能的实施方式中,第一网络数据为目标网络资源有关的数据在第一时隙的采样值或者从第三时隙到第一时隙为止的统计值,第二网络数据为目标网络资源有关的数据在第二时隙的采样值,第三时隙在第一时隙之前。In one possible implementation, the first network data is a sampled value of data related to the target network resources in the first time slot or a statistical value from the third time slot to the first time slot, and the second network data is a sampled value of data related to the target network resources in the second time slot, and the third time slot is before the first time slot.
一种可能的实施方式中,全局先验特征为特征向量或第一机器学习模型,第一机器学习模型用于第二网络数据的推理。In a possible implementation, the global prior feature is a feature vector or a first machine learning model, and the first machine learning model is used for inference of the second network data.
一种可能的实施方式中,在全局先验特征为特征向量的情况下,第一联邦学习客户端根据全局先验特征和第二网络数据进行推理,以得到推理结果包括:第一联邦学习客户端根据全局先验特征、第二网络数据以及本地的第二机器学习模型进行推理,以得到推理结果,第二机器学习模型用于第二网络数据的推理。In one possible implementation, when the global prior feature is a feature vector, the first federated learning client performs reasoning based on the global prior feature and the second network data to obtain an inference result, including: the first federated learning client performs reasoning based on the global prior feature, the second network data, and a local second machine learning model to obtain an inference result, and the second machine learning model is used for reasoning about the second network data.
上述可能的实施方式中,第一联邦学习客户端需要将全局先验特征和第二网络数据输入到本地的第二机器学习模型中进行推理,将该第二机器学习模型输出的结果作为推理结果,使用可训练的第二机器学习模型进行推理,可以提高方案的准确度。In the above possible implementation manner, the first federated learning client needs to input the global prior features and the second network data into the local second machine learning model for reasoning, and use the result output by the second machine learning model as the reasoning result. Using the trainable second machine learning model for reasoning can improve the accuracy of the solution.
一种可能的实施方式中,第一联邦学习客户端根据全局先验特征、第二网络数据以及本地的第二机器学习模型进行推理,以得到推理结果包括:第一联邦学习客户端将第二网络数据输入到第三学习模型中,以得到第三学习模型输出的第二网络数据的多个特征;第一联邦学习客户端将全局先验特征输入到第二机器学习模型中,以获得第二网络数据的多个特征各自的权重;第一联邦学习客户端根据第二网络数据的多个特征以及第二网络数据的多个特征各自的权重,确定推理结果。In one possible implementation, the first federated learning client performs reasoning based on the global prior features, the second network data, and the local second machine learning model to obtain the reasoning result, including: the first federated learning client inputs the second network data into the third learning model to obtain multiple features of the second network data output by the third learning model; the first federated learning client inputs the global prior features into the second machine learning model to obtain the respective weights of the multiple features of the second network data; the first federated learning client determines the reasoning result based on the multiple features of the second network data and the respective weights of the multiple features of the second network data.
上述可能的实施方式中,在将第二网络数据输入到第二机器学习模型中之前,第一联邦学习客户端还可以将第二网络数据输入到第三机器学习模型,以获得可以体现第二网络数据特点的多个特征,可以节省计算资源。第一联邦学习客户端将全局先验特征和第二网络数据输入到本地的第二机器学习模型中进行推理的方式可以是,第一联邦学习客户端将全局先验特征输入到该第二机器学习模型中,可以获得第二机器学习模型输出的第二网络数据的多个特征对应的权重,即每个特征对应一个权重,然后即可根据第二网络数据的多个特征以及第二网络数据的多个特征各自的权重确定推理结果,不同特征对应不同的权重,提高推理的准确性。In the above possible implementation manner, before inputting the second network data into the second machine learning model, the first federated learning client may also input the second network data into the third machine learning model to obtain multiple features that can reflect the characteristics of the second network data, which can save computing resources. The first federated learning client inputs the global prior features and the second network data into the local second machine learning model for reasoning, which can be that the first federated learning client inputs the global prior features into the second machine learning model, and can obtain the weights corresponding to the multiple features of the second network data output by the second machine learning model, that is, each feature corresponds to a weight, and then the reasoning result can be determined according to the multiple features of the second network data and the weights of the multiple features of the second network data. Different features correspond to different weights, which improves the accuracy of reasoning.
一种可能的实施方式中,第二机器学习模型包括多个第一任务模型;第一联邦学习客户端根据全局先验特征、第二网络数据以及本地的第二机器学习模型进行推理,以得到推理结果包括:第一联邦学习客户端根据全局先验特征,计算多个第一任务模型各自的权重;第一联邦学习客户端将第二网络数据的特征输入到多个第一任务模型中,以得到多个第一任务模型输出的推理特征;第一联邦学习客户端根据多个第一任务模型各自的权重以及多个第一任务模型输出的推理特征,得到推理结果。In one possible implementation, the second machine learning model includes multiple first task models; the first federated learning client performs reasoning based on global prior features, second network data, and a local second machine learning model to obtain reasoning results including: the first federated learning client calculates the weights of the multiple first task models based on the global prior features; the first federated learning client inputs features of the second network data into the multiple first task models to obtain reasoning features output by the multiple first task models; the first federated learning client obtains the reasoning result based on the weights of the multiple first task models and the reasoning features output by the multiple first task models.
上述可能的实施方式中,第二机器学习模型包括多个第一任务模型,可以对第二网络数据的多个特征分别进行处理,具体的,第一联邦学习客户端获得全局先验特征后,可以从该全局先验特征确定多个第一任务模型各自的权重,第一联邦学习客户端可以将第二网络数据的特征输入到多个第一任务模型中,该多个第一任务模型的输入特征可以是默认类型的特征,即第二网络数据的特征按照类别分类,并输入到对应类别的第一任务模型,第一联邦学习客户端即可以对多个第一任务模型输出的推理特征结合多个第一任务模型对应的权重进行加权平均,以获得推理结果。对不同类型的特征在不同的第一任务模型中训练,再基于权重加权平均,可以提高推理的准确性。In the above possible implementation, the second machine learning model includes multiple first task models, which can process multiple features of the second network data separately. Specifically, after the first federated learning client obtains the global prior features, the weights of the multiple first task models can be determined from the global prior features. The first federated learning client can input the features of the second network data into the multiple first task models. The input features of the multiple first task models can be features of the default type, that is, the features of the second network data are classified by category and input into the first task models of the corresponding category. The first federated learning client can combine the inference features output by the multiple first task models with the weights corresponding to the multiple first task models to perform weighted averaging to obtain the inference results. Training different types of features in different first task models and then weighted averaging based on weights can improve the accuracy of inference.
一种可能的实施方式中,第一联邦学习客户端根据全局先验特征,计算多个第一任务模型各自的权重包括:第一联邦学习客户端根据全局先验特征和第二网络数据,计算多个第一任务模型各自的权重。In a possible implementation, the first federated learning client calculates the weights of each of the plurality of first task models according to the global prior features, including: the first federated learning client calculates the weights of each of the plurality of first task models according to the global prior features and the second network data.
上述可能的实施方式中,第一联邦学习客户端结合客户端本地数据和全局先验特征计算第一任务模型的权重,采用具有实时性的第二网络数据,提高权重的准确性。In the above possible implementation manner, the first federated learning client calculates the weight of the first task model by combining the client local data and the global prior features, and uses the real-time second network data to improve the accuracy of the weight.
一种可能的实施方式中,该方法还包括:第一联邦学习客户端通过第三机器学习模型提取第二网络数据的特征。In a possible implementation, the method further includes: the first federated learning client extracting features of the second network data through a third machine learning model.
上述可能的实施方式中,采用第二网络数据的特征进行推理,减少推理计算量。In the above possible implementation manner, the features of the second network data are used for reasoning to reduce the amount of reasoning calculation.
一种可能的实施方式中,第三机器学习模型包括多个第二任务模型;第一联邦学习客户端通过第三机器学习模型提取第二网络数据的特征包括:第一联邦学习客户端根据第二网络数据确定多个第二任务模型各自的权重;第一联邦学习客户端将第二网络数据输入到多个第二任务模型中,以得到多个第二任务模型输出的第二网络数据的子特征;根据多个第二任务模型各自的权重和多个第二任务模型输出的第二网络数据的子特征,得到第二网络数据的特征。In one possible implementation, the third machine learning model includes multiple second task models; the first federated learning client extracts features of the second network data through the third machine learning model, including: the first federated learning client determines the weights of each of the multiple second task models based on the second network data; the first federated learning client inputs the second network data into the multiple second task models to obtain sub-features of the second network data output by the multiple second task models; and obtains features of the second network data based on the weights of each of the multiple second task models and the sub-features of the second network data output by the multiple second task models.
上述可能的实施方式中,第一联邦学习客户端先根据本地数据或者第二网络数据确定多个第二任务模型对应的权重,然后将第二网络数据输入到第二任务模型中,可以获得第二任务模型输出的第二网络数据的子特征,第一联邦学习客户端即可根据多个第二任务模型对应的权重以及第二任务模型输出的子特征进行加权平均,以获得第二网络数据的特征,对不同类型的特征在不同的第一任务模型中训练,再基于权重加权平均,可以提高推理的准确性。In the above possible implementation manner, the first federated learning client first determines the weights corresponding to multiple second task models based on local data or second network data, and then inputs the second network data into the second task model, so as to obtain the sub-features of the second network data output by the second task model. The first federated learning client can then perform weighted averaging based on the weights corresponding to the multiple second task models and the sub-features output by the second task model to obtain the features of the second network data. Different types of features can be trained in different first task models, and then weighted averaged based on the weights, so as to improve the accuracy of reasoning.
一种可能的实施方式中,每个第二任务模型是一层自编码器,多个第二任务模型中第 r个任务模型的重构目标是第r-1个任务模型的残差,其中,r为大于1的整数且表示第二任务模型的数量。In one possible implementation, each second task model is a layer of autoencoder, and the reconstruction target of the rth task model among the multiple second task models is the residual of the r-1th task model, where r is an integer greater than 1 and represents the number of second task models.
一种可能的实施方式中,在全局先验特征为第一机器学习模型的情况下,第一联邦学习客户端根据全局先验特征和第二网络数据进行推理,以得到推理结果包括:第一联邦学习客户端提取第二网络数据的特征;第一联邦学习客户端将第二网络数据的特征输入到第一机器学习模型中,以得到第一机器学习模型输出的推理结果。In one possible implementation, when the global prior feature is a first machine learning model, the first federated learning client performs reasoning based on the global prior feature and the second network data to obtain an inference result including: the first federated learning client extracts features of the second network data; the first federated learning client inputs the features of the second network data into the first machine learning model to obtain an inference result output by the first machine learning model.
上述可能的实施方式中,联邦学习服务端可以直接下发第一机器学习模型作为推理模型,提高方案的灵活性。In the above possible implementations, the federated learning server can directly send the first machine learning model as the inference model to improve the flexibility of the solution.
一种可能的实施方式中,在全局先验特征为第一机器学习模型的情况下,第一联邦学习客户端根据全局先验特征和第二网络数据进行推理,以得到推理结果包括:第一联邦学习客户端利用样本数据对第一机器学习模型进行训练;第一联邦学习客户端提取第二网络数据的特征;第一联邦学习客户端将第二网络数据的特征输入到训练后的第一机器学习模型中,以得到训练后的第一机器学习模型输出的推理结果。In one possible implementation, when the global prior feature is a first machine learning model, the first federated learning client performs reasoning based on the global prior feature and the second network data to obtain an inference result, including: the first federated learning client trains the first machine learning model using sample data; the first federated learning client extracts features of the second network data; the first federated learning client inputs the features of the second network data into the trained first machine learning model to obtain an inference result output by the trained first machine learning model.
上述可能的实施方式中,联邦学习服务端直接下发第一机器学习模型作为推理模型时,客户端还可以基于本地的样本数据进一步训练,提高推理模型的准确性。In the above possible implementations, when the federated learning server directly sends the first machine learning model as the inference model, the client can also further train based on local sample data to improve the accuracy of the inference model.
一种可能的实施方式中,该方法还包括:第一联邦学习客户端向联邦学习服务端发送分组信息,分组信息指示第一局部特征所在的分组,以使得联邦学习服务端根据第一局部特征、第一局部特征所在的分组、第二局部特征以及第二局部特征所在的分组得到全局先验特征。In one possible implementation, the method further includes: the first federated learning client sends grouping information to the federated learning server, the grouping information indicating the group where the first local feature is located, so that the federated learning server obtains the global prior feature based on the first local feature, the group where the first local feature is located, the second local feature, and the group where the second local feature is located.
上述可能的实施方式中,第一联邦学习客户端还可以向服务端发送分组信息,分组信息指示局部特征所在的分组,以使得服务端根据来自多个客户端的局部特征以及局部特征所在的分组得到全局先验特征,避免所有客户端的数据一起确定全局先验特征会影响组间的输出。In the above possible implementation manner, the first federated learning client may also send grouping information to the server, where the grouping information indicates the group where the local features are located, so that the server obtains the global prior features based on the local features from multiple clients and the groups where the local features are located, thereby avoiding the situation where the global prior features determined by the data of all clients together will affect the output between groups.
一种可能的实施方式中,该方法还包括:第一联邦学习客户端接收来自联邦学习服务端的任务同步信息,任务同步信息用于指示第一时隙;第一联邦学习客户端根据任务同步信息从本地数据中选择出第一网络数据。In a possible implementation, the method further includes: the first federated learning client receives task synchronization information from the federated learning server, where the task synchronization information is used to indicate the first time slot; and the first federated learning client selects the first network data from the local data according to the task synchronization information.
上述可能的实施方式中,有联邦学习服务端指示客户端上传的局部特征所属的时隙,提高客户端上传的数据的同步性。In the above possible implementation manner, the federated learning server indicates the time slot to which the local features uploaded by the client belong, thereby improving the synchronization of the data uploaded by the client.
本申请第二方面提供了一种推理方法,该方法包括:联邦学习服务端接收来自第一联邦学习客户端的第一局部特征,第一局部特征是从第一网络数据中提取出的,第一网络数据为第一联邦学习客户端在第一时隙获取的与目标网络资源有关的数据,目标网络资源为第一联邦学习客户端管理的网络资源;联邦学习服务端根据第一局部特征和第二局部特征,得到全局先验特征,第二局部特征是由第二联邦学习客户端提供;联邦学习服务端向第一联邦学习客户端发送全局先验特征,使得第一联邦学习客户端根据全局先验特征和第二网络数据进行推理,以得到推理结果,第二网络数据为第一联邦学习客户端在第二时隙获取的与目标网络资源有关的数据,推理结果用于管理目标网络资源,其中,第二时隙与第一时隙相同或在第一时隙之后。A second aspect of the present application provides an inference method, the method comprising: a federated learning server receives a first local feature from a first federated learning client, the first local feature is extracted from first network data, the first network data is data related to a target network resource acquired by the first federated learning client in a first time slot, and the target network resource is a network resource managed by the first federated learning client; the federated learning server obtains a global prior feature based on the first local feature and a second local feature, and the second local feature is provided by the second federated learning client; the federated learning server sends the global prior feature to the first federated learning client, so that the first federated learning client performs inference based on the global prior feature and the second network data to obtain an inference result, the second network data is data related to the target network resource acquired by the first federated learning client in a second time slot, and the inference result is used to manage the target network resource, wherein the second time slot is the same as the first time slot or after the first time slot.
一种可能的实施方式中,第一网络数据为目标网络资源有关的数据在第一时隙的采样值或者从第三时隙到第一时隙为止的统计值,第二网络数据为目标网络资源有关的数据在第二时隙的采样值,第三时隙在第一时隙之前。In one possible implementation, the first network data is a sampled value of data related to the target network resources in the first time slot or a statistical value from the third time slot to the first time slot, and the second network data is a sampled value of data related to the target network resources in the second time slot, and the third time slot is before the first time slot.
一种可能的实施方式中,全局先验特征为特征向量或第一机器学习模型,第一机器学习模型用于第二网络数据的推理。In a possible implementation, the global prior feature is a feature vector or a first machine learning model, and the first machine learning model is used for inference of the second network data.
一种可能的实施方式中,该方法还包括:联邦学习服务端接收来自第一联邦学习客户端的分组信息,来自第一联邦学习客户端的分组信息指示第一局部特征所在的分组;联邦学习服务端根据第一局部特征和第二局部特征,得到全局先验特征包括:联邦学习服务端根据第一局部特征、第一局部特征所在的分组、第二局部特征以及第二局部特征所在的分组得到全局先验特征,第二局部特征所在的分组是由来自第二联邦学习客户端的分组信息指示的。In one possible implementation, the method further includes: the federated learning server receives grouping information from the first federated learning client, the grouping information from the first federated learning client indicates the group where the first local feature is located; the federated learning server obtains the global prior feature based on the first local feature and the second local feature, including: the federated learning server obtains the global prior feature based on the first local feature, the group where the first local feature is located, the second local feature, and the group where the second local feature is located, the group where the second local feature is located is indicated by the grouping information from the second federated learning client.
一种可能的实施方式中,第一局部特征包括第一子特征和第二子特征,第二局部特征包括第三子特征和第四子特征,来自第一联邦学习客户端的分组信息指示第一子特征所在的分组和第二子特征所在的分组,来自第二联邦学习客户端的分组信息指示第三子特征所在的分组和第四子特征所在的分组,且第一子特征所在的分组和第三子特征所在的分组相同;联邦学习服务端根据第一局部特征、第一局部特征所在的分组、第二局部特征以及第二局部特征所在的分组得到全局先验特征包括:基于第一子特征所在的分组和第三子特征所在的分组相同,联邦学习服务端对第一子特征和第三子特征进行处理,得到中间特征;联邦学习服务端根据中间特征、第二子特征、第四子特征、第二子特征所在的分组以及第四子特征所在的分组,得到全局先验特征。In one possible implementation, the first local feature includes a first sub-feature and a second sub-feature, the second local feature includes a third sub-feature and a fourth sub-feature, the grouping information from the first federated learning client indicates the group where the first sub-feature is located and the group where the second sub-feature is located, the grouping information from the second federated learning client indicates the group where the third sub-feature is located and the group where the fourth sub-feature is located, and the group where the first sub-feature is located is the same as the group where the third sub-feature is located; the federated learning server obtains the global prior feature based on the first local feature, the group where the first local feature is located, the second local feature, and the group where the second local feature is located, including: based on the fact that the group where the first sub-feature is located and the group where the third sub-feature is located are the same, the federated learning server processes the first sub-feature and the third sub-feature to obtain an intermediate feature; the federated learning server obtains the global prior feature based on the intermediate feature, the second sub-feature, the fourth sub-feature, the group where the second sub-feature is located, and the group where the fourth sub-feature is located.
上述可能的实施方式中,第一联邦学习客户端上传的第一局部特征包括第一子特征和第二子特征,第二联邦学习客户端上传的第二局部特征包括第三子特征和第四子特征,来自第一联邦学习客户端的分组信息可以指示第一子特征所在的分组和第二子特征所在的分组,来自第二联邦学习客户端的分组信息指示第三子特征所在的分组和第四子特征所在的分组,假设第一子特征所在的分组和第三子特征所在的分组相同,则联邦学习服务端可以先对第一子特征和第三子特征进行处理,得到中间特征,再按照分组,将中间特征与第二子特征进行处理后获得的处理结果与第四子特征进行处理,以获得全局先验特征。对于不同类型的客户端上传的特征可以分开处理,减少不同类型客户端之间的影响。In the above possible implementation, the first local feature uploaded by the first federated learning client includes the first sub-feature and the second sub-feature, the second local feature uploaded by the second federated learning client includes the third sub-feature and the fourth sub-feature, the grouping information from the first federated learning client can indicate the group where the first sub-feature is located and the group where the second sub-feature is located, and the grouping information from the second federated learning client indicates the group where the third sub-feature is located and the group where the fourth sub-feature is located. Assuming that the group where the first sub-feature is located is the same as the group where the third sub-feature is located, the federated learning server can first process the first sub-feature and the third sub-feature to obtain the intermediate feature, and then process the intermediate feature and the second sub-feature according to the grouping, and the processing result obtained after processing the fourth sub-feature to obtain the global prior feature. Features uploaded by different types of clients can be processed separately to reduce the impact between different types of clients.
一种可能的实施方式中,联邦学习服务端根据第一局部特征和第二局部特征,得到全局先验特征包括:联邦学习服务端根据第一局部特征、第二局部特征、来自第一联邦学习客户端的历史局部特征以及来自第二联邦学习客户端的历史局部特征,得到全局先验特征。In one possible implementation, the federated learning server obtains the global prior feature based on the first local feature and the second local feature, including: the federated learning server obtains the global prior feature based on the first local feature, the second local feature, the historical local feature from the first federated learning client, and the historical local feature from the second federated learning client.
上述可能的实施方式中,联邦学习服务端确定全局先验特征除了需要第一局部特征和第二局部特征外,还可以结合来自第一联邦学习客户端的历史局部特征以及来自第二联邦学习客户端的历史局部特征进行确定,提高全局先验特征的准确性。In the above possible implementation manner, in addition to the first local feature and the second local feature, the federated learning server may also determine the global prior feature in combination with the historical local features from the first federated learning client and the historical local features from the second federated learning client to improve the accuracy of the global prior feature.
一种可能的实施方式中,联邦学习服务端根据第一局部特征、第二局部特征、来自第一联邦学习客户端的历史局部特征以及来自第二联邦学习客户端的历史局部特征,得到全局先验特征包括:联邦学习服务端计算当前推理过程的局部特征与多组历史局部特征的相似度,当前推理过程的局部特征包括第一局部特征和第二局部特征,每组历史局部特征包括一次历史推理过程中来自第一联邦学习客户端的历史局部特征以及来自第二联邦学习客户端的历史局部特征;联邦学习服务端根据当前推理过程的局部特征与多组历史局部特征的相似度,对多组历史局部特征对应的历史先验特征进行加权求和,以得到全局先验特征。In one possible implementation, the federated learning server obtains the global prior feature based on the first local feature, the second local feature, the historical local feature from the first federated learning client, and the historical local feature from the second federated learning client, including: the federated learning server calculates the similarity between the local features of the current reasoning process and multiple groups of historical local features, the local features of the current reasoning process include the first local feature and the second local feature, each group of historical local features includes the historical local features from the first federated learning client and the historical local features from the second federated learning client in a historical reasoning process; the federated learning server performs weighted summation of the historical prior features corresponding to the multiple groups of historical local features based on the similarity between the local features of the current reasoning process and the multiple groups of historical local features to obtain the global prior feature.
上述可能的实施方式中,联邦学习服务端可以计算当前推理过程的局部特征与多组历史局部特征的相似度,即确定第一局部特征与各组历史局部特征中的来自第一联邦学习客户端的历史局部特征的相似度,以及确定第二局部特征与各组历史局部特征中的来自第二联邦学习客户端的历史局部特征的相似度,然后基于相似度对多组历史局部特征对应的历史先验特征进行加权求和,获得所需的全局先验特征,提高全局先验特征的准确性。In the above possible implementation manner, the federated learning server can calculate the similarity between the local features of the current reasoning process and multiple groups of historical local features, that is, determine the similarity between the first local feature and the historical local features from the first federated learning client in each group of historical local features, and determine the similarity between the second local feature and the historical local features from the second federated learning client in each group of historical local features, and then perform weighted summation of the historical prior features corresponding to the multiple groups of historical local features based on the similarity to obtain the required global prior features and improve the accuracy of the global prior features.
一种可能的实施方式中,多组历史局部特征都具有标签,标签为人为标注的每组历史局部特征的实际结果;该方法还包括:联邦学习服务端接收来自第一联邦学习客户端的推理结果;联邦学习服务端根据第一联邦学习客户端的推理结果和第二联邦学习客户端的推理结果确定目标推理结果;在当前推理过程的局部特征与目标组历史局部特征的相似度大于或等于阈值的情况下,联邦学习服务端根据当前推理过程的局部特征与目标组历史局部特征的相似度对目标组历史局部特征进行更新,目标组历史局部特征为多组历史局部特征中,标签为目标推理结果;在当前推理过程的局部特征与目标组历史局部特征的相似度小于阈值的情况下,联邦学习服务端在多组历史局部特征的基础上增加一组历史局部特征,增加的一组历史局部特征为当前推理过程的局部特征。In one possible implementation, multiple groups of historical local features all have labels, and the labels are actual results of each group of historical local features manually marked; the method also includes: a federated learning server receives an inference result from a first federated learning client; the federated learning server determines a target inference result based on the inference result of the first federated learning client and the inference result of the second federated learning client; when the similarity between the local features of the current inference process and the historical local features of the target group is greater than or equal to a threshold, the federated learning server updates the historical local features of the target group based on the similarity between the local features of the current inference process and the historical local features of the target group, and the historical local features of the target group are among the multiple groups of historical local features, and the labels are the target inference results; when the similarity between the local features of the current inference process and the historical local features of the target group is less than a threshold, the federated learning server adds a group of historical local features based on the multiple groups of historical local features, and the added group of historical local features are the local features of the current inference process.
上述可能的实施方式中,多组历史局部特征还可以具有标签,该标签是人为标注的每组历史局部特征的实际结果,可以用来和推理结果比较,来确定推理结果的准确度。客户端在获得推理结果后,可以上传给联邦学习服务端,联邦学习服务端可以根据多个客户端的推理结果确定当前全局先验特征对应的目标推理结果,则可以从多组历史局部特征中选择标签为该目标推理结果的目标组历史局部特征,并将当前推理过程的局部特征与目标组历史局部特征的相似度大于或等于阈值的基于相似度更新该目标组历史局部特征,小于阈值的则作为新的一组历史局部特征,可以随时更新和补充样本库,提高样本库的有效性。In the above possible implementation, multiple groups of historical local features may also have labels, which are the actual results of each group of historical local features manually marked, and can be used to compare with the reasoning results to determine the accuracy of the reasoning results. After obtaining the reasoning results, the client can upload them to the federated learning server. The federated learning server can determine the target reasoning result corresponding to the current global prior feature based on the reasoning results of multiple clients, and then select the target group historical local features with the label as the target reasoning result from the multiple groups of historical local features, and update the target group historical local features based on the similarity between the local features of the current reasoning process and the historical local features of the target group if the similarity is greater than or equal to the threshold, and use the target group historical local features less than the threshold as a new set of historical local features. The sample library can be updated and supplemented at any time to improve the effectiveness of the sample library.
一种可能的实施方式中,该方法还包括:联邦学习服务端向第一联邦学习客户端发送任务同步信息,任务同步信息用于指示第一时隙,以使得第一联邦学习客户端根据任务同步信息从本地数据中选择出第一网络数据。In a possible implementation, the method further includes: the federated learning server sends task synchronization information to the first federated learning client, where the task synchronization information is used to indicate the first time slot, so that the first federated learning client selects the first network data from the local data according to the task synchronization information.
本申请第三方面提供了一种推理装置,可以实现上述第一方面或第一方面中任一种可能的实施方式中的方法。该装置包括用于执行上述方法的相应的单元或模块。该装置包括的单元或模块可以通过软件和/或硬件方式实现。该装置例如可以为网络设备,也可以为支持网络设备实现上述方法的芯片、芯片系统、或处理器等,还可以为能实现全部或部分网络设备功能的逻辑模块或软件。The third aspect of the present application provides an inference device that can implement the method in the first aspect or any possible implementation of the first aspect. The device includes corresponding units or modules for executing the above method. The units or modules included in the device can be implemented by software and/or hardware. The device can be, for example, a network device, or a chip, a chip system, or a processor that supports the network device to implement the above method, or a logic module or software that can implement all or part of the network device functions.
本申请第四方面提供了一种推理装置,可以实现上述第二方面或第二方面中任一种可能的实施方式中的方法。该装置包括用于执行上述方法的相应的单元或模块。该装置包括的单元或模块可以通过软件和/或硬件方式实现。该装置例如可以为网络设备,也可以为支持网络设备实现上述方法的芯片、芯片系统、或处理器等,还可以为能实现全部或部分网络设备功能的逻辑模块或软件。In a fourth aspect, the present application provides an inference device that can implement the method in the second aspect or any possible implementation of the second aspect. The device includes corresponding units or modules for executing the above method. The units or modules included in the device can be implemented by software and/or hardware. The device can be, for example, a network device, or a chip, a chip system, or a processor that supports the network device to implement the above method, or a logic module or software that can implement all or part of the network device functions.
本申请第五方面提供了一种计算机设备,包括:处理器,该处理器与存储器耦合,该存储器用于存储指令,当指令被处理器执行时,使得该计算机设备实现上述第一方面或第一方面中任一种可能的实施方式中的方法。该计算机设备例如可以为网络设备,也可以为支持网络设备实现上述方法的芯片或芯片系统等。In a fifth aspect, the present application provides a computer device, including: a processor, the processor is coupled to a memory, the memory is used to store instructions, and when the instructions are executed by the processor, the computer device implements the method in the first aspect or any possible implementation of the first aspect. The computer device may be, for example, a network device, or a chip or chip system that supports the network device to implement the above method.
本申请第六方面提供了一种计算机设备,包括:处理器,该处理器与存储器耦合,该存储器用于存储指令,当指令被处理器执行时,使得该计算机设备实现上述第二方面或第二方面中任一种可能的实施方式中的方法。该计算机设备例如可以为网络设备,也可以为支持网络设备实现上述方法的芯片或芯片系统等。In a sixth aspect, the present application provides a computer device, including: a processor, the processor is coupled to a memory, the memory is used to store instructions, and when the instructions are executed by the processor, the computer device implements the method in the second aspect or any possible implementation of the second aspect. The computer device may be, for example, a network device, or a chip or chip system that supports the network device to implement the above method.
本申请第七方面提供了一种计算机可读存储介质,该计算机可读存储介质中保存有指令,当该指令被处理器执行时,实现前述第一方面或第一方面任一种可能的实施方式、第二方面或第二方面中任一种可能的实施方式提供的方法。The seventh aspect of the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed by a processor, the method provided by the first aspect or any possible implementation method of the first aspect, the second aspect or any possible implementation method of the second aspect is implemented.
本申请第八方面提供了一种芯片系统,芯片系统包括至少一个处理器,处理器用于执行存储器中存储的计算机程序或指令,当计算机程序或指令在至少一个处理器上执行时,实现前述第一方面或第一方面任一种可能的实施方式、第二方面或第二方面中任一种可能的实施方式提供的方法。In an eighth aspect of the present application, a chip system is provided, which includes at least one processor, and the processor is used to execute a computer program or instruction stored in a memory. When the computer program or instruction is executed on at least one processor, the method provided by the first aspect or any possible implementation method of the first aspect, the second aspect or any possible implementation method of the second aspect is implemented.
本申请第九方面提供了一种计算机程序产品,计算机程序产品中包括计算机程序代码,当该计算机程序代码在计算机上执行时,实现前述第一方面或第一方面任一种可能的实施方式、第二方面或第二方面中任一种可能的实施方式提供的方法。In the ninth aspect of the present application, a computer program product is provided, which includes a computer program code. When the computer program code is executed on a computer, it implements the method provided by the first aspect or any possible implementation method of the first aspect, the second aspect or any possible implementation method of the second aspect.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本申请实施例提供的一种计算机系统的结构示意图;FIG1 is a schematic diagram of the structure of a computer system provided in an embodiment of the present application;
图2为本申请实施例提供的一种推理方法的流程示意图;FIG2 is a flow chart of a reasoning method provided in an embodiment of the present application;
图3为本申请实施例提供的一种推理结构示意图;FIG3 is a schematic diagram of an inference structure provided in an embodiment of the present application;
图4为本申请实施例提供的另一种推理结构示意图;FIG4 is a schematic diagram of another reasoning structure provided in an embodiment of the present application;
图5为本申请实施例提供的另一种推理结构示意图;FIG5 is a schematic diagram of another reasoning structure provided in an embodiment of the present application;
图6为本申请实施例提供的一种计算图的示意图;FIG6 is a schematic diagram of a calculation graph provided in an embodiment of the present application;
图7为本申请实施例提供的一种知识图谱的示意图;FIG7 is a schematic diagram of a knowledge graph provided in an embodiment of the present application;
图8为本申请实施例提供的另一种推理结构示意图;FIG8 is a schematic diagram of another reasoning structure provided in an embodiment of the present application;
图9为本申请实施例提供的联邦学习服务端的本地数据的获取方式示意图;FIG9 is a schematic diagram of a method for acquiring local data of a federated learning server provided in an embodiment of the present application;
图10为本申请实施例提供的一种固定参数任务选择器生成的流程示意图;FIG10 is a schematic diagram of a flow chart of generating a fixed parameter task selector provided in an embodiment of the present application;
图11为本申请实施例提供的一种任务模型选择的流程示意图;FIG11 is a schematic diagram of a process flow of selecting a task model provided in an embodiment of the present application;
图12为本申请实施例提供的一种模型预训练的流程示意图;FIG12 is a schematic diagram of a model pre-training process provided in an embodiment of the present application;
图13为本申请实施例提供的一种模型训练的流程示意图;FIG13 is a schematic diagram of a flow chart of a model training process provided in an embodiment of the present application;
图14为本申请实施例提供的一种模型按策略训练的流程示意图;FIG14 is a schematic diagram of a flow chart of a model training according to a strategy provided in an embodiment of the present application;
图15为本申请实施例提供的一种推理装置的结构示意图;FIG15 is a schematic diagram of the structure of an inference device provided in an embodiment of the present application;
图16为本申请实施例提供的另一种推理装置的结构示意图;FIG16 is a schematic diagram of the structure of another reasoning device provided in an embodiment of the present application;
图17为本申请实施例提供的一种计算机设备的结构示意图;FIG17 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application;
图18为本申请实施例提供的另一种计算机设备的结构示意图。FIG. 18 is a schematic diagram of the structure of another computer device provided in an embodiment of the present application.
具体实施方式DETAILED DESCRIPTION
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
本申请的说明书和权利要求书及上述附图中的术语“第一”、第二”以及相应术语标号等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的术语在适当情况下可以互换,这仅仅是描述本申请的实施例中对相同属性的对象在描述时所采用的区分方式。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,以便包含一系列单元的过程、方法、系统、产品或设备不必限于那些单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它单元。The terms "first", "second" and corresponding terminology numbers in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged under appropriate circumstances. This is merely a way of distinguishing objects with the same properties when describing the embodiments of the present application. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, so that a process, method, system, product or device that includes a series of units is not necessarily limited to those units, but may include other units that are not explicitly listed or inherent to these processes, methods, products or devices.
在本申请的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本申请中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,在本申请的描述中,“至少一项”是指一项或者多项,“多项”是指两项或两项以上。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个) 的任意组合。例如,a,b,或c中的至少一项(个),可以表示:a,b,c,a-b,a-c,b-c,或a-b-c,其中a,b,c可以是单个,也可以是多个。In the description of this application, unless otherwise specified, "/" means or, for example, A/B can mean A or B; "and/or" in this application is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and/or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of this application, "at least one" refers to one or more items, and "multiple items" refers to two or more items. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c can be single or multiple.
图1是适用于本申请实施例的计算机系统的结构示意图,如图1所示,该计算机系统包括联邦学习服务端和多个客户端。联邦学习服务端和多个客户端配合,用于模型的训练和基于模型的推理。其中,客户端的数量可以根据实际需求进行调整。FIG1 is a schematic diagram of the structure of a computer system applicable to an embodiment of the present application. As shown in FIG1 , the computer system includes a federated learning server and multiple clients. The federated learning server and multiple clients cooperate for model training and model-based reasoning. The number of clients can be adjusted according to actual needs.
应理解,在推理阶段,某个客户端仅使用本地数据进行推理,而不使用其他客户端的数据进行推理,尽管可以保护其他客户端的隐私,但可能导致推理结果不够准确。It should be understood that during the inference phase, a client only uses local data for inference, and does not use data from other clients for inference. Although this can protect the privacy of other clients, it may result in inaccurate inference results.
为此,本申请实施例提供了一种推理方法,在该方法中,服务端参与推理过程,具体地,联邦学习服务端根据多个客户端的局部特征得到全局先验特征,并将全局先验特征发送至各个客户端,使得各个客户端利用全局先验特征和本地数据进行推理。由于全局先验特征是根据多个客户端的局部特征得到的,局部特征是从第一网络数据中提取出的,所以对于每个客户端来说,在推理过程中都利用了其他客户端的数据的信息,可以提高推理结果的准确性。To this end, an embodiment of the present application provides an inference method, in which a server participates in the inference process. Specifically, the federated learning server obtains a global prior feature based on the local features of multiple clients, and sends the global prior feature to each client, so that each client uses the global prior feature and local data for inference. Since the global prior feature is obtained based on the local features of multiple clients, and the local feature is extracted from the first network data, for each client, the information of the data of other clients is used in the inference process, which can improve the accuracy of the inference result.
本申请实施例提供的推理方法的应用场景可以有多种,例如可以应用于语音识别场景和图像识别场景。The reasoning method provided in the embodiments of the present application can be applied in various scenarios, for example, it can be applied to speech recognition scenarios and image recognition scenarios.
以语音识别场景为例,在演唱会现场一个人在演唱会现场使用语言助手进行语音转文字操作,单个设备无法判断接收到的语音是来自背景(演唱会的歌词)还是来自正在录入语音的人,此时则需要同一个演唱会的其它用户的设备采集到的语音信息,以通过其它用户的设备采集到的语音信息判断设备接收到的语音是来自背景(演唱会的歌词)还是来自正在录入语音。在该场景下,则可以使用本申请实施例提供的推理方法,根据多个用户的设备采集到的语音信息进行推理,以推理出语音的来源(背景或用户录入的)。Taking the voice recognition scenario as an example, at a concert, a person uses a language assistant to perform voice-to-text operations. A single device cannot determine whether the received voice is from the background (concert lyrics) or from the person who is recording the voice. At this time, the voice information collected by the devices of other users of the same concert is needed to determine whether the voice received by the device is from the background (concert lyrics) or from the voice being recorded. In this scenario, the reasoning method provided in the embodiment of the present application can be used to reason based on the voice information collected by the devices of multiple users to infer the source of the voice (background or user recording).
以图像识别场景为例,在一条道路上行驶了很多辆车,每辆车上的摄像头都拍摄到了该条道路的图像。使用本申请实施例提供的推理方法,则可以通过多辆车的摄像头拍摄到的图像进行推理,以推理出当前道路的交通状况(不拥堵、正常拥堵或交通事故引发拥堵)。Taking the image recognition scenario as an example, there are many cars driving on a road, and the camera on each car captures the image of the road. Using the reasoning method provided in the embodiment of the present application, the images captured by the cameras of multiple cars can be used for reasoning to infer the current traffic conditions of the road (no congestion, normal congestion, or congestion caused by a traffic accident).
本申请实施例提供的推理方法所使用的数据(包括下文中的本地数据、第一网络数据、第二网络数据等)可以是图像、语音、文字等多种形式的数据。The data used in the reasoning method provided in the embodiment of the present application (including local data, first network data, second network data, etc. mentioned below) can be data in various forms such as images, voices, and texts.
需要说明的是,在推理过程中需要用到一部分模型,这部分模型可以通过预先的训练得到,为此,下文会先介绍本申请实施例提供的推理方法,然后介绍推理方法所使用的模型的训练方法。It should be noted that a part of the model is needed in the reasoning process, and this part of the model can be obtained through pre-training. For this reason, the following will first introduce the reasoning method provided in the embodiment of the present application, and then introduce the training method of the model used in the reasoning method.
下面先介绍本申请实施例提供的推理方法。The following first introduces the reasoning method provided by the embodiment of the present application.
图2是本申请实施例提供的一种推理方法的流程示意图,应用于推理系统,该推理系统包括服务端和多个客户端,具体可以是图1所示的推理系统。FIG2 is a flow chart of an inference method provided in an embodiment of the present application, which is applied to an inference system including a server and multiple clients, and specifically may be the inference system shown in FIG1 .
在该实施例中,以多个客户端中的一个为例,该实施例具体包括:In this embodiment, taking one of the multiple clients as an example, the embodiment specifically includes:
步骤201.服务端向多个客户端发送任务同步信息,以使得多个客户端根据任务同步信息从本地数据中选择出第一网络数据,任务同步信息表示对第一网络数据的时间要求。Step 201. The server sends task synchronization information to multiple clients, so that the multiple clients select first network data from local data according to the task synchronization information, and the task synchronization information indicates a time requirement for the first network data.
任务同步信息的作用是使得多个客户端从本地数据中选择与目标网络资源有关的第一网络数据,以在满足用户需求的前提下进行推理。其中,目标网络资源可以是目标网络当前的状态,例如目标网络资源可以是车辆的故障状态,则第一网络数据可以包括以下至少一项:第一车辆的定位数据、行驶速度数据、行驶里程数据、电池电量数据、电池电压数据、刹车数据、油门数据、电机的电压和电流数据、绝缘电阻数据和温度数据等,本申请实施例对处不作限定。The role of task synchronization information is to enable multiple clients to select the first network data related to the target network resource from the local data to perform reasoning under the premise of meeting user needs. Among them, the target network resource can be the current state of the target network, for example, the target network resource can be the fault state of the vehicle, then the first network data can include at least one of the following: the first vehicle's positioning data, driving speed data, driving mileage data, battery power data, battery voltage data, brake data, throttle data, motor voltage and current data, insulation resistance data and temperature data, etc., the embodiment of the present application does not limit the place.
本申请实施例对任务同步信息的内容不做具体限定,例如,任务同步信息可以是某一具体时刻,以使得多个客户端任务同步信息从本地数据中选择出的第一网络数据的时刻相同,或者说,使得多个客户端任务同步信息从本地数据中选择出的第一网络数据的时刻比较接近,或者说,以使得多个客户端任务同步信息从本地数据中选择出的第一网络数据的时刻之前一段时间数据条数维度降维后的数据,如多条数据的平均值、中值或者通过主成分分析等降维得到的主成分值、聚类的聚类中心值等。The embodiments of the present application do not specifically limit the content of the task synchronization information. For example, the task synchronization information may be a specific moment, so that the moment of the first network data selected from the local data by the task synchronization information of multiple clients is the same, or in other words, the moment of the first network data selected from the local data by the task synchronization information of multiple clients is relatively close, or in other words, the data after dimensionality reduction of the number of data items for a period of time before the moment of the first network data selected from the local data by the task synchronization information of multiple clients, such as the average value, median value of multiple data items, or the principal component value obtained by dimensionality reduction such as principal component analysis, the cluster center value of the cluster, etc.
第一联邦学习客户端为多个客户端中的一个,第一联邦学习客户端可以接收来自服务端的任务同步信息,任务同步信息表示对该第一联邦学习客户端的本地数据中的第一网络数据的时间要求。The first federated learning client is one of the multiple clients. The first federated learning client can receive task synchronization information from the server. The task synchronization information indicates a time requirement for first network data in local data of the first federated learning client.
步骤202.第一联邦学习客户端根据任务同步信息从本地数据中选择出第一网络数据。Step 202: The first federated learning client selects first network data from local data according to the task synchronization information.
本实施例中,该任务同步信息指示一个时间点,第一联邦学习客户端可以从本地数据中选择该时间点的数据作为第一网络数据。In this embodiment, the task synchronization information indicates a time point, and the first federated learning client can select data at the time point from local data as the first network data.
第一网络数据为目标网络资源有关的数据在第一时隙的采样值或者从第三时隙到第一时隙为止的统计值,第三时隙在第一时隙之前。The first network data is a sampled value of data related to the target network resource in the first time slot or a statistical value from the third time slot to the first time slot, and the third time slot is before the first time slot.
例如,任务同步信息包括10点10分这一时刻,那么第一联邦学习客户端可以根据任务同步信息选择10点10分这一时刻的本地数据作为第一网络数据,或者,第一联邦学习客户端可以根据任务同步信息选择与10点10分这一时刻较为接近的时刻的本地数据或本地数据沿数据维度降维后的数据作为第一网络数据,例如,第一联邦学习客户端可以选择10点9分至10点11分内的本地数据作为第一网络数据。For example, if the task synchronization information includes the time of 10:10, the first federated learning client can select the local data at 10:10 as the first network data according to the task synchronization information, or the first federated learning client can select the local data at a time close to 10:10 or the data after dimensionality reduction along the data dimension as the first network data according to the task synchronization information. For example, the first federated learning client can select the local data between 10:09 and 10:11 as the first network data.
步骤203.第一联邦学习客户端从第一网络数据中提取第一网络数据的特征,第一网络数据的特征包含第一局部特征。Step 203: The first federated learning client extracts features of the first network data from the first network data, where the features of the first network data include first local features.
第一网络数据的特征可以包括一个特征,也可以包括多个特征;当第一网络数据的特征包括多个特征时,局部特征可以是多个特征中的一个或多个。The features of the first network data may include one feature or multiple features; when the features of the first network data include multiple features, the local feature may be one or more of the multiple features.
第一网络数据的特征一般用特征向量表示,以第一网络数据的特征包括三个特征为例,第一网络数据的特征可以表示为其中,局部特征可以为这三个特征中的一个或多个,传输哪个或哪些特征可以事先约定,也可以根据当前第一网络数据特性、第一网络数据的特征特性、客户端计算资源,客户端和/或服务器端网络资源决定,决定的策略可以是人工写的逻辑也可以是通过机器学习得到的模型,本申请实施例以为例,其中,n是第一联邦学习客户端的标识,可以为数字1、2、3等,不同的n指代不同的客户端。下文也将第一网络数据的特征称为隐含特征。第一网络数据特性指的原始数据特性,比如原始数据信息量少则直传一个特征,如果原始数据信息量大则传多个特征。原始数据的信息量可以用熵来计算,也可以通过一个神经网络或者机器学习模型来计算。The features of the first network data are generally represented by feature vectors. Taking the first network data including three features as an example, the features of the first network data can be represented as follows: Among them, the local feature can be one or more of these three features. Which or which features to transmit can be agreed in advance, or it can be determined based on the current first network data characteristics, the characteristic characteristics of the first network data, the client computing resources, and the client and/or server network resources. The decision strategy can be a manually written logic or a model obtained by machine learning. The embodiment of the present application is based on For example, n is the identifier of the first federated learning client, which can be 1, 2, 3, etc. Different n refers to different clients. The characteristics of the first network data are also referred to as implicit characteristics below. The characteristics of the first network data refer to the characteristics of the original data. For example, if the amount of information in the original data is small, one feature is directly transmitted. If the amount of information in the original data is large, multiple features are transmitted. The amount of information in the original data can be calculated using entropy, or it can be calculated using a neural network or machine learning model.
第一联邦学习客户端可以通过局部特征提取模型提取第一网络数据的特征,其中,局部特征提取模型的种类包括多种,本申请实施例对此不做具体限定。The first federated learning client can extract features of the first network data through a local feature extraction model, wherein there are many types of local feature extraction models, which are not specifically limited in the embodiments of the present application.
作为一种可实现的方式,当第一网络数据特征为多个类型时,局部特征提取模型可以包括多个第二任务模型,相应地,步骤203具体可以是:第一联邦学习客户端将第一网络数据分别输入到多个第二任务模型中,以得到多个第二任务模型输出的第一网络数据的多个特征。即第一联邦学习客户端将第一网络数据按照类型分别输入到不同的第二任务模型中,各个第二任务模型分别输出该类型对应的特征。As an implementable manner, when the first network data features are of multiple types, the local feature extraction model may include multiple second task models. Accordingly, step 203 may specifically be: the first federated learning client inputs the first network data into multiple second task models respectively to obtain multiple features of the first network data output by the multiple second task models. That is, the first federated learning client inputs the first network data into different second task models according to the type, and each second task model outputs the features corresponding to the type respectively.
本申请实施例对第二任务模型的种类不做具体限定。The embodiment of the present application does not specifically limit the type of the second task model.
作为一种可实现的方式,每个第二任务模型是一层自编码器,第r个任务模型的重构目标是第r-1个任务模型的残差,其中,r为大于1的整数且表示第二任务模型的数量。As an implementable approach, each second task model is a layer of autoencoder, and the reconstruction target of the rth task model is the residual of the r-1th task model, where r is an integer greater than 1 and represents the number of second task models.
具体地,自编码器是一个输入和学习目标相同的神经网络,其结构分为编码器和解码器两部分。输入第一网络数据后,由编码器输出的隐含特征,即“编码特征(encodedfeature)”可视为第一网络数据的表征。Specifically, an autoencoder is a neural network with the same input and learning target, and its structure is divided into two parts: encoder and decoder. After inputting the first network data, the implicit features output by the encoder, namely the "encoded features", can be regarded as the representation of the first network data.
其中,自编码器可以采用深度神经网络(deep neural network,DNN)、卷积神经网络(convolutional neural network,CNN)或者Transformer神经网络实现。Among them, the autoencoder can be implemented using a deep neural network (DNN), a convolutional neural network (CNN) or a Transformer neural network.
具体地,以3个第二任务模型为例,即局部特征提取模型包含3层自编码器。第1层的自编码器输入为原始特征Xn,通过编码器得到隐含特征编码器可以采用深度神经网络实现。隐含特征的维度比原始特征Xn的维度低。隐含特征通过与编码器对应的解码器得到原始特征Xn的重建特征解码器可以采用深度神经网络。Specifically, take the three second task models as an example, that is, the local feature extraction model includes three layers of autoencoders. The first layer of the autoencoder input is the original feature Xn , which is passed through the encoder Get hidden features Encoder It can be implemented using deep neural networks. Hidden features The dimension of is lower than that of the original feature Xn . Hidden features By using the encoder The corresponding decoder Get the reconstructed features of the original features Xn Decoder A deep neural network can be used.
第2层的自编码器输入为原始特征Xn,通过编码器得到隐含特征编码器可以采用深度神经网络实现。隐含特征的维度比原始特征Xn的维度低。隐含特征通过与编码器对应的解码器得到原始特征Xn与第1层模型重构的差异的重建特征 The second layer of the autoencoder input is the original feature Xn , which is passed through the encoder Get hidden features Encoder It can be implemented using deep neural networks. Hidden features The dimension of is lower than that of the original feature Xn . Hidden features By using the encoder The corresponding decoder Get the original feature Xn and the first layer model reconstruction The Difference Reconstruction features
第3层的自编码器输入为原始特征Xn,通过编码器得到隐含特征编码器可以采用深度神经网络实现。隐含特征h3的维度比原始特征Xn的维度低。隐含特征h3通过与编码器E3对应的解码器D3得到原始特征Xn与第1层模型重构和第2层模型重构之和的差异的重建特征 The third layer of the autoencoder input is the original feature Xn , which is passed through the encoder Get hidden features Encoder It can be implemented using a deep neural network. The dimension of the latent feature h3 is lower than that of the original feature Xn . The latent feature h3 is obtained by the decoder D3 corresponding to the encoder E3 to obtain the original feature Xn and the first layer model reconstruction. and layer 2 model reconstruction The difference of the sum Reconstruction features
其中,该自编码器的预训练过程可以是:Among them, the pre-training process of the autoencoder can be:
(1)联邦学习服务端下发第n层的自编码器模型;(2)客户端接收第n层的自编码器模型,使用本地数据训练模型若干轮后上传第n层的自便器模型到联邦学习服务端;(3) 重复(1)到(2)直到第n层的自编码器收敛;(4)重复(1)到(3)逐层训练各层的自编码器。(1) The federated learning server sends the autoencoder model of the nth layer; (2) The client receives the autoencoder model of the nth layer, trains the model with local data for several rounds, and then uploads the autoencoder model of the nth layer to the federated learning server; (3) Repeat (1) to (2) until the autoencoder of the nth layer converges; (4) Repeat (1) to (3) to train the autoencoder of each layer layer by layer.
步骤204.第一联邦学习客户端向服务端发送第一局部特征,第一局部特征是从第一网络数据中提取出的,第一联邦学习客户端为多个客户端中的任意一个。相应地,服务端接收来自多个客户端的局部特征,局部特征是从第一网络数据中提取出的。Step 204. The first federated learning client sends a first local feature to the server, where the first local feature is extracted from the first network data, and the first federated learning client is any one of the multiple clients. Accordingly, the server receives local features from the multiple clients, where the local features are extracted from the first network data.
本实施例中,第一联邦学习客户端在从第一网络数据的特征中选择除第一局部特征后,可以发送给服务端,其他客户端也可以相应从本地的第一网络数据中提取局部特征发送给服务端,示例性的,第二联邦学习客户端从本地的第一网络数据的特征中选择第二局部特征发送给服务端。In this embodiment, the first federated learning client can send the first local feature to the server after selecting it from the features of the first network data. Other clients can also extract local features from the local first network data and send them to the server. For example, the second federated learning client selects the second local feature from the features of the local first network data and sends it to the server.
步骤205.服务端根据来自多个客户端的局部特征,得到全局先验特征。Step 205: The server obtains global prior features based on local features from multiple clients.
本实施例中,联邦学习服务端采集多个客户端上报的局部特征,然后可以对这些局部特征进行处理,基于多个客户端的特征确定全局先验特征,该全局先验特征通过多客户端信息融合获得,可以提高该全局先验特征的准确度。In this embodiment, the federated learning server collects local features reported by multiple clients, and then processes these local features to determine global prior features based on the features of multiple clients. The global prior features are obtained by multi-client information fusion, which can improve the accuracy of the global prior features.
其中,联邦学习服务端接收多个客户端上传的局部特征将多个客户端上传的局部特征拼接成全局先验特征提取模型的输入特征,输入全局先验特征提取模型,得到输出的各客户端对应的全局先验特征。Among them, the federated learning server receives local features uploaded by multiple clients Local features uploaded by multiple clients The input features of the global prior feature extraction model are spliced together and input into the global prior feature extraction model to obtain the global prior features corresponding to each client as output.
全局先验特征提取模型采用DNN、CNN、Transformer或者RNN模型,模型的输入除了拼接后的局部特征还有上一次的输出值。全局先验特征提取模型也可以使用查找表的方式实现,例如将拼接后的局部特征作为key,对应的全局先验特征作为value。The global prior feature extraction model uses a DNN, CNN, Transformer or RNN model. The input of the model includes the concatenated local features and the previous output value. The global prior feature extraction model can also be implemented using a lookup table, for example, using the concatenated local features as the key and the corresponding global prior features as the value.
拼接指的是沿特征的某一个维度或者多个为将数据级联在一起。例如是一个 D×W×H的3维张量,如果W的维度拼接则拼接后的维度D×NW×H的3维张量。例如是一个D×W×H的3维张量,如果W和H的维度拼接则拼接后的维度D×N1W×N2H的3维张量,其中N1N2=N。Concatenation refers to concatenating data along one or more dimensions of a feature. For example is a 3D tensor of D×W×H. If the dimensions of W are concatenated, the concatenated dimensions are D×NW×H. It is a 3D tensor of D×W×H. If the dimensions of W and H are concatenated, the concatenated 3D tensor is of dimension D×N 1 W×N 2 H, where N 1 N 2 =N.
由于客户端的数据只在分组内有影响,组间没有影响。如果将所有客户端的数据一起确定全局先验特征会影响组间的输出,所以需要分组输入。作为一种可实现的方式,第一联邦学习客户端还可以向服务端发送分组信息,分组信息指示局部特征所在的分组,以使得服务端根据来自多个客户端的局部特征以及局部特征所在的分组得到全局先验特征。Since the client data only has an impact within the group and has no impact between groups, if the data of all clients are used together to determine the global prior features, it will affect the output between groups, so group input is required. As an implementable method, the first federated learning client can also send group information to the server, and the group information indicates the group where the local features are located, so that the server obtains the global prior features based on the local features from multiple clients and the groups where the local features are located.
其中,第一联邦学习客户端上传的第一局部特征包括第一子特征和第二子特征,第二联邦学习客户端上传的第二局部特征包括第三子特征和第四子特征,来自第一联邦学习客户端的分组信息可以指示第一子特征所在的分组和第二子特征所在的分组,来自第二联邦学习客户端的分组信息指示第三子特征所在的分组和第四子特征所在的分组,假设第一子特征所在的分组和第三子特征所在的分组相同,则联邦学习服务端可以先对第一子特征和第三子特征进行处理,得到中间特征,再按照分组,将中间特征与第二子特征进行处理后获得的处理结果与第四子特征进行处理,以获得全局先验特征。对于不同类型的客户端上传的特征可以分开处理,减少不同类型客户端之间的影响。Among them, the first local feature uploaded by the first federated learning client includes the first sub-feature and the second sub-feature, and the second local feature uploaded by the second federated learning client includes the third sub-feature and the fourth sub-feature. The grouping information from the first federated learning client can indicate the group where the first sub-feature is located and the group where the second sub-feature is located. The grouping information from the second federated learning client indicates the group where the third sub-feature is located and the group where the fourth sub-feature is located. Assuming that the group where the first sub-feature is located is the same as the group where the third sub-feature is located, the federated learning server can first process the first sub-feature and the third sub-feature to obtain the intermediate feature, and then process the intermediate feature and the second sub-feature according to the grouping, and the processing result obtained by processing the fourth sub-feature to obtain the global prior feature. Features uploaded by different types of clients can be processed separately to reduce the impact between different types of clients.
具体的,该分组信息为对客户端之间的分组的信息,组内对应的是相同土地性质(农田、道路、城镇)的客户端,组间是不同土地性质的客户端。不同的土地性质对信号的传输影响不同,因此进行分组处理减少不同土地客户端之间的影响。例如高速路上,处于同一方向或者同一条车道上的车辆(1、2、3)的数据为同一分组,不同方向的车辆(4、5、 6)的数据为另一分组,则车辆(1、2、3)上传的分组信息指示同一分组,车辆(4、5、 6)上传的分组信息指示同一分组。Specifically, the grouping information is information about the grouping between clients. The client within the group corresponds to the client with the same land nature (farmland, road, town), and the client between the groups corresponds to the client with different land nature. Different land natures have different effects on signal transmission, so grouping is performed to reduce the impact between clients of different lands. For example, on a highway, the data of vehicles (1, 2, 3) in the same direction or the same lane are the same group, and the data of vehicles (4, 5, 6) in different directions are another group. Then the grouping information uploaded by vehicles (1, 2, 3) indicates the same group, and the grouping information uploaded by vehicles (4, 5, 6) indicates the same group.
联邦学习服务端接收多个客户端上传的局部特征和对应的分组信息分组信息可以通过对步骤103中的分别进行聚类得到。The federated learning server receives local features uploaded by multiple clients And the corresponding group information The grouping information can be obtained by Clustering is performed separately.
将相同的拼接在一起,根据全局先验特征提取模型采用不同的模型,如DNN、CNN、 RNN、Transformer,对应不同的拼接方式:Will Same Splice together and use different models according to the global prior feature extraction model, such as DNN, CNN, RNN, Transformer, corresponding to different splicing methods:
对于DNN、CNN这类输入数据需要同时输入的模型,对按全局位置拼接,未被该组选中的位置用默认值代替,如下表所示。例如,各客户端在全局位置如下表1所示:For models such as DNN and CNN, where input data needs to be input simultaneously, The global positions are stitched together, and the positions not selected by the group are replaced by default values, as shown in the following table. The global position is shown in Table 1 below:
表1Table 1
如果和属于同一个分组;一个分组;一个分组则,则数据拼接后为表2、表3和表4所示:if and Belong to the same group; A grouping; If there is one group, the data is concatenated as shown in Table 2, Table 3 and Table 4:
表2Table 2
表3Table 3
表4Table 4
如果采用RNN和Transformer模型,输入数据可以逐一输入到模型。可以将属于同一组的添加全局位置编码然后输入到模型。全局位置编码如下表所示。If RNN and Transformer models are used, the input data can be fed into the model one by one. Add the global position code and then input it into the model. The global position code is shown in the following table.
输入模型的序列为 The sequence of inputs to the model is
将拼接好的局部特征输入全局先验特征提取模型的第一层模型,得到第一层的隐含特征 表示第一层第m组的隐含特征。The spliced local features are input into the first layer model of the global prior feature extraction model to obtain the implicit features of the first layer. Represents the implicit features of the mth group in the first layer.
将全局先验特征提取模型的第一层模型输出的隐含特征与局部特征进行拼接,如下表5所示:Extract the implicit features of the first layer model output by the global prior feature extraction model With local features Perform splicing as shown in Table 5 below:
表5Table 5
将拼接后的局部特征按第一层的方式分组输入全局先验特征提取模型的第二层模型得到第二层每组的第二层的分组可以是在第一层的分组基础上进行再分组,也可以是对全部局部特征进行重新分组。The spliced local features are grouped in the first layer and input into the second layer model of the global prior feature extraction model to obtain the second layer of each group The second layer of grouping can be regrouping based on the first layer of grouping, or all local features can be regrouped.
将全局先验特征提取模型的第二层模型输出的隐含特征与局部特征进行拼接,讲拼接的结果输入全局先验特征提取模型的第三层模型,得到输出的各客户端对应的全局先验特征 Extract the implicit features of the second layer model output by the global prior feature extraction model With local features Perform splicing, and input the splicing result into the third layer model of the global prior feature extraction model to obtain the global prior features corresponding to each client.
步骤206.联邦学习服务端向多个客户端分别发送全局先验特征,相应的,第一联邦学习客户端接收全局先验特征。Step 206: The federated learning server sends the global prior features to the multiple clients respectively, and correspondingly, the first federated learning client receives the global prior features.
本实施例中,联邦学习服务端在确定全局先验特征后,即可向连接的多个客户端下发该全局先验特征。In this embodiment, after determining the global prior feature, the federated learning server can send the global prior feature to multiple connected clients.
步骤207.第一联邦学习客户端根据全局先验特征和第二网络数据进行推理,以得到推理结果。Step 207: The first federated learning client performs reasoning based on the global prior features and the second network data to obtain a reasoning result.
本实施例中,第一联邦学习客户端可以基于该全局先验特征对本地的第二网络数据进行推理,获得第二网络数据的推理结果。其中,第二时隙与第一时隙相同或在第一时隙之后,即第二网络数据可以与第一网络数据处于相同时刻,也可以处于第一网络数据的时刻之后的数据,示例性的,假设第一网络数据为9:00的数据,则第二网络数据可以是9:00到9:15之间任意时刻的数据,本申请实施例对此不作限定。In this embodiment, the first federated learning client can infer the local second network data based on the global prior feature to obtain the inference result of the second network data. Among them, the second time slot is the same as the first time slot or after the first time slot, that is, the second network data can be at the same time as the first network data, or it can be data after the time of the first network data. For example, assuming that the first network data is 9:00 data, the second network data can be data at any time between 9:00 and 9:15, and this embodiment of the application is not limited to this.
推理的过程中可以直接对第二网络数据处理,也可以对从第二网络数据中提取的隐含特征进行推理,还可以是从隐含特征中选择一个或多个特征进行推理,本申请实施例对此不作限定。During the inference process, the second network data may be directly processed, or the implicit features extracted from the second network data may be inferred, or one or more features may be selected from the implicit features for inference, which is not limited in the embodiments of the present application.
全局先验特征为特征向量或推理模型,推理模型用于根据第二网络数据输出第二网络数据的推理结果。The global prior feature is a feature vector or an inference model, and the inference model is used to output an inference result of the second network data according to the second network data.
对于全局先验特征为特征向量的场景,第一联邦学习客户端根据全局先验特征、第二网络数据以及本地的第二机器学习模型进行推理,以得到推理结果,第二机器学习模型用于第二网络数据的推理。具体的,第一联邦学习客户端需要将全局先验特征和第二网络数据输入到本地的第二机器学习模型中进行推理,将该第二机器学习模型输出的结果作为推理结果。For the scenario where the global prior feature is a feature vector, the first federated learning client performs reasoning based on the global prior feature, the second network data, and the local second machine learning model to obtain the reasoning result, and the second machine learning model is used for the reasoning of the second network data. Specifically, the first federated learning client needs to input the global prior feature and the second network data into the local second machine learning model for reasoning, and use the result output by the second machine learning model as the reasoning result.
其中,在将第二网络数据输入到第二机器学习模型中之前,第一联邦学习客户端还可以将第二网络数据输入到第三机器学习模型(例如局部特征提取模型),以获得可以体现第二网络数据特点的多个特征,可以节省计算资源。第一联邦学习客户端将全局先验特征和第二网络数据输入到本地的第二机器学习模型中进行推理的方式可以是,第一联邦学习客户端将全局先验特征输入到该第二机器学习模型中,可以获得第二机器学习模型输出的第二网络数据的多个特征对应的权重,即每个特征对应一个权重,然后即可根据第二网络数据的多个特征以及第二网络数据的多个特征各自的权重确定推理结果。Among them, before inputting the second network data into the second machine learning model, the first federated learning client can also input the second network data into a third machine learning model (such as a local feature extraction model) to obtain multiple features that can reflect the characteristics of the second network data, which can save computing resources. The first federated learning client inputs the global prior features and the second network data into the local second machine learning model for reasoning. The first federated learning client inputs the global prior features into the second machine learning model, and can obtain the weights corresponding to the multiple features of the second network data output by the second machine learning model, that is, each feature corresponds to a weight, and then the reasoning result can be determined according to the multiple features of the second network data and the weights of the multiple features of the second network data.
图3为本申请实施例提供的一种推理结构示意图,如图3所示,客户端根据全局先验特征计算不同隐含特征对应的权重值,具体的,局部特征提取模型采用多层自编码器。FIG3 is a schematic diagram of an inference structure provided in an embodiment of the present application. As shown in FIG3 , the client calculates weight values corresponding to different implicit features based on global prior features. Specifically, the local feature extraction model adopts a multi-layer autoencoder.
客户端Cn接收联邦学习服务端下发的全局先验特征推理模型(第二机器学习模型) 采用DNN模型,客户端Cn将全局先验特征输入推理模型,推理模型输出多个隐含特征的对应的权重值并保存权重值 Client Cn receives the global prior features sent by the federated learning server The inference model (the second machine learning model) uses the DNN model. The client C n converts the global prior features Input the inference model, and the inference model outputs multiple implicit features The corresponding weight value And save the weight value
客户端Cn通过采集器获取本地t时刻的待推理数据X(t)n,经待推理数据X(t)n通过局部特征提取模型输出的多个隐含特征根据局部特征提取模型输出的多个隐含特征推理模型输出的权重值和本地的锚点数据集计算分类到各锚点的距离r(t)n,m,其中 Client Cn obtains the local data to be inferred X(t) n at time t through the collector, and extracts multiple implicit features output by the local feature extraction model from the data to be inferred X(t) n Extract multiple implicit features from the local feature extraction model output The weight value output by the inference model and local anchor datasets Calculate the distance r(t) n,m from the classification to each anchor point, where
选取全部锚点数据集对应的r(t)n,m最小的值对应的yn,m作为X(t)n的输出。Select y n, m corresponding to the smallest value of r(t) n, m corresponding to all anchor point data sets as the output of X(t) n .
计算局部特征提取模型输出的多个隐含特征分别对应的分类结果作为输出稳定性的评价指标,即Calculate multiple latent features output by the local feature extraction model The corresponding classification results are used as the evaluation indicators of output stability, namely
选取全部锚点数据集对应的最小的值对应的yn,m作为X(t)n隐含特征的类别,选取全部锚点数据集对应的最小的值对应的yn,m作为X(t)n隐含特征的类别选取全部锚点数据集对应的最小的值对应的yn,m作为X(t)n隐含特征的类别。Select all anchor point datasets corresponding to The smallest value corresponding to y n,m is used as the hidden feature of X(t) n The categories of all anchor datasets are selected. The smallest value corresponding to y n,m is used as the hidden feature of X(t) n The categories of all anchor datasets are selected The smallest value corresponding to y n,m is used as the hidden feature of X(t) n Category.
输出稳定性的评价指标=相同类别最大数/隐含特征向量总数。The evaluation index of output stability = maximum number of the same category/total number of hidden feature vectors.
如果三个类别一致则稳定性的评价指标=1,如果两个类别一致则稳定性的评价指标=2/3,如果类别都不一致则稳定性的评价指标=1/3。If the three categories are consistent, the stability evaluation index = 1, if two categories are consistent, the stability evaluation index = 2/3, and if none of the categories are consistent, the stability evaluation index = 1/3.
上面讲述的第二机器学习模型是一个任务模型,该任务模型不需要对第二网络数据进行处理,下面对任务模型需要对第二网络数据进行处理的方式进行描述,其中,第二机器学习模型包括多个第一任务模型,可以对第二网络数据的多个特征分别进行处理,具体的,第一联邦学习客户端获得全局先验特征后,可以从该全局先验特征确定多个第一任务模型各自的权重,第一联邦学习客户端可以将第二网络数据的特征输入到多个第一任务模型中,该多个第一任务模型的输入特征可以是默认类型的特征,即第二网络数据的特征按照类别分类,并输入到对应类别的第一任务模型,第一联邦学习客户端即可以对多个第一任务模型输出的推理特征结合多个第一任务模型对应的权重进行加权平均,以获得推理结果。The second machine learning model described above is a task model, which does not need to process the second network data. The following describes the way in which the task model needs to process the second network data, wherein the second machine learning model includes multiple first task models, which can process multiple features of the second network data separately. Specifically, after the first federated learning client obtains the global prior features, it can determine the weights of the multiple first task models from the global prior features. The first federated learning client can input the features of the second network data into the multiple first task models. The input features of the multiple first task models can be features of the default type, that is, the features of the second network data are classified according to categories and input into the first task models of the corresponding categories. The first federated learning client can perform weighted averaging on the inference features output by the multiple first task models in combination with the weights corresponding to the multiple first task models to obtain the inference result.
其中,第一联邦学习客户端根据全局先验特征确定多个第一任务模型各自的权重的方式可以是,第一联邦学习客户端需要结合全局先验特征和第二网络数据,来计算多个第一任务模型各自的权重,即结合需要推理的数据的特征计算权重,提高权重的准确度。Among them, the way in which the first federated learning client determines the respective weights of multiple first task models based on the global prior features can be that the first federated learning client needs to combine the global prior features and the second network data to calculate the respective weights of the multiple first task models, that is, to calculate the weights in combination with the features of the data to be inferred, thereby improving the accuracy of the weights.
其中,在将第二网络数据输入到第二机器学习模型中之前,第一联邦学习客户端还可以将第二网络数据输入到第三学习模型(例如局部特征提取模型),以获得可以体现第二网络数据特点的多个特征,可以节省计算资源。Among them, before inputting the second network data into the second machine learning model, the first federated learning client can also input the second network data into a third learning model (such as a local feature extraction model) to obtain multiple features that can reflect the characteristics of the second network data, thereby saving computing resources.
图4为本申请实施例提供的另一种推理结构示意图,请参阅图4,客户端Cn接收联邦学习服务端下发的全局先验特征并保存全局先验特征其中,推理模型采用缓和专家模型,该混合专家模型包括模型选择器和多个第一任务模型,如图中的任务模型1至任务模型N。FIG4 is a schematic diagram of another reasoning structure provided in an embodiment of the present application. Referring to FIG4 , the client C n receives the global prior feature information sent by the federated learning server. And save the global prior features The reasoning model adopts a moderated expert model, and the hybrid expert model includes a model selector and a plurality of first task models, such as task model 1 to task model N in the figure.
客户端Cn通过采集器获取本地t时刻的待推理数据X(t)n,推理模型(第二机器学习模型)采用混合专家模型,将待推理数据X(t)n和全局先验特征输入混合专家模型计算推理结果。Client Cn obtains the local data to be inferred X(t) n at time t through the collector. The inference model (the second machine learning model) adopts a hybrid expert model to combine the data to be inferred X(t) n and the global prior features. Input the hybrid expert model to calculate the inference results.
其中,混合专家模型由模型选择器、多个任务模型组成的任务模型组构成和分类器组成:模型选择器输入为全局先验特征(也可以加入第二网络数据),输出为对“任务模型组”中的多个任务模型的权重(选择可是为一种0-1化的权重);“任务模型组”由N个“任务模型”组成,每个“任务模型”根据输入数据,输出为隐含特征向量;分类器输入的是经过模型选择器输出的权重加权求和后的隐含特征向量,输出的分类结果。Among them, the hybrid expert model is composed of a model selector, a task model group composed of multiple task models and a classifier: the model selector input is the global prior feature (the second network data can also be added), and the output is the weight of multiple task models in the "task model group" (the selection can be a 0-1 weight); the "task model group" is composed of N "task models", and each "task model" outputs an implicit feature vector based on the input data; the classifier input is the implicit feature vector after the weighted summation of the weights output by the model selector, and the output is the classification result.
具体步骤如下:The specific steps are as follows:
第一步:全局先验特征(也可以加入第二网络数据)通过“模型选择器”计算多个任务模型的权重值。Step 1: The global prior features (the second network data can also be added) calculate the weight values of multiple task models through the "model selector".
全局先验特征首先输入模型选择器模型(模型可以用DNN、CNN、Transformer实现),模型参数用表示。模型选择器模型的输入-输出关系表示为:或者 The global prior features are first input into the model selector model (the model can be implemented by DNN, CNN, Transformer), and the model parameters are The input-output relationship of the model selector model is expressed as: or
然后计算g(t)′到各个锚点的距离距离可以使用欧式距离、余弦距离或者自定义的距离。模型选择器模型的锚点集合为:Then calculate the distance from g(t)′ to each anchor point The distance can use Euclidean distance, cosine distance or custom distance. The anchor point set of the model selector model is:
其中表示输入第m个任务模型对应的第k个锚点。表示第m 个任务模型对应的锚点集合。in Represents the kth anchor point corresponding to the input mth task model. Represents the anchor point set corresponding to the mth task model.
然后选取每个任务模型对应的锚点的集合中的各锚点到g(t)′的最佳距离最佳距离与具体计算距离的方式有关,如果使用欧式距离,最佳距离为欧式距离最小值的倒数;如果使用余弦距离,最佳距离为余弦距离最大值。Then select the best distance from each anchor point to g(t)′ in the set of anchor points corresponding to each task model. The optimal distance is related to the specific method of calculating the distance. If Euclidean distance is used, the optimal distance is the reciprocal of the minimum Euclidean distance; if cosine distance is used, the optimal distance is the maximum cosine distance.
最后计算“模型选择器”输出的权重向量g=[g1 g2…gn,m…gm,M],gn,m表示对第m个任务网络的权重 Finally, the weight vector g = [g 1 g 2 …g n,m …g m,M ] output by the “model selector” is calculated, where g n,m represents the weight of the mth task network.
第二步:计算本地原始特征经过“模型选择器”选中的任务模型的隐含特征提取值。第m个任务网络的参数用表示,第m个任务网络的输入-输出关系表示为:Step 2: Calculate the implicit feature extraction value of the task model selected by the "model selector" after the local original features. The parameters of the mth task network are Indicates that the input-output relationship of the mth task network is expressed as:
第三步:“加权求和器”将“模型选择器”输出的M个权重对“任务模型组”的M个隐含特征向量进行加权求和(未选中的任务模型的隐含特征可不参与计算),Step 3: The "weighted summer" performs weighted summation on the M implicit feature vectors of the "task model group" using the M weights output by the "model selector" (the implicit features of the unselected task models do not participate in the calculation).
第四步:分类器采用DNN实现,模型参数为输入-输出关系为:Step 4: The classifier is implemented using DNN, and the model parameters are The input-output relationship is:
本实施例中,联邦学习服务端下发的全局先验特征还可以直接是混合专家模型中的模型选择器,此处不作限定,局部特征提取模型也可以是混合专家模型。局部特征提取模型(第三机器学习模型)可以包括多个第二任务模型,则第一联邦学习客户端通过第三机器学习模型提取第二网络数据的特征的方式可以是,第一联邦学习客户端先根据本地数据或者第二网络数据确定多个第二任务模型对应的权重,然后将第二网络数据输入到第二任务模型中,可以获得第二任务模型输出的第二网络数据的子特征,第一联邦学习客户端即可根据多个第二任务模型对应的权重以及第二任务模型输出的子特征进行加权平均,以获得第二网络数据的特征。In this embodiment, the global prior features sent by the federated learning server can also be directly the model selector in the hybrid expert model, which is not limited here, and the local feature extraction model can also be a hybrid expert model. The local feature extraction model (third machine learning model) can include multiple second task models, and the first federated learning client can extract the features of the second network data through the third machine learning model in the following way: the first federated learning client first determines the weights corresponding to the multiple second task models based on the local data or the second network data, and then inputs the second network data into the second task model, and the sub-features of the second network data output by the second task model can be obtained. The first federated learning client can perform weighted averaging based on the weights corresponding to the multiple second task models and the sub-features output by the second task model to obtain the features of the second network data.
图5为本申请实施例提供的另一种推理结构示意图,请参阅图5,联邦学习服务端生成任务同步信息,并下发任务同步信息给多个客户端。FIG5 is another schematic diagram of a reasoning structure provided in an embodiment of the present application. Please refer to FIG5 . The federated learning server generates task synchronization information and sends the task synchronization information to multiple clients.
客户端Cn接收到联邦学习服务端下发的任务同步信息,并从本地数据中找到满足任务同步信息的数据Xn。其中,满足任务同步信息指的是数据Xn的采集时间与任务同步信息的时间最为接近。The client Cn receives the task synchronization information sent by the federated learning server, and finds data Xn that meets the task synchronization information from the local data. Among them, meeting the task synchronization information means that the collection time of data Xn is closest to the time of the task synchronization information.
客户端Cn通过本地的局部特征提取模型得到隐含特征其中作为客户端Cn的局部特征。局部特征提取模型混合专家模型实现,即由多个任务模型i和一个模型选择器组成。数据通过模型选择器选择任务模型进行特征提取,得到局部特征 Client Cn obtains implicit features through the local feature extraction model in As the local feature of client C n . The local feature extraction model is implemented by a hybrid expert model, which consists of multiple task models i and a model selector. The data is extracted by selecting the task model through the model selector to obtain the local feature
任务模型i采用解耦表征学习训练得到,即任务模型输出的局部特征可以分成K个组,组内特征具有相似性,组间特征具有特异性。不同的神经网络结构得到的的类型不同,因此可以是一个标量,也可以是一个向量,一个距离或者一个张量,具体如下:Task model i is trained using decoupled representation learning, that is, the local features output by the task model It can be divided into K groups, the features within the group are similar, and the features between the groups are specific. Different neural network structures get The types are different, so It can be a scalar, a vector, a distance or a tensor, as follows:
局部特征提取器采用全连接神经网络或者RNN,如则是一个标量,其中W1,W2为模型参数,是一个矩阵;如果在就是一个向量,其中和W1是模型参数,是矩阵。引入张量计算的表达W2是一个三维的张量,°是张量计算;W2还可以是更高为的张量,此时得到的可以是一个矩阵或者张量。The local feature extractor uses a fully connected neural network or RNN, such as but is a scalar, where W1 and W2 are model parameters and is a matrix; if exist is a vector, where and W1 are model parameters, which are matrices. Introducing the expression of tensor calculation W2 is a three-dimensional tensor, ° is a tensor calculation; W2 can also be a higher tensor, in this case What you get Can be a matrix or a tensor.
局部特征提取器采用卷积神经网络或者Transformer神经网络,则是一个矩阵,以图像为例,图像经过CNN的卷积层之后得到此时表示是卷积核m对应的第m个通道的特征图,是一个矩阵。如果将一个通道内的数据进行求平均操作,则就是一个标量。The local feature extractor uses a convolutional neural network or a Transformer neural network. is a matrix. Taking an image as an example, the image is obtained after passing through the convolution layer of CNN. at this time It represents the feature map of the mth channel corresponding to the convolution kernel m, which is a matrix. If the data in a channel is averaged, then It's a scalar.
组内特征具有相似,组间特征具有特异性,相似性和特异性可以通过度量和之间的距离得到,如果m1和m2属于同一个特征组,则他们的距离值小,如果他们属于不同的特征组,则他们的距离值大。The characteristics within a group are similar, and the characteristics between groups are specific. Similarity and specificity can be measured by and The distance between them is obtained. If m1 and m2 belong to the same feature group, their distance value is small. If they belong to different feature groups, their distance value is large.
客户端Cn上传到联邦学习服务端,相应的,联邦学习服务端接收多个客户端上传的局部特征联邦学习服务端可以将多个客户端上传的局部特征拼接成全局先验特征提取模型的输入特征,输入全局先验特征提取模型,输出全局先验特征,全局先验特征为各客户端推理模型的任务选择器。并将各客户端对应的全局先验特征(推理模型的任务选择器)发送给对应的客户端Cn。Client C n upload To the federated learning server, the federated learning server receives local features uploaded by multiple clients. The federated learning server can store local features uploaded by multiple clients. The input features of the global prior feature extraction model are spliced and input into the global prior feature extraction model, and the global prior features are output. The global prior features are the task selectors of the inference models of each client. The global prior features (task selectors of the inference model) corresponding to each client are sent to the corresponding client C n .
客户端Cn接收联邦学习服务端下发的全局先验特征(推理模型的任务选择器),通过采集器获取本地t时刻的待推理数据X(t)n,讲待推理数据X(t)n得到局部特征h(t)n,将局部特征h(t)n输入推理模型得到推理结果。The client Cn receives the global prior features (task selector of the inference model) sent by the federated learning server, obtains the local data to be inferred X(t) n at time t through the collector, obtains the local features h(t) n from the data to be inferred X(t)n , and inputs the local features h(t) n into the inference model to obtain the inference result.
推理模型采用混合专家模型,即由模型选择器和任务模型组成。模型选择器为全局先验特征(推理模型的任务选择器)。每个任务模型对应局部特征h(t)n的一个特征组,每个特征组中的特征具有相似性。即任务模型1的输入是h(t)n的第1组特征,任务模型2的输入是h(t)n的第2组特征,任务模型2的输入是h(t)n的第n组特征。The reasoning model adopts a hybrid expert model, which is composed of a model selector and a task model. The model selector is a global prior feature (task selector of the reasoning model). Each task model corresponds to a feature group of local features h(t) n , and the features in each feature group have similarity. That is, the input of task model 1 is the first group of features of h(t) n , the input of task model 2 is the second group of features of h(t) n , and the input of task model 2 is the nth group of features of h(t) n .
全局先验特征也可以直接是推理模型,例如一个带有模型参数的分类器或者回归器其中z表示分类器或者回归器的输入,表示分类器或者回归器模型参数。各客户端的分类器或者回归器可以相同,也可以不同。该可以是 The global prior feature can also be directly an inference model, such as a classifier or regressor with model parameters. Where z represents the input of the classifier or regressor, Represents the model parameters of a classifier or regressor. The classifiers or regressors of each client can be the same or different. Can be
图6为本申请实施例提供的一种计算图的示意图,如图6所示,全局先验特征可以是一个带有一组特征值以及计算逻辑关系的计算图,以为例,其中表示第n个客户端的第k个特征向量,特征向量可以作为模型参数的一部分在训练的过程中通过数据学习,也可以是人工设置的值;Cn表示第n个客户端的计算流图。各客户端的计算图可以相同,也可以不同。计算图可以通过数据训练得到,也可以通过知识图谱得到。FIG6 is a schematic diagram of a calculation graph provided in an embodiment of the present application. As shown in FIG6, the global prior feature can be a calculation graph with a set of feature values and a calculation logic relationship. For example, represents the kth feature vector of the nth client. The feature vector can be learned through data during the training process as part of the model parameters, or it can be a manually set value; Cn represents the computational flow graph of the nth client. The computational graphs of each client can be the same or different. The computational graph can be obtained through data training or through knowledge graphs.
左图表示输入的特征向量v与计算图中的特征值计算预先距离,即v与中的每一个值计算余弦距离得到The left figure shows the distance between the input feature vector v and the feature value in the calculation graph, that is, v and Calculate the cosine distance for each value in
然后计算后面的逻辑操作 Then calculate the following logical operation
右图在计算计算余弦距离后与阈值比较,大于阈值的为1,小于阈值的为0,即The right picture shows the cosine distance after calculation. The value greater than the threshold is 1, and the value less than the threshold is 0.
然后计算逻辑操作,这里的加对应的是逻辑里面的或操作,乘对应的是逻辑里面的与操作: Then calculate the logical operation. The addition here corresponds to the OR operation in logic, and the multiplication corresponds to the AND operation in logic:
全局先验特征可以是知识图谱,以图像识别为例。局部特征提取器采用解耦表征学习训练得到,即局部特征提取器得到的隐含特征可以分组成不同自概念的学习,如车轮、车门、车窗、车灯、人的眼睛、人的鼻子、人的嘴等,即局部特征提取器得到的隐含特征 h={h(1)=车轮,h(2)=车门,h(3)=车窗,h(4)=车灯,h(5)=人的眼睛,h(6)=人的鼻子,h(7)=人的嘴}。The global prior feature can be a knowledge graph, taking image recognition as an example. The local feature extractor is trained by decoupled representation learning, that is, the implicit features obtained by the local feature extractor can be grouped into different self-concept learning, such as wheels, doors, windows, lights, human eyes, human noses, human mouths, etc., that is, the implicit features obtained by the local feature extractor are h = {h(1) = wheels, h(2) = doors, h(3) = windows, h(4) = lights, h(5) = human eyes, h(6) = human noses, h(7) = human mouths}.
图7为本申请实施例提供的一种知识图谱的示意图,如图7所示,此时局部特征提取器在参与推理时不但要计算特征的值还要计算特征的位置。激活表示局部特征提取器某个通道的值之和或通道的组合或者通道内某个像素值大于阈值。FIG7 is a schematic diagram of a knowledge graph provided by an embodiment of the present application. As shown in FIG7, at this time, the local feature extractor not only calculates the value of the feature but also calculates the position of the feature when participating in reasoning. Activation indicates that the sum of the values of a certain channel of the local feature extractor or the combination of channels or a pixel value in a channel is greater than a threshold.
当客户端直接使用已经训练好的局部特征提取模型和推理模型时:When the client directly uses the trained local feature extraction model and inference model:
客户端Cn接收联邦学习服务端下发的全局先验特征,计算图或者分类器/回归器或者知识图谱,本地保存计算图或者分类器/回归器或者知识图谱。Client Cn receives the global prior features sent by the federated learning server and calculates the graph or classifier/regressor Or knowledge graph, save the calculation graph locally or classifier/regressor Or a knowledge graph.
客户端Cn通过采集器获取本地t时刻的待推理数据X(t)n,将待推理数据X(t)n通过局部特征提取模型输出的多个隐含特征然后将输入计算图或者分类器/回归器或者知识图谱得到输出结果。Client Cn obtains the local data to be inferred X(t) n at time t through the collector, and extracts multiple implicit features output by the local feature extraction model from the data to be inferred X(t) n. Then Input computation graph or classifier/regressor Or the knowledge graph gets the output result.
当客户端还需要对推理模型进行重新训练时:第一联邦学习客户端利用样本数据对第一机器学习模型进行训练,提取第二网络数据的特征,然后将第二网络数据的特征输入到训练后的第一机器学习模型中,以得到训练后的第一机器学习模型输出的推理结果。When the client still needs to retrain the inference model: the first federated learning client uses sample data to train the first machine learning model, extracts the features of the second network data, and then inputs the features of the second network data into the trained first machine learning model to obtain the inference result output by the trained first machine learning model.
具体的,客户端Cn接收联邦学习服务端下发的全局先验特征,计算图或者分类器/回归器或者知识图谱,初始化本地推理局部特征提取模型参数,使用或者分类器/回归器或者知识图谱作为分类器或者回归器,组成推理模型,再使用本地数据训练推理模型并保存训练结束的推理模型其中,此处的本地数据为历史数据和对应的历史推理结果。Specifically, the client Cn receives the global prior features sent by the federated learning server and calculates the graph or classifier/regressor Or knowledge graph, initialize local inference local feature extraction model parameters, use or classifier/regressor Or the knowledge graph is used as a classifier or regressor to form an inference model, and then the inference model is trained using local data. And save the inference model after training The local data here refers to historical data and corresponding historical reasoning results.
客户端Cn通过采集器获取本地t时刻的待推理数据X(t)n,待推理数据X(t)n通过推理模型得到输出结果。Client Cn obtains the local data to be inferred X(t) n at time t through the collector. The data to be inferred X(t) n is calculated through the inference model Get the output result.
联邦学习服务端确定全局先验特征除了需要第一局部特征和第二局部特征外,还可以结合来自第一联邦学习客户端的历史局部特征以及来自第二联邦学习客户端的历史局部特征进行确定。联邦学习服务端可以计算当前推理过程的局部特征与多组历史局部特征的相似度,即确定第一局部特征与各组历史局部特征中的来自第一联邦学习客户端的历史局部特征的相似度,以及确定第二局部特征与各组历史局部特征中的来自第二联邦学习客户端的历史局部特征的相似度,然后基于相似度对多组历史局部特征对应的历史先验特征进行加权求和,获得所需的全局先验特征。In addition to the first local feature and the second local feature, the federated learning server can also determine the global prior feature by combining the historical local features from the first federated learning client and the historical local features from the second federated learning client. The federated learning server can calculate the similarity between the local features of the current reasoning process and multiple groups of historical local features, that is, determine the similarity between the first local feature and the historical local features from the first federated learning client in each group of historical local features, and determine the similarity between the second local feature and the historical local features from the second federated learning client in each group of historical local features, and then perform weighted summation of the historical prior features corresponding to the multiple groups of historical local features based on the similarity to obtain the required global prior features.
在一个可行的实施方式中,多组历史局部特征还可以具有标签,该标签是人为标注的每组历史局部特征的实际结果,可以用来和推理结果比较,来确定推理结果的准确度。客户端在获得推理结果后,可以上传给联邦学习服务端,联邦学习服务端可以根据多个客户端的推理结果确定当前全局先验特征对应的目标推理结果,则可以从多组历史局部特征中选择标签为该目标推理结果的目标组历史局部特征,如果当前推理过程的局部特征与目标组历史局部特征的相似度大于或等于阈值,则可以根据当前推理过程的局部特征与该目标组历史局部特征的相似度对所述目标组历史局部特征进行更新,如果当前推理过程的局部特征与目标组历史局部特征的相似度小于该阈值,则可以将当前推理过程的局部特征作为新的一组历史局部特征保存在本地。In a feasible implementation, multiple groups of historical local features may also have labels, which are the actual results of each group of historical local features manually marked, and can be used to compare with the reasoning results to determine the accuracy of the reasoning results. After obtaining the reasoning results, the client can upload them to the federated learning server. The federated learning server can determine the target reasoning result corresponding to the current global prior feature based on the reasoning results of multiple clients, and then select the target group historical local features with the label as the target reasoning result from the multiple groups of historical local features. If the similarity between the local features of the current reasoning process and the historical local features of the target group is greater than or equal to a threshold, the target group historical local features can be updated according to the similarity between the local features of the current reasoning process and the historical local features of the target group. If the similarity between the local features of the current reasoning process and the historical local features of the target group is less than the threshold, the local features of the current reasoning process can be saved locally as a new group of historical local features.
图8为本申请实施例提供的另一种推理结构示意图,请参阅图8,联邦学习服务端接收多个客户端上传的局部特征通过全局先验模型计算局部特征与样例库中的的相似度,并基于形似度对对应的hg(m)进行加权求和作为的全局先验特征。FIG8 is a schematic diagram of another reasoning structure provided in an embodiment of the present application. Referring to FIG8 , the federated learning server receives local features uploaded by multiple clients. Compute local features through global prior models With the sample library The similarity of The corresponding hg(m) is weighted summed as The global prior features.
联邦学习服务端的样例库中为 表示第m 条样例数据对应的历史局部特征集合,hg(m)表示第m条样例数据对应的历史全局先验特征。The sample library of the federated learning server is represents the historical local feature set corresponding to the m-th sample data, and hg(m) represents the historical global prior feature corresponding to the m-th sample data.
相似度可以采用欧式、余弦距离或者训练的神经网络来度量,以余弦距离为例:Similarity can be measured using Euclidean distance, cosine distance, or trained neural network. Take cosine distance as an example:
加权求和为:The weighted sum is:
联邦学习服务端下发全局先验特征hg给各个客户端,各客户端获取待推理数据,结合全局先验特征hg,得到本地推理结果。然后上传推理结果到联邦学习服务端,如果客户端有事后观测标注功能,则上传事后标注的标签到联邦学习服务端。The federated learning server sends the global prior feature hg to each client. Each client obtains the data to be inferred and combines the global prior feature hg to obtain the local inference result. Then the inference result is uploaded to the federated learning server. If the client has the post-observation annotation function, the post-annotated label is uploaded to the federated learning server.
联邦学习服务端接收客户端上传的推理结果或者标注的标签,统计对应的类别数量最多的类y,从中找到全部类别相同的样例,即y(m) 与y相同。计算和类别相同的类的样例的形似度,如欧式距离、余弦距离或者神经网络,对于相似度大于阈值的样例数据,根据相似度更新对应的hg(m),如果全部选中的样例都不满足阈值,则将作为一个新的样例。The federated learning server receives the inference results or labeled labels uploaded by the client and counts them. The corresponding class y has the largest number of categories, from Find all samples with the same category, that is, y(m) is the same as y. Calculate The similarity of samples of the same class as the category, such as Euclidean distance, cosine distance or neural network. For sample data with similarity greater than the threshold, the corresponding hg(m) is updated according to the similarity. If all selected samples do not meet the threshold, then As a new example.
以余弦距离为例:Take the cosine distance as an example:
相似度: Similarity:
hg(m)的更新:hg(m)=r(m)*hg+(1-r(m))*hg(m)。Update of hg(m): hg(m)=r(m)*hg+(1-r(m))*hg(m).
客户端在获得推理结果以及人为标注的标签后,还可以对图3中全局先验模型和局部特征提取模型、推理模型进行训练,具体的,各客户端计算推理结果和标签的误差,使用误差反向传播计算全局先验特征的误差,并将全局先验特征的误差上传给联邦学习服务端。联邦学习服务端接收各客户端上传的全局先验特征的误差,使用误差反向传播计算局部特征的误差,并下发给各客户端。各客户端和联邦学习服务端使用各自的误差计算模型梯度并更新模型,其中,客户端根据推理结果和标签的误差更新推理模型,根据局部特征的误差更新局部特征提取模型,联邦学习服务端根据全局先验特征的误差更新全局先验局部特征提取模型。After obtaining the inference results and manually annotated labels, the client can also train the global prior model, local feature extraction model, and inference model in Figure 3. Specifically, each client calculates the error of the inference result and the label, uses error back propagation to calculate the error of the global prior feature, and uploads the error of the global prior feature to the federated learning server. The federated learning server receives the error of the global prior feature uploaded by each client, uses error back propagation to calculate the error of the local feature, and sends it to each client. Each client and the federated learning server use their own error calculation model gradients and update the model. Among them, the client updates the inference model according to the error of the inference result and the label, updates the local feature extraction model according to the error of the local feature, and the federated learning server updates the global prior local feature extraction model according to the error of the global prior feature.
联邦学习服务端还可以保存多个客户端的部分数据,将该部分数据作为联邦学习服务端的本地数据,并基于联邦学习服务端的本地数据训练推理初始模型,具体此处不作限定。The federated learning server may also save partial data of multiple clients, use the partial data as local data of the federated learning server, and train an initial inference model based on the local data of the federated learning server, which is not specifically limited here.
图9为本申请实施例提供的一种联邦学习服务端的本地数据的获取方式示意图,如图 9所示,联邦学习服务端使用本地数据训练“差异性判决模型”并下发到客户端侧。客户端侧使用联邦学习服务端下发的“差异性判决模型”计算差异性指标,并对差异性指标进行抽样,将抽样后的差异性指标上传到联邦学习服务端。联邦学习服务端收集差异性指标进行聚类,以获得全局差异性指标类中心,然后将该全局差异性指标类中心下发给客户端。FIG9 is a schematic diagram of a method for obtaining local data of a federated learning server provided in an embodiment of the present application. As shown in FIG9 , the federated learning server uses local data to train a "difference judgment model" and sends it to the client side. The client side uses the "difference judgment model" sent by the federated learning server to calculate the difference index, and samples the difference index, and uploads the sampled difference index to the federated learning server. The federated learning server collects the difference index for clustering to obtain the global difference index class center, and then sends the global difference index class center to the client.
客户端侧接收云侧下发的差异性指标类型中心,将客户端侧本地数据向各类中心进行归类并统计归类结果,并统计各类中心中数据个数,以及远离类中心的数据的个数和重要数据的个数,将统计结果上传到联邦学习服务端。其中客户端侧本地数据包括普通数据和重要数据,该重要数据可以是入侵数据、错例数据、投票不一致数据、或离锚点远的数据,此处不作限定。The client side receives the difference indicator type center sent by the cloud side, classifies the local data on the client side into various centers and counts the classification results, and counts the number of data in each center, as well as the number of data far away from the center and the number of important data, and uploads the statistical results to the federated learning server. The local data on the client side includes ordinary data and important data. The important data can be intrusion data, wrong data, inconsistent voting data, or data far from the anchor point, which is not limited here.
联邦学习服务端接收统计结果并结合本地数据生成采集策略(各客户端侧可不同),并下发给各客户端。The federated learning server receives the statistical results and generates a collection strategy based on the local data (which can be different for each client side), and sends it to each client.
客户端侧接收联邦学习服务端下发的采集策略并采集数据,对采集的数据进行抽样,将抽样后的数据上传到联邦学习服务端。联邦学习服务端采用主动学习的方式对上传的数据打标签并下发给各客户端侧。The client receives the collection strategy sent by the federated learning server and collects data, samples the collected data, and uploads the sampled data to the federated learning server. The federated learning server uses active learning to label the uploaded data and sends it to each client.
联邦学习服务端使用本地数据训练打标签模型并下发客户端侧。客户端侧使用该打标签模型对本地数据打标签,然后根据该打标签的本地数据和联邦学习服务端下发的有标签的数据对本地的推理模型进行训练。The federated learning server uses local data to train a labeling model and sends it to the client. The client uses the labeling model to label local data, and then trains the local inference model based on the labeled local data and the labeled data sent by the federated learning server.
联邦学习服务端还可以对联邦学习服务端的本地数据进行压缩,如采用训练数据生成器对数据进行压缩。且联邦学习服务端还可以基于本地数据训练推理模型作为客户端的初始推理模型,具体此处不作赘述。The federated learning server can also compress the local data of the federated learning server, such as using a training data generator to compress the data. The federated learning server can also train an inference model based on local data as the initial inference model of the client, which will not be described in detail here.
对于图4中的混合专家模型的训练,则需要按照固定参数任务选择器生成、任务模型选择性下发、模型预训练、模型训练和模型按策略训练的方式进行训练。For the training of the hybrid expert model in Figure 4, it is necessary to perform training in the manner of fixed parameter task selector generation, selective task model delivery, model pre-training, model training, and model strategy training.
图10为本申请实施例提供的一种固定参数任务选择器生成的流程示意图,具体请参阅图10:FIG10 is a schematic diagram of a flow chart of generating a fixed parameter task selector provided in an embodiment of the present application. For details, please refer to FIG10 :
步骤1001.联邦学习服务端按照类别生成聚类的K1个类中心信息。Step 1001. The federated learning server generates K1 cluster center information according to categories.
步骤1002.联邦学习服务端下发K1个类中心信息到客户端。Step 1002: The federated learning server sends K1 class center information to the client.
步骤1003.客户端接收K1个聚类中心信息,将K类数据按聚类中心信息归到K1个聚类中心信息,统计每个聚类中心所属数据的均值和个数,并上传联邦学习服务端。Step 1003. The client receives K1 cluster center information, classifies K types of data into K1 cluster center information according to the cluster center information, counts the mean and number of data belonging to each cluster center, and uploads them to the federated learning server.
步骤1004.客户端将每个聚类中心所属数据的均值和个数上传联邦学习服务端。Step 1004: The client uploads the mean and number of data belonging to each cluster center to the federated learning server.
步骤1005.联邦学习服务端计算全局的每个聚类中心所属数据的均值得到新的聚类中心信息。Step 1005: The federated learning server calculates the average value of the data belonging to each global cluster center to obtain new cluster center information.
步骤1006.联邦学习服务端判断新的聚类中心信息是否收敛,如果没有收敛,则转到步骤1002,如果收敛则转到步骤1007。收敛的条件可以是新的聚类中心信息较前一次的聚类中心信息的变化量小于阈值,或者是达到迭代次数。Step 1006. The federated learning server determines whether the new cluster center information has converged. If not, go to step 1002. If converged, go to step 1007. The convergence condition may be that the change in the new cluster center information compared with the previous cluster center information is less than a threshold, or the number of iterations is reached.
步骤1007.联邦学习服务端下发新的K1个聚类中心信息。Step 1007: The federated learning server sends new K1 cluster center information.
步骤1008.客户端统计K个类的数据分别对应在K1个聚类中心信息的个数。Step 1008: The client counts the number of K1 cluster center information corresponding to the data of the K classes.
步骤1009.客户端上传K个类的数据分别对应在K1个聚类中心信息的个数到联邦学习服务端。Step 1009: The client uploads the data of K classes corresponding to the number of K1 cluster center information to the federated learning server.
步骤1010.联邦学习服务端接收各客户端上传的K个类的数据分别对应在K1个聚类中心信息的个数,生成固定参数任务选择器规则。Step 1010: The federated learning server receives the K classes of data uploaded by each client, and the corresponding numbers of K1 cluster center information, and generates a fixed parameter task selector rule.
示例性的,方案1:对于需要隐私保护的场景:Exemplary, Solution 1: For scenarios requiring privacy protection:
客户端n上传的K个类的数据分别对应在K1个聚类中心信息的个数为矩阵An:The data of K classes uploaded by client n correspond to the number of K1 cluster center information in the matrix A n :
表示第n个客户端上传的第k个类的属于第k1个聚类中心信息。 Indicates that the k-th class uploaded by the n-th client belongs to the k1-th cluster center information.
第一步:计算全局的K个类别数据对应到K1个聚类中心信息的A:Step 1: Calculate the global K category data corresponding to K1 cluster center information A:
其中ak=[ak,1…ak,k1]表示第k个类对应到K1个聚类中心信息的全局数据量。in a k =[ ak,1 … ak,k1 ] represents the global data volume of K1 cluster center information corresponding to the kth class.
第二步:为每个类别选择数量最多的topK1对应的聚类中心信息对应的聚类编号作为该类选择的专家。Step 2: For each category, select the cluster number corresponding to the cluster center information corresponding to the topK1 with the largest number as the expert selected for that category.
其中bk=[bk,1…bk,k1]中有topK1个值不为零,bk中不为零的位置为ak中topK1对应的位置。bk中不为零的位置的值可以是1,也可以是数据量的加权值,加权值为:Among them, there are topK1 values in b k = [b k,1 …b k,k1 ] that are not zero, and the non-zero positions in b k are the positions corresponding to the topK1 in a k . The values of the non-zero positions in b k can be 1 or the weighted value of the data volume, and the weighted value is:
在此基础上为了满足专家之间的任务均衡性,设置每个专家最多可以用topK2次,当专家被选中的次数超过topK2时,则该专家不再在topK1的选择时被选中。专家选择的顺序可以按专家被选中的数据量排序,从数据量最多的专家开始,比如ak,k1的值最大,则从第k个类开始选专家。On this basis, in order to meet the task balance among experts, it is set that each expert can use topK2 times at most. When the number of times an expert is selected exceeds topK2, the expert will no longer be selected when selecting topK1. The order of expert selection can be sorted by the amount of data selected by the experts, starting with the experts with the largest amount of data. For example, if the value of a k,k1 is the largest, then the expert is selected starting from the kth class.
B作为固定参数任务选择器规则。B is used as a fixed parameter task selector rule.
方案2:对于每个用户选中的专家个数尽可能少作为优化目标的场景:Solution 2: For the scenario where the number of experts selected by each user is as small as possible as the optimization goal:
第一步:对An对每类中属于不同聚类中心信息的数据进行归一化得到每类数据属于不同聚类中心信息的概率:Step 1: Normalize the data belonging to different cluster center information in each category of An to obtain the probability that each category of data belongs to different cluster center information:
其中 in
第二步:将进行K3个聚类中心信息的聚类,属于同一个聚类中心信息的分在一个组中。Step 2: Cluster the K3 cluster center information, and the cluster center information belonging to the same cluster center information In a group.
第三步:与方案1相同,只是限制每个组中的专家个数不同超多topK4,如果超过则只在topK4对应的专家中选择数据量最大的专家作为对应类别的专家。Step 3: Same as Solution 1, except that the number of experts in each group is limited to not more than topK4. If it exceeds, only the experts with the largest amount of data among the experts corresponding to topK4 are selected as the experts for the corresponding category.
第四步:对于组间不一致的类别和专家的匹配关系按类别和专家的匹配最多的方式,例如假设有10组,若其中专家2对应的组数最多,则选择专家2。Step 4: For inconsistent categories and experts between groups, the matching relationship between categories and experts is selected in the way with the most matches. For example, if there are 10 groups, if expert 2 has the most groups, then expert 2 is selected.
图11为本申请实施例提供的一种任务模型选择的流程示意图,请参阅图11:FIG11 is a schematic diagram of a process flow of selecting a task model provided in an embodiment of the present application. Please refer to FIG11 :
步骤1101.联邦学习服务端下发成固定参数任务选择器规则。Step 1101. The federated learning server sends down fixed parameter task selector rules.
步骤1102.客户端接收固定参数任务选择器规则,统计本地数据对应的任务模型ID号。Step 1102: The client receives the fixed parameter task selector rule and counts the task model ID number corresponding to the local data.
步骤1103.客户端将任务模型ID上传联邦学习服务端。Step 1103. The client uploads the task model ID to the federated learning server.
步骤1104.联邦学习服务端匹配各客户端任务模型ID并匹配对应的任务模型和参数可训练的任务模型选择器。Step 1104. The federated learning server matches each client task model ID and matches the corresponding task model and the task model selector with trainable parameters.
图12为本申请实施例提供的一种模型预训练的流程示意图,请参阅图12:FIG12 is a schematic diagram of a model pre-training process provided in an embodiment of the present application. Please refer to FIG12 :
步骤1201.联邦学习服务端下发任务模型和参数可训练的任务模型选择器。Step 1201. The federated learning server sends a task model and a task model selector with trainable parameters.
步骤1202.客户端接收参数可训练的任务模型选择器,统计本地数据对应的任务模型 ID号。Step 1202. The client receives a task model selector with trainable parameters and counts the task model ID number corresponding to the local data.
步骤1203.客户端将任务模型ID上传联邦学习服务端。Step 1203: The client uploads the task model ID to the federated learning server.
步骤1204.联邦学习服务端匹配各客户端任务模型ID并匹配对应的任务模型。Step 1204. The federated learning server matches each client task model ID and matches the corresponding task model.
步骤1205.联邦学习服务端下发任务模型。Step 1205: The federated learning server sends the task model.
步骤1206.客户端使用本地数据,使用联邦学习服务端的任务模型作为客户端的任务模型的初始值,通过固定参数任务选择器选择任务模型,并训练客户端的任务模型若干轮。Step 1206. The client uses local data and the task model of the federated learning server as the initial value of the client's task model, selects the task model through a fixed parameter task selector, and trains the client's task model for several rounds.
步骤1207.客户端使用本地数据,将联邦学习服务端的参数可训练的任务模型选择器作为客户端的参数可训练的任务模型选择器的初始值,通过固定参数任务选择器对数据打伪标签,然后训练参数可训练的任务模型选择器若干轮。Step 1207. The client uses local data and takes the parameter trainable task model selector of the federated learning server as the initial value of the parameter trainable task model selector of the client, pseudo-labels the data through the fixed parameter task selector, and then trains the parameter trainable task model selector for several rounds.
步骤1208.客户端上传更新后的客户端的任务模型和参数可训练的任务模型选择器。Step 1208: The client uploads the updated client task model and the task model selector with trainable parameters.
步骤1209.联邦学习服务端接收各客户端更新后的客户端的任务模型和参数可训练的任务模型选择器,加权平均得到联邦学习服务端的任务模型和参数可训练的任务模型选择器。Step 1209. The federated learning server receives the updated task models and parameter-trainable task model selectors of each client, and obtains the task model and parameter-trainable task model selector of the federated learning server by weighted average.
步骤1210.重复步骤1201到步骤1209若干次。Step 1210. Repeat steps 1201 to 1209 several times.
图13为本申请实施例提供的一种模型训练的流程示意图,请参阅图13:FIG13 is a schematic diagram of a model training process provided in an embodiment of the present application. Please refer to FIG13 :
步骤1301.联邦学习服务端下发联邦学习服务端的参数可训练的任务模型选择器。Step 1301. The federated learning server sends a parameter trainable task model selector of the federated learning server.
步骤1302.客户端接收联邦学习服务端的参数可训练的任务模型选择器,统计本地数据对应的任务模型ID号。Step 1302: The client receives the parameter-trainable task model selector from the federated learning server and counts the task model ID number corresponding to the local data.
步骤1303.客户端上传任务模型ID号到联邦学习服务端。Step 1303: The client uploads the task model ID number to the federated learning server.
步骤1304.联邦学习服务端接收各客户端任务模型ID并匹配对应的联邦学习服务端的任务模型。Step 1304: The federated learning server receives each client's task model ID and matches the corresponding task model of the federated learning server.
步骤1305.联邦学习服务端下发对应的联邦学习服务端的任务模型。Step 1305: The federated learning server sends the corresponding task model of the federated learning server.
步骤1306.客户端使用本地数据,将联邦学习服务端的任务模型作为初始模型,通过联邦学习服务端的参数可训练的任务模型选择器选择任务模型并训练客户端的任务模型N 轮。Step 1306. The client uses local data and the task model of the federated learning server as the initial model, selects the task model through the parameter trainable task model selector of the federated learning server, and trains the client's task model for N rounds.
步骤1307.客户端并上传更新的客户端的任务模型到联邦学习服务端。Step 1307: The client uploads the updated client task model to the federated learning server.
步骤1308.联邦学习服务端接收各客户端更新后的客户端的任务模型,加权平均得到联邦学习服务端的任务模型。Step 1308: The federated learning server receives the task models of the clients updated by each client, and obtains the task model of the federated learning server by weighted average.
步骤1309.联邦学习服务端并下发更新的联邦学习服务端的任务模型到客户端。Step 1309: The federated learning server sends the updated task model of the federated learning server to the client.
步骤1310.客户端使用本地数据,将联邦学习服务端的任务模型作为客户端的任务模型,将联邦学习服务端的参数可训练的任务模型选择器作为客户端的参数可训练的任务模型选择器的初始值,通过客户端的参数可训练的任务模型选择器选择任务模型并训练客户端的参数可训练的任务模型选择器N轮。Step 1310. The client uses local data, takes the task model of the federated learning server as the task model of the client, takes the parameter trainable task model selector of the federated learning server as the initial value of the parameter trainable task model selector of the client, selects the task model through the parameter trainable task model selector of the client, and trains the parameter trainable task model selector of the client for N rounds.
步骤1311.客户端并上传更新的客户端的参数可训练的任务模型选择器。Step 1311. The client uploads the updated client's parameter trainable task model selector.
步骤1312.联邦学习服务端接收各更新后的客户端参数可训练的任务模型选择器,加权平均得到联邦学习服务端参数可训练的任务模型选择器。Step 1312: The federated learning server receives each updated client parameter trainable task model selector, and obtains a federated learning server parameter trainable task model selector by weighted average.
步骤1313.重复步骤1301到步骤1312若干次。Step 1313. Repeat steps 1301 to 1312 several times.
图14为本申请实施例提供的一种模型按策略训练的流程示意图,请参阅图14:FIG14 is a schematic diagram of a flow chart of a model training according to a strategy provided in an embodiment of the present application. Please refer to FIG14 :
步骤1401.联邦学习服务端下发联邦学习服务端的参数可训练的任务模型选择器。Step 1401. The federated learning server sends the federated learning server's parameter trainable task model selector.
步骤1402.客户端接收联邦学习服务端的参数可训练的任务模型选择器,统计本地数据各任务模型处理各类数据的条数。Step 1402. The client receives the parameter trainable task model selector from the federated learning server, and counts the number of each type of data processed by each task model of the local data.
步骤1403.客户端并上传统计结果到联邦学习服务端。Step 1403. The client uploads the statistical results to the federated learning server.
步骤1404.联邦学习服务端接收各客户端各任务模型处理各类数据的条数,统计全局各任务模型处理各类数据的条数。Step 1404. The federated learning server receives the number of each type of data processed by each task model of each client, and counts the number of each type of data processed by each task model globally.
步骤1405.联邦学习服务端生成任务模型与各类数据对应关系。Step 1405. The federated learning server generates the correspondence between the task model and various types of data.
步骤1406.联邦学习服务端下发任务模型与各类数据对应关系。Step 1406. The federated learning server sends the correspondence between the task model and various types of data.
步骤1407.客户端使用本地数据,使用联邦学习服务端的任务模型作为客户端的任务模型的初始值,通过任务模型与各类数据对应关系选择客户端的任务模型作为学生,将联邦学习服务端的任务模型作为老师模型,通过知识蒸馏训练客户端的任务模型N轮。Step 1407. The client uses local data and the task model of the federated learning server as the initial value of the client's task model, selects the client's task model as the student through the correspondence between the task model and various types of data, and uses the task model of the federated learning server as the teacher model, and trains the client's task model for N rounds through knowledge distillation.
步骤1408.客户端使用本地数据,将联邦学习服务端的参数可训练的任务模型选择器作为客户端的参数可训练的任务模型选择器的初始值,通过任务模型与各类数据对应关系对数据打伪标签训练参数可训练的任务模型选择器L6轮。Step 1408. The client uses local data and takes the parameter-trainable task model selector of the federated learning server as the initial value of the parameter-trainable task model selector of the client, and trains the parameter-trainable task model selector L6 rounds by pseudo-labeling the data through the correspondence between the task model and various types of data.
步骤1409.客户端上传更新后的客户端的任务模型和参数可训练的任务模型选择器。Step 1409: The client uploads the updated client task model and the task model selector with trainable parameters.
步骤1410.联邦学习服务端接收各更新后的客户端参数可训练的任务模型选择器,加权平均得到联邦学习服务端参数可训练的任务模型选择器。Step 1410: The federated learning server receives each updated client parameter trainable task model selector, and obtains a federated learning server parameter trainable task model selector by weighted average.
步骤1411.重复步骤1401到步骤1410若干次。Step 1411. Repeat steps 1401 to 1410 several times.
本申请实施例中,第一联邦学习客户端采集第一时隙的与目标网络资源有关的第一网络数据,并提取该第一网络数据的第一局部特征发送给联邦学习服务端,联邦学习服务端收集多个客户端上传的局部特征计算全局先验特征,并下发给各客户端,第一联邦学习客户端可以根据该全局先验特征对第二时隙的第二网络数据进行推理,在推理过程中利用了除本地数据外其他客户端的数据的信息,用于提高推理结果的准确性。In an embodiment of the present application, a first federated learning client collects first network data related to a target network resource in a first time slot, extracts a first local feature of the first network data and sends it to a federated learning server. The federated learning server collects local features uploaded by multiple clients to calculate a global prior feature and sends it to each client. The first federated learning client can infer the second network data in a second time slot based on the global prior feature. During the inference process, information on data of other clients in addition to local data is used to improve the accuracy of the inference results.
上面讲述了推理方法,下面对执行该方法的装置进行描述。The above describes the reasoning method, and the following describes the device for executing the method.
图15为本申请实施例提供的一种推理装置的结构示意图,请参阅图15,该装置150包括:FIG. 15 is a schematic diagram of the structure of an inference device provided in an embodiment of the present application. Referring to FIG. 15 , the device 150 includes:
收发单元1501,用于向联邦学习服务端发送第一局部特征,第一局部特征是从第一网络数据中提取出的,第一网络数据为第一联邦学习客户端在第一时隙获取的与目标网络资源有关的数据,目标网络资源为第一联邦学习客户端管理的网络资源,接收来自联邦学习服务端的全局先验特征,全局先验特征是根据第一局部特征和第二局部特征得到的,第二局部特征是由第二联邦学习客户端提供;The transceiver unit 1501 is used to send a first local feature to the federated learning server, where the first local feature is extracted from the first network data, where the first network data is data related to the target network resource acquired by the first federated learning client in the first time slot, where the target network resource is a network resource managed by the first federated learning client, and receive a global prior feature from the federated learning server, where the global prior feature is obtained based on the first local feature and the second local feature, where the second local feature is provided by the second federated learning client;
处理单元1502,用于根据全局先验特征和第二网络数据进行推理,以得到推理结果,第二网络数据为第一联邦学习客户端在第二时隙获取的与目标网络资源有关的数据,推理结果用于管理目标网络资源,其中,第二时隙与第一时隙相同或在第一时隙之后。Processing unit 1502 is used to perform reasoning based on the global prior features and the second network data to obtain an inference result, where the second network data is data related to the target network resources obtained by the first federated learning client in the second time slot, and the inference result is used to manage the target network resources, wherein the second time slot is the same as the first time slot or after the first time slot.
其中,收发单元1501用于执行图2方法实施例中的步骤204和步骤206,处理单元1502用于执行图2方法实施例中的步骤207。The transceiver unit 1501 is used to execute step 204 and step 206 in the method embodiment of FIG. 2 , and the processing unit 1502 is used to execute step 207 in the method embodiment of FIG. 2 .
可选的,第一网络数据为目标网络资源有关的数据在第一时隙的采样值或者从第三时隙到第一时隙为止的统计值,第二网络数据为目标网络资源有关的数据在第二时隙的采样值,第三时隙在第一时隙之前。Optionally, the first network data is a sampling value of data related to the target network resources in the first time slot or a statistical value from the third time slot to the first time slot, and the second network data is a sampling value of data related to the target network resources in the second time slot, and the third time slot is before the first time slot.
可选的,全局先验特征为特征向量或第一机器学习模型,第一机器学习模型用于第二网络数据的推理。Optionally, the global prior feature is a feature vector or a first machine learning model, and the first machine learning model is used for inference of the second network data.
可选的,在全局先验特征为特征向量的情况下,处理单元1502具体用于:Optionally, when the global prior feature is a feature vector, the processing unit 1502 is specifically configured to:
根据全局先验特征、第二网络数据以及本地的第二机器学习模型进行推理,以得到推理结果,第二机器学习模型用于第二网络数据的推理。Reasoning is performed based on the global prior features, the second network data, and the local second machine learning model to obtain an inference result, and the second machine learning model is used for reasoning about the second network data.
可选的,处理单元1502具体用于:将第二网络数据输入到第三学习模型中,以得到第三学习模型输出的第二网络数据的多个特征;将全局先验特征输入到第二机器学习模型中,以获得第二网络数据的多个特征各自的权重;根据第二网络数据的多个特征以及第二网络数据的多个特征各自的权重,确定推理结果。Optionally, the processing unit 1502 is specifically used to: input the second network data into the third learning model to obtain multiple features of the second network data output by the third learning model; input the global prior features into the second machine learning model to obtain the respective weights of the multiple features of the second network data; determine the inference result based on the multiple features of the second network data and the respective weights of the multiple features of the second network data.
可选的,第二机器学习模型包括多个第一任务模型;处理单元1502具体用于:根据全局先验特征,计算多个第一任务模型各自的权重;将第二网络数据的特征输入到多个第一任务模型中,以得到多个第一任务模型输出的推理特征;根据多个第一任务模型各自的权重以及多个第一任务模型输出的推理特征,得到推理结果。Optionally, the second machine learning model includes multiple first task models; the processing unit 1502 is specifically used to: calculate the weights of each of the multiple first task models based on global prior features; input the features of the second network data into the multiple first task models to obtain inference features output by the multiple first task models; obtain inference results based on the weights of each of the multiple first task models and the inference features output by the multiple first task models.
可选的,处理单元1502具体用于:根据全局先验特征和第二网络数据,计算多个第一任务模型各自的权重。Optionally, the processing unit 1502 is specifically configured to calculate the weights of the plurality of first task models according to the global prior features and the second network data.
可选的,处理单元还用于:通过第三机器学习模型提取第二网络数据的特征。Optionally, the processing unit is also used to: extract features of the second network data through a third machine learning model.
可选的,第三机器学习模型包括多个第二任务模型;处理单元1502具体用于:根据第二网络数据确定多个第二任务模型各自的权重;将第二网络数据输入到多个第二任务模型中,以得到多个第二任务模型输出的第二网络数据的子特征;根据多个第二任务模型各自的权重和多个第二任务模型输出的第二网络数据的子特征,得到第二网络数据的特征。Optionally, the third machine learning model includes multiple second task models; the processing unit 1502 is specifically used to: determine the weights of each of the multiple second task models based on the second network data; input the second network data into the multiple second task models to obtain sub-features of the second network data output by the multiple second task models; obtain features of the second network data based on the weights of each of the multiple second task models and the sub-features of the second network data output by the multiple second task models.
可选的,每个第二任务模型是一层自编码器,多个第二任务模型中第r个任务模型的重构目标是第r-1个任务模型的残差,其中,r为大于1的整数且表示第二任务模型的数量。Optionally, each second task model is a layer of autoencoder, and the reconstruction target of the rth task model among the multiple second task models is the residual of the r-1th task model, where r is an integer greater than 1 and represents the number of second task models.
可选的,在全局先验特征为第一机器学习模型的情况下,处理单元1502具体用于:提取第二网络数据的特征;将第二网络数据的特征输入到第一机器学习模型中,以得到第一机器学习模型输出的推理结果。Optionally, when the global prior feature is the first machine learning model, the processing unit 1502 is specifically used to: extract the features of the second network data; input the features of the second network data into the first machine learning model to obtain the inference result output by the first machine learning model.
可选的,在全局先验特征为第一机器学习模型的情况下,处理单元1502具体用于:利用样本数据对第一机器学习模型进行训练;提取第二网络数据的特征;将第二网络数据的特征输入到训练后的第一机器学习模型中,以得到训练后的第一机器学习模型输出的推理结果。Optionally, when the global prior feature is the first machine learning model, the processing unit 1502 is specifically used to: train the first machine learning model using sample data; extract features of the second network data; input the features of the second network data into the trained first machine learning model to obtain the inference result output by the trained first machine learning model.
可选的,收发单元1501还用于:向联邦学习服务端发送分组信息,分组信息指示第一局部特征所在的分组,以使得联邦学习服务端根据第一局部特征、第一局部特征所在的分组、第二局部特征以及第二局部特征所在的分组得到全局先验特征。Optionally, the transceiver unit 1501 is also used to: send grouping information to the federated learning server, the grouping information indicating the group where the first local feature is located, so that the federated learning server obtains the global prior feature based on the first local feature, the group where the first local feature is located, the second local feature, and the group where the second local feature is located.
可选的,收发单元1501还用于:接收来自联邦学习服务端的任务同步信息,任务同步信息用于指示第一时隙;根据任务同步信息从本地数据中选择出第一网络数据。Optionally, the transceiver unit 1501 is further used to: receive task synchronization information from the federated learning server, where the task synchronization information is used to indicate the first time slot; and select the first network data from the local data according to the task synchronization information.
图16为本申请实施例提供的另一种推理装置的结构示意图,请参阅图16,该装置160 包括:FIG. 16 is a schematic diagram of the structure of another inference device provided in an embodiment of the present application. Referring to FIG. 16 , the device 160 includes:
收发单元1601,用于接收来自第一联邦学习客户端的第一局部特征,第一局部特征是从第一网络数据中提取出的,第一网络数据为第一联邦学习客户端在第一时隙获取的与目标网络资源有关的数据,目标网络资源为第一联邦学习客户端管理的网络资源;The transceiver unit 1601 is used to receive a first local feature from a first federated learning client, where the first local feature is extracted from first network data, where the first network data is data related to a target network resource acquired by the first federated learning client in a first time slot, where the target network resource is a network resource managed by the first federated learning client;
处理单元1602,用于根据第一局部特征和第二局部特征,得到全局先验特征,第二局部特征是由第二联邦学习客户端提供;A processing unit 1602 is configured to obtain a global prior feature according to the first local feature and the second local feature, where the second local feature is provided by the second federated learning client;
收发单元1601,用于向第一联邦学习客户端发送全局先验特征,使得第一联邦学习客户端根据全局先验特征和第二网络数据进行推理,以得到推理结果,第二网络数据为第一联邦学习客户端在第二时隙获取的与目标网络资源有关的数据,推理结果用于管理目标网络资源,其中,第二时隙与第一时隙相同或在第一时隙之后。The transceiver unit 1601 is used to send the global prior feature to the first federated learning client, so that the first federated learning client performs reasoning based on the global prior feature and the second network data to obtain an inference result, where the second network data is data related to the target network resources obtained by the first federated learning client in the second time slot, and the inference result is used to manage the target network resources, wherein the second time slot is the same as the first time slot or after the first time slot.
其中,收发单元1601用于执行图2方法实施例中的步骤204和步骤206,处理单元1602用于执行图2方法实施例中的步骤205。The transceiver unit 1601 is used to execute step 204 and step 206 in the method embodiment of FIG. 2 , and the processing unit 1602 is used to execute step 205 in the method embodiment of FIG. 2 .
可选的,第一网络数据为目标网络资源有关的数据在第一时隙的采样值或者从第三时隙到第一时隙为止的统计值,第二网络数据为目标网络资源有关的数据在第二时隙的采样值,第三时隙在第一时隙之前。Optionally, the first network data is a sampling value of data related to the target network resources in the first time slot or a statistical value from the third time slot to the first time slot, and the second network data is a sampling value of data related to the target network resources in the second time slot, and the third time slot is before the first time slot.
可选的,全局先验特征为特征向量或第一机器学习模型,第一机器学习模型用于第二网络数据的推理。Optionally, the global prior feature is a feature vector or a first machine learning model, and the first machine learning model is used for inference of the second network data.
可选的,收发单元1601还用于:接收来自第一联邦学习客户端的分组信息,来自第一联邦学习客户端的分组信息指示第一局部特征所在的分组;Optionally, the transceiver unit 1601 is further used to: receive grouping information from the first federated learning client, where the grouping information from the first federated learning client indicates the group where the first local feature is located;
处理单元1602具体用于:根据第一局部特征、第一局部特征所在的分组、第二局部特征以及第二局部特征所在的分组得到全局先验特征,第二局部特征所在的分组是由来自第二联邦学习客户端的分组信息指示的。The processing unit 1602 is specifically used to obtain a global prior feature according to the first local feature, the group where the first local feature is located, the second local feature, and the group where the second local feature is located, wherein the group where the second local feature is located is indicated by the group information from the second federated learning client.
可选的,第一局部特征包括第一子特征和第二子特征,第二局部特征包括第三子特征和第四子特征,来自第一联邦学习客户端的分组信息指示第一子特征所在的分组和第二子特征所在的分组,来自第二联邦学习客户端的分组信息指示第三子特征所在的分组和第四子特征所在的分组,且第一子特征所在的分组和第三子特征所在的分组相同;Optionally, the first local feature includes a first sub-feature and a second sub-feature, the second local feature includes a third sub-feature and a fourth sub-feature, the grouping information from the first federated learning client indicates a group where the first sub-feature is located and a group where the second sub-feature is located, the grouping information from the second federated learning client indicates a group where the third sub-feature is located and a group where the fourth sub-feature is located, and the group where the first sub-feature is located is the same as the group where the third sub-feature is located;
处理单元1602具体用于:基于第一子特征所在的分组和第三子特征所在的分组相同,联邦学习服务端对第一子特征和第三子特征进行处理,得到中间特征;根据中间特征、第二子特征、第四子特征、第二子特征所在的分组以及第四子特征所在的分组,得到全局先验特征。The processing unit 1602 is specifically used for: based on the fact that the group where the first sub-feature is located is the same as the group where the third sub-feature is located, the federated learning server processes the first sub-feature and the third sub-feature to obtain an intermediate feature; and obtains a global prior feature according to the intermediate feature, the second sub-feature, the fourth sub-feature, the group where the second sub-feature is located, and the group where the fourth sub-feature is located.
可选的,处理单元1602具体用于:根据第一局部特征、第二局部特征、来自第一联邦学习客户端的历史局部特征以及来自第二联邦学习客户端的历史局部特征,得到全局先验特征。Optionally, the processing unit 1602 is specifically used to obtain a global prior feature according to the first local feature, the second local feature, the historical local feature from the first federated learning client, and the historical local feature from the second federated learning client.
可选的,处理单元1602具体用于:计算当前推理过程的局部特征与多组历史局部特征的相似度,当前推理过程的局部特征包括第一局部特征和第二局部特征,每组历史局部特征包括一次历史推理过程中来自第一联邦学习客户端的历史局部特征以及来自第二联邦学习客户端的历史局部特征;根据当前推理过程的局部特征与多组历史局部特征的相似度,对多组历史局部特征对应的历史先验特征进行加权求和,以得到全局先验特征。Optionally, the processing unit 1602 is specifically used to: calculate the similarity between the local features of the current reasoning process and multiple groups of historical local features, the local features of the current reasoning process include first local features and second local features, each group of historical local features includes historical local features from the first federated learning client and historical local features from the second federated learning client in a historical reasoning process; according to the similarity between the local features of the current reasoning process and multiple groups of historical local features, perform weighted summation of historical prior features corresponding to the multiple groups of historical local features to obtain global prior features.
可选的,多组历史局部特征都具有标签,标签为人为标注的每组历史局部特征的实际结果;处理单元1602还用于:接收来自第一联邦学习客户端的推理结果;根据第一联邦学习客户端的推理结果和第二联邦学习客户端的推理结果确定目标推理结果;在当前推理过程的局部特征与目标组历史局部特征的相似度大于或等于阈值的情况下,根据当前推理过程的局部特征与目标组历史局部特征的相似度对目标组历史局部特征进行更新,目标组历史局部特征为多组历史局部特征中,标签为目标推理结果;在当前推理过程的局部特征与目标组历史局部特征的相似度小于阈值的情况下,在多组历史局部特征的基础上增加一组历史局部特征,增加的一组历史局部特征为当前推理过程的局部特征。Optionally, multiple groups of historical local features all have labels, and the labels are actual results of each group of historical local features manually marked; the processing unit 1602 is also used to: receive inference results from the first federated learning client; determine the target inference results based on the inference results of the first federated learning client and the inference results of the second federated learning client; when the similarity between the local features of the current inference process and the historical local features of the target group is greater than or equal to a threshold, update the historical local features of the target group according to the similarity between the local features of the current inference process and the historical local features of the target group, and the historical local features of the target group are among the multiple groups of historical local features, and the labels are the target inference results; when the similarity between the local features of the current inference process and the historical local features of the target group is less than a threshold, add a group of historical local features on the basis of the multiple groups of historical local features, and the added group of historical local features are the local features of the current inference process.
可选的,收发单元1601还用于:向第一联邦学习客户端发送任务同步信息,任务同步信息用于指示第一时隙,以使得第一联邦学习客户端根据任务同步信息从本地数据中选择出第一网络数据。Optionally, the transceiver unit 1601 is further used to: send task synchronization information to the first federated learning client, where the task synchronization information is used to indicate the first time slot, so that the first federated learning client selects the first network data from the local data according to the task synchronization information.
图17为本申请的实施例提供的计算机设备170的一种可能的逻辑结构示意图。计算机设备170包括:处理器1701、通信接口1702、存储系统1703以及总线1704。处理器1701、通信接口1702以及存储系统1703通过总线1704相互连接。在本申请的实施例中,处理器1701用于对计算机设备170的动作进行控制管理,例如,处理器1701用于执行图2的方法实施例中发送端所执行的步骤。通信接口1702用于支持计算机设备170进行通信。存储系统1703,用于存储计算机设备170的程序代码和数据。FIG17 is a possible logical structure diagram of a computer device 170 provided in an embodiment of the present application. The computer device 170 includes: a processor 1701, a communication interface 1702, a storage system 1703, and a bus 1704. The processor 1701, the communication interface 1702, and the storage system 1703 are interconnected via the bus 1704. In an embodiment of the present application, the processor 1701 is used to control and manage the actions of the computer device 170. For example, the processor 1701 is used to execute the steps performed by the sending end in the method embodiment of FIG2. The communication interface 1702 is used to support the computer device 170 to communicate. The storage system 1703 is used to store program codes and data of the computer device 170.
其中,处理器1701可以是中央处理器单元,通用处理器,数字信号处理器,专用集成电路,现场可编程门阵列或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。处理器1701也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,数字信号处理器和微处理器的组合等等。总线1704可以是外设部件互连标准(PeripheralComponent Interconnect,PCI)总线或扩展工业标准结构(Extended Industry StandardArchitecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图17中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。Among them, the processor 1701 can be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor 1701 can also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like. The bus 1704 can be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in Figure 17, but it does not mean that there is only one bus or one type of bus.
装置150中的收发单元1501相当于计算机设备170中的通信接口1702,装置150中的处理单元1502相当于计算机设备170中的处理器1701。The transceiver unit 1501 in the apparatus 150 is equivalent to the communication interface 1702 in the computer device 170 , and the processing unit 1502 in the apparatus 150 is equivalent to the processor 1701 in the computer device 170 .
本实施例的计算机设备170可对应于上述图2方法实施例中的第一联邦学习客户端,该计算机设备170中的通信接口1702可以实现上述图2方法实施例中的第一联邦学习客户端所具有的功能和/或所实施的各种步骤,为了简洁,在此不再赘述。The computer device 170 of this embodiment may correspond to the first federated learning client in the method embodiment of FIG. 2 . The communication interface 1702 in the computer device 170 may implement the functions and/or various steps of the first federated learning client in the method embodiment of FIG. 2 , which will not be described in detail for the sake of brevity.
图18为本申请的实施例提供的计算机设备180的另一种可能的逻辑结构示意图。计算机设备180包括:处理器1801、通信接口1802、存储系统1803以及总线1804。处理器1801、通信接口1802以及存储系统1803通过总线1804相互连接。在本申请的实施例中,处理器 1801用于对计算机设备180的动作进行控制管理,例如,处理器1801用于执行图2的方法实施例中接收端所执行的步骤。通信接口1802用于支持计算机设备180进行通信。存储系统1803,用于存储计算机设备180的程序代码和数据。FIG18 is another possible logical structure diagram of a computer device 180 provided in an embodiment of the present application. The computer device 180 includes: a processor 1801, a communication interface 1802, a storage system 1803, and a bus 1804. The processor 1801, the communication interface 1802, and the storage system 1803 are interconnected via the bus 1804. In an embodiment of the present application, the processor 1801 is used to control and manage the actions of the computer device 180. For example, the processor 1801 is used to execute the steps performed by the receiving end in the method embodiment of FIG2. The communication interface 1802 is used to support the computer device 180 to communicate. The storage system 1803 is used to store the program code and data of the computer device 180.
其中,处理器1801可以是中央处理器单元,通用处理器,数字信号处理器,专用集成电路,现场可编程门阵列或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。处理器1801也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,数字信号处理器和微处理器的组合等等。总线1804可以是外设部件互连标准(PeripheralComponent Interconnect,PCI)总线或扩展工业标准结构(Extended Industry StandardArchitecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图18中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。Among them, the processor 1801 can be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor 1801 can also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like. The bus 1804 can be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in Figure 18, but it does not mean that there is only one bus or one type of bus.
装置160中的收发单元1601相当于计算机设备180中的通信接口1802,装置160中的处理单元1602相当于计算机设备180中的处理器1801。The transceiver unit 1601 in the apparatus 160 is equivalent to the communication interface 1802 in the computer device 180 , and the processing unit 1602 in the apparatus 160 is equivalent to the processor 1801 in the computer device 180 .
本实施例的计算机设备180可对应于上述图2方法实施例中的接收端,该计算机设备 180中的通信接口1802可以实现上述图2方法实施例中的接收端所具有的功能和/或所实施的各种步骤,为了简洁,在此不再赘述。The computer device 180 of this embodiment may correspond to the receiving end in the method embodiment of FIG. 2 . The communication interface 1802 in the computer device 180 may implement the functions and/or various steps of the receiving end in the method embodiment of FIG. 2 . For the sake of brevity, they will not be described in detail here.
应理解以上装置中单元的划分仅仅是一种逻辑功能的划分,实际实现时可以全部或部分集成到一个物理实体上,也可以物理上分开。且装置中的单元可以全部以软件通过处理元件调用的形式实现;也可以全部以硬件的形式实现;还可以部分单元以软件通过处理元件调用的形式实现,部分单元以硬件的形式实现。例如,各个单元可以为单独设立的处理元件,也可以集成在装置的某一个芯片中实现,此外,也可以以程序的形式存储于存储器中,由装置的某一个处理元件调用并执行该单元的功能。此外这些单元全部或部分可以集成在一起,也可以独立实现。这里所述的处理元件又可以成为处理器,可以是一种具有信号的处理能力的集成电路。在实现过程中,上述方法的各步骤或以上各个单元可以通过处理器元件中的硬件的集成逻辑电路实现或者以软件通过处理元件调用的形式实现。It should be understood that the division of the units in the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And the units in the device can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some units can also be implemented in the form of software calling through processing elements, and some units can be implemented in the form of hardware. For example, each unit can be a separately established processing element, or it can be integrated in a certain chip of the device. In addition, it can also be stored in the memory in the form of a program, and called and executed by a certain processing element of the device. The function of the unit. In addition, all or part of these units can be integrated together, or they can be implemented independently. The processing element described here can also be a processor, which can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each unit above can be implemented by an integrated logic circuit of hardware in the processor element or in the form of software calling through a processing element.
在一个例子中,以上任一装置中的单元可以是被配置成实施以上方法的一个或多个集成电路,例如:一个或多个特定集成电路(application specific integratedcircuit, ASIC),或,一个或多个微处理器(digital singnal processor,DSP),或,一个或者多个现场可编程门阵列(field programmable gate array,FPGA),或这些集成电路形式中至少两种的组合。再如,当装置中的单元可以通过处理元件调度程序的形式实现时,该处理元件可以是通用处理器,例如中央处理器(central processing unit,CPU)或其它可以调用程序的处理器。再如,这些单元可以集成在一起,以片上系统(system-on-a-chip,SOC)的形式实现。In one example, the unit in any of the above devices may be one or more integrated circuits configured to implement the above method, such as: one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA), or a combination of at least two of these integrated circuit forms. For another example, when the unit in the device can be implemented in the form of a processing element scheduler, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call a program. For another example, these units can be integrated together and implemented in the form of a system-on-a-chip (SOC).
在本申请的另一个实施例中,还提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机执行指令,当设备的处理器执行该计算机执行指令时,设备执行上述方法实施例中第一联邦学习客户端所执行的方法。In another embodiment of the present application, a computer-readable storage medium is further provided, in which computer-executable instructions are stored. When the processor of the device executes the computer-executable instructions, the device executes the method executed by the first federated learning client in the above method embodiment.
在本申请的另一个实施例中,还提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机执行指令,当设备的处理器执行该计算机执行指令时,设备执行上述方法实施例中联邦学习服务端所执行的方法。In another embodiment of the present application, a computer-readable storage medium is further provided, in which computer-executable instructions are stored. When the processor of the device executes the computer-executable instructions, the device executes the method executed by the federated learning server in the above method embodiment.
在本申请的另一个实施例中,还提供一种计算机程序产品,该计算机程序产品包括计算机执行指令,该计算机执行指令存储在计算机可读存储介质中。当设备的处理器执行该计算机执行指令时,设备执行上述方法实施例中第一联邦学习客户端所执行的方法。In another embodiment of the present application, a computer program product is further provided, the computer program product comprising computer-executable instructions stored in a computer-readable storage medium. When the processor of the device executes the computer-executable instructions, the device executes the method executed by the first federated learning client in the above method embodiment.
在本申请的另一个实施例中,还提供一种计算机程序产品,该计算机程序产品包括计算机执行指令,该计算机执行指令存储在计算机可读存储介质中。当设备的处理器执行该计算机执行指令时,设备执行上述方法实施例中联邦学习服务端所执行的方法。In another embodiment of the present application, a computer program product is further provided, the computer program product comprising computer executable instructions, the computer executable instructions being stored in a computer readable storage medium. When the processor of the device executes the computer executable instructions, the device executes the method executed by the federated learning server in the above method embodiment.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备 (可以是个人计算机,服务端,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-OnlyMemory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk.
Claims (30)
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210962642.4A CN117648981A (en) | 2022-08-11 | 2022-08-11 | Reasoning method and related device |
| PCT/CN2023/103784 WO2024032214A1 (en) | 2022-08-11 | 2023-06-29 | Reasoning method and related device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210962642.4A CN117648981A (en) | 2022-08-11 | 2022-08-11 | Reasoning method and related device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN117648981A true CN117648981A (en) | 2024-03-05 |
Family
ID=89850661
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210962642.4A Pending CN117648981A (en) | 2022-08-11 | 2022-08-11 | Reasoning method and related device |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN117648981A (en) |
| WO (1) | WO2024032214A1 (en) |
Families Citing this family (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118585891B (en) * | 2024-08-07 | 2024-11-22 | 杭州次元岛科技有限公司 | Live broadcast data optimization method and system based on hybrid expert model |
| CN119005319B (en) * | 2024-08-16 | 2025-07-08 | 中图科信数智技术(北京)有限公司 | Federal knowledge graph representation learning method and system based on reconstruction network |
| CN119206437B (en) * | 2024-09-11 | 2025-05-16 | 山西师范大学 | A secure distributed SAR image target recognition method based on federated learning |
| CN119129708B (en) * | 2024-11-08 | 2025-08-15 | 精为技术(天津)有限公司 | Inverse knowledge distillation method and system based on federal large model |
| CN120258095B (en) * | 2025-06-05 | 2025-09-16 | 齐鲁工业大学(山东省科学院) | Federal learning method and device based on double countermeasure training under industrial Internet of things |
| CN120450056A (en) * | 2025-07-10 | 2025-08-08 | 中国科学技术大学 | Target tag attack method, equipment and medium for longitudinal federal reasoning system |
Family Cites Families (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111768008B (en) * | 2020-06-30 | 2023-06-16 | 平安科技(深圳)有限公司 | Federal learning method, apparatus, device, and storage medium |
| US20220114475A1 (en) * | 2020-10-09 | 2022-04-14 | Rui Zhu | Methods and systems for decentralized federated learning |
| CN112200321B (en) * | 2020-12-04 | 2021-04-06 | 同盾控股有限公司 | Inference method, system, device and medium based on knowledge federation and graph network |
| CN112989944A (en) * | 2021-02-08 | 2021-06-18 | 西安翔迅科技有限责任公司 | Intelligent video safety supervision method based on federal learning |
| CN113435604B (en) * | 2021-06-16 | 2024-05-07 | 清华大学 | A federated learning optimization method and device |
| CN114048838A (en) * | 2021-10-26 | 2022-02-15 | 西北工业大学 | Knowledge migration-based hybrid federal learning method |
| CN114580662B (en) * | 2022-02-28 | 2025-04-08 | 浙江大学 | Federation learning method and system based on anchor point aggregation |
| CN114861936A (en) * | 2022-05-10 | 2022-08-05 | 天津大学 | A Federated Incremental Learning Method Based on Feature Prototypes |
-
2022
- 2022-08-11 CN CN202210962642.4A patent/CN117648981A/en active Pending
-
2023
- 2023-06-29 WO PCT/CN2023/103784 patent/WO2024032214A1/en not_active Ceased
Also Published As
| Publication number | Publication date |
|---|---|
| WO2024032214A1 (en) | 2024-02-15 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN117648981A (en) | Reasoning method and related device | |
| CN109035779B (en) | DenseNet-based expressway traffic flow prediction method | |
| US20160070673A1 (en) | Event-driven spatio-temporal short-time fourier transform processing for asynchronous pulse-modulated sampled signals | |
| US20230087292A1 (en) | Data annotation method and apparatus, and fine-grained recognition method and apparatus | |
| US11551076B2 (en) | Event-driven temporal convolution for asynchronous pulse-modulated sampled signals | |
| WO2023185539A1 (en) | Machine learning model training method, service data processing method, apparatuses, and systems | |
| CN110852295B (en) | Video behavior recognition method based on multitasking supervised learning | |
| CN113505797A (en) | Model training method and device, computer equipment and storage medium | |
| CN114358250B (en) | Data processing method, apparatus, computer device, medium, and program product | |
| CN110298374A (en) | A kind of driving locus energy consumption analysis method and apparatus based on deep learning | |
| CN112380919A (en) | Vehicle category statistical method | |
| CN116524379A (en) | Aerial photographing target detection method based on attention mechanism and self-adaptive feature fusion | |
| CN111970400A (en) | Crank call identification method and device | |
| CN115331460A (en) | Large-scale traffic signal control method and device based on deep reinforcement learning | |
| CN116432736A (en) | Neural network model optimization method, device and computing equipment | |
| CN113033444A (en) | Age estimation method and device and electronic equipment | |
| CN112364720A (en) | Method for quickly identifying and counting vehicle types | |
| CN113536845A (en) | Face attribute recognition method and device, storage medium and intelligent equipment | |
| CN116071715A (en) | A method for building a real-time semantic segmentation model for autonomous vehicles | |
| CN115497059B (en) | A vehicle behavior recognition method based on attention network | |
| CN109697511B (en) | Data reasoning method and device and computer equipment | |
| CN116189281B (en) | End-to-end human behavior classification method and system based on spatiotemporal adaptive fusion | |
| CN110263638A (en) | A kind of video classification methods based on significant information | |
| CN111401519B (en) | Deep neural network unsupervised learning method based on similarity distance in object and between objects | |
| CN109753999B (en) | Fine-grained vehicle type identification method for automobile pictures with any visual angles |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |