CN113973125A - Communication method and device in federal learning, electronic equipment and storage medium - Google Patents

Communication method and device in federal learning, electronic equipment and storage medium Download PDF

Info

Publication number
CN113973125A
CN113973125A CN202111251208.7A CN202111251208A CN113973125A CN 113973125 A CN113973125 A CN 113973125A CN 202111251208 A CN202111251208 A CN 202111251208A CN 113973125 A CN113973125 A CN 113973125A
Authority
CN
China
Prior art keywords
data
module
transmitted
communication
federal learning
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
Application number
CN202111251208.7A
Other languages
Chinese (zh)
Inventor
汪兰军
姚志强
卞杰
李宏宇
李晓林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Bodun Xiyan Technology Co ltd
Original Assignee
Hangzhou Bodun Xiyan Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Hangzhou Bodun Xiyan Technology Co ltd filed Critical Hangzhou Bodun Xiyan Technology Co ltd
Priority to CN202111251208.7A priority Critical patent/CN113973125A/en
Publication of CN113973125A publication Critical patent/CN113973125A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the application discloses a communication method and device, electronic equipment and a storage medium in federated learning, wherein the method is executed by participants in a federated learning system, the participants comprise a federated learning module and a communication module independent of the federated learning module, and the method comprises the following steps: the federal learning module sends the data transmission request to a communication module of the local terminal, the communication module acquires data to be transmitted and identification information of the receiving terminal from the data request, searches a communication address of the receiving terminal from the routing table according to the identification information of the receiving terminal, and transmits the data to be transmitted to the receiving terminal according to the searched communication address. According to the technical scheme, the interference of the data transmission process on the federal learning module can be reduced, the deployment difficulty of the communication module is reduced, and the lightweight of each module is realized.

Description

