CN115185543B - Model deployment method, packing method, device, equipment and storage medium - Google Patents

Model deployment method, packing method, device, equipment and storage medium Download PDF

Info

Publication number
CN115185543B
CN115185543B CN202211099332.0A CN202211099332A CN115185543B CN 115185543 B CN115185543 B CN 115185543B CN 202211099332 A CN202211099332 A CN 202211099332A CN 115185543 B CN115185543 B CN 115185543B
Authority
CN
China
Prior art keywords
model
local
information
data
submodel
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.)
Active
Application number
CN202211099332.0A
Other languages
Chinese (zh)
Other versions
CN115185543A (en
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202211099332.0A priority Critical patent/CN115185543B/en
Publication of CN115185543A publication Critical patent/CN115185543A/en
Application granted granted Critical
Publication of CN115185543B publication Critical patent/CN115185543B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • G06N20/20Ensemble learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/04Inference or reasoning models

Landscapes

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

Abstract

The application discloses a model deployment method, a packing device, a model deployment apparatus and a storage medium, and belongs to the technical field of artificial intelligence. For deploying a first local model in a multi-party federated model, the multi-party federated model including at least two local models, the method comprising: obtaining model package information of the first local model, wherein the model package information comprises model information, calculation logic information and communication logic information of the first local model; reconstructing to obtain at least one local submodel based on the parameters of at least one local submodel in the first local model indicated by the model information; and configuring at least one local sub-model based on the calculation logic information and the communication logic information, and starting a local model service corresponding to the first local model. The method enriches the information carried by the model package information, and expands the description dimension of the first local model from the internal algorithm logic and the communication logic of the cross deployment party; the problem of the risk of model deviation is effectively avoided.

Description

Model deployment method, packing method, device, equipment and storage medium
Technical Field
The present application relates to the field of artificial intelligence, and in particular, to a model deployment method, a packing method, an apparatus, a device, and a storage medium.
Background
The multi-party federation model completes the training of the machine deep learning model through multi-party cooperation, and realizes the direct data exchange among scattered data sources while protecting the privacy of users and the data safety.
In the related technology, after a multi-party federal model is obtained through training, model parameters of the multi-party federal model are stored through a model file; when a multi-party federated model is used, the multi-party federated model is reconstructed based on the model parameters.
However, all information in the multi-party federal model cannot be completely described through model parameters, and the reconstructed multi-party federal model has a risk of model deviation.
Disclosure of Invention
The application provides a model deployment method, a packing method, a device, equipment and a storage medium.
According to an aspect of the present application, there is provided a model deployment method for deploying a first local model in a multi-party federated model, the multi-party federated model including at least two local models, the at least two local models corresponding to different deployers, the method comprising:
obtaining model package information of the first local model, wherein the model package information comprises model information, calculation logic information and communication logic information of the first local model;
reconstructing to obtain at least one local submodel based on the parameters of the at least one local submodel in the first local model indicated by the model information;
configuring the at least one local sub-model based on the computation logic information and the communication logic information to complete the deployment of the first local model; starting a local model service corresponding to the first local model;
the computation logic information is used for indicating a data operation relation in the at least one local sub-model, the communication logic information is used for indicating a data transmission condition between the at least one local sub-model and a second local model, and the second local model is one or more local models except the first local model in the multi-party federation model.
According to another aspect of the present application, there is provided a method for packaging a first local model in a multi-party federated model, the multi-party federated model including at least two local models, the at least two local models corresponding to different deployers, the method comprising:
acquiring computation logic information and communication logic information of a first local model, wherein the computation logic information is used for indicating a data operation relation in at least one local submodel in the first local model, the communication logic information is used for indicating a data transmission condition between the at least one local submodel and a second local model, and the second local model is one or more local models except the first local model in the multi-party federation model;
deriving model information of the first local model based on the trained at least one local submodel, the model information being used to indicate model parameters of the at least one local submodel;
and packaging the model information, the calculation logic information and the communication logic information to obtain model package information of the first local model.
According to another aspect of the present application, there is provided a model deployment apparatus for deploying a first local model in a multi-party federal model, the multi-party federal model including at least two local models, the at least two local models corresponding to different deployers, the apparatus comprising:
an obtaining module, configured to obtain model package information of the first local model, where the model package information includes model information, computation logic information, and communication logic information of the first local model;
the reconstruction module is used for reconstructing to obtain at least one local submodel based on the parameters of the at least one local submodel in the first local model indicated by the model information;
the configuration module is used for configuring the at least one local sub-model based on the calculation logic information and the communication logic information to complete the first local model deployment; starting a local model service corresponding to the first local model;
the computation logic information is used for indicating a data operation relation in the at least one local sub-model, the communication logic information is used for indicating a data transmission condition between the at least one local sub-model and a second local model, and the second local model is one or more local models except the first local model in the multi-party federal model.
In an optional design of the present application, the configuration module is further configured to:
configuring the at least one local submodel based on the calculation logic information to obtain submodel prediction logic of the at least one local submodel, wherein the submodel prediction logic is used for indicating an operation weight parameter and an operation relation character of at least one data in the at least one local submodel;
and configuring at least one cross-network message in the sub-model prediction logic based on the communication logic information to complete the deployment of the first local model, wherein the cross-network message is used for carrying data transmitted between the at least one local sub-model and the second local model.
In an alternative design of the present application, the configuration module is further configured to:
and configuring at least one of a cross-network inlet and a cross-network outlet of at least one cross-network message in the sub-model prediction logic based on the communication logic information to complete the deployment of the first local model, wherein the cross-network inlet is used for indicating a message source of the cross-network message, and the cross-network outlet is used for indicating a message destination of the cross-network message.
In an optional design of the present application, the model information, the computation logic information, and the communication logic information of the first local model are information obtained through serialization processing.
In an alternative design of the present application, the apparatus further includes:
the receiving and dispatching module is used for receiving or sending a model deployment request, the model deployment request is used for indicating a receiving party to deploy a local model corresponding to the receiving party in the multi-party federal model, and the receiving party is one or more than one party receiving the model deployment request.
In an alternative design of the present application, the configuration module is further configured to:
responding to a request for obtaining the expansion and contraction capacity, and adding a copy model for deploying or undeploying the first local model, wherein the copy model is a copy of the first local model;
the first local model and the replica model form at least two sets of first local models which are deployed in parallel.
In an optional design of the present application, the scaling request is generated when an inference request corresponding to the multi-party federal model exceeds a load threshold;
the load threshold comprises at least one of: the frequency threshold of the inference request, the memory load threshold of the computer equipment corresponding to the multi-party federal model and the processor load threshold of the computer equipment corresponding to the multi-party federal model.
In an optional design of the present application, the model package information further includes configuration information of the first local model;
the configuration module is further to:
configuring a data flow topology of the at least one local sub-model in the first local model based on the configuration information.
In an alternative design of the present application, the configuration module is further configured to:
configuring the data flow topology based on the configuration information represented using directed acyclic graphs;
and each node in the directed acyclic graph corresponds to one of the local submodel, the data entry of the data and the data exit of the data.
In an alternative design of the present application, the configuration module is further configured to at least one of:
configuring a data inflow topology of the local submodel under the condition that a starting node of a first edge in the directed acyclic graph corresponds to the data entry and an end node of the first edge corresponds to the local submodel;
and configuring the data outflow topology of the local submodel under the condition that the starting node of the second edge in the directed acyclic graph corresponds to the local submodel and the end node of the second edge corresponds to the data outlet.
In an alternative design of the present application, the first local model comprises at least two local submodels, the at least two local submodels comprising: a first local submodel and a second local submodel;
the configuration module is further to:
and under the condition that a starting node of a third edge in the directed acyclic graph corresponds to the first local submodel and an end node of the third edge corresponds to the second local submodel, performing association configuration on a data outflow topology of the first local submodel and a data inflow topology of the second local submodel.
In an optional design of the present application, the obtaining module is further configured to obtain an inference request, where the inference request corresponds to data to be processed;
and the prediction module is used for calling the first local model to perform prediction processing on the data to be processed to obtain prediction information corresponding to the inference request.
In an alternative design of the present application, the apparatus further includes:
the receiving and sending module is used for forwarding the inference request to a load balancer corresponding to the first local model according to the model identity of the first local model carried by the inference request;
and the determining module is used for calling the load balancer to determine the first local model used at this time in at least two sets of first local models deployed in parallel.
In an alternative design of the present application, the apparatus further includes:
and the transceiver module is used for sending a broadcast message to other local models except the first local model in the multi-party federation model, wherein the broadcast message carries the inference request.
In an alternative design of the present application, the prediction module is further configured to:
determining a first intermediate message according to the data to be processed;
sending the first intermediate message to a second local model, the second local model being one or more of the multi-party federated models other than the first local model;
receiving a second intermediate message sent by a second local model, wherein the second intermediate message is determined according to the first intermediate message;
and obtaining the prediction information corresponding to the inference request according to at least one of the first intermediate message, the second intermediate message and the data to be processed.
In an alternative design of the present application, the first local model includes a predictive service and an auxiliary service; the prediction service is used for performing prediction processing on the data to be processed to obtain prediction information corresponding to the inference request;
the device further comprises:
and the receiving and sending module is used for receiving at least one of the first intermediate message, the second intermediate message and the data to be processed through asynchronous messages by the auxiliary service and processing the received at least one of the first intermediate message, the second intermediate message and the data to be processed to obtain an auxiliary result.
According to another aspect of the present application, there is provided a model deployment apparatus for packaging a first local model in a multi-party federated model, the multi-party federated model including at least two local models, the at least two local models corresponding to different deployers, the apparatus comprising:
an obtaining module, configured to obtain computation logic information and communication logic information of a first local model, where the computation logic information is used to indicate a data operation relationship in at least one local sub-model in the first local model, the communication logic information is used to indicate a data transmission situation between the at least one local sub-model and a second local model, and the second local model is one or more local models in the multi-party federation model except the first local model;
a deriving module, configured to derive model information of the first local model based on the trained at least one local submodel, where the model information is used to indicate a model parameter of the at least one local submodel;
and the packing module is used for packing the model information, the calculation logic information and the communication logic information to obtain model package information of the first local model.
In an optional design of the present application, the obtaining module is further configured to:
analyzing the data operation relation in the at least one local submodel according to the trained at least one local submodel to obtain the calculation logic information of the first local model.
In an optional design of the present application, the obtaining module is further configured to:
analyzing the data transmission condition between the at least one local submodel and a second local model according to the trained at least one local submodel, and obtaining the communication logic information of the first local model under the condition that cross-network information exists between the at least one local submodel and the second local model.
In an alternative design of the present application, the export module is further configured to:
serializing the trained at least one local submodel, coding to obtain serialization information of the at least one local submodel, and taking the serialization information of the at least one local submodel as model information of the first local model.
In an alternative design of the present application, the export module is further configured to:
and carrying out serialization processing on the trained at least one local submodel based on a model interface protocol, and coding to obtain serialization information of the at least one local submodel, wherein the model interface protocol is used for indicating a serialization coding mode of the at least one local submodel.
In an optional design of the present application, the obtaining module is further configured to:
acquiring configuration information of a first local model, wherein the configuration information is used for indicating the data flow direction topology of at least one local sub-model in the first local model in the multi-party federation model;
the packaging module is further configured to:
and packaging the model information, the calculation logic information, the communication logic information and the configuration information to obtain the model package information of the first local model.
In an optional design of the present application, the obtaining module is further configured to:
generating the configuration information represented by a directed acyclic graph according to the data flow topology of the at least one local sub-model in the multi-party federal model;
wherein an edge in the directed acyclic graph corresponds to a flow direction path of data, and each node in the directed acyclic graph corresponds to one of the local submodel, a data entry of the data, and a data exit of the data.
In an alternative design of the present application, the obtaining module is further configured to at least one of:
generating a first edge in the directed acyclic graph under the condition that first data flows from the data entry to the local submodel, wherein a starting node of the first edge corresponds to the data entry, and an end node of the first edge corresponds to the local submodel;
and under the condition that second data flow from the local submodel to the data outlet, generating a second edge in the directed acyclic graph, wherein a starting node of the second edge corresponds to the local submodel, and an end node of the second edge corresponds to the data outlet.
In an alternative design of the present application, the first local model comprises at least two local submodels, the at least two local submodels comprising: a first local submodel and a second local submodel;
the acquisition module is further configured to:
and under the condition that third data flow from the first local submodel to the second local submodel, generating a third edge in the directed acyclic graph, wherein a starting node of the third edge corresponds to the first local submodel, and an end node of the third edge corresponds to the second local submodel.
According to another aspect of the present application, there is provided a computer device comprising a processor and a memory, the memory having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions, which is loaded and executed by the processor to implement the model deployment method and/or the model packing method as described above.
According to another aspect of the present application, there is provided a computer readable storage medium having stored therein at least one instruction, at least one program, code set, or set of instructions, which is loaded and executed by a processor to implement a model deployment method and/or a model packaging method as described above.
According to another aspect of the present application, there is provided a computer program product comprising computer instructions stored in a computer-readable storage medium, from which a processor reads and executes the computer instructions to implement the model deployment method and/or the model packing method as described above.
The beneficial effect that technical scheme that this application provided brought includes at least:
configuring at least one local sub-model in the first local model through the calculation logic information and the communication logic information of the first local model, enriching the information carried by the model package information, and expanding the description dimension of the first local model from the internal algorithm logic and the communication logic of the cross deployment party; the calculation logic information and the communication logic information are utilized to ensure that the deployed first local model is the same as the trained first local model, and the problem of model deviation risk is effectively avoided.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a schematic diagram of a computer system provided in an exemplary embodiment of the present application;
FIG. 2 is a schematic diagram of a multi-party federation model provided in an exemplary embodiment of the present application;
FIG. 3 is a first flowchart of a model deployment method provided by an exemplary embodiment of the present application;
FIG. 4 is a second flowchart of a model deployment method provided by an exemplary embodiment of the present application;
FIG. 5 is a third flowchart of a model deployment method provided by an exemplary embodiment of the present application;
FIG. 6 is a fourth flowchart of a model deployment method provided by an exemplary embodiment of the present application;
FIG. 7 is a fifth flowchart of a model deployment method provided by an exemplary embodiment of the present application;
FIG. 8 is a sixth flowchart of a model deployment method provided in an exemplary embodiment of the present application;
FIG. 9 is a schematic diagram of a directed acyclic graph provided by an exemplary embodiment of the present application;
FIG. 10 is a schematic diagram of another directed acyclic graph provided in an exemplary embodiment of the present application;
FIG. 11 is a seventh flowchart of a model deployment method provided in an exemplary embodiment of the present application;
FIG. 12 is a schematic diagram of yet another directed acyclic graph provided by an exemplary embodiment of the present application;
FIG. 13 is a schematic illustration of a first local model packaging and deployment provided by an exemplary embodiment of the present application;
FIG. 14 is an eighth flowchart of a model deployment method provided by an exemplary embodiment of the present application;
FIG. 15 is a ninth flowchart of a model deployment method provided by an exemplary embodiment of the present application;
FIG. 16 is a diagram of another multi-party federation model provided in an exemplary embodiment of the present application;
FIG. 17 is a tenth flowchart of a model deployment method provided in an exemplary embodiment of the present application;
FIG. 18 is a schematic illustration of yet another multi-party federation model provided in an exemplary embodiment of the present application;
FIG. 19 is a flowchart of a method for packing a model provided by an exemplary embodiment of the present application;
FIG. 20 is a flowchart of another method for packaging models provided by an exemplary embodiment of the present application;
FIG. 21 is a flowchart of yet another method for packaging models provided by an exemplary embodiment of the present application;
FIG. 22 is a block diagram illustrating a model deployment apparatus according to an exemplary embodiment of the present application;
FIG. 23 is a block diagram of a model packaging apparatus according to an exemplary embodiment of the present application;
fig. 24 is a block diagram of a server according to an exemplary embodiment of the present application.
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.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings in which the same 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 application, as detailed in the appended claims.
The terminology used in the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used in this disclosure and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data need to comply with the relevant laws and regulations and standards of the relevant country and region. For example, the information such as configuration information and model information referred to in the present application is obtained under sufficient authorization.
It will be understood that, although the terms first, second, etc. may be used herein to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first parameter may also be referred to as a second parameter, and similarly, a second parameter may also be referred to as a first parameter, without departing from the scope of the present disclosure. The word "if," as used herein, may be interpreted as "at \8230; \8230when" or "when 8230; \823030when" or "in response to a determination," depending on the context.
FIG. 1 is a diagram illustrating a computer system provided by one embodiment of the present application. The computer system may implement a system architecture that becomes a model deployment method and/or a model packaging method. The computer system may include: a terminal 110 and a server 120. The terminal 110 may be an electronic device such as a mobile phone, a tablet Computer, a car terminal (car machine), a wearable device, a PC (Personal Computer), an unmanned reservation terminal, and the like. The terminal 110 may have installed therein a client running a target application, which may be an event characterization prediction model training and/or using application, or another application provided with an event characterization prediction model training and/or using function, and is not limited in this application. The form of the target Application is not limited in the present Application, and may include, but is not limited to, an App (Application program) installed in the terminal 110, an applet, and the like, and may be a web page form. The server 120 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing a cloud computing service. The server 120 may be a background server of the target application program, and is used for providing a background service for the client of the target application program.
According to the model deployment method and/or the model packing method provided by the embodiment of the application, the execution subject of each step can be computer equipment, and the computer equipment refers to electronic equipment with data calculation, processing and storage capabilities. Taking the embodiment implementation environment shown in fig. 1 as an example, the terminal 110 may execute the model deployment method and/or the model packaging method (for example, a client installed with a running target application program in the terminal 110 executes the model deployment method and/or the model packaging method), the server 120 may execute the model deployment method and/or the model packaging method, or the terminal 110 and the server 120 cooperate with each other to execute the model deployment method and/or the model packaging method, which is not limited in this application.
In addition, the technical scheme of the application can be combined with the block chain technology. For example, the model deployment method and/or the model packing method disclosed in the present application, some data (configuration information, model information, etc.) involved therein may be saved on the blockchain. The communication between the terminal 110 and the server 120 may be through a network, such as a wired or wireless network.
First, a multi-party federal model is introduced in the present application.
FIG. 2 illustrates a schematic diagram of a multi-party federal model provided in an exemplary embodiment of the present application.
Illustratively, the multi-party federated model includes at least two local models for different parties, and the multi-party federated model is illustratively described herein as including two local models for two parties. It is understood that the multi-party federated model may include more local models, and accordingly, the local models correspond to the respective deployed parties.
The multi-party federation model 300 includes a first local model 310 and a second local model 320; wherein the first local model 310 is deployed at institution 1 and the second local model 320 is deployed at institution 2. It should be noted that the first local model, the second local model, and the like in this application are merely exemplary names, and the first local model is a local model corresponding to the first deployment party, such as the organization 1. For the first deployer, other local models except the first local model in the multi-party federal model can also be called foreign models.
Illustratively, the first local model 310 includes four local sub-models, specifically including: a first federal feature project 311, a first feature project 312a, a second feature project 312b, a first federal logistic regression 313. The second local model includes a third local submodel, which specifically includes: second Nippon feature project 321, third feature project 322, and second Nippon logistic regression 323.
Illustratively, there is data transfer between the first federal feature engineering 311 and the second federal feature engineering 321. Illustratively, encrypted transmission is usually performed by carrying data to be transmitted through cross-network messages. In one example, the first federal feature project 311 and the second federal feature project 321 belong to the same feature engineering model network structure used to perform feature engineering, a first portion of the feature engineering model network structure, such as the first federal feature project 311, is deployed at agency 1, and a second portion of the feature engineering model network structure, such as the second federal feature project 321, is deployed at agency 2. Similarly, there is data transfer between the first federated logistic regression 313 and the second federated logistic regression 323. It is understood that the present embodiment is only an exemplary description of the local submodel with data transmission, and data transmission between local submodels with more or less functions may be possible.
Illustratively, there is no data transfer between the first feature engineering 312a, the second feature engineering 312b, and the second local model 320 in the first local model 310. There is also no data transfer between the third feature engineering 322 in the second local model 320 and the first local model 310. For example, first feature engineering 312a, second feature engineering 312b, and third feature engineering 322 may be referred to as single-sided feature engineering.
Calling the multi-party federation model 300 to perform prediction processing, inputting data 1 into the first local model 310, inputting data 2 into the second local model 320, and obtaining prediction information 334, wherein the prediction information 334 is a prediction result obtained by performing prediction processing on the multi-party federation model 300. In the process of invoking the multi-party federated model 300 for prediction processing, a plurality of local models corresponding to different parties included in the multi-party federated model 300 are required to be completed together. In this embodiment, it is necessary for the institution 1 corresponding to the first local model 310 and the institution 2 corresponding to the second local model 320 to be completed together.
Next, a model deployment method will be described by the following embodiments.
FIG. 3 illustrates a first flowchart of a model deployment method provided by an exemplary embodiment of the present application. The method may be performed by a computer device. The method comprises the following steps.
Step 510: model package information of the first local model is obtained.
Illustratively, the present embodiment is configured to deploy a first local model in a multi-party federated model, which includes at least two local models corresponding to different parties. Illustratively, the multi-party federated model includes at least two local models that correspond to different parties of deployment. The first local model is a local model corresponding to any one deployment party in the counterpart federal model.
Illustratively, the model package information is a model package obtained by packaging the first local model, and the model package information is used for indicating model parameters of at least one sub-model in the first local model, algorithm logic in the first local model related to the inside of the first local model, and communication logic between models related to the first local model and the second local model. Illustratively, the model package information includes model information, computation logic information, and communication logic information of the first local model.
It should be noted that, in this embodiment, the model packet information includes the model information, the computation logic information, and the communication logic information of the first local model, which is only an exemplary description, and in an alternative implementation, the model packet information may include more information, and this embodiment does not set any limitation to this.
Step 520: and reconstructing to obtain at least one local submodel based on the parameters of at least one local submodel in the first local model indicated by the model information.
Illustratively, the model information of the first local model is used for indicating model parameters of at least one local sub-model in the first local model. For example, the model information may directly indicate the model parameters of the at least one local sub-model, or may indirectly indicate the model parameters of the at least one local sub-model; the present embodiment does not set any limiting specification on the manner of indicating the model parameters. In one example, the model information carries model parameters of at least one sub-model, in another example, the model information carries a model structure of at least one sub-model, the model parameters of at least one sub-model can be obtained by analyzing the model structure, and the model information indirectly indicates the model parameters of at least one sub-model.
Step 530: configuring at least one local sub-model based on the calculation logic information and the communication logic information to complete first local model deployment; and starting the local model service corresponding to the first local model.
Illustratively, the at least one local sub-model is constructed from model information of the first local model. Illustratively, the local model service corresponding to the first local model is initiated to indicate that the inference request corresponding to the multi-party federated model is allowed to be received.
Illustratively, deploying the first local model is realized by performing supplementary configuration on the at least one local sub-model through calculation logic information and communication logic information. Illustratively, the computation logic information is used for indicating data operation relations in at least one local sub-model, the communication logic information is used for indicating data transmission conditions between the at least one local sub-model and a second local model, and the second local model is one or more local models except the first local model in the multi-party federation model.
In summary, in the method provided in this embodiment, at least one local sub-model in the first local model is configured through the computation logic information and the communication logic information of the first local model, information carried by the model package information is enriched, and the description dimension of the first local model is expanded from the internal algorithm logic and the communication logic of the cross-deployment party; the calculation logic information and the communication logic information are utilized to ensure that the deployed first local model is the same as the trained first local model, and the problem of model deviation risk is effectively avoided.
FIG. 4 illustrates a second flowchart of a model deployment method provided by an exemplary embodiment of the present application. The method may be performed by a computer device. That is, in the embodiment shown in fig. 3, step 530 may be implemented as step 532, step 534.
Step 532: and configuring at least one local submodel based on the calculation logic information to obtain the submodel prediction logic of at least one local submodel.
Illustratively, the computation logic information indicates data operational relationships in at least one local submodel, and the computation logic information directly or indirectly indicates operational relationships in the local submodel. Illustratively, the operation relation symbol includes an operator in algebraic calculation, such as an addition/subtraction operator; and operation rules describing model calculation logic of the local submodel, such as principal component analysis, normalization calculation, convolution calculation, pooling calculation and the like. Illustratively, supplementing at least one local submodel based on the calculation logic information to obtain the submodel prediction logic of the local submodel; it can be understood that the sub-model prediction logic not only carries model parameter information of at least one local sub-model, but also carries a data operation relation of at least one data in the local sub-model. The sub-model prediction logic is to indicate an operational weight parameter and an operational relation for at least one data in at least one local sub-model.
Step 534: configuring at least one cross-network message in the sub-model prediction logic based on the communication logic information to complete first local model deployment; and starting a local model service corresponding to the first local model.
Illustratively, the communication logic information is used for indicating data transmission conditions between the at least one local sub-model and the second local model; and configuring the cross-network message according to the indication of the communication logic information, wherein the cross-network message carries data which are indicated by the communication logic information and transmitted between the at least one local sub-model and the second local model.
Illustratively, there is at least one cross-network message for the first local model for data transfer between the local submodel of the first local model and the second local model. Further, the first local model has at least one local sub-model and the second local model has data transmission between them; but there is no limitation that there is a data transfer between each local sub-model in the first local model and the second local model.
In an optional implementation manner, at least one of a cross-network entry and a cross-network exit of at least one cross-network message in the sub-model prediction logic is configured based on the communication logic information, so that the first local model deployment is completed, the cross-network entry is used for indicating a message source of the cross-network message, and the cross-network exit is used for indicating a message destination of the cross-network message.
For example, in one implementation, for a cross-network message sent by the second local model to the first local model, only a message entry of the cross-network message may be configured, indicating that a source of the cross-network message is the second local model. For the cross-network message sent by the first local model to the second local model, only the message outlet of the cross-network message may be configured, indicating that the message of the cross-network message is destined to the second local model. In another implementation, both the data ingress and the data egress of the cross-network message may be configured.
It should be noted that the cross-network message carries data transmitted between the first local model and the second local model, and the data carried by the cross-network message is usually transmitted in an encrypted manner, but the possibility of outgoing in an unencrypted manner is not excluded.
In this embodiment, at least one of the cross-network entry and the cross-network exit of at least one cross-network message is generally configured, but the case where only the cross-network message is marked is not excluded.
To sum up, in the method provided in this embodiment, at least one local sub-model in the first local model is configured through the computation logic information of the first local model, and the cross-network message is configured through the communication logic information; the description dimensionality of the first local model is expanded from internal algorithm logic and communication logic of a cross-deployment party; the first local model obtained by deployment is enriched, the first local model obtained by deployment is the same as the first local model obtained by training, and the problem of model deviation risk is effectively avoided.
Fig. 5 is a third flowchart illustrating a model deployment method according to an exemplary embodiment of the present application. The method may be performed by a computer device. I.e. in the embodiment shown in fig. 3, further comprises step 502.
Step 502: a model deployment request is received or sent.
Illustratively, the model deployment request is used for instructing a receiving party to deploy a local model corresponding to the receiving party in the multi-party federal model, and the receiving party is one or more than one party receiving the model deployment request.
Illustratively, the computer device corresponding to the first local model receives the model deployment request, and the receiving and deploying party comprises the computer device corresponding to the first local model, and deploys the first local model. Optionally, the first local model sends a model deployment request, where the model deployment request is used to instruct a deployer that receives the model deployment request to deploy a corresponding local model.
It should be noted that the execution sequence of the received model deployment request is before step 530, but the execution sequence between other steps in this embodiment is not limited in any way. It can be understood that the computer device may obtain the model package information after receiving the model deployment request, may obtain the model package information first, or may perform reconstruction of the local sub-model in the first local model first, and complete deployment of the first local model after receiving the model deployment request. The order of execution of the delivery model deployment requests and the order of execution between other steps in this embodiment is not intended to be limiting. The computer device may send a model deployment request at any timestamp in the process of deploying the first local model, and instruct other deployers corresponding to the multi-party federal model to which the first local model belongs to deploy the corresponding local models.
In one example, the model deployment request is sent by a federal schedule component in a computer device. Further, the resource layer receives a model deployment request sent by the federal scheduling component and deploys the first local model.
For example, the model deployment request may be sent by a federal scheduling component corresponding to one or more local models other than the first local model in the multi-party federal model. Further, the model deployment request is used for ensuring that at least two local models corresponding to different parties included in the opposite party federal model are deployed at the same time.
In summary, the method provided by the embodiment ensures that at least two local models in the multi-party federal model are deployed at the same time through the model deployment request, and lays a foundation for calling the multi-party federal model to perform prediction processing; the deployed first local model is ensured to be the same as the trained first local model, and the problem of model deviation risk is effectively avoided.
Fig. 6 shows a fourth flowchart of a model deployment method according to an exemplary embodiment of the present application. The method may be performed by a computer device. I.e., in the embodiment shown in fig. 3, step 535 is also included.
Step 535: and adding or undeploying the replica model of the first local model in response to the request for obtaining the scale and shrink capacity.
Illustratively, the replica model is a duplicate of the first local model; and adding a deployment copy model for indicating that the first local model is deployed again. The undeployment is used for indicating deletion cancellation of the deployed first local model.
Illustratively, the first local model and the replica model form at least two sets of the first local models deployed in parallel.
In one example, the scale and shrink request is sent by a federal schedule component in a computer device. The expansion and contraction capacity request can be sent by a federal scheduling component corresponding to one or more federal models except the first local model in the multi-party federal model. Further, the capacity expansion and contraction request is used for ensuring that at least two local models corresponding to different parties included in the opposite party federal model are deployed at the same time.
For example, for one thread of the computer device, only the first local model of the multi-party federal model is deployed, or only at least two sets of first local models deployed in parallel are deployed. In the case where the computer device is also deployed with another multi-party federated model, the different multi-party federated models are deployed in different threads.
Illustratively, the scaling request is generated when an inference request corresponding to the multi-party federal model exceeds a load threshold.
Exemplary loading thresholds include, but are not limited to, at least one of: the method comprises the steps of reasoning a frequency threshold of a request, a computer device memory load threshold corresponding to a multi-party federal model, and a computer device processor load threshold corresponding to the multi-party federal model.
Specifically, a capacity expansion request in the capacity expansion and reduction requests is taken as an example for explanation, and a capacity expansion condition corresponding to the capacity expansion request is that the load of the computer device exceeds a first load threshold. Such as: the number of requests per unit time of the first local model exceeds a first load threshold, and the memory usage or processor usage of the computer device exceeds the first load threshold. Taking a capacity expansion request in the capacity expansion and reduction requests as an example for explanation, the capacity reduction condition corresponding to the capacity expansion request is that the load of the computer device does not exceed the second load threshold. Such as: the number of requests per unit time of the first local model exceeds a second load threshold, and the memory usage or processor usage of the computer device exceeds the second load threshold.
In summary, the method provided in this embodiment ensures that at least two federal models in a multi-party federal model perform capacity expansion and contraction deployment simultaneously through the capacity expansion and contraction request, and lays a foundation for invoking the multi-party federal model to perform prediction processing; the deployed first local model is ensured to be the same as the trained first local model, and the problem of model deviation risk is effectively avoided.
In one example, the model information, the calculation logic information, and the communication logic information of the first local model are information obtained through a serialization process.
In one implementation mode, deserializing is carried out on serialized information of at least one local submodel carried in model information, and the at least one local submodel is obtained through parsing and rebuilding.
Illustratively, the model information includes serialization information for at least one local sub-model.
Illustratively, the serialization information is obtained by serializing at least one sub-model. The serialization information is binary information. Optionally, the model information further carries meta information of the first local model, and for example, the meta information is an identity of the first local model. The identity of the first local model may be any identification manner capable of identifying the first local model, may be implemented as a model identification of a multi-party federation model to which the first local model belongs, and may also be implemented as a model identification of a local sub-model included in the first local model. Optionally, the model information further carries a model structure of the first local model, and is used to describe at least one of contents such as the model structure and the cascade relationship in the first local model.
In an optional implementation manner, the serialization information of at least one submodel is processed based on a model interface protocol, and the at least one submodel is obtained through analysis.
Illustratively, the model interface protocol is used to implement a deserialization parsing of serialized information. In one example, the model interface protocol may indicate the resolution of deserialization directly or indirectly. Specifically, the model interface protocol is used for realizing a serialization analysis mode, and the deserialization analysis mode is the reverse process of the serialization analysis mode.
Fig. 7 shows a fifth flowchart of a model deployment method according to an exemplary embodiment of the present application. The method may be performed by a computer device.
Step 538: configuring a data flow topology of the at least one local sub-model in the first local model based on the configuration information.
Illustratively, the model package information further includes configuration information of the first local model. Illustratively, the configuration information indicates a data flow situation of at least one local sub-model in the multi-party federal model, and the data flow topology of the at least one local sub-model is configured according to the configuration information. Illustratively, the configuration information of the first local model is used for indicating a flow condition of at least one data in the first local model, and the data flow topology of the local sub-model is configured through the flow condition.
In an alternative implementation, step 538 in this embodiment may be implemented as: the data flow topology is configured based on configuration information represented using a directed acyclic graph.
Illustratively, a Directed Acyclic Graph (DAG) is a loop-free Directed Graph in which a vertex cannot be started from and returned to the vertex through at least one edge.
For example, in the configuration information represented by the directed acyclic graph, an edge in the directed acyclic graph corresponds to a flow direction path of the data, and each node in the directed acyclic graph corresponds to one of a sub-model, a data entry of the data, and a data exit of the data.
For example, the directed acyclic graph may be used to indicate the flow of one data in the first local model, and may also be used to indicate the flow of a plurality of data in the first local model. Illustratively, the edges in a directed acyclic graph are directional, and the direction of the edges is used to indicate the direction of flow of the corresponding data.
Step 530a and step 530b in this embodiment may refer to step 530 above, and are not described again in this embodiment; it is understood that step 530a may be performed before, after, or simultaneously with step 538.
To sum up, in the method provided in this embodiment, a directed acyclic graph is used to represent the configuration information of the first local model, and a flow path of data in the first local model is described; the configuration information configures the data flow topology of at least one sub-model in the first local model, thereby enriching the information carried by the model package information and expanding the description dimensionality of the first local model; the configuration file is used for ensuring that the deployed first local model is the same as the trained first local model, and the problem of model deviation risk is effectively avoided.
Fig. 8 shows a sixth flowchart of a model deployment method according to an exemplary embodiment of the present application. The method may be performed by a computer device. That is, in the embodiment shown in fig. 7, step 538 may be implemented as step 538a and step 538b.
Step 538a: and configuring the data inflow topology of the local submodel under the condition that the starting node of the first edge in the directed acyclic graph corresponds to the data entry and the end node of the first edge corresponds to the local submodel.
In this embodiment, a first edge and a second edge in the directed acyclic graph are described, and the first edge and the second pass are different types of edges in the directed acyclic graph.
The starting node of the first edge corresponds to a data inlet, the end node of the first edge corresponds to a local submodel, the first edge is used for indicating that first data flows from the data inlet to the local submodel, and the data inflow topology of the local submodel is configured according to the first edge of the directed acyclic graph to indicate that the data flows into the local submodel. Fig. 9 is a schematic diagram illustrating a directed acyclic graph according to an exemplary embodiment of the present application. The start node 412 of the first edge 410 corresponds to the data entry Xi and the end node 414 of the first edge corresponds to the local submodel Fa. For example, there may be only a first edge or a plurality of edges in the directed acyclic graph.
Step 538b: and under the condition that the starting node of the second edge in the directed acyclic graph corresponds to the local submodel and the end node of the second edge corresponds to the data outlet, configuring the data outflow topology of the local submodel.
And the starting node of the second edge corresponds to the local submodel, the end node of the second edge corresponds to the data outlet, the second edge is used for indicating that second data flows from the local submodel to the data outlet, and the data outflow topology of the local submodel is configured according to the second edge of the directed acyclic graph to indicate that the data flows out of the local submodel. FIG. 10 is a diagram illustrating another directed acyclic graph provided in an exemplary embodiment of the present application. The start node 422 of the second edge 420 corresponds to the local submodel Fa and the end node 424 of the second edge corresponds to the data egress Xo. For example, there may be only the second edge or a plurality of edges in the directed acyclic graph.
In an alternative implementation manner, as shown in the seventh flowchart of the model deployment method shown in fig. 11, on the basis of the embodiment shown in fig. 8, the method further includes a step 538c.
Step 538c: and under the condition that the starting node of the third edge in the directed acyclic graph corresponds to the first local submodel and the ending node of the third edge corresponds to the second local submodel, performing associated configuration on the data outflow topology of the first local submodel and the data inflow topology of the second local submodel.
In this embodiment, the first local model comprises at least two local submodels, the at least two local submodels comprising: a first local submodel and a second local submodel. It will be appreciated that in one implementation the first local model comprises more local sub-models.
Illustratively, the start node of the third edge corresponds to a first local submodel, and the end node of the third edge corresponds to a second local submodel, the third edge for indicating a flow of third data from the first local submodel to the second local submodel. And according to the third edge of the directed acyclic graph, performing associated configuration on the data outflow topology of the first local submodel and the data inflow topology of the second local submodel, and indicating that data flow from the first local submodel to the second local submodel.
Fig. 12 is a schematic diagram illustrating yet another directed acyclic graph provided by an exemplary embodiment of the present application. The start node 432 of the third edge 430 corresponds to the first local submodel Fb, and the end node 434 of the first edge corresponds to the second local submodel Fc. For example, only the third edge may exist in the directed acyclic graph, or a plurality of edges may exist.
In summary, in the method provided in this embodiment, the data flow topology of at least one local sub-model in the first local model is configured through different types of edges in the directed acyclic graph, so that information carried by the model packet information is enriched, and the description dimension of the first local model is expanded; the configuration file is used for ensuring that the deployed first local model is the same as the trained first local model, and the problem of model deviation risk is effectively avoided.
Next, the packing and deployment process of the model will be described.
FIG. 13 illustrates a first local model packaging and deployment diagram provided by an exemplary embodiment of the present application.
It should be noted that the multi-party federation model includes at least two federation models corresponding to different parties, and in this embodiment, only the first local model 350 in the multi-party federation model is taken as an example to illustrate the packing and deployment process of the first local model 350. The first local model 350 is a federal model held by a deployment party to which the multi-party federal model corresponds.
In this embodiment, the first local model 350 includes four local sub-models: first federal feature engineering 352, first feature engineering 354, second feature engineering 356, and first federal logistic regression 358. The four sub-models are trained sub-models. The four local submodels are introduced with reference to the embodiment shown in fig. 2 above.
The task flow configuration file 360 is used for indicating the data flow topology of the four sub-models in the multi-party federation model; illustratively, the task flow configuration file 360 includes at least one of data entry information, data exit information, and data flow information for data in the first local model 350; wherein the data entry information is used for indicating an entry of the streaming data into the first local model 350, the data exit information is used for indicating an exit of the streaming data out of the first local model 350, and the data streaming information is used for indicating a streaming path of the streaming data in the first local model 350.
Further, in the training process of the four submodels, the task flow configuration file 360 is also used for instructing and training the four initial submodels to obtain the four submodels.
Illustratively, in the packaging process of the first local model 350, the federal model online scoring interface protocol 370 is called to perform serialization processing on the first federal feature engineering 352, and first serialization information 352a of the first federal feature engineering 352 is derived.
And calling the federal model online scoring interface protocol 370 to perform serialization processing on the first feature project 354, and deriving second serialization information 354a of the first feature project 354.
And calling a federal model online scoring interface protocol 370 to perform serialization processing on the second feature engineering 356, and deriving third serialization information 356a of the second feature engineering 356.
And calling a federal model online grading interface protocol 370 to perform serialization processing on the first federal logistic regression 358, and deriving fourth serialization information 358a of the first federal logistic regression 358.
And packaging the task flow configuration file 360, the first serialization information 352a, the second serialization information 354a, the third serialization information 356a and the fourth serialization information 358a to obtain the model package information 340 of the multi-party federal model.
Analyzing the model package information 340, deploying the first local model 350, and specifically, in the deployment process of the first local model 350: deserializing the first serialization information 352a results in a first local sub-model instance 352b. The second serialization information 354a is deserialized to obtain a second local sub-model instance 354b. And performing deserialization processing on the third serialized information 356a to obtain a third local submodel instance 356b. The fourth serialization information 358a is deserialized to obtain a fourth local sub-model instance 358b. Illustratively, the four local submodels in the four local submodel instances are generally the same, and the local submodel instances are model instances obtained by packing corresponding local submodels to obtain model package information and redeploying the model package information.
And configuring the data flow topology of the four sub-model instances in the multi-party federal model based on the task flow configuration file 360, and deploying to obtain a first local model. And deploying to obtain a first local model according to the data flow relation indicated by the task flow configuration file 360.
Fig. 14 shows an eighth flowchart of a model deployment method according to an exemplary embodiment of the present application. The method may be performed by a computer device. Namely, on the basis of the embodiment shown in fig. 3, the method further includes steps 540 and 550.
Step 540: and acquiring an inference request.
Illustratively, the inference request is used to instruct invocation of the first local model for the prediction process. The inference request corresponds to the data to be processed; the first local model carries out prediction processing on data to be processed.
Step 550: and calling the first local model to perform prediction processing on the data to be processed to obtain prediction information corresponding to the inference request.
Illustratively, the prediction processing of the data to be processed is a using process of the model, and the first local model is called to perform prediction processing on the data to be processed. Illustratively, a first local model deployed in a computer device is invoked for predictive processing of data to be processed. Correspondingly, the multi-party federal model comprises at least two federal models corresponding to different parties; the prediction information is obtained by calling each federal model prediction process in the multi-party federal model.
For example, in this embodiment, invoking the first local model to perform prediction processing on the data to be processed may be referred to as invoking the first local model to perform inference on the data to be processed in an optional representation manner. In one example, the prediction process and the inference process each represent a process of processing corresponding data by calling a model, and the present application does not limit the process.
In summary, according to the method provided by this embodiment, the prediction processing is performed on the data to be processed by calling the first local model, so that the prediction processing is performed by using the deployed model, the deployed first local model is ensured to be the same as the trained first local model, and the problem of risk of model deviation is effectively avoided.
Fig. 15 shows a ninth flowchart of a model deployment method according to an exemplary embodiment of the present application. The method may be performed by a computer device. That is, in the embodiment shown in fig. 14, steps 542 and 544 are also included.
Step 542: and forwarding the inference request to a load balancer corresponding to the first local model according to the model identity of the first local model carried by the inference request.
Illustratively, the inference request carries a model identity of the first local model; other federated networks are also deployed in the computer device. Illustratively, the first local model belongs to a multi-party federal model and the other federal network belongs to another multi-party federal model.
Illustratively, the flow splitter forwards the inference request to a load balancer corresponding to the first local model according to the model identity of the first local model carried by the inference request. Further, the load balancer is a load balancer corresponding to the first local model.
Step 544: and calling the load balancer to determine the first local model used at this time in at least two sets of first local models deployed in parallel.
In this embodiment, the computer device is deployed with a first local model and a replica model of the first local model, and the first local model and the replica model form at least two sets of first local models deployed in parallel. And the load balancer of the first local model determines the first local model used at this time in the first local model and the replica model.
In summary, the method provided in this embodiment effectively directs the load balancer corresponding to the first local model by forwarding the inference request; the load balancer determines the first local model used at this time in the first local model and the corresponding replica model, so that the load condition of calling the first local model is fully considered, and the model calling efficiency is ensured.
FIG. 16 illustrates a schematic diagram of another multi-party federation model provided in an exemplary embodiment of the present application.
Illustratively, the inference request 402 carries a model id, and the model splitter 404 forwards the inference request 402 to the corresponding load balancer according to the model id, and in the case that the model id corresponds to the first local model 408a, the model splitter 404 forwards the inference request 402 to the first load balancer 406a. In the event that the model identity corresponds to the second local model 408b, the model splitter 404 forwards the inference request 402 to the second load balancer 406b.
Illustratively, the first load balancer 406a is configured to determine a first local model 408a; the second load balancer 406b is used to determine the model used this time in the second local model 408b and the second replica local model 408c deployed in parallel.
It should be noted that the first multi-party federation model includes a first local model 408a and a third local model 408d; the second multi-party federation model includes a second local model 408b and a fourth local model 408e; a replica model exists in the second multi-party federation model, and the replica model of the second multi-party federation model includes a second replica local model 408c and a fourth replica local model 408f for the second replica multi-party federation model.
Intermediate result information of the first multi-party federation model is transmitted between the first local model 408a and the third local model 408d over a first channel 412 a.
Intermediate result information of the second multi-party federal model and the second replica multi-party federal model is transmitted through the second channel 412 b.
Inference requests of the first multi-party federation model, the second multi-party federation model, and the second multi-party federation are transmitted through the request queue 412 c.
Deployment schedule information for the first federated scheduling component 410a and the second federated scheduling component 410b is transmitted via a schedule queue 412 d. The first federal schedule component 410a submits a model service deployment request to a resource layer 400a of organization a, such as a cluster orchestration system, which responds with the resource layer 400a of organization a and starts a copy of the model, while registering the model address with the registry 408. Illustratively, the first federated scheduling component 410a sends the scheduling queue 412d to the second federated scheduling component 410B through cross-network communication, and the second federated scheduling component 410B submits a deployment request to the resource layer 400B of the organization B; during the operation of each model, the resource usage amount and the model identity (such as the number of requests per unit time, the processor and memory usage rate) are reported to the first federated scheduling component 410a or the second federated scheduling component 410b periodically.
Fig. 17 shows a tenth flowchart of a model deployment method according to an exemplary embodiment of the present application. The method may be performed by a computer device. That is, in the embodiment shown in fig. 14, step 550 may be implemented as step 552, step 554, step 556, and step 558.
Step 552: and determining a first intermediate message according to the data to be processed.
For example, the first intermediate message may carry the data to be processed, or may carry the data to be processed by invoking the first local model. Illustratively, the first intermediate message is data output from the first local model. It should be noted that the first intermediate message generally carries data in an encrypted manner, and similarly, the second intermediate message in this embodiment also generally carries data in an encrypted manner.
Step 554: the first intermediate message is sent to the second local model.
Illustratively, the second local model is one or more of the multi-party federal models other than the first local model; in this embodiment, the first intermediate message is sent to the second local model. Specifically, the first intermediate message is sent through the intermediate channel, and the first intermediate message also carries the flow condition in the first local model. For example, the first intermediate message may carry a model identity of the first local model indicating a flow situation in the first local model.
Step 556: and receiving a second intermediate message sent by the second local model.
Illustratively, the second intermediate message is determined from the first intermediate message; and transmitting a second intermediate message through the intermediate channel, the second intermediate message being data output by the second local model. The second intermediate message also carries the flow situation in the second local model. For example, the second intermediate message may carry a model identity of the second local model indicating a flow situation in the second local model.
Step 558: and obtaining the prediction information corresponding to the inference request according to at least one of the first intermediate message, the second intermediate message and the data to be processed.
For example, the prediction information may be at least one of the first intermediate message, the second intermediate message, and the data to be processed, or may be obtained by invoking the first local model to process at least one of the first intermediate message, the second intermediate message, and the data to be processed.
It should be noted that, in this embodiment, only one message transmission situation between the first local model and the second local model is exemplarily shown. Those skilled in the art will appreciate that there may be multiple data transfer modes between the first local model and the second local model, such as the first local model sending an intermediate message to the second local model, the second local model sending an intermediate message to the first local model, and the first local model and the second local model performing multiple round-trip intermediate message transfers.
In an alternative design of this embodiment, the following steps are also included.
And sending a broadcast message to other federal models except the first local model in the multi-party federal model, wherein the broadcast message carries the inference request.
In another alternative design of this embodiment, the following steps are also included.
And the auxiliary service receives at least one of the first intermediate message, the second intermediate message and the data to be processed through the asynchronous message and processes the received first intermediate message, the second intermediate message and the data to be processed to obtain an auxiliary result.
Illustratively, the first local model includes a prediction service and an auxiliary service; the prediction service is used for performing prediction processing on the data to be processed to obtain prediction information corresponding to the inference request; specifically, the auxiliary service is used for at least one of a billing service, a statistical service, and a logging service.
It should be noted that the present embodiment does not limit the message received by the auxiliary service to the message transmitted between the first local model and the second local model. In one example, there is one intermediate message in the first local model, which is transmitted from the first local model to the auxiliary service only by asynchronous messages; there is no case of transmission between the first local model and the second local model. Further, the message received by the auxiliary service is auxiliary information generated in the prediction process, such as information related to services such as billing and statistics, and the auxiliary information may be completely information stored inside the deployment party corresponding to the first local model, and does not need to be synchronized to the deployment party corresponding to the first local model. For example, the message received by the auxiliary service may directly carry the data to be processed, or may carry data obtained based on the data to be processed.
In summary, the method provided in this embodiment provides an effective way for information transmission of the first local model and other federal models in the opposite federal model by sending and receiving intermediate messages obtained according to the data to be processed, and ensures the efficiency of invoking multiple federal models.
FIG. 18 illustrates a schematic diagram of yet another multi-party federation model provided in an exemplary embodiment of the present application.
Illustratively, agency a deploys inference services, including a first inference service 461 and a second inference service 462, for predictively processing the pending data corresponding to inference request 452.
First inference service 461 is configured with adapter 1, second inference service 462 is configured with adapter 2; adapter 1 and adapter 2 are used to connect to a business system that is used to provide sample features or perform other ancillary services. Specifically, the deployment of the auxiliary services by agency a includes a first feature service 471a, a first statistical service 472a, and a first billing service 473a. The first feature service 471a is used to perform a feature query. The first statistics service 472a subscribes to the request queue 482c for performance statistics. The first charging service 473a subscribes to the sample feature query for charging. The prediction service and the auxiliary service are decoupled, and the first statistic service 472a, the first charging service 473a and the first feature service 471a in the auxiliary service are triggered by asynchronous calling, for example, asynchronous message transmission information is sent through the first message queue 470a, so that the calling process of the main link is reduced, and the end-to-end delay is reduced. Optionally, the first message queue 470a is transmitted via a message bus.
Agency B is deployed with inference services that perform predictive processing, including third inference service 463 and fourth inference service 464. Third inference service 463 configured with adapter 3, fourth inference service 464 configured with adapter 4; the adapter 3 and the adapter 4 are used to connect to a business system for providing sample features or performing other ancillary services. Specifically, the deployment of the auxiliary services by the organization B includes a second feature service 471B, a second statistics service 472B, and a second billing service 473B. Asynchronous messaging information is sent through the second message queue 470b for the secondary service. Optionally, the second message queue 470b is transmitted via a message bus.
Illustratively, the channel queues for cross-network communication include a first channel 482a, a second channel 482b, and a request queue 482c. The message queues for cross-network communication are divided into two types, namely a broadcast request queue and an intermediate result queue.
The broadcast request queue includes a request queue 482c, the name format of the broadcast request queue is { model Id }/service (model Id is model identifier), and the event content includes a request identifier (request Id) and a sample identifier (sample Id). Wherein the request identifies a unique identifier generated by the agency a side for each request.
The intermediate result queue includes a first channel 482a and a second channel 482b, and has a name format of { model Id } - { request Id }/{ task-name } - { var-name }. the task-name is the name of the task in the federal task flow, and the var-name represents the serialized encrypted data that each party needs to transmit.
In one example, after the model service of agency B starts, the message queue { model Id }/service on the subscribing agency A side starts.
A reasoning request is initiated from the A side of the mechanism to designate a sample identifier, after a model service receives a forwarding request from a load balancer, a globally unique request identifier is generated for the request, and then an event (request Id, sample Id) is broadcasted to a message queue { model Id }/service.
Starting the inference process of the execution mechanism a side, inquiring the sample feature value from the first feature service 471a, and then sequentially executing the execution plan after loading the federal model, and scoring the data preprocessing and the model.
Meanwhile, the B side of the mechanism subscribes to the message queue { model Id }/service to obtain (request Id, sample Id), and starts an inference process of the B side of the synchronous execution mechanism.
When the mechanism A side and the mechanism B side execute a model scoring process, cross-network data transmission needs to be called according to different federal algorithms, intermediate encrypted data is exchanged, and assuming that the name of a federal task is task-name and the name of data needing to be transmitted is var-name, a receiver waits for data by subscribing { model Id } - { request Id }/{ task-name } - { var-name }, and a sender sends the data. The mechanism A side and the mechanism B side do not need to be concerned about services for executing reasoning, data routing is carried out through queue names, and complex data interaction processes are supported.
Next, a model packing method will be described by the following embodiments.
Fig. 19 is a flowchart illustrating a model packing method according to an exemplary embodiment of the present application. The method may be performed by a computer device. The method comprises the following steps.
Step 610: and acquiring the calculation logic information and the communication logic information of the first local model.
Illustratively, the present embodiment is configured to deploy a first local model in a multi-party federated model, which includes at least two local models corresponding to different parties. Illustratively, the multi-party federated model includes at least two local models that correspond to different parties of deployment. The first local model is a local model corresponding to any one of the deployers in the counterpart federation model.
The calculation logic information is used for indicating a data operation relation in at least one local submodel in the first local model, the communication logic information is used for indicating a data transmission condition between the at least one local submodel and the second local model, and the second local model is one or more local models except the first local model in the multi-party federal model.
Illustratively, the present embodiment is configured to deploy a first local model in a multi-party federated model, which includes at least two local models corresponding to different parties.
Step 620: deriving model information of the first local model based on the trained at least one local submodel;
model information of the first local model is derived based on the trained at least one sub-model.
Illustratively, the model information of the first local model is used for indicating model parameters of at least one sub-model in the first local model. Illustratively, the model information is used to indicate model parameters of at least one local sub-model; the model information may directly indicate model parameters of the at least one sub-model or may indirectly indicate model parameters of the at least one sub-model.
Step 630: and packaging the model information, the calculation logic information and the communication logic information to obtain model package information of the first local model.
Illustratively, the model package information is a model package obtained by packaging the first local model, and the model package information is used for indicating model parameters of at least one sub-model in the first local model, algorithm logic in the first local model related to the inside of the first local model, and communication logic between models related to the first local model and the second local model. Illustratively, the model package information includes model information, computation logic information, and communication logic information of the first local model.
In summary, in the method provided by this embodiment, through the computation logic information and the communication logic information of the first local model, the information carried by the model package information is enriched, and the description dimension of the first local model is expanded from the internal algorithm logic and the communication logic of the cross-deployment party; the calculation logic information and the communication logic information are utilized to ensure that the deployed first local model is the same as the trained first local model, and the problem of model deviation risk is effectively avoided.
Step 610 in the embodiment shown in fig. 19 is further described below.
For the computational logic information of the first local model, at least the following implementations are possible.
And analyzing the data operation relation in the at least one local submodel according to the trained at least one local submodel to obtain the computational logic information of the first local model.
Illustratively, the computation logic information is used for indicating data operational relations in at least one local submodel, and the computation logic information directly or indirectly indicates operational relations in the local submodel. Illustratively, the operation relation symbol includes an operator in algebraic calculation, such as an addition/subtraction operator; and operation rules describing model calculation logic of the local submodel, such as principal component analysis, normalization calculation, convolution calculation, pooling calculation and the like.
For the communication logic information of the first local model, at least the following implementations are possible.
And analyzing the data transmission condition between the at least one local submodel and the second local model according to the trained at least one local submodel, and obtaining the communication logic information of the first local model under the condition that cross-network messages exist between the at least one local submodel and the second local model.
Illustratively, the communication logic information is used for indicating data transmission conditions between the at least one local sub-model and the second local model; illustratively, there is at least one cross-network message for the first local model for data transfer between the local submodel of the first local model and the second local model. Further, the first local model has at least one local sub-model and the second local model has data transmission; but there is no limitation that there is a data transfer between each local sub-model in the first local model and the second local model.
Illustratively, the cross-network message carries data transmitted between the at least one local sub-model and the second local model indicated by the communication logic information.
FIG. 20 is a flowchart illustrating another model deployment method provided by an exemplary embodiment of the present application. The method may be performed by a computer device. That is, in the embodiment shown in FIG. 19, step 630 may be implemented as step 632; step 625 is also included.
Step 625: configuration information of the first local model is obtained.
The configuration information is used for indicating the data flow topology of at least one local sub-model in the first local model in the multi-party federal model; the configuration information of the first local model is used for configuring the data flow topology of at least one sub-model in the multi-party federal model, and exemplarily, the configuration information of the first local model is used for indicating the flow condition of at least one data in the first local model, and the data flow topology of the sub-model is configured through the flow condition.
Step 632: and packaging the model information, the calculation logic information, the communication logic information and the configuration information to obtain model package information of the first local model.
Illustratively, the model package information is a model package obtained by packaging the first local model, and the model package information includes model information, computation logic information, communication logic information, and configuration information.
Optionally, step 625 in this embodiment has the following implementation.
And generating configuration information represented by a directed acyclic graph according to the data flow topology of at least one local sub-model in the multi-party federal model.
Illustratively, an edge in the directed acyclic graph corresponds to a flow direction path of the data, and each node in the directed acyclic graph corresponds to one of a local submodel, a data entry of the data, and a data exit of the data.
For example, the directed acyclic graph may be used to indicate the flow of one data in the first local model, and may also be used to indicate the flow of a plurality of data in the first local model. Illustratively, the edges in a directed acyclic graph are directional, and the direction of the edges is used to indicate the direction of flow of the corresponding data.
In an alternative implementation manner of the embodiment, at least one of the following may be implemented.
And under the condition that the first data flows from the data entry to the local submodel, generating a first edge in the directed acyclic graph, wherein the starting node of the first edge corresponds to the data entry, and the ending node of the first edge corresponds to the local submodel.
And under the condition that the second data flow from the local submodel to the data outlet, generating a second edge in the directed acyclic graph, wherein the starting node of the second edge corresponds to the local submodel, and the ending node of the second edge corresponds to the data outlet.
For example, reference may be made to the embodiment shown in fig. 6 above for description of the first edge and the second edge of the directed acyclic graph, which is not described in detail in this embodiment.
In a further optional implementation, the first local model comprises at least two local submodels, the at least two local submodels comprising: a first local submodel and a second local submodel.
And under the condition that the third data flow from the first local submodel to the second local submodel, generating a third edge in the directed acyclic graph, wherein the starting node of the third edge corresponds to the first local submodel, and the ending node of the third edge corresponds to the second local submodel.
For example, reference may be made to the embodiment shown in fig. 9 above for description of the third edge of the directed acyclic graph, which is not described in detail in this embodiment.
To sum up, in the method provided in this embodiment, a directed acyclic graph is used to represent the configuration information of the first local model, and a flow path of data in the first local model is described; the information carried by the model packet information is enriched, and the description dimensionality of the first local model is expanded; the configuration file is used for ensuring that the deployed first local model is the same as the trained first local model, and the problem of model deviation risk is effectively avoided.
FIG. 21 is a flowchart illustrating a further method for model deployment according to an exemplary embodiment of the present application. The method may be performed by a computer device. That is, in the embodiment shown in fig. 19, step 620 may be implemented as step 622.
Step 622: and carrying out serialization processing on the trained at least one local submodel, coding to obtain serialization information of the at least one local submodel, and taking the serialization information of the at least one local submodel as the model information of the first local model.
Illustratively, the model information includes serialization information for at least one local sub-model.
Illustratively, the serialization information is used to indicate model parameters of at least one local sub-model. Further, the serialization information includes a model structure and/or a model computation logic of at least one local submodel, the serialization information does not directly include model parameters of the local submodel, and the serialization information indirectly indicates the model parameters. Illustratively, the serialization information is obtained by serializing at least one local sub-model. The serialization information is binary information.
In an alternative implementation, step 622 in this implementation may be implemented as follows.
And carrying out serialization processing on the trained at least one local submodel based on a model interface protocol, and coding to obtain serialization information of the at least one local submodel.
Illustratively, the model interface protocol is used to indicate a serialized encoding mode for at least one local sub-model; the model interface protocol can directly indicate the deserialization analysis mode or indirectly indicate the deserialization analysis mode.
In summary, in the method provided in this embodiment, serialization information of at least one local sub-model is obtained through encoding, and the first local model is described based on the serialization information; at least one local submodel is obtained through serialized information analysis, the local submodel is prevented from being realized again, the deployed first local model is ensured to be the same as the trained first local model, and the problem of model deviation risk is effectively avoided.
Illustratively, the multi-party federal model for the technical solution of the present application includes the following three main stages: model packing process, model deployment process and model scoring prediction process. The following description is made one by one.
In a specific example of the application, in the model packing process, a dynamic loading of the model is realized through a federation model online scoring interface protocol decoupling algorithm implementation and reasoning framework, and the expansibility of a multi-party federation model is improved; and describing the federated tasks in a mode of configuring dependency among tasks in a DAG mode, ensuring that the same data preprocessing flow is realized in an offline model training process and an online model using process, and ensuring model compatibility.
Specifically, a federal task flow configuration file is defined, which contains meta-information of a federal model and a data flow dependency relationship between federal training tasks, and is also called data preprocessing logic. The off-line model training process and the calculation logic used by the on-line model are compatible, and the on-line sample characteristic processing and model matching are ensured; meanwhile, by defining the online scoring interface protocol of the federal model, the offline task passes through the example of the online scoring interface protocol of the federal model. The model online scoring interface protocol comprises data preprocessing parameters, model parameters and joint calculation logic, is exported in a serialized mode to form a model file, realizes maintenance of offline and online scoring logic in a set of models, avoids re-realization of the scoring logic in an inference framework, and ensures that an offline scoring result is consistent with an online scoring result.
The online scoring interface protocol of the federal model is defined to unify the interfaces of online scoring calculation logics required to be realized by the model derived by the federal learning algorithm, and the interfaces have two realization forms: for a data preprocessing algorithm, the interface realizes the processing logic of an input sample and outputs the processed new sample data; for a machine learning algorithm, the interface realizes the process of jointly scoring the input samples, and intermediate results are interacted for many times by other parties who cross the network and deploy a multi-party federal model according to the actual needs of the algorithm.
Defining a federal task flow configuration file, and describing content including but not limited to at least one of the following: a unique identity of a federal task flow or federal model; unique identity identification of each task, a data execution entry, a federal task or algorithm parameter list and the like; the task list, the dependency relationship among a plurality of tasks, and the data flow dependency relationship among a plurality of tasks.
Illustratively, in the off-line training stage, analyzing task stream configuration files and sequentially starting off-line training algorithm tasks; after the algorithm of each federal training task is finished, object serialization for realizing an online scoring interface protocol of a federal model is exported to be a part of a model file, and the serialized object comprises model parameters and data preprocessing logic or online scoring logic; after the whole task flow of off-line training is finished, integrally packaging a task flow configuration file and model files exported at each stage into a federal model, and importing the federal model into a model warehouse; in the online reasoning stage, after loading the federal model, model files of each algorithm task are sequentially loaded to obtain a model object example, the task flow configuration file is analyzed to generate an execution plan of sample online reasoning, and for each reasoning request, the calculation logic of the model object example is sequentially executed and the result is transmitted to the next model object example, or the final reasoning scoring result is obtained.
In a specific example of the present application, during model deployment, separate dynamic scaling of different multi-party federal model versions is achieved by introducing a model service splitter and a federal scheduling component.
Introducing a federal dispatching assembly to coordinate all deployers to carry out unified online deployment, offline undeployment, capacity expansion and contraction and load balance on multi-party federal model services, and supporting independent dynamic capacity expansion and contraction aiming at different model services; each model service copy is only loaded with one multi-party federal model, the service copies of the same multi-party federal model correspond to one load balancer, and the introduced model shunt component forwards the inference request to the load balancers of different multi-party federal models according to different model identity identifications, so that the load balancing of different multi-party federal model services is realized.
In a specific example of the application, in the model scoring prediction process, the calling process of a scoring link is reduced by adopting message bus asynchronous notification, and the end-to-end time delay is reduced; the session maintaining function among multiple copies is realized in a cross-network message queue mode, and multiple data interaction among multi-party federal tasks is realized.
Based on the asynchronous notification mode of the message bus, the scoring prediction calculation logic and other service system logics are connected, such as: services such as statistics, charging and the like are decoupled, so that the calling of a scoring prediction link is reduced, and the time delay is reduced; meanwhile, a temporary Topic (Topic) is established for a single scoring prediction request on the side of an initiator based on a cross-network difficult message queue, and a model service maintains a conversation by subscribing topics to acquire data or sending data to the topics, so that the complexity of data routing is simplified, and complex data interaction processes such as multi-party online reasoning and the like are supported.
Illustratively, in the technical scheme provided by the application, a multi-party-oriented complete federal online reasoning system is provided for a multi-party federal model, and is applied to multiple scenes such as joint marketing, joint advertising and joint wind control. According to the technical scheme, a set of formats and interface protocols of the combined model are defined, an algorithm protocol is decoupled from an online reasoning framework, the expansibility of the system is increased, and the maintenance cost of the system is reduced. According to the technical scheme, by introducing the federal scheduling component and the model shunt, the use scenes of a plurality of multi-party federal model services are flexibly supported, dynamic expansion and contraction of multi-party federal model service copies are realized according to the flow and the resource usage of model services of different versions, and the stability and the fault tolerance of the system are improved. According to the technical scheme, the internal message bus architecture is adopted, the calling of the reasoning main link is reduced, so that the end-to-end time delay is reduced, meanwhile, the cross-network communication message queue architecture is adopted to realize the data routing among multiple parties to realize the session holding function, so that the complex data interaction processes of multi-party online reasoning and the like are supported, and the more complex multi-party federal learning algorithm is supported.
Those skilled in the art can understand that the above embodiments can be implemented independently, or can be freely combined to combine a new embodiment to implement the model deployment method and/or the model packaging method of the present application.
Fig. 22 shows a block diagram of a model deployment apparatus provided in an exemplary embodiment of the present application. The device is used for deploying a first local model in a multi-party federal model, the multi-party federal model comprises at least two local models, and the at least two local models correspond to different deployments, and the device comprises the following components:
an obtaining module 810, configured to obtain model package information of the first local model, where the model package information includes model information, computation logic information, and communication logic information of the first local model;
a rebuilding module 820, configured to rebuild to obtain at least one local sub-model in the first local model based on the parameter of the at least one local sub-model indicated by the model information;
a configuration module 830, configured to configure the at least one local sub-model based on the computation logic information and the communication logic information, so as to complete deployment of the first local model; starting a local model service corresponding to the first local model;
the computation logic information is used for indicating a data operation relation in the at least one local sub-model, the communication logic information is used for indicating a data transmission condition between the at least one local sub-model and a second local model, and the second local model is one or more local models except the first local model in the multi-party federal model.
In an alternative design of the present application, the configuration module 830 is further configured to:
configuring the at least one local sub-model based on the calculation logic information to obtain sub-model prediction logic of the at least one local sub-model, wherein the sub-model prediction logic is used for indicating an operation weight parameter and an operation relation character of at least one data in the at least one local sub-model;
and configuring at least one cross-network message in the sub-model prediction logic based on the communication logic information to complete the deployment of the first local model, wherein the cross-network message is used for carrying data transmitted between the at least one local sub-model and the second local model.
In an alternative design of the present application, the configuration module 830 is further configured to:
and configuring at least one of a cross-network inlet and a cross-network outlet of at least one cross-network message in the sub-model prediction logic based on the communication logic information to complete the deployment of the first local model, wherein the cross-network inlet is used for indicating a message source of the cross-network message, and the cross-network outlet is used for indicating a message destination of the cross-network message.
In an optional design of the present application, the model information, the computation logic information, and the communication logic information of the first local model are information obtained through serialization processing.
In an alternative design of the present application, the apparatus further includes:
a transceiver module 840, configured to receive or send a model deployment request, where the model deployment request is used to instruct a receiving party to deploy a local model corresponding to the receiving party in the multi-party federal model, and the receiving party is one or more than one party receiving the model deployment request.
In an alternative design of the present application, the configuration module 830 is further configured to:
responding to a request for obtaining the expansion and contraction capacity, and adding a copy model for deploying or undeploying the first local model, wherein the copy model is a copy of the first local model;
the first local model and the replica model form at least two sets of first local models which are deployed in parallel.
In an optional design of the present application, the scaling request is generated when an inference request corresponding to the multi-party federal model exceeds a load threshold;
the load threshold comprises at least one of: the frequency threshold of the inference request, the memory load threshold of the computer equipment corresponding to the multi-party federal model, and the processor load threshold of the computer equipment corresponding to the multi-party federal model.
In an optional design of the present application, the model package information further includes configuration information of the first local model;
the configuration module 830 is further configured to:
configuring a data flow topology of the at least one local sub-model in the first local model based on the configuration information.
In an alternative design of the present application, the configuration module 830 is further configured to:
configuring the data flow topology based on the configuration information represented using directed acyclic graphs;
wherein an edge in the directed acyclic graph corresponds to a flow direction path of data, and each node in the directed acyclic graph corresponds to one of the local submodel, a data entry of the data, and a data exit of the data.
In an alternative design of the present application, the configuration module 830 is further configured to at least one of:
configuring a data inflow topology of the local submodel under the condition that a starting node of a first edge in the directed acyclic graph corresponds to the data entry and an end node of the first edge corresponds to the local submodel;
and configuring the data outflow topology of the local submodel under the condition that the starting node of the second edge in the directed acyclic graph corresponds to the local submodel and the ending node of the second edge corresponds to the data outlet.
In an alternative design of the present application, the first local model comprises at least two local submodels, the at least two local submodels comprising: a first local submodel and a second local submodel;
the configuration module 830 is further configured to:
and under the condition that a starting node of a third edge in the directed acyclic graph corresponds to the first local submodel and an end node of the third edge corresponds to the second local submodel, performing association configuration on a data outflow topology of the first local submodel and a data inflow topology of the second local submodel.
In an optional design of the present application, the obtaining module 810 is further configured to obtain an inference request, where the inference request corresponds to data to be processed;
the prediction module 850 is configured to invoke the first local model to perform prediction processing on the to-be-processed data, so as to obtain prediction information corresponding to the inference request.
In an alternative design of the present application, the apparatus further includes:
the transceiver module 840 is configured to forward the inference request to a load balancer corresponding to the first local model according to the model identity of the first local model carried in the inference request;
a determining module 860, configured to invoke the load balancer to determine, in at least two sets of first local models deployed in parallel, the first local model used this time.
In an alternative design of the present application, the apparatus further includes:
a transceiver module 840, configured to send a broadcast message to other local models except the first local model in the multi-party federation model, where the broadcast message carries the inference request.
In an alternative design of the present application, the prediction module 850 is further configured to:
determining a first intermediate message according to the data to be processed;
sending the first intermediate message to a second local model, the second local model being one or more of the multi-party federated models other than the first local model;
receiving a second intermediate message sent by a second local model, wherein the second intermediate message is determined according to the first intermediate message;
and obtaining the prediction information corresponding to the inference request according to at least one of the first intermediate message, the second intermediate message and the data to be processed.
In an alternative design of the present application, the first local model includes a predictive service and an auxiliary service; the prediction service is used for performing prediction processing on the data to be processed to obtain prediction information corresponding to the inference request;
the device further comprises: a transceiver module 840, configured to receive, by the auxiliary service through an asynchronous message, at least one of the first intermediate message, the second intermediate message, and the to-be-processed data, and process to obtain an auxiliary result.
Fig. 23 shows a block diagram of a model deployment apparatus provided in an exemplary embodiment of the present application. The device is used for packaging a first local model in a multi-party federal model, wherein the multi-party federal model comprises at least two local models, and the at least two local models correspond to different deployments, and the device comprises the following contents:
an obtaining module 870 configured to obtain computation logic information and communication logic information of a first local model, where the computation logic information is used to indicate a data operation relationship in at least one local sub-model in the first local model, and the communication logic information is used to indicate a data transmission situation between the at least one local sub-model and a second local model, where the second local model is one or more local models in the multi-party federation model except the first local model;
a deriving module 880, configured to derive, based on the trained at least one local submodel, model information of the first local model, where the model information is used to indicate a model parameter of the at least one local submodel;
a packing module 890, configured to pack the model information, the computation logic information, and the communication logic information to obtain model package information of the first local model.
In an alternative design of the present application, the obtaining module 870 is further configured to:
analyzing the data operation relation in the at least one local submodel according to the trained at least one local submodel to obtain the calculation logic information of the first local model.
In an alternative design of the present application, the obtaining module 870 is further configured to:
analyzing the data transmission condition between the at least one local submodel and a second local model according to the trained at least one local submodel, and obtaining the communication logic information of the first local model under the condition that cross-network information exists between the at least one local submodel and the second local model.
In an alternative design of the present application, the derivation module 880 is further configured to: serializing the trained at least one local submodel, coding to obtain serialization information of the at least one local submodel, and taking the serialization information of the at least one local submodel as model information of the first local model.
In an alternative design of the present application, the deriving module 880 is further configured to: and carrying out serialization processing on the trained at least one local submodel based on a model interface protocol, and coding to obtain serialization information of the at least one local submodel, wherein the model interface protocol is used for indicating a serialization coding mode of the at least one local submodel.
In an alternative design of the present application, the obtaining module 870 is further configured to:
acquiring configuration information of a first local model, wherein the configuration information is used for indicating the data flow direction topology of at least one local sub-model in the first local model in the multi-party federation model;
the packing module 890 is further operable to:
and packaging the model information, the calculation logic information, the communication logic information and the configuration information to obtain the model package information of the first local model.
In an optional design of the present application, the obtaining module 870 is further configured to:
generating the configuration information represented by a directed acyclic graph according to the data flow topology of the at least one local sub-model in the multi-party federation model;
and each node in the directed acyclic graph corresponds to one of the local submodel, the data entry of the data and the data exit of the data.
In an optional design of the present application, the obtaining module 870 is further configured to at least one of:
under the condition that first data flow from the data entry to the local submodel, generating a first edge in the directed acyclic graph, wherein a starting node of the first edge corresponds to the data entry, and an end node of the first edge corresponds to the local submodel;
and under the condition that second data flow from the local submodel to the data outlet, generating a second edge in the directed acyclic graph, wherein a starting node of the second edge corresponds to the local submodel, and an end node of the second edge corresponds to the data outlet.
In an alternative design of the present application, the first local model comprises at least two local submodels, the at least two local submodels comprising: a first local submodel and a second local submodel;
the acquisition module 870 is further configured to: and under the condition that third data flow from the first local submodel to the second local submodel, generating a third edge in the directed acyclic graph, wherein a starting node of the third edge corresponds to the first local submodel, and an end node of the third edge corresponds to the second local submodel.
It should be noted that, when the apparatus provided in the foregoing embodiment implements the functions thereof, only the division of each functional module is illustrated, and in practical applications, the above functions may be distributed by different functional modules according to actual needs, that is, the content structure of the device may be divided into different functional modules to implement all or part of the functions described above.
With regard to the apparatus in the above-described embodiment, the specific manner in which the respective modules perform operations has been described in detail in the embodiment related to the method; the technical effects achieved by the operations performed by the respective modules are the same as those in the embodiments related to the method, and will not be described in detail here.
An embodiment of the present application further provides a computer device, where the computer device includes: a processor and a memory, the memory having a computer program stored therein; the processor is configured to execute the computer program in the memory to implement the model deployment method and/or the model packaging method provided in the foregoing method embodiments.
Optionally, the computer device is a server. Illustratively, fig. 24 is a block diagram of a server according to an exemplary embodiment of the present application.
In general, the server 2300 includes: a processor 2301 and a memory 2302.
The processor 2301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on. The processor 2301 may be implemented in at least one hardware form selected from Digital Signal Processing (DSP), field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 2301 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in a wake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 2301 may be integrated with a Graphics Processing Unit (GPU) which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 2301 may also include an Artificial Intelligence (AI) processor for processing computing operations related to machine learning.
The memory 2302 may include one or more computer-readable storage media, which may be non-transitory. Memory 2302 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in the memory 2302 is used to store at least one instruction for execution by the processor 2301 to implement the model deployment method and/or the model packing method provided by the method embodiments herein.
In some embodiments, the server 2300 may further optionally include: an input interface 2303 and an output interface 2304. The processor 2301, the memory 2302, the input interface 2303 and the output interface 2304 may be connected by a bus or a signal line. Each peripheral device may be connected to the input interface 2303 and the output interface 2304 by a bus, a signal line, or a circuit board. The Input interface 2303 and the Output interface 2304 can be used for connecting at least one peripheral device related to Input/Output (I/O) to the processor 2301 and the memory 2302. In some embodiments, the processor 2301, memory 2302, and input interface 2303 and output interface 2304 are integrated on the same chip or circuit board; in some other embodiments, the processor 2301, the memory 2302, and any one or both of the input interface 2303 and the output interface 2304 can be implemented on separate chips or circuit boards, which is not limited by the embodiments.
Those skilled in the art will appreciate that the above-described illustrated architecture is not meant to be limiting with respect to the server 2300 and may include more or fewer components than those shown, or may combine certain components, or may employ a different arrangement of components.
In an exemplary embodiment, there is also provided a chip comprising programmable logic circuits and/or program instructions for implementing the model deployment method and/or the model packing method of the above aspects when the chip is run on a computer device.
In an exemplary embodiment, a computer program product is also provided that includes 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 reads the computer instructions from the computer-readable storage medium and executes the computer instructions to implement the model deployment method and/or the model packing method provided by the above method embodiments.
In an exemplary embodiment, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program is loaded and executed by a processor to implement the model deployment method and/or the model packing method provided by the above-mentioned method embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Those skilled in the art will recognize that, in one or more of the examples described above, the functions described in the embodiments of the present application may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The above description is intended only to illustrate the alternative embodiments of the present application, and should not be construed as limiting the present application, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (19)

1. A model deployment method is used for deploying a first local model in a multi-party federated model, wherein the multi-party federated model comprises at least two local models, and the at least two local models correspond to different deployers, and the method comprises the following steps:
obtaining model package information of the first local model, wherein the model package information comprises model information, calculation logic information and communication logic information of the first local model;
reconstructing to obtain at least one local submodel based on the parameters of the at least one local submodel in the first local model indicated by the model information;
configuring the at least one local sub-model based on the computation logic information and the communication logic information to complete the deployment of the first local model; starting a local model service corresponding to the first local model;
the computation logic information is used for indicating a data operation relation in the at least one local sub-model, the communication logic information is used for indicating a data transmission condition between the at least one local sub-model and a second local model, and the second local model is one or more local models except the first local model in the multi-party federal model.
2. The method of claim 1, wherein configuring the at least one local sub-model based on the computational logic information and the communication logic information completes the first local model deployment, comprising:
configuring the at least one local sub-model based on the calculation logic information to obtain sub-model prediction logic of the at least one local sub-model, wherein the sub-model prediction logic is used for indicating an operation weight parameter and an operation relation character of at least one data in the at least one local sub-model;
and configuring at least one of a cross-network inlet and a cross-network outlet of at least one cross-network message in the sub-model prediction logic based on the communication logic information to complete the deployment of the first local model, wherein the cross-network message is used for carrying data transmitted between the at least one local sub-model and the second local model, the cross-network inlet is used for indicating a message source of the cross-network message, and the cross-network outlet is used for indicating a message destination of the cross-network message.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
receiving or sending a model deployment request, wherein the model deployment request is used for instructing a receiving party to deploy a local model corresponding to the receiving party in the multi-party federated model, and the receiving party is one or more than one party receiving the model deployment request.
4. The method according to claim 1 or 2, characterized in that the method further comprises:
responding to a request for obtaining the expansion and contraction capacity, and adding a copy model for deploying or undeploying the first local model, wherein the copy model is a copy of the first local model;
wherein the first local model and the replica model form at least two sets of first local models deployed in parallel; the scaling request is generated under the condition that an inference request corresponding to the multi-party federal model exceeds a load threshold;
the load threshold comprises at least one of: the frequency threshold of the inference request, the memory load threshold of the computer equipment corresponding to the multi-party federal model, and the processor load threshold of the computer equipment corresponding to the multi-party federal model.
5. The method of claim 1, wherein the model package information further includes configuration information for the first local model;
the method further comprises the following steps:
configuring a data flow topology of the at least one local sub-model in the first local model based on the configuration information.
6. The method of claim 5, wherein configuring the data flow topology of the at least one local sub-model in the first local model based on the configuration information comprises:
configuring the data flow topology based on the configuration information represented using directed acyclic graphs;
wherein an edge in the directed acyclic graph corresponds to a flow direction path of data, and each node in the directed acyclic graph corresponds to one of the local submodel, a data entry of the data, and a data exit of the data.
7. The method of claim 6, wherein configuring the data flow topology based on the configuration information represented using directed acyclic graph representation comprises at least one of:
configuring a data inflow topology of the local submodel under the condition that a starting node of a first edge in the directed acyclic graph corresponds to the data entry and an end node of the first edge corresponds to the local submodel;
and configuring the data outflow topology of the local submodel under the condition that the starting node of the second edge in the directed acyclic graph corresponds to the local submodel and the end node of the second edge corresponds to the data outlet.
8. The method according to claim 1 or 2, characterized in that the method further comprises:
acquiring an inference request, wherein the inference request corresponds to data to be processed;
and calling the first local model to carry out prediction processing on the data to be processed to obtain prediction information corresponding to the inference request.
9. The method of claim 8, further comprising:
forwarding the inference request to a load balancer corresponding to the first local model according to the model identity of the first local model carried by the inference request;
and calling the load balancer to determine the first local model used at this time in at least two sets of first local models deployed in parallel.
10. The method of claim 8, further comprising:
and sending a broadcast message to other local models except the first local model in the multi-party federation model, wherein the broadcast message carries the inference request.
11. A model packaging method for packaging a first local model in a multi-party federal model including at least two local models corresponding to different deployments, the method comprising:
acquiring computation logic information and communication logic information of the first local model, wherein the computation logic information is used for indicating a data operation relation in at least one local sub-model in the first local model, the communication logic information is used for indicating a data transmission condition between the at least one local sub-model and a second local model, and the second local model is one or more local models except the first local model in the multi-party federal model;
deriving model information of the first local model based on the trained at least one local submodel, the model information being used to indicate model parameters of the at least one local submodel;
and packaging the model information, the calculation logic information and the communication logic information to obtain model package information of the first local model.
12. The method of claim 11, wherein obtaining computational logic information and communication logic information of the first local model comprises:
analyzing a data operation relation in the at least one local submodel according to the trained at least one local submodel to obtain the calculation logic information of the first local model;
analyzing the data transmission condition between the at least one local submodel and the second local model according to the trained at least one local submodel, and obtaining the communication logic information of the first local model under the condition that cross-network information exists between the at least one local submodel and the second local model.
13. The method according to claim 11 or 12, wherein the deriving model information of the first local model based on the trained at least one local submodel comprises:
serializing the trained at least one local submodel, coding to obtain serialization information of the at least one local submodel, and taking the serialization information of the at least one local submodel as the model information of the first local model.
14. The method according to claim 11 or 12, further comprising:
generating configuration information represented by a directed acyclic graph according to the data flow topology of the at least one local sub-model in the multi-party federation model, wherein the configuration information is used for indicating the data flow topology of the at least one local sub-model in the first local model in the multi-party federation model;
wherein an edge in the directed acyclic graph corresponds to a flow direction path of data, and each node in the directed acyclic graph corresponds to one of the local submodel, a data entry of the data, and a data exit of the data;
the packaging the model information, the computation logic information, and the communication logic information to obtain model package information of the first local model includes:
and packaging the model information, the calculation logic information, the communication logic information and the configuration information to obtain the model package information of the first local model.
15. The method according to claim 14, wherein the generating configuration information represented by a directed acyclic graph according to a data flow topology of the at least one local sub-model in the multi-party federation model comprises at least one of:
under the condition that first data flow from the data entry to the local submodel, generating a first edge in the directed acyclic graph, wherein a starting node of the first edge corresponds to the data entry, and an end node of the first edge corresponds to the local submodel;
and under the condition that second data flow from the local submodel to the data outlet, generating a second edge in the directed acyclic graph, wherein a starting node of the second edge corresponds to the local submodel, and an end node of the second edge corresponds to the data outlet.
16. A model deployment apparatus, wherein the apparatus is configured to deploy a first local model in a multi-party federal model, the multi-party federal model includes at least two local models, and the at least two local models correspond to different deployment parties, the apparatus comprising:
an obtaining module, configured to obtain model package information of the first local model, where the model package information includes model information, computation logic information, and communication logic information of the first local model;
the reconstruction module is used for reconstructing to obtain at least one local submodel based on the parameters of the at least one local submodel in the first local model indicated by the model information;
the configuration module is used for configuring the at least one local sub-model based on the calculation logic information and the communication logic information to complete the first local model deployment; starting a local model service corresponding to the first local model;
the computation logic information is used for indicating a data operation relation in the at least one local sub-model, the communication logic information is used for indicating a data transmission condition between the at least one local sub-model and a second local model, and the second local model is one or more local models except the first local model in the multi-party federal model.
17. A model packaging apparatus, for packaging a first local model in a multi-party federal model, the multi-party federal model including at least two local models, the at least two local models corresponding to different deployments, the apparatus comprising:
an obtaining module, configured to obtain computation logic information and communication logic information of the first local model, where the computation logic information is used to indicate a data operation relationship in at least one local sub-model in the first local model, the communication logic information is used to indicate a data transmission situation between the at least one local sub-model and a second local model, and the second local model is one or more local models in the multi-party federation model except the first local model;
a deriving module, configured to derive model information of the first local model based on the trained at least one local submodel, where the model information is used to indicate a model parameter of the at least one local submodel;
and the packing module is used for packing the model information, the calculation logic information and the communication logic information to obtain the model package information of the first local model.
18. A computer device, characterized in that the computer device comprises: the system comprises a processor and a memory, wherein at least one program is stored in the memory; the processor is configured to execute the at least one program in the memory to implement the model deployment method according to any one of claims 1 to 10 or the model packaging method according to any one of claims 11 to 15.
19. A computer-readable storage medium having stored thereon executable instructions that are loaded and executed by a processor to implement the model deployment method of any of claims 1 to 10 or the model packaging method of any of claims 11 to 15.
CN202211099332.0A 2022-09-09 2022-09-09 Model deployment method, packing method, device, equipment and storage medium Active CN115185543B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211099332.0A CN115185543B (en) 2022-09-09 2022-09-09 Model deployment method, packing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211099332.0A CN115185543B (en) 2022-09-09 2022-09-09 Model deployment method, packing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115185543A CN115185543A (en) 2022-10-14
CN115185543B true CN115185543B (en) 2022-11-25

Family

ID=83524669

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211099332.0A Active CN115185543B (en) 2022-09-09 2022-09-09 Model deployment method, packing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115185543B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111340232A (en) * 2020-02-17 2020-06-26 支付宝(杭州)信息技术有限公司 Online prediction service deployment method and device, electronic equipment and storage medium
CN112257876A (en) * 2020-11-15 2021-01-22 腾讯科技(深圳)有限公司 Federal learning method, apparatus, computer device and medium
CN114764475A (en) * 2021-01-14 2022-07-19 新智数字科技有限公司 Central calibration system of combined learning engine
CN114818011A (en) * 2022-06-27 2022-07-29 国网智能电网研究院有限公司 Federal learning method and system suitable for carbon credit evaluation and electronic equipment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110126197A1 (en) * 2009-11-25 2011-05-26 Novell, Inc. System and method for controlling cloud and virtualized data centers in an intelligent workload management system
US9716634B2 (en) * 2013-03-15 2017-07-25 International Business Machines Corporation Fulfillment of cloud service orders
US20210374502A1 (en) * 2020-06-01 2021-12-02 Nvidia Corporation Technique to perform neural network architecture search with federated learning
US20220083917A1 (en) * 2020-09-15 2022-03-17 Vmware, Inc. Distributed and federated learning using multi-layer machine learning models

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111340232A (en) * 2020-02-17 2020-06-26 支付宝(杭州)信息技术有限公司 Online prediction service deployment method and device, electronic equipment and storage medium
CN112257876A (en) * 2020-11-15 2021-01-22 腾讯科技(深圳)有限公司 Federal learning method, apparatus, computer device and medium
CN114764475A (en) * 2021-01-14 2022-07-19 新智数字科技有限公司 Central calibration system of combined learning engine
CN114818011A (en) * 2022-06-27 2022-07-29 国网智能电网研究院有限公司 Federal learning method and system suitable for carbon credit evaluation and electronic equipment

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
"Reducing Model Cost Based on the Weights of Each Layer for Federated Learning Clustering";Hyungbin Kim 等;《2021 Twelfth International Conference on Ubiquitous and Future Networks》;20210913;405-408 *
"基于模型准确率的链上去中心化联邦学习模型";宋宇波 等;《清华大学学报(自然科学版)》;20220317;第62卷(第5期);832-841 *
"基于边缘的联邦学习模型清洗和设备聚类方法";刘艳 等;《计算机学报》;20211215;第44卷(第12期);2515-2528 *

Also Published As

Publication number Publication date
CN115185543A (en) 2022-10-14

Similar Documents

Publication Publication Date Title
CN111401903B (en) Block chain message processing method, device, computer and readable storage medium
CN110888722B (en) Task processing method and device, electronic equipment and computer readable storage medium
US20200177572A1 (en) Sending cross-chain authenticatable messages
Ali et al. A cost and energy efficient task scheduling technique to offload microservices based applications in mobile cloud computing
John et al. Ai on the edge: Architectural alternatives
CN114189525A (en) Service request method and device and electronic equipment
US9407546B2 (en) Routing a message using a routing table in a dynamic service mesh
CN104852939A (en) Capability interface deploying method and system
CN114710571A (en) Data packet processing system
US20090132582A1 (en) Processor-server hybrid system for processing data
CN115185543B (en) Model deployment method, packing method, device, equipment and storage medium
CN116755799A (en) Service arrangement system and method
CN106936643B (en) Equipment linkage method and terminal equipment
US10489213B2 (en) Execution of a method at a cluster of nodes
Brogi et al. A service-oriented model for embedded peer-to-peer systems
CN115550468A (en) Service request processing method, device, equipment and medium
CN112416980A (en) Data service processing method, device and equipment
CN116719627B (en) Data processing method, device, equipment and storage medium
CN111488216B (en) Data processing method and device and electronic equipment
CN114253747B (en) Distributed message management system and method
CN116938757A (en) Data processing method, device, electronic equipment and storage medium
Baraki et al. MOCCAA: A Delta-synchronized and Adaptable Mobile Cloud Computing Framework.
CN114626847A (en) Block chain certificate management method and device
CN115604010A (en) Data hybrid processing method, system, device, medium, and data processing system
Xu et al. SmartLLM: A New Oracle System for Smart Contracts Calling Large Language Models

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
GR01 Patent grant
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40077102

Country of ref document: HK