Algorithm component intercommunication method and device, storage medium and electronic equipment
By registering the agent component provider and component docking module in the federated learning platform to generate agent components, the problem of algorithm component interoperability between different platforms is solved, efficient data interaction is achieved, development workload is reduced and operating efficiency is maintained.
Patent Information
- Application Number
- CN202410191984.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-21
- Publication Date
- 2024-10-18
AI Technical Summary
Algorithm components between different federated learning platforms cannot be interconnected, making data interaction difficult, and rewriting them into a programming language that conforms to platform specifications will lead to performance degradation.
By registering the agent component provider and component docking module in the federated learning platform, agent components are generated to realize data interaction between algorithm components and the platform, avoiding code rewriting.
It realizes the interoperability of algorithm components between different platforms, reduces development workload, maintains operating efficiency, and avoids performance degradation.
Smart Images

Figure CN118796501A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of federated learning and big data technology, and in particular to a method, device, computer-readable storage medium and electronic device for intercommunication of algorithm components. Background Art
[0002] Federated Learning is a distributed machine learning method that allows model training on multiple local devices to protect privacy and reduce data transmission. This processing method can be used to jointly train models through interactive model intermediate parameters, achieving a balance between data privacy protection and data sharing analysis.
[0003] In related technologies, different manufacturers have developed different federated learning platforms, which are usually unable to connect with each other and collaborate to complete federated learning tasks. Therefore, when different participants work together to carry out federated learning projects, there is a problem that data cannot be connected and circulated between the participants due to the different federated learning platforms deployed by the participants.
[0004] For example, the core federated training code of the widely used open source federated learning framework FATE (Federated AI Technology Enabler) is written in Python, and the algorithm components used are also Python files (groups) that conform to the FATE custom component implementation specifications. However, the algorithm components in many other federated learning platforms are written in other programming languages (such as Go, C++, etc.) and run as independent processes or Docker containers. Such algorithm components cannot be directly integrated into FATE, and cannot be interconnected with FATE. If the running code in such an algorithm component is to be rewritten in Python according to the FATE custom component implementation specifications, the workload will be very huge, resulting in poor algorithm component operation efficiency. If such an algorithm component has made many performance optimizations based on the characteristics of the original programming language it uses, rewriting it in Python will lead to a decrease in the performance of the algorithm component. Summary of the invention
[0005] The purpose of the embodiments of the present invention is to provide a method, device, computer-readable storage medium and electronic device for intercommunication of algorithm components.
[0006] In order to achieve the above object, an embodiment of the present invention provides a method for intercommunication of algorithm components, which is applied to an agent system of a federated learning platform. The agent system includes a platform docking module and a component docking module. The method includes:
[0007] In response to the federated training service of the federated learning platform, registering the proxy component provider in the federated learning platform through the platform docking module, and starting the instance process of the component docking module;
[0008] After registering the algorithm component in the instance process of the component docking module, generating an agent component suitable for the federated learning platform through the component docking module, and registering the agent component in the federated learning platform;
[0009] In response to the federated learning platform's request for obtaining the proxy component, generating a proxy class instance of the proxy component through the proxy component provider;
[0010] During the operation of the proxy component, data interaction of the algorithm component is realized through the interface of the proxy class instance of the proxy component, wherein the data interaction is data interaction during the execution of the federated training task.
[0011] Furthermore, the registering of the proxy component provider in the federated learning platform through the platform docking module specifically includes:
[0012] Obtaining property information of the proxy component provider;
[0013] The attribute information of the proxy component provider is written into the memory of the federated learning platform.
[0014] Further, after registering the algorithm component in the instance process of the component docking module, generating a proxy component suitable for the federated learning platform through the component docking module, and registering the proxy component in the federated learning platform, includes:
[0015] After the algorithm component is started, the interface call information corresponding to the instance process of the component docking module is loaded into the process of the algorithm component; wherein the interface call information includes an IP address and a listening port number;
[0016] In response to a component registration request initiated by the algorithm component to the component docking module through the interface of the component docking module, the algorithm component is registered to the instance process of the component docking module, and the proxy component is generated through the component docking module; wherein the algorithm component calls the interface of the component docking module through the interface calling information;
[0017] By calling the first HTTP interface of the federated training service, the proxy component is registered in the federated learning platform, and the component provider of the proxy component is registered as the proxy component provider.
[0018] Furthermore, the method further comprises:
[0019] After registering the proxy component in the federated learning platform, periodically receiving a heartbeat request sent by the algorithm component through the component docking module;
[0020] If the component docking module does not receive the heartbeat request within a preset time period, the proxy component corresponding to the algorithm component is removed from the federated learning platform by calling the second HTTP interface of the federated training service.
[0021] Further, in response to the federated learning platform's request for obtaining the proxy component, generating a proxy class instance of the proxy component through the proxy component provider includes:
[0022] In response to the acquisition request, calling a module interface on the component docking module through the proxy component provider;
[0023] Obtaining component information of the algorithm component corresponding to the proxy component from the component docking module through the module interface; wherein the component information includes: component name, component IP address information, and component port number;
[0024] The proxy component provider generates a proxy class instance of the proxy component according to the component information, and returns the proxy class instance to the federated learning platform.
[0025] Further, the generating of the proxy class instance of the proxy component according to the component information by the proxy component provider includes:
[0026] The component information is processed by the proxy component provider using the metaclass function in Python, and a proxy class instance of the proxy component is obtained after processing; wherein the component information includes the IP address and port number of the algorithm component.
[0027] Furthermore, during the operation of the proxy component, data interaction of the algorithm component is realized through the interface of the proxy class instance of the proxy component, including:
[0028] Obtaining component parameters and input data of the algorithm component sent by the federated learning platform through the interface of the proxy class instance, and forwarding the component parameters and input data to the algorithm component;
[0029] Obtaining a computing instruction sent by the federated learning platform through the interface of the proxy class instance, and forwarding the computing instruction to the algorithm component; wherein the computing instruction is sent after the algorithm component successfully receives the component parameters and the input data;
[0030] After the algorithm component obtains the output result of the calculation instruction, it obtains the output result acquisition request sent by the federated learning platform through the interface of the proxy class instance, forwards the acquisition request to the algorithm component, and transmits the output result fed back by the algorithm component based on the acquisition request to the federated learning platform.
[0031] In order to achieve the above-mentioned purpose, an embodiment of the present invention further provides a device for intercommunication of algorithm components, which is arranged in an agent system of a federated learning platform, and the device includes:
[0032] A component provider registration unit, configured to register a proxy component provider in the federated learning platform through the platform docking module in response to a federated training service of the federated learning platform, and to start an instance process of the component docking module;
[0033] A component registration unit, configured to generate a proxy component applicable to the federated learning platform through the component docking module after registering the algorithm component in the instance process of the component docking module, and register the proxy component in the federated learning platform;
[0034] A component instantiation unit, configured to generate an agent class instance of the agent component through the agent component provider in response to an acquisition request of the federated learning platform for the agent component;
[0035] A component operation unit is used to realize data interaction of the algorithm component through the interface of the proxy class instance of the proxy component during the operation of the proxy component, wherein the data interaction operation is data interaction during the execution of a federated training task.
[0036] An embodiment of the present invention further provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, the device where the computer-readable storage medium is located controls the execution of any of the above-mentioned methods for intercommunication of algorithm components.
[0037] An embodiment of the present invention further provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements any of the above-mentioned methods for intercommunication of algorithm components when executing the computer program.
[0038] The embodiment of the present invention provides a method, device, computer-readable storage medium and electronic device for algorithm component intercommunication. In the embodiment of the present application, the agent system can respond to the federated training service of the federated learning platform, register the agent component provider in the federated learning platform through the platform docking module in the agent system, and start the instance process of the component docking module; next, after registering the algorithm component in the instance process of the component docking module, the agent component suitable for the federated learning platform can be generated through the component docking module, and the agent component can be registered in the federated learning platform; thereafter, in response to the acquisition request of the federated learning platform for the agent component, the agent class instance of the agent component can be generated through the agent component provider; and during the operation of the agent component, the data interaction of the algorithm component is realized through the interface of the agent class instance of the agent component, wherein the data interaction is the data interaction during the execution of the federated training task.
[0039] Through the above processing method, there is no need to rewrite the code of the algorithm component in other programming languages according to the component implementation specifications of the connected federated learning platform, so as to achieve the interconnection between the algorithm component and the connected federated learning platform, reduce the development workload, maintain the operating efficiency of the algorithm component, and will not affect the performance of the algorithm component, thereby solving the interconnection problem when the algorithm component running in the form of an independent process or Docker container is connected to the federated learning platform that requires the component to be integrated into the code base in the form of a static file. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is a flowchart of a preferred embodiment of a method for intercommunication of algorithm components provided by the present invention;
[0041] Figure 2 It is a structural block diagram of a preferred embodiment of an agent system provided by the present invention;
[0042] Figure 3 It is a flow chart of registering an agent component provider in the federated learning platform through a platform docking module provided by the present invention;
[0043] Figure 4 It is a flowchart provided by the present invention for generating a proxy component suitable for a federated learning platform through a component docking module and registering the proxy component in the federated learning platform;
[0044] Figure 5 It is a flow chart of generating a proxy class instance of the proxy component through a proxy component provider provided by the present invention;
[0045] Figure 6 It is a flowchart provided by the present invention for realizing data interaction of algorithm components through the interface of the proxy class instance of the proxy component during the operation of the proxy component;
[0046] Figure 7 It is a schematic diagram of a device for interconnecting algorithm components provided by the present invention;
[0047] Figure 8 It is a schematic diagram of an electronic device provided by the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this technical field without creative work are within the scope of protection of the present invention.
[0049] The embodiment of the present invention provides a method for algorithm component intercommunication, see Figure 1 , which is a flowchart of a preferred embodiment of a method for intercommunication of algorithm components provided by the present invention, wherein the method is applied to a connected federated learning platform, wherein the federated learning platform runs an agent system, wherein the agent system includes a platform docking module and a component docking module, and wherein the method includes steps S101 to S104:
[0050] Step S101: In response to the federated training service of the federated learning platform, register the proxy component provider in the federated learning platform through the platform docking module, and start the instance process of the component docking module.
[0051] In an embodiment of the present application, the proxy system includes a platform docking module and a component docking module; wherein the platform docking module is used to dock with the FATE platform (i.e., the federated learning platform). The platform docking module is integrated into FATE in the form of a static Python file (group) for calling by other parts of the FATE platform. The component docking module is used to dock with the algorithm components running in the form of a process or in the form of a Docker container to realize the functions of registration and communication with the algorithm components. Here, the component docking module can be written in Python. In the actual operation of the component docking module, a resident background process (i.e., component docking process) can be started to communicate in real time with each algorithm component through the component docking process.
[0052] Here, registering the proxy component provider in the federated learning platform can be understood as adding the attribute information of the proxy component provider to the memory of the federated learning platform after the FATE platform is started, wherein the attribute information includes the name, source file path, version, etc. of the proxy component provider. Here, after the proxy component provider is registered, the instance process of the component docking module can also be started, so that the instance process is in an available state to execute subsequent processes.
[0053] Step S102: After registering the algorithm component in the instance process of the component docking module, generate an agent component suitable for the federated learning platform through the component docking module, and register the agent component in the federated learning platform.
[0054] Here, after completing the initialization of the platform docking module and the component docking module according to the above steps, the algorithm component to be registered can be registered to the instance process of the component docking module, so that the component docking module can generate a special component that meets the native component registration requirements of the FATE platform. This special component is also called a proxy component. The proxy component can be registered on the FATE platform through the platform docking module.
[0055] Step S103: In response to the federated learning platform's request to obtain the proxy component, generate a proxy class instance of the proxy component through the proxy component provider.
[0056] In an embodiment of the present application, when the federated training task performed by the FATE platform requires the proxy component registered in the above steps, a request for acquisition can be sent to the proxy system. After detecting the acquisition request, the proxy system can generate a proxy class instance (also called a component running instance) of the proxy component through the proxy component provider; wherein the generated proxy class instance refers to the proxy class instance object of the proxy component used in the federated training task. After generating the proxy class instance of the proxy component, the proxy class instance can be returned to the FATE platform.
[0057] Step S104: During the operation of the proxy component, data interaction of the algorithm component is realized through the interface of the proxy class instance of the proxy component, wherein the data interaction is data interaction during the execution of the federated training task.
[0058] In the embodiment of the present application, data interaction is used to indicate that during the process of the agent component executing the federated training task, the FATE platform interacts with the algorithm component through the agent class instance; through this data interaction, the federated training task can be completed.
[0059] Through the above processing method, there is no need to rewrite the code of the algorithm component in other programming languages according to the component implementation specifications of the connected federated learning platform, so as to achieve the interconnection between the algorithm component and the connected federated learning platform, reduce the development workload, maintain the operating efficiency of the algorithm component, and will not affect the performance of the algorithm component, thereby solving the interconnection problem when the algorithm component running in the form of an independent process or Docker container is connected to the federated learning platform that requires the component to be integrated into the code base in the form of a static file.
[0060] like Figure 2 The figure shows a schematic diagram of the structure of an agent system. Figure 2 As shown in the figure, the connected federated learning platform is the FATE platform, and the algorithm component is an independently running component process A or a component container B running in a Docker container. Figure 2 As shown, the agent system includes two parts: a platform docking part (ie, a platform docking module) and a component docking part (ie, a component docking module).
[0061] From the above description, we can know that the platform docking part is used to interact with the FATE platform, thereby providing the FATE platform with Python files (groups) that comply with its component implementation specifications. The platform docking part can realize the following functions: component provider (Provider) registration, proxy component registration, component instantiation and component runtime (runtime) functions. Here, the platform docking part is integrated into the FATE platform in the form of static Python files (groups), which can be called by other parts of the FATE platform.
[0062] like Figure 2 As shown, the component docking part can interact with the algorithm component (for example, component process A running as an independent process or component container B running as a Docker container). The component docking part can register component process A or component container B and communicate with the algorithm component. Here, the component docking part is written in Python. When the component docking part is running, a resident background process can be started to communicate with each algorithm component in real time.
[0063] Here, if Figure 2 The FATE platform, component process A and component container B are an optional embodiment of the technical solution disclosed in the present invention. Other platforms and component processes that can use the disclosed technical solution to implement federated training are within the protection scope of this application.
[0064] Next, we will combine Figure 2 The main process of the disclosed technical solution is briefly introduced, and the specific process is described as follows:
[0065] After the federated training service is started on the FATE platform, the initialization of the proxy component provider in the platform docking part and the initialization of the component docking part can be realized by running the execution code of the federated training service. Here, the initialization of the proxy component provider can be understood as registering the proxy component provider in the platform docking part to the memory of all registered providers on the FATE platform; the initialization of the component docking part can be understood as starting the instance process of the component docking part.
[0066] After completing the registration of the proxy component provider, the algorithm component can be registered in the instance process of the component docking part. After registration, a component that meets the native component registration requirements of the FATE platform can be generated through the component docking part, which can be called a proxy component. The proxy component is registered on the FATE platform through the platform docking part.
[0067] After completing the registration of the algorithm component, when the FATE platform executes a federated training task and determines that the federated training task uses the registered algorithm component, a proxy class instance of the proxy component is generated through the proxy component provider and the proxy class instance is returned to the FATE platform.
[0068] During the operation of the proxy component, data interaction between the FATE platform and the component process is realized through the proxy class instance, thereby completing the federated training task.
[0069] It can be seen from the above description that in the disclosed embodiment, a proxy system is deployed between the federated learning platform and the algorithm component. On the one hand, the proxy system can interact with the federated learning platform, and on the other hand, the proxy system can interact with the algorithm component or Docker container, thereby solving the problem that the algorithm component and the federated learning platform cannot be interconnected in the prior art. Here, the algorithm component can achieve interconnection between the algorithm component and the federated learning platform by setting a communication interface for communicating with the proxy system. There is no need to make major modifications to the core process inside the algorithm component, and there is no need to rewrite the algorithm component code in other programming languages according to the component implementation specifications of the federated learning platform, thereby reducing the development workload, maintaining the operating efficiency of the algorithm component, and will not affect the performance of the algorithm component.
[0070] In an optional embodiment, if Figure 3 As shown, the above step S101 registers the proxy component provider in the federated learning platform through the platform docking module and starts the instance process of the component docking module, which specifically includes the following steps:
[0071] Step S11: Add the proxy component provider to the registered Provider collection in the memory.
[0072] In specific implementation, the registration source code of the proxy component provider can be run to obtain the attribute information of the proxy component provider, and the attribute information of the proxy component provider can be written into the memory of the federated learning platform to complete the registration of the proxy component provider.
[0073] Here, the property information of the proxy component provider includes at least one of the following: the name, source file path, version and other information of the proxy component provider.
[0074] For the FATE platform, after the federated training service of the FATE platform is started, the step of registering the component provider is performed. At this time, in addition to the original component providers Default Provider and FateFlow Provider, the proxy component provider Proxy Provider proposed by the technical solution of the present disclosure is added and registered.
[0075] Step S12: starting the instance process of the component docking module.
[0076] In the embodiment of the present disclosure, a startup program of the instance process of the component docking module can also be added to the startup process. During the execution of the startup process, the instance process of the component docking module can be started by running the startup program.
[0077] In an optional implementation, after registering the algorithm component in the instance process of the component docking module, the above step S102 generates a proxy component suitable for the federated learning platform through the component docking module, and registers the proxy component in the federated learning platform, specifically including the following steps:
[0078] Step S21: after the algorithm component is started, the interface call information corresponding to the instance process of the component docking module is loaded into the process of the algorithm component; wherein the interface call information includes an IP address and a listening port number;
[0079] Step S22: In response to a component registration request initiated by the algorithm component to the component docking module through the interface of the component docking module, register the algorithm component to the instance process of the component docking module, and generate the proxy component through the component docking module; wherein the algorithm component calls the interface of the component docking module through the interface calling information;
[0080] Step S23: registering the proxy component in the federated learning platform by calling the first HTTP interface of the federated training service, and registering the component provider of the proxy component as the proxy component provider.
[0081] In the disclosed embodiment, after the proxy component is registered in the federated learning platform, the component docking module in the proxy system can be independently run as a background process. At this time, the component docking module can open a listening port, which can communicate with the component process.
[0082] After the algorithm component (i.e., component process) is started, the interface call information of the component docking module can be loaded into the process of the algorithm component, wherein the interface call information includes the IP address corresponding to the instance process of the component docking module and the listening port number opened on the component docking module.
[0083] Here, the IP address and listening port number can be loaded into the algorithm component process by modifying the algorithm component's system configuration file. In addition, the environment variables can be configured in the computer system that executes the program, and the relevant configuration can be read by reading the relevant environment variables when the program starts; for example, the IP address and listening port number can be configured as environment variables, and the relevant configuration (i.e., IP address and listening port number) can be read by reading the relevant environment variables.
[0084] Afterwards, the algorithm component can initiate a call request for the interface of the component docking module to the component docking module based on the interface call information, and after successfully calling the interface, send a component registration request to the component docking module through the interface, wherein the component registration request carries information about the algorithm component itself, such as the name, introduction, IP address, listening port and other information of the algorithm component.
[0085] After the component docking module receives the component registration request, the algorithm component can be registered in the instance process of the component docking module, and a proxy component suitable for the federated learning platform can be generated through the component docking module.
[0086] After the proxy component is generated, the component docking module can register the proxy component in the federated learning platform by calling the first HTTP interface preset on the federated training service, and register the component provider corresponding to the proxy component as the proxy component provider.
[0087] It should be noted that the algorithm components in the federated learning platform will save their corresponding component providers in the running memory. Taking the FATE platform as an example, each algorithm component in the FATE platform will save its corresponding Provider in the running memory. The Providers originally supported by the FATE platform include the Default Provider and the Fate Flow Provider. In the above embodiment, the Proxy Provider is registered. Therefore, after the proxy component corresponding to the algorithm component is registered in the connected federated learning platform, when the information of the proxy component is saved in the memory, the content of the Provider part can be set to the proxy component to provide the Proxy Provider.
[0088] In an optional embodiment, the method further comprises the following steps:
[0089] Step S31: After registering the proxy component in the federated learning platform, periodically receiving a heartbeat request sent by the algorithm component through the component docking module;
[0090] Step S32: If the component docking module does not receive the heartbeat request within a preset time period, the proxy component corresponding to the algorithm component is removed from the federated learning platform by calling the second HTTP interface of the federated training service.
[0091] After registering the proxy component in the federated learning platform, the algorithm component will periodically call the specific network interface on the component docking module and send a heartbeat request to the component docking module.
[0092] Here, in order to indicate to the component docking module that its own process is in a running state, the algorithm component needs to periodically send a request to the component docking module to prove its own survival, that is, a heartbeat request.
[0093] If the component docking module receives the heartbeat request sent by the algorithm component on a regular basis, it is confirmed that the algorithm component is in operation. If the component docking module has not received the heartbeat request sent by the algorithm component within the preset time period, the proxy component corresponding to the algorithm component is removed from the federated learning platform by calling the second HTTP interface of the federated training service, and accordingly, the algorithm component is also removed from the instance process of the component docking module. Here, the specific network interface can be understood as an interface for monitoring the heartbeat request of the algorithm component.
[0094] It can be seen from the above description that in addition to sending a heartbeat request to the component docking module, the algorithm component can also send other network requests (for example, component registration requests) to the component docking module. Based on this, the component docking module can parse the request content of the monitored network request of the external algorithm component, and thus determine the interface corresponding to the network request through the request content.
[0095] For example, if the network request is a component registration request, the component registration request is received through the corresponding interface in the component docking module, and the business logic of the component registration is executed; if the network request is a heartbeat request, the heartbeat request is received through the specific network interface, and the running status of the algorithm component is monitored through the heartbeat request.
[0096] That is to say, in the embodiment of the present disclosure, in addition to maintaining a collection of registered component processes (or component Docker containers) in memory, the component docking module can also save information such as the name, IP address, port, and last heartbeat timestamp of each component process (or component Docker container).
[0097] Combine the following Figure 4 The above process is introduced as follows: Figure 4 As shown, the process is described as follows:
[0098] First, the component process sends a component registration request to the component docking module.
[0099] Here, after detecting the component process (that is, the algorithm component), the IP address and listening port number of the instance process of the component docking module can be first loaded into the process of the algorithm component; then, a call request to the interface is initiated through the IP address and the listening port number, and after successfully calling the interface, the component registration request is sent to the component docking module through the interface.
[0100] Secondly, the component docking module sends the registration application of the proxy component to the FATE platform.
[0101] Here, after receiving the component registration request, the component docking module can register the algorithm component to the instance process of the component docking module, and generate a proxy component through the component docking module; then, after generating the proxy component of the component process, send a registration application for the proxy component to the FATE platform.
[0102] Next, the component docking module receives the registration result returned by the FATE platform and forwards the registration result to the component process.
[0103] Finally, after the registration is successful, the component process sends the heartbeat request to the component docking module, so that the component docking module monitors the running state of the component process based on the heartbeat request.
[0104] In another optional implementation, the above step S103 generates a proxy class instance of the proxy component through the proxy component provider in response to the federated learning platform's request to obtain the proxy component, and specifically includes the following steps:
[0105] Step S41: In response to the acquisition request, calling the module interface on the component docking module through the proxy component provider;
[0106] Step S42: Obtaining component information of the algorithm component corresponding to the proxy component from the component docking module through the module interface; wherein the component information includes: component name, component IP address information, and component port number;
[0107] Step S43: Generate a proxy class instance of the proxy component according to the component information through the proxy component provider, and return the proxy class instance to the federated learning platform.
[0108] In the embodiments of the present application, Figure 5 As shown, if the above registered proxy component is required in the federated training task executed by the FATE system, the FATE platform can send an acquisition request for the algorithm component to the proxy component provider. After receiving the acquisition request, the proxy component provider can call the module interface on the component docking module, thereby sending a request to obtain component information to the component docking module through the module interface. After receiving the acquisition request for component information, the component docking module can return the component information to the proxy component provider; wherein the component information includes information such as component name, component IP address information, and component port number.
[0109] After receiving the component information, the proxy component provider can generate a proxy class instance. For example, it can generate a proxy class instance of the proxy component according to the component information and return the proxy class instance to the FATE platform; wherein the generated proxy class instance refers to the proxy class instance object of the proxy component used in the federated training task.
[0110] Here, when the proxy component is registered in the memory of the FATE platform, the information of the proxy component provider corresponding to the proxy component is written in the memory at the same time. At this time, the information of the proxy component provider (ProxyProvider) corresponding to the proxy component can be found. At this time, the code of the Proxy Provider can be loaded in the program, and the relevant business code in the code can be called. By running the business code, the proxy class instance of the proxy component can be generated.
[0111] In an optional implementation, the above step generates a proxy class instance of the proxy component according to the component information by the proxy component provider, specifically comprising the following steps:
[0112] The component information is processed by the proxy component provider using the metaclass function in Python, and a proxy class instance of the proxy component is obtained after processing; wherein the component information includes the IP address and port number of the algorithm component.
[0113] In the disclosed embodiment, the proxy component provider can generate a proxy class instance of the corresponding proxy component based on the information of the algorithm component corresponding to the proxy component and utilize the metaclass function in Python, and then return the proxy class instance to the FATE platform.
[0114] In an optional implementation, the above steps implement data interaction of the algorithm component through the interface of the proxy class instance of the proxy component during the operation of the proxy component, and specifically include the following steps:
[0115] Step S51: obtaining component parameters and input data of the algorithm component sent by the federated learning platform through the interface of the proxy class instance, and forwarding the component parameters and input data to the algorithm component;
[0116] Step S52: obtaining the computing instruction sent by the federated learning platform through the interface of the proxy class instance, and forwarding the computing instruction to the algorithm component; wherein the computing instruction is sent after the algorithm component successfully receives the component parameters and the input data;
[0117] Step S53: After the algorithm component obtains the output result of the calculation instruction, obtain the output result acquisition request sent by the federated learning platform through the interface of the proxy class instance, forward the acquisition request to the algorithm component, and transmit the output result fed back by the algorithm component based on the acquisition request to the federated learning platform.
[0118] In an embodiment of the present application, during the operation of the proxy component, the FATE platform can call the interface on the proxy class instance of the proxy component to perform component parameter transfer, input data transfer, execution of calculation instructions, and output data transfer. The proxy class instance can call the corresponding interface on the corresponding proxy component in the form of a network request, thereby passing component parameters, input data, execution of calculation instructions, and output data to the component process corresponding to the proxy component through the interface. Through this process, the component process corresponding to the proxy component participates in and completes the federated training task in the connected federated learning platform.
[0119] The following will be combined Figure 6 Introducing the above process, the specific process is described as follows:
[0120] First, the FATE platform sends the component parameters to the proxy class instance, and the proxy class instance forwards the component parameters to the component process. After successfully receiving the component parameters, the component process sends a successful reception response to the proxy class instance, and the proxy class instance forwards the successful reception response to the FATE platform.
[0121] Here, the component parameters are associated with the federated training task. For example, the component parameters may be parameters such as the starting value of training, the training step size, and the conditions for the end of training in the federated training task. The present disclosure does not make specific limitations on this, and it is subject to what can be implemented.
[0122] Secondly, the FATE platform sends input data to the proxy class instance, and the proxy class instance forwards the input data to the component process. After successfully receiving the input data, the component process sends a successful reception response to the proxy class instance, and the proxy class instance forwards the successful reception response to the FATE platform.
[0123] Here, the input data can be understood as the input data of the neural network model to be trained in the federated training task. The present disclosure does not specifically limit the data type of the input data, which is subject to implementation.
[0124] Next, the FATE platform sends a computation instruction to the proxy class instance (i.e. Figure 6 The proxy class instance forwards the calculation instruction to the component process. After successfully receiving the calculation instruction, the component process processes the input data through the neural network model to be trained to obtain the output result. After the component process completes the calculation, it sends a calculation completion response to the proxy class instance, and the proxy class instance forwards the calculation completion response to the FATE platform.
[0125] Finally, the FATE platform sends a request to obtain the output result to the proxy class instance, and the proxy class instance forwards the request to obtain the output result to the component process. After successfully receiving the request to obtain the output result, the component process sends the output result to the proxy class instance, and the proxy class instance forwards the output result to the FATE platform.
[0126] It can be seen from the above description that in the disclosed embodiment, the FATE platform performs processes such as sending component parameters, passing in input data, performing calculations, and obtaining output data with the proxy class instance by calling the interface of the proxy class instance. The proxy class instance calls several interfaces on the component process A in the form of network requests, and performs processes such as sending component parameters, sending input data, performing calculations, and obtaining output data with each component process. Through this processing method, each component process is assisted to participate in and complete the federated training task in the FATE platform.
[0127] Here, the algorithm components on the FATE platform generally perform distributed machine learning training tasks. For example, the logistic regression (a certain machine learning algorithm) algorithm component performs a logistic regression training task. This disclosure does not specifically limit the task content of the training task, which is subject to achievable implementation.
[0128] From the above description, it can be seen that the technical solution disclosed in the present invention has transformed the algorithm components (i.e., component processes or component Docker containers) and the federated learning platform respectively.
[0129] After the algorithm component is modified, the component process or component Docker container needs to initiate a component registration request to the component docking module when it is started; after the algorithm component is successfully registered, it is also necessary to send a heartbeat request to the component docking module at regular intervals. In addition, the component process or component Docker container also needs to implement interface functions such as receiving component parameters, receiving input data, performing calculations, and returning output data. Compared with the existing technology, the above-mentioned modification workload is greatly reduced, while also ensuring the processing quality of the algorithm component.
[0130] After the federated learning platform is transformed, when the federated training service of the federated learning platform is started, on the basis of registering the original component provider, the proxy component provider Proxy Provider proposed in the embodiment of the present invention can be added and registered. In addition, the federated training service also needs to provide an additional HTTP interface for the component docking part of the proxy system to register new components and delete components.
[0131] The embodiment of the present invention further provides a device for intercommunication of algorithm components, which is used to implement the method for intercommunication of algorithm components described in any of the above embodiments, see Figure 7 , which is a structural block diagram of a preferred embodiment of a device for intercommunication of algorithm components provided by the present invention, wherein the device is arranged in a proxy system of a federated learning platform, and comprises: a component provider registration unit 10, a component registration unit 20, a component instantiation unit 30 and a component operation unit 40;
[0132] A component provider registration unit 10, configured to register a proxy component provider in the federated learning platform through the platform docking module in response to the federated training service of the federated learning platform, and start an instance process of the component docking module;
[0133] A component registration unit 20, configured to generate a proxy component applicable to the federated learning platform through the component docking module after registering the algorithm component in the instance process of the component docking module, and register the proxy component in the federated learning platform;
[0134] A component instantiation unit 30, configured to generate an agent class instance of the agent component through the agent component provider in response to the federated learning platform's request for obtaining the agent component;
[0135] The component operation unit 40 is used to realize the data interaction of the algorithm component through the interface of the proxy class instance of the proxy component during the operation of the proxy component, wherein the data interaction operation is the data interaction during the execution of the federated training task.
[0136] In a possible implementation manner, the component provider registration unit 10 is further configured to:
[0137] Obtaining property information of the proxy component provider;
[0138] The attribute information of the proxy component provider is written into the memory of the federated learning platform.
[0139] In a possible implementation manner, the component registration unit 20 is further configured to:
[0140] After the algorithm component is started, the interface call information corresponding to the instance process of the component docking module is loaded into the process of the algorithm component; wherein the interface call information includes an IP address and a listening port number;
[0141] In response to a component registration request initiated by the algorithm component to the component docking module through the interface of the component docking module, the algorithm component is registered to the instance process of the component docking module, and the proxy component is generated through the component docking module; wherein the algorithm component calls the interface of the component docking module through the interface calling information;
[0142] By calling the first HTTP interface of the federated training service, the proxy component is registered in the federated learning platform, and the component provider of the proxy component is registered as the proxy component provider.
[0143] In a possible implementation manner, the component registration unit 20 is further configured to:
[0144] After registering the proxy component in the federated learning platform, periodically receiving a heartbeat request sent by the algorithm component through the component docking module;
[0145] If the component docking module does not receive the heartbeat request within a preset time period, the proxy component corresponding to the algorithm component is removed from the federated learning platform by calling the second HTTP interface of the federated training service.
[0146] In a possible implementation manner, the component instantiation unit 30 is further configured to:
[0147] In response to the acquisition request, calling a module interface on the component docking module through the proxy component provider;
[0148] Obtaining component information of the algorithm component corresponding to the proxy component from the component docking module through the module interface; wherein the component information includes: component name, component IP address information, and component port number;
[0149] The proxy component provider generates a proxy class instance of the proxy component according to the component information, and returns the proxy class instance to the federated learning platform.
[0150] In a possible implementation manner, the component instantiation unit 30 is further configured to:
[0151] The component information is processed by the proxy component provider using the metaclass function in Python, and a proxy class instance of the proxy component is obtained after processing; wherein the component information includes the IP address and port number of the algorithm component.
[0152] In a possible implementation manner, the component operation unit 40 is further configured to:
[0153] Obtaining component parameters and input data of the algorithm component sent by the federated learning platform through the interface of the proxy class instance, and forwarding the component parameters and input data to the algorithm component;
[0154] Obtaining a computing instruction sent by the federated learning platform through the interface of the proxy class instance, and forwarding the computing instruction to the algorithm component; wherein the computing instruction is sent after the algorithm component successfully receives the component parameters and the input data;
[0155] After the algorithm component obtains the output result of the calculation instruction, it obtains the output result acquisition request sent by the federated learning platform through the interface of the proxy class instance, forwards the acquisition request to the algorithm component, and transmits the output result fed back by the algorithm component based on the acquisition request to the federated learning platform.
[0156] It should be noted that an apparatus for intercommunication of algorithm components provided in an embodiment of the present invention can implement all processes of the method for intercommunication of algorithm components described in any of the above embodiments. The functions of each unit in the apparatus and the technical effects achieved are respectively the same as the functions of the method for intercommunication of algorithm components described in the above embodiments and the technical effects achieved, which will not be repeated here.
[0157] Corresponds to Figure 1 The embodiment of the present disclosure also provides an electronic device 80, such as Figure 8 FIG. 8 is a schematic diagram of the structure of an electronic device 80 provided in an embodiment of the present disclosure, including:
[0158] Processor 81, memory 82, and bus 83; memory 82 is used to store execution instructions, including internal memory 821 and external memory 822; the internal memory 821 is also called internal memory, which is used to temporarily store the operation data in the processor 81 and the data exchanged with the external memory 822 such as a hard disk. The processor 81 exchanges data with the external memory 822 through the internal memory 821. When the electronic device 80 is running, the processor 81 communicates with the memory 82 through the bus 83, so that the processor 81 executes the following instructions:
[0159] In response to the federated training service of the federated learning platform, registering the proxy component provider in the federated learning platform through the platform docking module, and starting the instance process of the component docking module;
[0160] After registering the algorithm component in the instance process of the component docking module, generating an agent component suitable for the federated learning platform through the component docking module, and registering the agent component in the federated learning platform;
[0161] In response to the federated learning platform's request for obtaining the proxy component, generating a proxy class instance of the proxy component through the proxy component provider;
[0162] During the operation of the proxy component, data interaction of the algorithm component is realized through the interface of the proxy class instance of the proxy component, wherein the data interaction is data interaction during the execution of the federated training task.
[0163] The embodiments of the present disclosure also provide a computer program product, which carries a program code. The instructions included in the program code can be used to execute the steps of the intercommunication method of the algorithm components described in the above system embodiment. For details, please refer to the above method embodiment, which will not be repeated here.
[0164] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0165] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0166] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0167] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0168] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling an electronic device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0169] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for intercommunication of algorithm components, characterized in that: An agent system applied to a federated learning platform, the agent system comprising a platform docking module and a component docking module, including: In response to the federated training service of the federated learning platform, registering the proxy component provider in the federated learning platform through the platform docking module, and starting the instance process of the component docking module; After registering the algorithm component in the instance process of the component docking module, generating an agent component suitable for the federated learning platform through the component docking module, and registering the agent component in the federated learning platform; In response to the federated learning platform's request for obtaining the proxy component, generating a proxy class instance of the proxy component through the proxy component provider; During the operation of the proxy component, data interaction of the algorithm component is realized through the interface of the proxy class instance of the proxy component, wherein the data interaction is data interaction during the execution of the federated training task.
2. The method according to claim 1, characterized in that The registering of the proxy component provider in the federated learning platform through the platform docking module specifically includes: Obtaining property information of the proxy component provider; The attribute information of the proxy component provider is written into the memory of the federated learning platform.
3. The method according to claim 1, characterized in that After registering the algorithm component in the instance process of the component docking module, generating an agent component suitable for the federated learning platform through the component docking module, and registering the agent component in the federated learning platform, including: After the algorithm component is started, the interface call information corresponding to the instance process of the component docking module is loaded into the process of the algorithm component; wherein the interface call information includes an IP address and a listening port number; In response to a component registration request initiated by the algorithm component to the component docking module through the interface of the component docking module, the algorithm component is registered to the instance process of the component docking module, and the proxy component is generated through the component docking module; wherein the algorithm component calls the interface of the component docking module through the interface calling information; By calling the first HTTP interface of the federated training service, the proxy component is registered in the federated learning platform, and the component provider of the proxy component is registered as the proxy component provider.
4. The method according to claim 3, characterized in that The method further comprises: After registering the proxy component in the federated learning platform, periodically receiving a heartbeat request sent by the algorithm component through the component docking module; If the component docking module does not receive the heartbeat request within a preset time period, the proxy component corresponding to the algorithm component is removed from the federated learning platform by calling the second HTTP interface of the federated training service.
5. The method according to claim 1, characterized in that The step of generating, in response to the federated learning platform's request for obtaining the proxy component, a proxy class instance of the proxy component through the proxy component provider includes: In response to the acquisition request, calling a module interface on the component docking module through the proxy component provider; Obtaining component information of the algorithm component corresponding to the proxy component from the component docking module through the module interface; wherein the component information includes: component name, component IP address information, and component port number; The proxy component provider generates a proxy class instance of the proxy component according to the component information, and returns the proxy class instance to the federated learning platform.
6. The method according to claim 5, characterized in that The generating, by the proxy component provider according to the component information, a proxy class instance of the proxy component comprises: The component information is processed by the proxy component provider using the metaclass function in Python, and a proxy class instance of the proxy component is obtained after processing; wherein the component information includes the IP address and port number of the algorithm component.
7. The method according to any one of claims 1 to 6, characterized in that During the operation of the proxy component, data interaction of the algorithm component is realized through the interface of the proxy class instance of the proxy component, including: Obtaining component parameters and input data of the algorithm component sent by the federated learning platform through the interface of the proxy class instance, and forwarding the component parameters and input data to the algorithm component; Obtaining a computing instruction sent by the federated learning platform through the interface of the proxy class instance, and forwarding the computing instruction to the algorithm component; wherein the computing instruction is sent after the algorithm component successfully receives the component parameters and the input data; After the algorithm component obtains the output result of the calculation instruction, it obtains the output result acquisition request sent by the federated learning platform through the interface of the proxy class instance, forwards the acquisition request to the algorithm component, and transmits the output result fed back by the algorithm component based on the acquisition request to the federated learning platform.
8. A device for intercommunication of algorithm components, characterized in that: The proxy system set up on the federated learning platform includes: A component provider registration unit, configured to register a proxy component provider in the federated learning platform through the platform docking module in response to a federated training service of the federated learning platform, and to start an instance process of the component docking module; A component registration unit, configured to generate a proxy component applicable to the federated learning platform through the component docking module after registering the algorithm component in the instance process of the component docking module, and register the proxy component in the federated learning platform; A component instantiation unit, configured to generate an agent class instance of the agent component through the agent component provider in response to an acquisition request of the federated learning platform for the agent component; A component operation unit is used to realize data interaction of the algorithm component through the interface of the proxy class instance of the proxy component during the operation of the proxy component, wherein the data interaction operation is data interaction during the execution of a federated training task.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program; wherein, when the computer program is run, it controls the device where the computer-readable storage medium is located to execute the method for algorithm component intercommunication as described in any one of claims 1 to 7.
10. A terminal device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the method for intercommunication of algorithm components as claimed in any one of claims 1 to 7 when executing the computer program.
Citation Information
Cited By
Information interaction method and apparatus, proxy node, federated learning client and network element
WO2026138702A1