Communication method and device in federal learning, electronic equipment and storage medium
Technical Field
The present application relates to the technical field of federal learning, and in particular, to a communication method and apparatus, an electronic device, and a computer-readable storage medium in federal learning.
Background
As a novel machine learning technology, federal learning can effectively help a plurality of participants to perform data use and machine learning modeling under the condition of meeting the requirements of user privacy protection, data safety and government regulations. In federal learning, participants need to have data transfer, for example, data needs to be exchanged between multiple participants to achieve joint modeling. At present, when a participant transmits data, the participant occupies a large amount of resources, so that interference is caused to federal learning, and therefore, how to reduce the interference of data transmission to federal learning is a problem to be solved urgently.
Disclosure of Invention
In order to solve the technical problem, embodiments of the present application provide a communication method and apparatus, an electronic device, and a computer-readable storage medium in federated learning.
Other features and advantages of the present application will be apparent from the following detailed description, or may be learned by practice of the application.
According to an aspect of an embodiment of the present application, there is provided a method for communication in federal learning, the method being performed by a first participant in a federal learning system, the first participant including a federal learning module and a communication module independent of the federal learning module, the method including:
the federal learning module sends a data transmission request to the communication module;
the communication module acquires the data to be transmitted and the identification information of a receiving end from the data transmission request;
and searching the communication address of the receiving terminal from a routing table according to the identification information of the receiving terminal, and transmitting the data to be transmitted to the receiving terminal according to the searched communication address.
According to an aspect of an embodiment of the present application, there is provided a method of communication in federal learning, the method being performed by a second party in a federal learning system, the second party including a federal learning module and a communication module independent of the federal learning module, the method including:
the communication module receives data from a sending end and stores the received data in a database;
the federal learning module sends a data acquisition request to the communication module;
the communication module acquires data corresponding to the data acquisition request from a database and sends the acquired data to the federal learning module so that the federal learning module performs federal learning based on the data.
According to an aspect of an embodiment of the present application, there is provided a communication apparatus in federal learning, applied to a participant in a federal learning system including a federal learning module and a communication module independent of the federal learning module, the apparatus including:
the first control module is configured to control the federal learning module to send a data transmission request to the communication module;
and the second control module is configured to control the communication module to acquire the data to be transmitted and the identification information of the receiving end from the data transmission request, search the communication address of the receiving end from the routing table according to the identification information of the receiving end, and transmit the data to be transmitted to the receiving end according to the searched communication address.
According to an aspect of an embodiment of the present application, there is provided an electronic device including: one or more processors; a storage device for storing one or more programs that, when executed by the one or more processors, cause the electronic equipment to implement the method of communication in federal learning as described above.
According to an aspect of embodiments of the present application, there is provided a computer-readable storage medium having stored thereon computer-readable instructions which, when executed by a processor of a computer, cause the computer to execute the method of communication in federal learning as described above.
According to an aspect of embodiments herein, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the communication method in federal learning as described above.
In the technical scheme provided by the embodiment of the application, the participants in the federal learning system comprise a federal learning module and a communication module independent of the federal learning module, the communication module independent of the federal learning module is communicated with the outside to transmit data, and the federal learning module is used for federal learning.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort. In the drawings:
FIG. 1 is an interaction diagram of a federated system involved in the related art;
FIG. 2 is a schematic illustration of an implementation environment to which the present application relates;
FIG. 3 is a block diagram of a first party to which the present application relates;
FIG. 4 is a schematic diagram of a data transmission process to which the present application relates;
fig. 5 is a flowchart illustrating a communication method in federal learning corresponding to a transmitting end according to an exemplary embodiment of the present application;
FIG. 6 is an interaction diagram between communication modules shown in an exemplary embodiment of the present application;
FIG. 7 is a flowchart of step S130 in the embodiment shown in FIG. 5 in an exemplary embodiment;
FIG. 8 is a schematic diagram of serialization and deserialization shown in an exemplary embodiment of the present application;
FIG. 9 is a process diagram illustrating serialization according to an exemplary embodiment of the present application;
FIG. 10 is a flowchart of step S130 in the embodiment shown in FIG. 5 in an exemplary embodiment;
FIG. 11 is a schematic diagram of a segmentation process shown in an exemplary embodiment of the present application;
FIG. 12 is a block diagram of a first party shown in an exemplary embodiment of the present application;
fig. 13 is a flowchart illustrating a communication method in federal learning corresponding to a receiver according to an exemplary embodiment of the present application;
FIG. 14 is a process diagram illustrating deserialization according to an exemplary embodiment of the present application;
fig. 15 is a diagram illustrating a data transmission process in a point-to-point communication according to an exemplary embodiment of the present application;
fig. 16 is a diagram illustrating a data reception process in a point-to-point communication according to an exemplary embodiment of the present application;
FIG. 17 is a diagram illustrating a data transmission process in a point-to-domain two-way communication according to an exemplary embodiment of the present application;
FIG. 18 is a diagram illustrating a data reception process in a point-to-domain two-way communication according to an exemplary embodiment of the present application;
FIG. 19 is a block diagram illustrating a communication device in Federal learning according to an exemplary embodiment of the present application;
fig. 20 is a schematic structural diagram of an electronic device according to an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
It should also be noted that: reference to "a plurality" in this application means two or more. "and/or" describe the association relationship of the associated objects, meaning that there may be three relationships, e.g., A and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
Federal Learning (fee), also known as federal machine Learning (fed machine Learning/fed Learning), joint Learning, league Learning. The federal learning is a machine learning framework, and can effectively help a plurality of federal learning participants to perform data use and machine learning modeling under the condition of meeting the requirements of user privacy protection, data safety and government regulations. According to the distribution characteristics of island data, federal learning is divided into three types: horizontal federal learning, vertical federal learning, federal transfer learning.
In federal learning, the participants need to communicate with the outside to transmit data, for example, data needs to be exchanged among the participants to realize joint modeling, in one example, referring to fig. 1, the federal learning system includes a server, a client a and a client B, and when doing federal learning, it includes the following steps: (1) the server sends public keys to the client A and the client B to encrypt data to be transmitted; (2) the client A and the client B respectively calculate intermediate results of features relevant to the client A and the client B, and carry out encryption interaction to obtain respective gradient and loss; (3) the client A and the client B respectively calculate the gradient after respective encryption and add a mask to send to the server, and meanwhile, the client B calculates the loss after encryption and sends to the server; (4) the server decrypts the gradient and the loss and then transmits the gradient and the loss back to the client A and the client B, and the client A and the client B remove the mask and update the model.
However, when the participating party performs data transmission, a large amount of resources are occupied, and thus interference is caused to the federal learning process inside the participating party, and based on this, the embodiment of the application provides a communication method and apparatus, an electronic device, and a computer readable storage medium in federal learning, which can reduce interference of the data transmission process to federal learning to a certain extent.
Referring to fig. 2, fig. 2 is a schematic diagram of an implementation environment related to the present application. The implementation environment is a federated learning system that includes a plurality of participants that implement joint modeling by exchanging machine learning intermediate results.
The participating party may be an independent physical device, a physical device cluster or a distributed system formed by a plurality of physical devices, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content Delivery Network), a big data and artificial intelligence platform, which is not limited herein.
The types of participants include clients that train the model with local data and servers that coordinate the clients. For example, an enterprise may apply for joining a federated learning system to become one of the clients and train a model with the enterprise's data. Additionally, in some embodiments, the federated learning system may not include a server.
In an exemplary embodiment, the federated learning system includes a first party, which may be a client or a server. The first participant is deployed with a federal learning module and a communication module independent of the federal learning module. If the first participant is an independent physical device, the federal learning module and the communication module are two mutually independent modules in the independent physical device, for example, the physical device may include a plurality of virtual devices, and the federal learning module and the communication module may be deployed on different virtual devices; if the first participant is a physical device cluster, a distributed system, or a cloud server, the federal learning module and the communication module may be deployed on different physical devices, or the federal learning module and the communication module may be deployed on different virtual appliances.
When a federal learning module deployed in a first participant needs to transmit data to the outside, the federal learning module generates a data transmission request containing the data to be transmitted and identification information of a receiving terminal, and sends the transmission request to a communication module in the first participant, the communication module acquires the data to be transmitted and the identification information of the receiving terminal from the data transmission request after receiving the data transmission request, searches a communication address of the receiving terminal from a routing table according to the identification information of the receiving terminal, and transmits the data to be transmitted to the receiving terminal according to the searched communication address. The receiving end can be a participant in the federal learning system or can be a device outside the federal learning system. The routing table may contain communication addresses of a plurality of participants deployed in the federated learning system such that the communication module may transmit data to any of the participants in the federated learning system based on the routing table. Therefore, data are transmitted to the outside through the communication module independent of the federal learning module, so that the interference of the data transmission process on the federal learning module is reduced, the lightweight of each module is realized, the deployment difficulty of the communication module is reduced, the expansion of the communication module is facilitated, and meanwhile, the containerization of the communication module is facilitated to a certain extent.
It should be noted that, in some embodiments, referring to fig. 3, the first participant may include an application layer and a communication layer, where the application layer is a layer in which the federal learning module is located, and includes an algorithm unit, a communication SDK (Software Development Kit), and a control platform, and the application layer may support GRPC (generic Remote Procedure Call) and HTTP (hypertext Transfer Protocol). The system comprises an algorithm unit, a control platform, a federal learning module and a communication SDK, wherein the algorithm unit is used for the operation processing of machine learning of various algorithms, the control platform is used for the processing of various federal events, the federal learning module can comprise the algorithm unit, and the federal learning module can also comprise the control platform and the communication SDK; GRPC is a high-performance, open-source and universal RPC (Remote Procedure Call) framework, has the characteristics of high efficiency and low delay, supports TLS (Transport Layer Security), is very suitable for micro-service, point-to-point real-time communication and multi-language mixed development environments, adopts GRPC as a data transmission protocol of a communication module, can enable the communication module to have the advantages of high efficiency and low delay, and can also transmit through TLS.
The communication layer is a layer where the communication module is located, and includes the communication module and a database (for example, KV-DB, that is, KV database), and the communication module includes a data route (routing table) and can support GRPC, HTTP, TLS. The KV database refers to a Key-value database, which is a database storing data by Key-value pairs, and includes, but is not limited to, Remote Dictionary service (Remote Dictionary Server).
The algorithm unit interacts with the communication module through the communication SDK, and the interaction between the communication SDK and the communication module can be based on a GRPC protocol. The control platform is responsible for controlling the communication session, which may interact with the communication unit via the HTTP protocol. In an example, a data transmission process between a first participant and a receiving end may be as shown in fig. 4, where a control platform deployed in the first participant sends a notification to a communication module to prepare for starting a model operation service based on an HTTP protocol, the communication module may synchronize the notification to the receiving end based on the HTTP protocol, the control platform sends an instruction to start the model operation service to an algorithm unit, the algorithm unit performs privacy calculation and sends related calculated data to a communication SDK, the communication SDK encrypts the data and sends the encrypted data to the communication module based on a GRPC protocol, and the communication module sends the encrypted data to the receiving end based on a GRPC protocol; when the model operation service is finished, the control platform sends a notice of finishing the model operation service to the communication module based on the HTTP protocol, and the communication module synchronizes the notice to the receiving end, so that the primary combined model operation service is finished.
In an exemplary embodiment, the federated learning system includes a second party, which may be a client or a server. The second participant is deployed with a federal learning module and a communication module independent of the federal learning module. If the second participant is an independent physical device, the federal learning module and the communication module are two relatively independent modules in the independent physical device, for example, the physical device may include a plurality of virtual devices, and the federal learning module and the communication module may be deployed on different virtual devices; if the second participant is a physical device cluster, a distributed system, or a cloud server, the federal learning module and the communication module may be deployed on different physical devices, or the federal learning module and the communication module may be deployed on different virtual appliances.
The method comprises the steps that a communication module deployed in a second participant receives data from a sending end and stores the received data to a database, a federal learning module deployed in the second participant sends a data acquisition request to the communication module, the communication module acquires data corresponding to the data acquisition request from the database after receiving the data acquisition request and sends the acquired data to the federal learning module, and accordingly the federal learning module conducts federal learning based on the data. Therefore, the communication module independent of the federal learning module receives data from the outside, so that the interference of a data transmission process to the federal learning module is reduced, the light weight of each module is realized, the deployment difficulty of the communication module is reduced, the expansion of the communication module is facilitated, and meanwhile, the containerization of the communication module is facilitated to a certain extent; and the communication module sends the data to the federal learning module after receiving the data and receiving the data acquisition request sent by the federal learning module, so that the federal learning module can acquire the data as required.
Wherein the second party may also include an application layer and a communication layer.
It should be noted that "the first" and "the second" of the first and the second parties are only used to characterize whether the party is used as a sender of data or a receiver of data, and are not used to limit a specific party, and under some conditions, the first party and the second party may be the same party, so that the party may implement data interaction with the outside through a communication module independent of the federal learning module.
Various implementation details of the technical solution of the embodiments of the present application are set forth in detail below:
referring to fig. 5, fig. 5 is a flowchart illustrating a communication method in federated learning according to an exemplary embodiment. The method is performed by a first party in a federated learning system.
As shown in fig. 5, in an exemplary embodiment, the communication method in federal learning may include steps S110 to S130, which are described in detail as follows:
in step S110, the federal learning module deployed in the first party sends a data transmission request to the communication module.
First, it should be noted that the first participant may be a client or a server. A federal learning module is deployed in the first participant and used for federal learning so as to realize joint modeling. For example, in some examples, if the first participant is a client, the federal learning module may train the model using local data, or the federal learning module may also update the model using data obtained from other clients or servers, etc.; if the first participant is a server, the federated learning module may aggregate data obtained from the client for model update, etc.
Second, a communication module independent of the federal learning module is also deployed in the first party. The number of the communication modules deployed in the first participant can be flexibly set according to actual needs, for example, one or more communication modules can be deployed in the first participant.
The development language of the communication module can be flexibly set according to actual needs. For example, in one example, the language of development of the communication module may be the Golang language. It should be noted that Golang is an open source programming language, which has the characteristics of simplicity, easy learning, source code level support protocol, and excellent performance, and has a strong ecosystem, in the aspect of constructing microservice, because of its natural network advantages, microservice can be rapidly deployed and tested, and native support is provided for microservice development; therefore, the Golang is adopted to develop the communication module, the development progress and the deployment efficiency of the communication module can be improved, the development process of the communication module can be made efficient, the method is suitable for various ecological environments, and the micro-service of the communication module is supported.
The data transmission protocol of the communication module can be flexibly set according to actual needs, for example, in one example, the data transmission protocol of the communication module can include GRPC. Since Golang language supports GRPC very well, in one example, the communication module may be developed in Golang language and the data transfer protocol is GRPC.
The federal learning module generates data during federal learning, including but not limited to parameters associated with the model, such as the gradient of the model, loss of the model, etc. The federal learning module can send this data to other participants in the federal learning system, or to devices outside of the federal learning system. Therefore, in this embodiment, the federal learning module generates a data transmission request including the data to be transmitted and the identification information of the receiving end, and sends the generated data transmission request to the communication module.
Wherein if the first party includes a communication module, the federal learning module can send a data transmission request to the communication module. If the first party comprises a plurality of communication modules, the federal learning module can send a data transmission request to one of the plurality of communication modules; alternatively, to improve the reliability of the data transmission, the federal learning module may send a data transmission request to at least two communication modules of the plurality of communication modules.
The receiving end can be a participant in the federal learning system or can be a device outside the federal learning system. The identification information of the receiving end includes, but is not limited to, an ID (Identity document) of the receiving end. The federal learning module can send the data transmission request to the communication module using GRPC or other data transmission protocol.
Step S120, the communication module deployed in the first participant acquires the data to be transmitted and the identification information of the receiving end from the data transmission request.
After receiving a data transmission request sent by the federal learning module, a communication module deployed in the first participant analyzes the data transmission request so as to acquire data to be transmitted and identification information of a receiving end from the data transmission request.
Step S130, the communication module deployed in the first participant searches the communication address of the receiving end from the routing table according to the identification information of the receiving end, and transmits the data to be transmitted to the receiving end according to the searched communication address.
The routing table includes identification information of different network terminals and communication addresses corresponding to the identification information. The communication address includes, but is not limited to, an IP (Internet Protocol) address. To enable the transfer of data to the various participants in the federated learning system, the routing table may include identification information and their corresponding communication addresses for the various participants deployed in the federated learning system.
After the communication module deployed in the first participant acquires the data to be transmitted and the identification information of the receiving end, the communication address of the receiving end can be searched from the routing table according to the identification information of the receiving end, and the data to be transmitted is transmitted to the network end corresponding to the searched communication address, so that the data to be transmitted is transmitted to the receiving end.
In step S130, the communication module may use a GRPC to transmit the data to be transmitted to the receiving end, and certainly, the communication module may also use other data transmission protocols to transmit the data to be transmitted to the receiving end.
In order to improve the Security of data transmission, in some embodiments, in step S130, the communication module may employ a TLS (Transport Layer Security), encrypt data to be transmitted, and transmit the encrypted data to the receiving end. For example, referring to fig. 6, in an example, a communication module deployed in one participant may perform data transmission with a communication module deployed in another participant through OpenSSL (open secure socket layer protocol) and TLS 1.3, and may perform transmission in the form of stream (data stream) during transmission.
In order to reduce the impact of the process of data reception on federal learning, in some embodiments, the communication module deployed in the first party further supports receiving data from outside and sending the received data to the federal learning module, so that the federal learning module performs federal learning according to the received data. The process of receiving data from the outside and sending the data to the federal learning module by the communication module deployed in the first party may refer to a subsequent processing process of the communication module deployed in the second party, which is not described herein again. Thus, the communication module can not only transmit data to the outside, but also receive data from the outside, so that the communication module can support various communication modes such as point-to-point one-way communication, point-to-point two-way communication, point-to-domain two-way communication (e.g., broadcasting), and the like.
According to the communication method in the federal learning provided by the embodiment, the communication module independent of the federal learning module sends data to the receiving end, the federal learning module does not need to sense the communication address of the receiving end, and the data transmission process does not occupy the resource of the federal learning module, so that the interference of the data transmission process on the federal learning module is reduced, the deployment difficulty of the communication module is reduced, and the lightweight of each module is realized.
In an exemplary embodiment, the data transmission request may further include a key (key) of the data to be transmitted. It should be noted that the key is a unique identifier of the data to be transmitted, and may be constructed by the federal learning module according to the context of the data to be transmitted. The context of the data to be transmitted includes, but is not limited to, at least one of a sender of the data to be transmitted, a receiver of the data to be transmitted, a name of the data to be transmitted, and the like.
Under the condition that the data transmission request includes the key of the data to be transmitted, after step S110 in the embodiment shown in fig. 5, the communication method in federal learning may further include: and the communication module deployed in the first participant acquires the key of the data to be transmitted from the data transmission request and transmits the key of the data to be transmitted to the receiving end, so that the receiving end can conveniently inquire and store the data according to the key of the data to be transmitted.
The data to be transmitted and the key of the data to be transmitted can be transmitted to the receiving end together, and can also be transmitted to the receiving end respectively.
In this embodiment, the data transmission request includes a key of the data to be transmitted, so that the communication module deployed in the first participant can store and query the data to be transmitted; and the key of the data to be transmitted is also transmitted to the receiving end, so that the receiving end can conveniently inquire and store the data according to the key of the data to be transmitted.
Referring to fig. 7, fig. 7 is a flowchart of step S130 in the embodiment shown in fig. 5 in an exemplary embodiment. As shown in fig. 7, the process of the communication module deployed in the first participant transmitting the data to be transmitted to the receiving end according to the found communication address may include steps S131 to S132, which are described in detail as follows:
step S131, the communication module deployed in the first participant serializes the data to be transmitted to obtain serialized data.
It should be noted that in the federal learning, the raw data is not data suitable for direct transmission, but exists in the form of an object, for example, assuming that the federal learning module adopts python language, the generated data is usually an object (a software set of some related variables and methods). To facilitate transmission, a communication module deployed in the first participant may serialize data to be transmitted to obtain serialized data. Wherein the data to be transmitted may be serialized into a byte stream or character stream form.
To increase the speed of serialization and reduce the size of serialized data, in some embodiments, the communication module may employ a protocol buffer (Protobuf) to serialize data to be transmitted. Of course, the communication module may also serialize the data to be transmitted in other manners.
In step S132, the communication module deployed in the first participant transmits the serialized data to the receiving end according to the searched communication address.
After the communication module deployed in the first participant obtains the serialized data, the serialized data is transmitted to the receiving end according to the searched communication address, and after the receiving end receives the serialized data, the receiving end can perform deserialization on the serialized data to obtain deserialized data, wherein the deserialized data is data to be transmitted. For example, as shown in fig. 8, in an example, if the data to be transmitted is in an object form, the first participant may serialize the data in the object form into serialized data in a bytes form through a pick.dump () function, and after receiving the serialized data, the receiving end may deserialize the serialized data through a pick.load () function to obtain deserialized data in the object form, where the deserialized data is the data to be transmitted. It should be noted that the pick.dump () function is a function that converts Python data objects into byte streams, and the pick.load () function is a function that deserializes byte streams into Python data objects, and in other examples, serialization or deserialization may be performed through other functions.
In this embodiment, the data to be transmitted is serialized through the communication module, and in other embodiments, the data to be transmitted may also be serialized through the federal learning module, and the serialized data to be transmitted is transmitted to the communication module. For example, in an example, referring to fig. 9, the federal learning module includes an algorithm module and a communication SDK, the algorithm module generates object-form data to be transmitted, and sends the object-form data to the communication SDK, the communication SDK constructs key of the data to be transmitted and identification information dst of a receiving end according to context (context) of the data to be transmitted, and serializes the object-form data to be transmitted to obtain byte stream-form serialized data value, and the communication SDK sends a data transmission request Req including the byte stream-form serialized data value, the byte to be transmitted data key, and the identification information dst of the receiving end to the communication module.
In this embodiment, the communication module serializes the data to be transmitted and transmits the serialized data to the receiving end, thereby improving transmission speed and security.
Referring to fig. 10, fig. 10 is a flowchart of step S130 in the embodiment shown in fig. 5 in an exemplary embodiment. As shown in fig. 10, the process of the communication module deployed in the first participant transmitting the data to be transmitted to the receiving end according to the found communication address may include steps S133 to S134, which are described in detail as follows:
step S133, the communication module deployed in the first participant divides the data to be transmitted according to a preset division rule to obtain a plurality of data segments.
It should be noted that the preset segmentation rule may be flexibly set according to actual needs, for example, the data to be transmitted may be segmented according to a preset data length to obtain a plurality of data segments with the data length being the preset data length, where the preset data length may be flexibly set according to actual needs, for example, may be set to 1MB or the like.
In this embodiment, to avoid a situation that the communication efficiency is low due to different data lengths, the communication module deployed in the first participant divides data to be transmitted according to a preset division rule to obtain a plurality of data segments. For example, referring to fig. 11, in one example, after receiving 1GB of data to be transmitted, the communication module divides the data to be transmitted into 1MB data segments, and transmits the data segments to the receiving end in the form of a data stream (stream).
Step S134, the communication module deployed in the first participant sequentially transmits the plurality of data segments to the receiving end according to the found communication address, so that the receiving end reassembles the received data segments to obtain reassembled data.
After obtaining the plurality of data segments, the communication module deployed in the first party may sequentially transmit the plurality of data segments to the receiving end according to the found communication address, and after receiving the plurality of data segments, the receiving end may reassemble the plurality of data segments to obtain reassembled data, where the reassembled data is the data to be transmitted.
When the data segments are transmitted, the data segments can be sequentially transmitted to a receiving end according to the positions of the data segments in the data to be transmitted, wherein the data segments can be transmitted before the positions, or the data segments can be transmitted before the positions.
When transmitting the data segments, the data segments may also be sequentially transmitted to the receiving end by streaming.
In this embodiment, the communication module divides data to be transmitted according to a preset division rule to obtain a plurality of data segments, and transmits the data segments to the receiving end, thereby increasing the data transmission speed.
In an exemplary embodiment, under the condition that the number of the receiving ends is multiple, after step S130 in the embodiment shown in fig. 5, the communication method in federal learning may further include steps S140 to S150, which are described in detail as follows:
step S140, the communication module deployed in the first participant receives response data sent by each of the plurality of receiving terminals for the data to be transmitted.
After the communication module deployed in the first participant transmits the data to be transmitted to the plurality of receiving terminals, each of the plurality of receiving terminals may send the response data to the first participant according to the data to be transmitted. A communication module deployed in the first participant receives the reply data from each of the plurality of receivers.
Step S150, the communication module deployed in the first participant merges the received response data, and sends the merged response data to the federal learning module.
After receiving the response data sent by each of the plurality of receiving terminals, the communication module may combine the received response data, and send the combined response data to the federal learning module, so that the federal learning module performs federal learning according to the received response data.
The communication module can store the combined response data into a database, and after receiving a data acquisition request sent by the federal learning module, the communication module acquires the response data from the database and sends the response data to the federal learning module.
In this embodiment, after receiving the response data sent by the multiple receiving terminals, the communication module combines the response data and then transmits the combined response data to the federal learning module, thereby increasing the transmission speed and avoiding the situation that multiple transmissions occupy network resources.
In an exemplary embodiment, on the condition that the first participant further includes a first transmission module in an operating mode and a second transmission module in a non-operating mode, step S110 in the embodiment shown in fig. 5 may include: a federal learning module deployed in the first party sends a data transmission request to the first transmission module to cause the first transmission module to send the data transmission request to the communication module.
It should be noted that "first" and "second" in the first transmission module and the second transmission module are only used to define the operating state, and are not used to define a specific transmission module.
A federated learning module deployed in the first party sends the data transmission request to a first transmission module, which forwards the data transmission request to a communication module.
If the first transmission module fails, the second transmission module can switch the working state of the second transmission module from a non-working mode to a working mode, and due to the change of the working state, the second transmission module becomes a new first transmission module to receive the data transmission request sent by the federal learning module and forward the data transmission request to the communication module.
In order to save cost, only two transmission modules can be deployed in the first participant, one transmission module is a first transmission module, and the other transmission module is a second transmission module; alternatively, at least three transmission modules may be deployed in the first participant, one of which is the first transmission module and the remaining plurality of which is the second transmission module. Under the condition that the number of the second transmission modules is multiple, if the first transmission module fails, one of the second transmission modules can switch the working state of the transmission module from a non-working mode to a working mode.
It should be noted that the first transmission module and the second transmission module may use lvs + keepalive mechanism and provide services based on VRRP (Virtual Router Redundancy Protocol). In this way, the first transmission module and the second transmission module may be active and standby with each other, and the first transmission module and the second transmission module externally represent a virtual IP address, the federal learning module may send a data transmission request to the first transmission module through the virtual IP address, and when the first transmission module fails, the second transmission module may take over the virtual IP address to receive the data transmission request sent by the federal learning module; in this way, the federal learning module does not perceive the switching of the transmission modules, thereby reducing the processing complexity of the federal learning module. It should be noted that lvs (Linux Virtual server) is a Linux Virtual server, and Linux is an operating system; keepalive is a survival detection mechanism.
In some embodiments, under the condition that the first party includes a plurality of communication modules, the first transmission module and the second transmission module may each include a load balancing unit, and the load balancing unit of the first transmission module may select one communication module from the plurality of communication modules according to a load balancing policy after receiving the data transmission request, and send the data transmission request to the selected communication module. Load balancing policies include, but are not limited to, round robin, weighted round robin, hash, and the like. The load balancing unit can work in seven layers of the network, so as to realize shunting according to the content of the application layer, for example, shunting according to a domain name, a directory structure and the like.
In an example, referring to fig. 12, the first transmission module and the second transmission module use an lvs + keepalive mechanism and provide services based on VRRP, each of the first transmission module and the second transmission module includes a load balancing unit nginx for performing load balancing, and after receiving a data transmission request, nginx transmits the data transmission request to one of the communication modules according to a load balancing policy.
In this embodiment, a first transmission module in a working mode and a second transmission module in a non-working mode are provided, the first transmission module is configured to forward a data transmission request received from the federal learning module to the communication module, and the second transmission module is configured to switch a self working state from the non-working mode to the working mode to become a new first transmission module under a condition that the first transmission module fails, so that a single point failure is avoided, and reliability of data transmission between the federal learning module and the communication module is improved.
In an exemplary embodiment, after step S120 in the embodiment shown in fig. 5, the communication method in federal learning may further include: step S160, the communication module deployed in the first participant stores the acquired data to be transmitted and the identification information of the receiving end in the database, and deletes the data to be transmitted and the identification information of the receiving end stored in the database after the data to be transmitted is successfully transmitted to the receiving end.
The communication module deployed in the first participant stores the data to be transmitted and the identification information of the receiving end in the database after acquiring the data to be transmitted and the identification information of the receiving end, so that if the data to be transmitted is lost in the transmission process due to various unpredictable reasons, the communication module can acquire the data to be transmitted and the identification information of the receiving end from the database and retransmit the data to be transmitted to the receiving end according to the identification information of the receiving end, thereby improving the reliability of transmission; meanwhile, after the data to be transmitted is successfully transmitted to the receiving end, the data to be transmitted and the identification information of the receiving end stored in the database are deleted, so that the storage pressure can be reduced; moreover, the data to be transmitted and the identification information of the receiving end are stored in the database instead of the communication module, so that the deployment difficulty of the communication module can be reduced, and the expandability of the communication module is improved.
The communication module deployed in the first participant can determine that the data to be transmitted is successfully transmitted to the receiving end when receiving a message sent by the receiving end and confirming that the data to be transmitted is received, and delete the data to be transmitted and the identification information of the receiving end stored in the database.
The database can be a KV database, so that the key of the data to be transmitted can be obtained from the data transmission request under the condition that the data transmission request contains the key of the data to be transmitted, and the data to be transmitted is stored in the KV database according to the key of the data to be transmitted. Of course, the database may also be other types of databases.
It should be noted that, in this embodiment, after the data to be transmitted is obtained from the data transmission request, the data to be transmitted may be directly stored in the database; alternatively, in order to reduce the complexity of the subsequent data retransmission process, the serialized data to be transmitted (i.e., the serialized data) may be stored in the database.
Referring to fig. 13, fig. 13 is a flowchart illustrating a communication method in federated learning according to an exemplary embodiment. The method is performed by a second party in the federated learning system.
As shown in fig. 13, in an exemplary embodiment, the communication method in federal learning may include steps S210 to S230, which are described in detail as follows:
step S210, the communication module deployed in the second party receives data from the sending end, and stores the received data in the database.
First, it should be noted that the second party may be a client or a server. The second party is deployed with a communication module, and the number of the communication modules can be flexibly set according to actual needs, for example, one or more communication modules can be deployed in the second party.
The development language of the communication module can be flexibly set according to actual needs. For example, in one example, the language of development of the communication module may be the Golang language.
The data transmission protocol of the communication module can be flexibly set according to actual needs, for example, in one example, the data transmission protocol of the communication module can include GRPC. Since Golang language supports GRPC very well, in one example, the communication module may be developed in Golang language and the data transfer protocol is GRPC.
The sender may be a participant in the federal learning system or may be a device outside the federal learning system.
A communication module deployed in the second participant may receive data from the sender and store the received data to a database. The database may be a KV database or other databases.
Step S220, the federal learning module deployed in the second party sends a data acquisition request to the communication module.
A federal learning module is also deployed in the second party, wherein the communication module is independent of the federal learning module. The federated learning module is used for performing federated learning to achieve federated modeling. For example, in some examples, if the second party is a client, the federal learning module may train the model using local data, or the federal learning module may update the model using data obtained from other clients or servers, etc.; if the second participant is a server, the federated learning module may aggregate data obtained from the client for model update, etc.
The federal learning module needs to acquire data sent by other participants so as to realize joint modeling according to the data sent by the other participants. Thus, the federal learning module can send a data acquisition request to a communication module deployed in the second party when data acquisition is needed. The data acquisition request may include identification information of the data to be acquired, so that the communication module may search for corresponding data from the database based on the identification information, for example, if the communication module deployed in the second party stores the received data in the KV database, the data acquisition request may include a key of the data to be acquired.
In step S230, the communication module deployed in the second party acquires data corresponding to the data acquisition request from the database, and sends the acquired data to the federal learning module, so that the federal learning module performs federal learning based on the data.
After receiving a data acquisition request from the federal learning module, a communication module deployed in the second participant acquires data corresponding to the data acquisition request from a database and sends the acquired data to the federal learning module, so that the federal learning module performs federal learning based on the data.
To reduce the amount of data storage, in some embodiments, after the communication module deployed in the second party sends the obtained data to the federal learning module, the communication module may delete the data in the database.
It should be noted that, in some embodiments, the communication module deployed in the second party may further transmit data from the local federal learning module to the outside, and the process of transmitting data to the outside may refer to the aforementioned process of transmitting data to the outside by the communication module deployed in the first party, which is not described herein again.
According to the communication method in the federal learning provided by the embodiment, the communication module independent of the federal learning module receives data from the sending end and stores the data in the database, and after a data acquisition request sent by the federal learning module is received, corresponding data is acquired from the database and transmitted to the federal learning module, so that the interference of the data transmission process on the federal learning module is reduced, the deployment difficulty of the communication module is reduced, and the lightweight of each module is realized.
In an exemplary embodiment, in step S210 in the embodiment shown in fig. 13, the process of storing the received data in the database by the communication module deployed in the second party may include steps S211 to S212, which are described in detail as follows:
step S211, the communication module deployed in the second party performs deserialization on the received data to obtain deserialized data.
For convenience of transmission, when the sending end sends data, the sending end can serialize the data and send the serialized data to the second participant, after the communication module deployed in the second participant receives the serialized data, the federal learning module processes the data conveniently, and the communication module deployed in the second participant performs deserialization on the received data to obtain deserialized data. Where the data can be deserialized into object form.
Step S212, the communication module deployed in the second party stores the deserialization data in the database.
After the communication module deployed in the second participant obtains the deserialization data, the deserialization data is stored in a database, so that the subsequent federal learning module can conveniently learn the federal after acquiring the data.
In this embodiment, the data is deserialized by the communication module, and in other embodiments, the received data may also be deserialized by the federal learning module. For example, referring to fig. 14, in one example, the federal learning module includes an algorithm unit, communication SDK, and the process of acquiring data by the federal learning module is as follows: the algorithm unit constructs a key of the data to be acquired according to the context of the data to be acquired, transmits a data acquisition request containing the key of the data to be acquired to the communication module through the communication SDK, the communication module acquires a corresponding value from the KV database according to the key and transmits the value to the communication SDK, and the communication SDK carries out deserialization on the value to obtain deserialization data in an object form and transmits the deserialization data to the algorithm unit.
In this embodiment, the received data is deserialized and then stored in the database, so that the federal learning module can conveniently perform federal learning according to the data acquired from the database.
In an exemplary embodiment, in step S210 in the embodiment shown in fig. 13, the process of storing the received data in the database by the communication module deployed in the second party may include steps S213 to S214, which are described in detail as follows:
step S211, if the received data is a data segment, the communication module deployed in the second party reassembles the data segments belonging to the data to be transmitted to obtain reassembled data after receiving other data segments belonging to the same data to be transmitted as the data segments.
When a sending end transmits data, the data can be divided into a plurality of data segments and then transmitted to a second party, after a communication module deployed in the second party receives the data from the sending end, whether the data is the data segment can be determined firstly, if yes, the data segments belonging to the data to be transmitted are recombined to obtain recombined data after other data segments belonging to the same data to be transmitted with the data segments are received, and the recombined data is the data before the sending end is divided.
Step S212, the communication module deployed in the second party stores the reorganization data to the database.
After the data segments are recombined to obtain recombined data, the communication module deployed in the second participant can store the recombined data in the database.
In this embodiment, the data is divided into data segments and then transmitted, and the second participant reassembles the received data segments, thereby increasing the transmission speed.
In an exemplary embodiment, the communication method in federal learning may further include: a communication module deployed in the second party receives the key of the data from the sender. That is, the transmitting end not only transmits the data to the second participant, but also transmits the key of the data to the second participant. Wherein the key is the unique identifier of the data.
Under the condition, in step S210 in the embodiment shown in fig. 13, the communication module deployed in the second party may store the data into the KV database according to the key of the received data, where value in the KV database is the received data.
A specific application scenario of the embodiment of the present application is described in detail below, in which a sending end is the first participant and a receiving end is the second participant, and the communication method in federal learning includes:
step S301, the federal learning module of the first participant generates a data acquisition request and sends the data acquisition request to the communication module of the local terminal.
Step S302, the communication module of the first party obtains the data to be transmitted, the corresponding key, and the identification information of the second party serving as the receiving end from the data obtaining request.
In step S303, the communication module of the first party looks up the communication address of the second party from the routing table according to the identification information of the second party.
The routing table comprises identification information and communication addresses of a plurality of participants in the federal learning system.
Step S304, the communication module of the first participant serializes the data to be transmitted to obtain serialized data, and stores the serialized data and the corresponding key in the local database.
Step S305, the communication module of the first party transmits the serialized data and the corresponding key to the second party according to the searched communication address of the second party, and deletes the key of the data to be transmitted and the serialized data stored in the local database.
And after the serialized data and the corresponding key are successfully transmitted to the second party, the communication module of the first party deletes the serialized data and the corresponding key stored in the database.
In step S306, the communication module of the second party receives the serialized data and the corresponding key from the first party.
Step S307, the communication module of the second participant performs deserialization on the serialized data to obtain deserialized data, and stores the deserialized data and the corresponding key to the database of the home terminal.
Step S308, after receiving the data acquisition request from the local terminal federal learning module, the communication module of the second participant acquires the key of the data to be acquired from the data acquisition request, searches the data to be acquired from the local terminal database according to the key of the data to be acquired, and sends the searched data to the local terminal federal learning module.
That is to say, in this embodiment, the sending end serializes data to be transmitted to obtain serialized data, and transmits the serialized data to the receiving end; the receiving end carries out deserialization on the received data to obtain deserialized data, wherein the deserialized data is the data to be transmitted of the transmitting end.
In some embodiments, the data may also be sent after being split. The process is as follows: the method comprises the steps that a sending end serializes data to be transmitted to obtain serialized data, divides the serialized data to obtain a plurality of data segments, and transmits the data segments to a receiving end; the receiving end carries out segmentation and recombination on the received data to obtain recombined data, carries out deserialization on the recombined data to obtain deserialized data, and the deserialized data are the data to be transmitted of the transmitting end.
It should be noted that the detailed processes of steps S301 to S308 are described in the foregoing embodiments, and therefore are not described herein again.
A specific application scenario of the embodiment of the present application is described in detail below, in which a point-to-point unidirectional communication is performed between a participant a and a participant B in a federal learning system as an example, where a federal learning module a1 and a communication module a2 are deployed in the participant a, and a federal learning module B1 and a communication module B2 are deployed in the participant B. The communication method in federal learning includes the following steps, which are described in detail as follows:
at step S410, the federal learning module a1 in party a sends a data transmission request to the communication module a 2.
The data acquisition request comprises data to be transmitted, a key of the data to be transmitted and identification information of a participant B serving as a receiving end.
In step S420, the communication module a2 obtains the data to be transmitted, the key of the data to be transmitted, and the identification information of the party B serving as the receiving end from the data transmission request, and transmits the data to be transmitted and the key of the data to be transmitted to the party B according to the identification information of the party B.
Wherein, step S420 may include steps S421 to S425, which are described in detail as follows:
in step S421, the communication module a2 receives the data acquisition request sent by the federal learning module a 1.
In step S422, the communication module a2 obtains the data to be transmitted and the key of the data to be transmitted from the data obtaining request, and stores the obtained data to be transmitted and the key of the data to be transmitted in the local database.
In step S423, the communication module a2 acquires the identification information of the party B as the receiving end from the data acquisition request, and looks up the communication address of the party B from the routing table.
In step S424, the communication module a2 transmits the data to be transmitted and the key of the data to be transmitted to the communication module B2 of the party B according to the communication address of the party B.
In step S425, the communication module a2 deletes the data to be transmitted and the key of the data to be transmitted, which are stored in the local database.
After the communication module a2 successfully transmits the data to be transmitted and the key of the data to be transmitted to the party B, the communication module a2 deletes the data to be transmitted and the key of the data to be transmitted stored in the local database.
In an example, the process of steps S421 to S425 may be as shown in fig. 15, where the communication module a2 receives a data transmission request sent by the federal learning module a1, where the data transmission request includes value1 of data to be transmitted, key1 of the data to be transmitted, and identification information dst of the receiving end is 0001; then, the communication module a2 stores (store) key1 and value1 in KVDB (KV database), and looks up 0001 corresponding communication address 10.58.14.11 from RouteTable (routing table): 6666, key1 and value1 are transmitted to the communication module b2 according to the found communication address, and after successful transmission, key1 and value1 in the database are deleted (delete).
In step S430, the communication module B2 of the party B receives the data to be transmitted and the key of the data to be transmitted from the party a, and stores the data to be transmitted and the key of the data to be transmitted in the local database.
In step S440, after receiving the data acquisition request from the federal learning module b1, the communication module b2 acquires data corresponding to the data acquisition request from the local database and transmits the data to the federal learning module b 1.
The data acquisition request comprises a key of the data to be acquired, and the key of the data to be acquired can be constructed according to the context of the data to be acquired. The communication module b2 acquires the key from the data acquisition request, searches the corresponding data from the local database according to the key, and transmits the corresponding data to the federal learning module.
To conserve storage space, in one example, after data is transmitted to the federated learning module, corresponding data stored in the database may be deleted.
In an example, the process from step S430 to step S440 may be as shown in fig. 16, after receiving the value1 of the data to be transmitted and the key1 of the data to be transmitted from the communication module a2, the communication module b2 stores (store) the data to be transmitted to the KVDB (KV database) of the local end, the federal learning module b1 sends the key1 of the data to be acquired to the communication module b2, and the communication module b2 finds the value1 from the database and sends the value1 to the federal learning module b1 according to the key1, and deletes the key1 and the value1 from the database.
A specific application scenario of the embodiment of the present application is described in detail below, in which point-to-point bidirectional communication between a participant a and a participant B in a federal learning system is taken as an example for description. The communication method in federal learning includes the following steps, which are described in detail as follows:
at step S510, the federal learning module a1 in party a sends a data transmission request to the communication module a 2.
In step S520, the communication module a2 obtains the data to be transmitted, the key of the data to be transmitted, and the identification information of the party B serving as the receiving end from the data transmission request, and transmits the data to be transmitted and the key of the data to be transmitted to the party B according to the identification information of the party B.
The specific processes of step S510 to step S520 may refer to step S410 to step S420. And will not be described in detail herein.
In step S530, the communication module B2 of the party B receives the data to be transmitted and the key of the data to be transmitted from the party a, and stores the data to be transmitted and the key of the data to be transmitted in the local database.
In step S540, after receiving the data acquisition request from the federal learning module b1, the communication module b2 acquires the data to be transmitted from the local database and transmits the data to the federal learning module b 1.
The federal learning module b1 generates a data acquisition request containing the key of the data to be transmitted, and the communication module b2 searches the data to be transmitted from the database according to the key of the data to be transmitted and transmits the data to the federal learning module b 1.
In step S550, the federal learning module b1 generates response data for the data to be transmitted, and transmits a data transmission request including the response data, the key of the response data, and the identification information of the party a as the receiving end to the communication module b 2.
After acquiring the data to be transmitted, the federal learning module b1 may generate response data and generate a data transmission request, where the data transmission request includes the response data, the key of the response data, and the identification information of the party a.
In step S560, the communication module b2 obtains the response data, the key of the response data, and the identification information of the party a from the data transmission request from the bang learning module b1, and transmits the response data, the key of the response data to the party a according to the identification information of the party a.
The specific process of step S560 may refer to step S520, which is not described herein again.
In step S570, the communication module a2 receives the response data and the key of the response data from the party B, and stores the response data and the key of the response data in the local database.
The specific process of step S570 may refer to step S530, which is not described herein again.
In step S580, after receiving the data acquisition request from the federal learning module a1, the communication module a2 acquires response data from the local database and transmits the response data to the federal learning module a 1.
The federal learning module a1 may generate a data acquisition request containing a key of the response data, and the communication module a2 searches the response data from the local database according to the request and transmits the response data to the federal learning module a 1. In order to save memory, after the response data is transmitted to the federal learning module a1, the response data and the key of the response data stored in the local database may be deleted.
A specific application scenario of the embodiment of the present application is described in detail below, in which point-to-domain bidirectional communication between a participant a and a participant B and a participant C in a federal learning system is taken as an example, where a federal learning module C1 and a communication module C2 are deployed in the participant C. The communication method in federal learning includes the following steps, which are described in detail as follows:
at step S610, the federal learning module a1 in the party a sends a data transmission request to the communication module a 2.
Step S620, the communication module a2 obtains the data to be transmitted, the key of the data to be transmitted, the identification information of the party B, and the identification information of the party C from the data transmission request, transmits the first data and the key of the first data to the party B according to the identification information of the party B, and transmits the key of the first data and the key of the second data to the party C according to the identification information of the party C.
The specific processes of step S610 to step S620 may refer to step S410 to step S420, which are not described herein again.
In an example, the process of step S620 may be as shown in fig. 17, where the communication module a2 receives a data transmission request sent by the federal learning module a1, where the data transmission request includes value1 of the data to be transmitted, key1 of the data to be transmitted, and identification information dst of the receiving end is 0001 and 0002; then, the communication module a2 stores (store) key1 and value1 in KVDB (KV database), and looks up 0001 corresponding communication address 10.58.14.11 from RouteTable (routing table): 6666, 0002 corresponding communication address 10.58.14.12: 6666, key1 and value1 are transmitted to communication module b2 and communication module c2 according to the found communication addresses, and key1 and value1 in the database are deleted (delete) after successful transmission.
Step S630, the communication module b2 receives the data to be transmitted and the key of the data to be transmitted from the participant A, and stores the data to be transmitted and the key of the data to be transmitted to the local database; after receiving a data acquisition request of the federal learning module b1, acquiring data to be transmitted from a local database and transmitting the data to the federal learning module b 1.
The specific process of step S630 may refer to steps S430 to S440, which are not described herein again.
Step 640, the communication module c2 receives the data to be transmitted and the key of the data to be transmitted from the participant a, and stores the data to be transmitted and the key of the data to be transmitted to the local database; after receiving the data acquisition request of the federal learning module c1, acquiring the data to be transmitted from the local database and transmitting the data to the federal learning module c 1.
The specific process of step S640 may refer to step S430 to step S440, which is not described herein again.
In step S650, the federal learning module b1 generates response data for the data to be transmitted, and transmits a data transmission request including the response data, the key of the response data, and the identification information of the party a as the receiving end to the communication module b 2.
The specific process of step S650 may refer to step S550, which is not described herein again.
In step S660, the communication module b2 obtains the response data, the key of the response data, and the identification information of the party a from the data transmission request from the bang learning module b1, and transmits the response data, the key of the response data to the party a according to the identification information of the party a.
The specific process of step S660 may refer to step S560, which is not described herein again.
In step S670, the federal learning module c1 generates response data for the data to be transmitted, and transmits a data transmission request including the response data, the key of the response data, and the identification information of the party a as the receiving end to the communication module c 2.
The specific process of step S670 may refer to step S550, which is not described herein again.
It should be noted that the keys of the response data generated by different receiving ends for the same data to be transmitted may be the same.
In step S680, the communication module c2 obtains the response data, the key of the response data, and the identification information of the party a from the data transmission request from the bang learning module c1, and transmits the response data, the key of the response data to the party a according to the identification information of the party a.
The specific process of step S680 may refer to step S560, which is not described herein again.
In step S690, the communication module a2 receives the response data and the key of the response data from the party B and the party C, and stores the response data and the key of the response data in the local database.
After receiving the response data from the party B and the party C, the communication module a2 may combine the response data of the party B and the party C, and store the combined response data in the local database.
In step S700, after receiving the data acquisition request from the federal learning module a1, the communication module a2 acquires response data from the local database and transmits the response data to the federal learning module a 1.
The federal learning module a1 generates a data acquisition request containing the key of the response data, and the communication module a2 searches the response data from the local database according to the key in the data acquisition request and transmits the response data to the federal learning module a 1.
In an example, the specific process of steps S690-S700 may be as shown in fig. 18, where the communication module a2 receives the response data value6 and the key6 of the response data from the communication module b2, stores (store) them in the local KVDB (KV database), the communication module a2 receives the response data value7 and the key6 of the response data from the communication module c2, merges and stores the value7 and the value6 in the KVDB, finds the value7 and the value6 from the KVDB according to the key6 included in the data acquisition request after receiving the data acquisition request from the federal learning module a1, sends the value7 and the value6 to the federal learning module a1, and deletes the value7 and the value6 stored in the KVDB.
Fig. 19 is a block diagram illustrating a communication device in federal learning according to an exemplary embodiment of the present application. Applied to the participant in the federal learning system including a federal learning module and a communication module independent of the federal learning module, the device comprises:
a first control module 1901 configured to control the federal learning module to send a data transmission request to the communication module; the second control module 1902 is configured to control the communication module to obtain the data to be transmitted and the identification information of the receiving end from the data transmission request, search the communication address of the receiving end from the routing table according to the identification information of the receiving end, and transmit the data to be transmitted to the receiving end according to the searched communication address.
In another exemplary embodiment, the second control module 1902 includes:
and the serialization control module is configured to control the communication module to serialize the data to be transmitted so as to obtain serialized data.
And the first transmission control module is configured to control the communication module to transmit the serialized data to the receiving end according to the searched communication address.
In another exemplary embodiment, the second control module 1902 includes:
and the segmentation control module is configured to control the communication module to segment the data to be transmitted according to a preset segmentation rule so as to obtain a plurality of data segments.
And the second transmission control module is configured to control the communication module to sequentially transmit the plurality of data segments to the receiving end according to the searched communication address so that the receiving end recombines the received data segments to obtain recombined data.
In another exemplary embodiment, in the case that the number of the receiving ends is multiple, the apparatus further includes:
and the receiving control module is configured to control the communication module to receive response data sent by each receiving end aiming at the data to be transmitted.
And the combination control module is configured to control the communication module to combine the received response data and send the combined response data to the federal learning module.
In another exemplary embodiment, when the participant includes a first transmission module in an operating mode and a second transmission module in a non-operating mode, and the second transmission module is configured to switch a self operating state from the non-operating mode to the operating mode to become a new first transmission module when the first transmission module fails, the first control module 1901 is configured to control the federal learning module to send the data transmission request to the first transmission module, so that the first transmission module sends the data transmission request to the communication module.
It should be noted that the first transmission module, the second transmission module, the first transmission control module, the second transmission control module, the first control module, and the second control module respectively implement different functions. The first control module controls the federal learning module to send the data transmission request to the first transmission module, the first transmission module sends the data transmission request to the communication module, and the second transmission module replaces the first transmission module to work when the first transmission module fails; the second control module transmits the data to be transmitted contained in the data transmission request to the receiving end in the control communication module. The second control module may further include a first transmission control module and a second transmission control module, where the first transmission control module and the second transmission control module are respectively configured to control the communication module to transmit the data to be transmitted contained in the data transmission request to the receiving end, but transmission modes controlled by the first transmission control module and the second transmission control module are different. The functions specifically implemented by the first transmission module, the second transmission module, the first transmission control module, the second transmission control module, the first control module, and the second control module may be referred to in the foregoing description.
In an exemplary embodiment, a communication apparatus for federal learning is further provided, which is applied to a participant in a federal learning system including a federal learning module and a communication module independent of the federal learning module, and the apparatus may include: the third control module is configured to control the communication module to receive the data from the sending end and store the received data in the database; the fourth control module is configured to control the federal learning module to send a data acquisition request to the communication module; and the fifth control module is configured to control the communication module to acquire data corresponding to the data acquisition request from the database and send the acquired data to the federal learning module so that the federal learning module performs federal learning based on the data.
In another exemplary embodiment, the third control module includes:
and the recombination control module is configured to control the communication module to recombine the data segments belonging to the data to be transmitted to obtain recombined data after receiving other data segments belonging to the same data to be transmitted as the data segments if the received data are the data segments.
And the storage control module is configured to control the communication module to store the data to be transmitted, which is obtained by recombination, into the database.
It should be noted that the apparatus provided in the foregoing embodiment and the method provided in the foregoing embodiment belong to the same concept, and the specific manner in which each module and unit execute operations has been described in detail in the method embodiment, and is not described again here.
An embodiment of the present application further provides an electronic device, including: one or more processors; a storage device configured to store one or more programs, which when executed by the one or more processors, cause the electronic device to implement the communication method in federal learning provided in the above embodiments.
FIG. 20 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
It should be noted that the computer system 1600 of the electronic device shown in fig. 20 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 20, computer system 1600 includes a Central Processing Unit (CPU)1601, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, according to a program stored in a Read-Only Memory (ROM) 1602 or a program loaded from a storage portion 1608 into a Random Access Memory (RAM) 1603. In the RAM 1603, various programs and data necessary for system operation are also stored. The CPU 1601, ROM 1602, and RAM 1603 are connected to each other via a bus 1604. An Input/Output (I/O) interface 1605 is also connected to the bus 1604.
The following components are connected to the I/O interface 1605: an input portion 1606 including a keyboard, a mouse, and the like; an output section 1607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage portion 1608 including a hard disk and the like; and a communication section 1609 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. The communication section 1609 performs communication processing via a network such as the internet. The driver 1610 is also connected to the I/O interface 1605 as needed. A removable medium 1611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1610 as necessary, so that a computer program read out therefrom is mounted in the storage portion 1608 as necessary.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising a computer program for performing the method illustrated by the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via the communication portion 1609, and/or installed from the removable media 1611. When the computer program is executed by a Central Processing Unit (CPU)1601, various functions defined in the system of the present application are executed.
It should be noted that the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium may be, for example, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM), a flash Memory, an optical fiber, a portable Compact Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with a computer program embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
Yet another aspect of the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method as described above. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist separately without being incorporated in the electronic device.
Another aspect of the application also provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the methods provided in the various embodiments described above.
The above description is only a preferred exemplary embodiment of the present application, and is not intended to limit the embodiments of the present application, and those skilled in the art can easily make various changes and modifications according to the main concept and spirit of the present application, so that the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method of communication in federated learning, the method performed by a first party in a federated learning system, the first party including a federated learning module and a communication module separate from the federated learning module, the method comprising:
the federal learning module sends a data transmission request to the communication module;
the communication module acquires the data to be transmitted and the identification information of a receiving end from the data transmission request;
and searching the communication address of the receiving terminal from a routing table according to the identification information of the receiving terminal, and transmitting the data to be transmitted to the receiving terminal according to the searched communication address.
2. The method of claim 1, wherein the transmitting the data to be transmitted to the receiving end according to the searched communication address comprises:
serializing the data to be transmitted to obtain serialized data;
and transmitting the serialized data to the receiving end according to the searched communication address.
3. The method of claim 1, wherein the transmitting the data to be transmitted to the receiving end according to the searched communication address comprises:
dividing the data to be transmitted according to a preset dividing rule to obtain a plurality of data segments;
and sequentially transmitting the plurality of data segments to the receiving end according to the found communication address so that the receiving end recombines the received data segments to obtain recombined data.
4. The method of claim 1, wherein the number of said receiving ends is plural; after the transmitting the data to be transmitted to the receiving end according to the found communication address, the method further includes:
the communication module receives response data sent by each receiving end aiming at the data to be transmitted in the plurality of receiving ends;
and combining the received response data, and sending the combined response data to the federal learning module.
5. The method according to any one of claims 1-4, wherein the first party comprises a first transmission module in an active mode and a second transmission module in a non-active mode, the second transmission module is configured to switch its own working state from the non-active mode to the active mode to become a new first transmission module when the first transmission module fails; the federal learning module sends a data transmission request to the communication module, and the method comprises the following steps:
the federal learning module sends a data transmission request to the first transmission module, so that the first transmission module sends the data transmission request to the communication module.
6. A method of communication in federated learning, the method performed by a second party in a federated learning system, the second party including a federated learning module and a communication module separate from the federated learning module, the method comprising:
the communication module receives data from a sending end and stores the received data in a database;
the federal learning module sends a data acquisition request to the communication module;
the communication module acquires data corresponding to the data acquisition request from a database and sends the acquired data to the federal learning module so that the federal learning module performs federal learning based on the data.
7. The method of claim 6, wherein storing the received data to a database comprises:
if the received data is a data segment, after other data segments which belong to the same data to be transmitted as the data segment are received, recombining the data segments belonging to the data to be transmitted to obtain recombined data;
storing the reorganization data to the database.
8. A communication apparatus in federal learning, applied to a participant in a federal learning system including a federal learning module and a communication module independent of the federal learning module, the apparatus comprising:
the first control module is configured to control the federal learning module to send a data transmission request to the communication module;
and the second control module is configured to control the communication module to acquire the data to be transmitted and the identification information of the receiving end from the data transmission request, search the communication address of the receiving end from the routing table according to the identification information of the receiving end, and transmit the data to be transmitted to the receiving end according to the searched communication address.
9. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the electronic device to carry out the method of any of claims 1-7.
10. A computer-readable storage medium having computer-readable instructions stored thereon, which, when executed by a processor of a computer, cause the computer to perform the method of any one of claims 1-7.
CN202111251208.7A 2021-10-26 2021-10-26 Communication method and device in federal learning, electronic equipment and storage medium Pending CN113973125A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111251208.7A CN113973125A (en) 2021-10-26 2021-10-26 Communication method and device in federal learning, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111251208.7A CN113973125A (en) 2021-10-26 2021-10-26 Communication method and device in federal learning, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113973125A true CN113973125A (en) 2022-01-25

Family

ID=79588508

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111251208.7A Pending CN113973125A (en) 2021-10-26 2021-10-26 Communication method and device in federal learning, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113973125A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114186213A (en) * 2022-02-16 2022-03-15 深圳致星科技有限公司 Data transmission method, device, equipment and medium based on federal learning
CN115249074A (en) * 2022-07-28 2022-10-28 上海光之树科技有限公司 Distributed federal learning method based on Spark cluster and Ring-AllReduce architecture
CN116361838A (en) * 2023-05-23 2023-06-30 华控清交信息科技(北京)有限公司 Data processing method, device and system and readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104376029A (en) * 2014-04-10 2015-02-25 亚信科技(中国)有限公司 Data processing method and system
CN110769465A (en) * 2019-10-24 2020-02-07 Oppo(重庆)智能科技有限公司 Data transmission method and device, electronic equipment and readable storage medium
CN111858955A (en) * 2020-07-01 2020-10-30 石家庄铁路职业技术学院 Knowledge graph representation learning enhancement method and device based on encrypted federated learning
CN112164224A (en) * 2020-09-29 2021-01-01 杭州锘崴信息科技有限公司 Traffic information processing system, method, device and storage medium for information security
CN112948129A (en) * 2021-03-30 2021-06-11 深圳致星科技有限公司 Data transmission optimization method and device based on federal learning and readable storage medium
CN113537508A (en) * 2021-06-18 2021-10-22 百度在线网络技术(北京)有限公司 Federal calculation processing method and device, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104376029A (en) * 2014-04-10 2015-02-25 亚信科技(中国)有限公司 Data processing method and system
CN110769465A (en) * 2019-10-24 2020-02-07 Oppo(重庆)智能科技有限公司 Data transmission method and device, electronic equipment and readable storage medium
CN111858955A (en) * 2020-07-01 2020-10-30 石家庄铁路职业技术学院 Knowledge graph representation learning enhancement method and device based on encrypted federated learning
CN112164224A (en) * 2020-09-29 2021-01-01 杭州锘崴信息科技有限公司 Traffic information processing system, method, device and storage medium for information security
CN112948129A (en) * 2021-03-30 2021-06-11 深圳致星科技有限公司 Data transmission optimization method and device based on federal learning and readable storage medium
CN113537508A (en) * 2021-06-18 2021-10-22 百度在线网络技术(北京)有限公司 Federal calculation processing method and device, electronic equipment and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114186213A (en) * 2022-02-16 2022-03-15 深圳致星科技有限公司 Data transmission method, device, equipment and medium based on federal learning
CN114186213B (en) * 2022-02-16 2022-07-05 深圳致星科技有限公司 Data transmission method, device, equipment and medium based on federal learning
CN115249074A (en) * 2022-07-28 2022-10-28 上海光之树科技有限公司 Distributed federal learning method based on Spark cluster and Ring-AllReduce architecture
CN115249074B (en) * 2022-07-28 2023-04-14 上海光之树科技有限公司 Distributed federal learning method based on Spark cluster and Ring-AllReduce architecture
CN116361838A (en) * 2023-05-23 2023-06-30 华控清交信息科技(北京)有限公司 Data processing method, device and system and readable storage medium
CN116361838B (en) * 2023-05-23 2023-08-11 华控清交信息科技(北京)有限公司 Data processing method, device and system and readable storage medium

Similar Documents

Publication Publication Date Title
CN113973125A (en) Communication method and device in federal learning, electronic equipment and storage medium
CN108769150B (en) Data processing method and device of block chain network, cluster node and storage medium
US10951395B2 (en) Data fetching in data exchange networks
CN109951546B (en) Transaction request processing method, device, equipment and medium based on intelligent contract
US20230291808A1 (en) Data processing method and apparatus, device and medium
US20050120073A1 (en) Method and apparatus for sharing applications using P2P protocol
CN104054068A (en) Improved bandwidth optimization for remote desktop protocol
CN111988323B (en) IPSec tunnel establishment method, IPSec tunnel establishment device, network system and electronic equipment
US9350606B2 (en) System and method for assigning server to terminal and efficiently delivering messages to the terminal
CN115361143A (en) Cross-domain data transmission method and device, electronic equipment and computer readable medium
US20120266211A1 (en) Transparent database connection reconnect
KR100597405B1 (en) System and method for relaying data by use of socket applicaton program
WO2024027288A1 (en) Resource rendering method and apparatus, and device, computer-readable storage medium and computer program product
CN112217735A (en) Information synchronization method and load balancing system
CN113810264B (en) Information transmission method, device, electronic equipment and storage medium
US11582674B2 (en) Communication device, communication method and data structure
CN112714274A (en) Video conference method and video conference resource management method
JP3751301B2 (en) Multi-node communication system
US20240244040A1 (en) Communication based on relay cluster
JP6048149B2 (en) COMMUNICATION CONTROL METHOD, INFORMATION PROCESSING SYSTEM, COMMUNICATION CONTROL DEVICE, AND COMMUNICATION CONTROL PROGRAM
CN116260859B (en) Data configuration system
CN113923046B (en) Method and system for realizing distributed firewall secure communication
CN115086425B (en) Message transmission method, device, program product, medium and electronic equipment
CN117857610A (en) Data communication method and device, computer readable storage medium and electronic equipment
WO2016090914A1 (en) Method and device for sending linkage data updating instruction

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