Partial homomorphism-based data compilation method, device and equipment and storage medium

By using the computational graph in the parsing library to automatically process partially homomorphic encrypted data, the inefficiency and high cost caused by manual coding in existing technologies are solved, and the data compilation is automated and flexible.

CN114489652BActive Publication Date: 2026-06-02WEBANK (CHINA)

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WEBANK (CHINA)
Filing Date
2020-10-23
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In existing technologies, data compilation for some homomorphic encryption methods requires manual writing of computational code, resulting in low computational efficiency and high labor costs.

Method used

The algorithm uses the computational graph in the parsing library to automatically process some homomorphic encrypted data, automatically calculating the relationships between parameters through the computational graph in the parsing library, thus avoiding the need for manual coding.

Benefits of technology

It has achieved automated and intelligent data compilation, reducing labor costs and improving compilation efficiency and flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114489652B_ABST
    Figure CN114489652B_ABST
Patent Text Reader

Abstract

The present disclosure provides a partial homomorphism-based data compiling method, device, equipment and storage medium, comprising: a first electronic device receiving a first ciphertext parameter sent by a second electronic device, the first ciphertext parameter being used to indicate processing of to-be-compiled data, the encryption logic of the to-be-compiled data being full homomorphic encryption, converting the encryption logic of the to-be-compiled data into partial homomorphic encryption, the converted to-be-compiled data including the first ciphertext parameter and a second ciphertext parameter generated by the first electronic device, determining an operation graph corresponding to the converted to-be-compiled data according to a preset analysis library, each operation graph in the analysis library being used to represent an operation relationship between multiple parameters, executing the operation graph corresponding to the converted to-be-compiled data according to the first ciphertext parameter and the second ciphertext parameter to obtain a data compilation result, realizing the automation and intelligence of compilation, and improving the general applicability and flexibility of compilation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the fields of data security and compilation, and in particular to a data compilation method, apparatus, device, and storage medium based on partial homomorphism. Background Technology

[0002] With the development of internet technology and the continuous increase in information volume, data security has become a critical issue. Devices can exchange encrypted data to ensure data security. Devices need to perform various calculations on data parameters, but because they can only obtain the encrypted data from the other device and not the plaintext, they cannot perform complex calculations on the data parameters during data processing.

[0003] In existing technologies, homomorphic encryption can be used to process ciphertext and then perform complex data operations. Specifically, the device can convert fully homomorphically encrypted data into partially homomorphically encrypted data, and then code is written to perform operations on the partially homomorphically encrypted data.

[0004] In the process of implementing this disclosure, the inventors discovered at least the following technical problems: because the compiler needs to manually write the calculation code each time the data of the partial homomorphic encryption method is calculated, the calculation efficiency is low and the labor cost is high. Summary of the Invention

[0005] The main objective of this disclosure is to provide a data compilation method, apparatus, device, and storage medium based on partial homomorphism, thereby reducing compilation costs and improving compilation efficiency.

[0006] In a first aspect, to achieve the above objectives, this disclosure provides a data compilation method based on partial homomorphism, the method being applied to a first electronic device, the method comprising:

[0007] The system receives a first ciphertext parameter sent by a second electronic device, wherein the first ciphertext parameter is used to indicate the processing of data to be compiled, and the encryption logic of the data to be compiled is fully homomorphic encryption.

[0008] The encryption logic of the data to be compiled is converted into partial homomorphic encryption to obtain the converted data to be compiled, wherein the converted data to be compiled includes the first ciphertext parameter and the second ciphertext parameter generated by the first electronic device;

[0009] According to the preset parsing library, which includes at least one operation graph, each operation graph is used to characterize the operation relationship between multiple parameters, and the operation graph corresponding to the converted data to be compiled is determined.

[0010] Based on the first ciphertext parameter and the second ciphertext parameter, the computation graph corresponding to the converted data to be compiled is executed to obtain the data compilation result.

[0011] In some embodiments, the converted data to be compiled has operators; the parameters of the computation graph have operators between them;

[0012] The step of determining the computational graph corresponding to the converted data to be compiled based on a preset parsing library includes:

[0013] Based on the operators between the parameters in each of the aforementioned computation graphs, determine the computation graph that matches the operators of the converted data to be compiled.

[0014] In some embodiments, there are operational relationships between the parameters of different computational graphs.

[0015] In some embodiments, the computation graph includes multiple nodes, and the computational relationship between parameters in the computation graph is the computational relationship between nodes, with each node used to substitute parameters;

[0016] Based on the first ciphertext parameter and the second ciphertext parameter, perform the computation graph corresponding to the transformed data to be compiled to obtain the data compilation result, including:

[0017] The first ciphertext parameter and the second ciphertext parameter are substituted into the nodes in the computation graph corresponding to the transformed data to be compiled, so as to perform the computation process of the computation graph corresponding to the transformed data to be compiled and obtain the data compilation result.

[0018] In some embodiments, before substituting the first ciphertext parameter and the second ciphertext parameter into the nodes in the computation graph corresponding to the transformed data to be compiled, the method further includes:

[0019] Obtain a third ciphertext parameter from the second electronic device, wherein the third ciphertext parameter is generated based on the first ciphertext parameter;

[0020] The first ciphertext parameter and the second ciphertext parameter are substituted into nodes in the computation graph corresponding to the transformed data to be compiled, to execute the computation process of the computation graph corresponding to the transformed data to be compiled, and to obtain the data compilation result, including:

[0021] The first ciphertext parameter, the second ciphertext parameter, the third ciphertext parameter, and the fourth ciphertext parameter are substituted into the nodes in the computation graph corresponding to the converted data to be compiled, so as to perform the computation process of the computation graph corresponding to the converted data to be compiled and obtain the data compilation result. The fourth ciphertext parameter is generated by the first electronic device based on the second ciphertext parameter.

[0022] In some embodiments, the first ciphertext parameter is intermediate information generated during the training or application of the federated learning model; after obtaining the data compilation result, the method further includes:

[0023] The compiled data results are sent to a third electronic device, and the compiled data results are used to determine the gradient parameters;

[0024] The system receives gradient parameters sent by the third electronic device and updates the federated learning model based on the gradient parameters.

[0025] In some embodiments, the method further includes:

[0026] Based on different computational requirements, including the requirements for computational relationships between different parameters, each computational graph is established to obtain the parsing library.

[0027] In some embodiments, the first electronic device is used to execute the Python language, and the second electronic device is used to execute the Python language.

[0028] Secondly, embodiments of this disclosure also provide a partially homomorphic data compilation apparatus, the apparatus being applied to a first electronic device, the apparatus comprising:

[0029] The first receiving module is used to receive a first ciphertext parameter sent by the second electronic device, wherein the first ciphertext parameter is used to indicate the processing of data to be compiled, and the encryption logic of the data to be compiled is fully homomorphic encryption;

[0030] A conversion module is used to convert the encryption logic of the data to be compiled into partial homomorphic encryption to obtain the converted data to be compiled, wherein the converted data to be compiled includes the first ciphertext parameter and the second ciphertext parameter generated by the first electronic device;

[0031] The determination module is used to determine the computational graph corresponding to the converted data to be compiled based on a preset parsing library, wherein the parsing library includes at least one computational graph, and each computational graph is used to characterize the computational relationship between multiple parameters.

[0032] The execution module is used to perform an operation graph corresponding to the converted data to be compiled based on the first ciphertext parameter and the second ciphertext parameter, and obtain the data compilation result.

[0033] In some embodiments, the converted data to be compiled has operators; the parameters of the computation graph have operators between them;

[0034] The determining module is used to determine the computation graph that matches the operators of the converted data to be compiled, based on the operators between the parameters in each computation graph.

[0035] In some embodiments, there are operational relationships between the parameters of different computational graphs.

[0036] In some embodiments, the computation graph includes multiple nodes, and the computational relationship between parameters in the computation graph is the computational relationship between nodes, with each node used to substitute parameters;

[0037] The execution module is used to substitute the first ciphertext parameter and the second ciphertext parameter into the nodes in the computation graph corresponding to the converted data to be compiled, so as to perform the computation process of the computation graph corresponding to the converted data to be compiled, and obtain the data compilation result.

[0038] In some embodiments, the execution module is configured to obtain a third ciphertext parameter from the second electronic device, wherein the third ciphertext parameter is generated based on the first ciphertext parameter, and substitute the first ciphertext parameter, the second ciphertext parameter, the third ciphertext parameter, and the fourth ciphertext parameter into nodes in the computation graph corresponding to the converted data to be compiled, so as to perform the computation process of the computation graph corresponding to the converted data to be compiled, and obtain the data compilation result, wherein the fourth ciphertext parameter is generated by the first electronic device based on the second ciphertext parameter.

[0039] In some embodiments, the first ciphertext parameter is intermediate information generated during the training or application of a federated learning model; the apparatus further includes:

[0040] A sending module is used to send the data compilation result to a third electronic device, the data compilation result being used to determine gradient parameters;

[0041] The second receiving module is used to receive gradient parameters sent by the third electronic device;

[0042] An update module is used to update the federated learning model based on the gradient parameters.

[0043] In some embodiments, the apparatus further includes:

[0044] A module is established to create each computational graph based on different computational requirements, including the requirements for computational relationships between different parameters, so as to obtain the parsing library.

[0045] In some embodiments, the first electronic device is used to execute the Python language, and the second electronic device is used to execute the Python language.

[0046] This disclosure provides a method, apparatus, device, and storage medium for compiling data based on partial homomorphism, comprising: a first electronic device receiving a first ciphertext parameter sent by a second electronic device, wherein the first ciphertext parameter is used to indicate processing data to be compiled, the encryption logic of the data to be compiled is fully homomorphic encryption, converting the encryption logic of the data to be compiled into partial homomorphic encryption to obtain converted data to be compiled, wherein the converted data to be compiled includes the first ciphertext parameter and a second ciphertext parameter generated by the first electronic device, and determining the relationship between the converted data and the data to be compiled according to a preset parsing library, wherein the parsing library includes at least one computational graph, each computational graph being used to characterize the computational relationship between multiple parameters. The computational graph corresponding to the translated data is used to execute the computational graph corresponding to the converted data to be compiled based on the first and second ciphertext parameters, thereby obtaining the data compilation result. In this embodiment, the computational graph corresponding to the converted data to be compiled is determined from the parsing library, and the first and second ciphertext parameters are combined to execute the computational graph corresponding to the converted data to be compiled, thereby obtaining the data compilation result. This avoids the problems of high labor costs and low efficiency caused by manually writing the computational code corresponding to the data to be compiled in related technologies, thereby achieving automation and intelligence in compilation and improving the technical effect of general applicability and flexibility of compilation. Attached Figure Description

[0047] Figure 1 This is a schematic diagram illustrating an application scenario of a partially homomorphic data compilation method according to an embodiment of this disclosure;

[0048] Figure 2 This is a flowchart illustrating a partially homomorphic data compilation method according to an embodiment of this disclosure;

[0049] Figure 3 This is a schematic diagram illustrating an application scenario of a partially homomorphic data compilation method according to another embodiment of this disclosure;

[0050] Figure 4 This is a flowchart illustrating a partially homomorphic data compilation method according to another embodiment of this disclosure;

[0051] Figure 5This is a schematic diagram of the structure of the computational graph according to an embodiment of the present disclosure;

[0052] Figure 6 This is a schematic diagram of the operational graph structure according to another embodiment of the present disclosure;

[0053] Figure 7 This is a schematic diagram of a partially homomorphic data compilation apparatus according to an embodiment of the present disclosure;

[0054] Figure 8 This is a schematic diagram of a partially homomorphic data compilation apparatus according to an embodiment of the present disclosure;

[0055] Figure 9 This is a block diagram of an electronic device according to an embodiment of this application.

[0056] The realization of the purpose, functional features and advantages of this disclosure will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0057] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0058] The partially homomorphic data compilation method provided in this embodiment can be applied to information interaction between two platforms or to information interaction between three platforms based on an intermediate platform. When the partially homomorphic data compilation method of this embodiment is applied to information interaction between three platforms, it can specifically be used for training or application of a federated learning model.

[0059] Taking the information exchange between the two platforms as an example, combined with Figure 1 An exemplary description is provided of the application scenarios of the partially homomorphic data compilation method according to embodiments of this disclosure.

[0060] like Figure 1 As shown, the application scenario may include a first platform 100 and a second platform 200, which are connected via a network.

[0061] The first platform 100 includes the first device 110, and as follows: Figure 1As shown, the first device 110 may include a server and terminal devices, and the terminal devices may be mobile terminals, such as mobile phones (or "cellular" phones) and computers with mobile terminals. For example, they may be portable, pocket-sized, handheld, computer-embedded, or vehicle-mounted mobile devices that exchange voice and / or data with the wireless access network. The terminal devices may also be Personal Communication Service (PCS) phones, cordless phones, Session Initiation Protocol (SIP) phones, Wireless Local Loop (WLL) stations, Personal Digital Assistants (PDAs), tablet computers, wireless modems, handsets, laptop computers, Machine Type Communication (MTC) terminals, etc. The terminal devices may also be referred to as systems, subscriber units, subscriber stations, mobile stations, mobile devices, remote stations, remote terminals, or access terminals. Terminal, user terminal, user agent, user device or user equipment, etc., are not limited here.

[0062] It is worth noting that the above application scenarios are only used to illustrate possible application scenarios of the embodiments of this disclosure, and should not be construed as limiting the application scenarios of the partially homomorphic data compilation method of this disclosure. For example, in some embodiments, the first device 110 in the first platform 100 can be adaptively added or removed, and other devices for supporting the first device 110, such as information storage devices, can also be adaptively added.

[0063] Combination such as Figure 1 In the application scenario shown, the second device 210 can send a first ciphertext parameter to the first device 110. The first ciphertext parameter is used to indicate the processing of the data to be compiled. When the encryption logic of the data to be compiled is fully homomorphic encryption, the first device 110 can convert the encryption logic of the data to be compiled into partially homomorphic encryption, and compile the data based on the conversion to partially homomorphic encryption to obtain the data compilation result.

[0064] In related technologies, after the first device can convert the fully homomorphic encryption method of data into a partially homomorphic encryption method, the compiler needs to write code to operate on the partially homomorphic encryption method, and then the device performs operations on the partially homomorphically encrypted data.

[0065] However, since compilers need to manually write the calculation code each time they process data using the homomorphic encryption method, the calculation efficiency is low and the labor cost is high.

[0066] Through creative work, the inventors of this disclosure arrived at the inventive concept: after the first device converts the fully homomorphic encryption method of the data into a partially homomorphic encryption method, the computational logic of the computational graph in the parsing library is used to automatically perform the operations between the parameters in the partially homomorphic encryption, thereby achieving the technical effect of reducing labor costs and improving computational efficiency.

[0067] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0068] According to one aspect of the embodiments of the invention, this disclosure provides a data compilation method based on partial homomorphism. Figure 2 This is a flowchart illustrating a partially homomorphic data compilation method according to an embodiment of this disclosure, as shown below. Figure 2 As shown, the method includes:

[0069] S101: The first electronic device receives the first ciphertext parameter sent by the second electronic device, wherein the first ciphertext parameter is used to indicate the processing of data to be compiled, and the encryption logic of the data to be compiled is fully homomorphic encryption.

[0070] For example, the execution subject of this disclosure embodiment can be a first electronic device, and the first electronic device can be a device with information interaction function, a processor, a server, or a chip, etc. Furthermore, when the method of this disclosure embodiment is applied to... Figure 1 In the application scenario shown, the first electronic device can be as follows: Figure 1 The first device in the first platform shown can also be the second device in the second platform, and the description of the first device and the second device can be found in the above example, which will not be repeated here.

[0071] It is worth noting that the data to be compiled can be sent from the second electronic device to the first electronic device, or it can be generated by the first electronic device when it receives the first ciphertext parameter.

[0072] Furthermore, the information that "the encryption logic of the data to be compiled is fully homomorphic encryption" can be sent from the second electronic device to the first electronic device, or the first electronic device can judge and determine the encryption logic of the data to be compiled.

[0073] In one example, if the first electronic device determines that the encryption logic of the data to be compiled is fully homomorphic encryption, then S102 is executed; in another example, if the first electronic device determines that the encryption logic of the data to be compiled is partially homomorphic encryption, then S103 is executed.

[0074] S102: The first electronic device converts the encryption logic of the data to be compiled into partial homomorphic encryption to obtain the converted data to be compiled, wherein the converted data to be compiled includes a first ciphertext parameter and a second ciphertext parameter generated by the first electronic device.

[0075] For example, if the data to be compiled for the fully homomorphic encryption logic is (a+b)**2 (representing the square of (a+b)), then the first electronic device can convert the data to be compiled as follows: (a+b)**2=a**2+b**2+2*a*b=[[a]]**2+[[b]]**2+2*[[a]]*[[b]], where [[a]] represents a as ciphertext, [[b]] ​​represents b as ciphertext, and in this embodiment, [[a]] is the ciphertext of the first electronic device (i.e., the second ciphertext parameter), and [[b]] ​​is the ciphertext of the second electronic device (i.e., the first ciphertext parameter).

[0076] S103: The first electronic device determines the computational graph corresponding to the converted data to be compiled based on a preset parsing library, wherein the parsing library includes at least one computational graph, each computational graph being used to characterize the computational relationship between multiple parameters.

[0077] In other words, the first electronic device includes a parsing library, which includes a computational graph. In one example, there may be one computational graph, while in another example, there may be multiple computational graphs. Each computational graph can represent the computational relationship between multiple parameters.

[0078] It is worth noting that in this embodiment, the features of the computation graph are introduced. By determining the computation graph corresponding to the converted data to be compiled from the computation graph, the drawbacks of low efficiency and high labor costs caused by compilers manually writing computation code are avoided, and the technical effect of automating the determination of the computation graph corresponding to the converted data to be compiled is achieved.

[0079] S104: The first electronic device performs a computational graph corresponding to the converted data to be compiled based on the first ciphertext parameter and the second ciphertext parameter to obtain the data compilation result.

[0080] After determining the computational graph corresponding to the converted data to be compiled, the compilation result can be determined by combining the first ciphertext parameter and the second ciphertext parameter.

[0081] Based on the above analysis, this disclosure provides a partially homomorphic data compilation method, which can be applied to a first electronic device. The method includes: receiving a first ciphertext parameter sent by a second electronic device, wherein the first ciphertext parameter is used to indicate the processing of data to be compiled, and the encryption logic of the data to be compiled is fully homomorphic encryption; converting the encryption logic of the data to be compiled into partially homomorphic encryption to obtain the converted data to be compiled, wherein the converted data to be compiled includes the first ciphertext parameter and a second ciphertext parameter generated by the first electronic device; and determining the converted data according to a preset parsing library, wherein the parsing library includes at least one computational graph, each computational graph being used to characterize the computational relationship between multiple parameters. The computation graph corresponding to the data to be compiled is determined from the parsing library. Based on the first and second ciphertext parameters, the computation graph corresponding to the converted data to be compiled is executed to obtain the data compilation result. In this embodiment, the computation graph corresponding to the converted data to be compiled is determined from the parsing library. The first and second ciphertext parameters are then combined to execute the computation graph corresponding to the converted data to be compiled to obtain the data compilation result. This avoids the problems of high labor costs and low efficiency caused by manually writing the computation code corresponding to the data to be compiled in related technologies. It realizes the automation and intelligence of compilation, and improves the technical effect of the general applicability and flexibility of compilation.

[0082] Based on the above description of the application scenarios of the partially homomorphic data compilation method of this disclosure, it can be seen that the partially homomorphic data compilation method of this disclosure can be applied to, for example... Figure 1 The application scenarios shown are two-party interactions, and can also be applied to multi-party interaction scenarios. Specifically, multi-party interaction scenarios can be the training of federated learning models or the application of federated learning models.

[0083] like Figure 3 As shown, the application scenarios for training federated learning models can include: a first electronic device A, a second electronic device B, and a third electronic device C participating in the training of the federated learning model, and Figure 3 The first electronic device A was demonstrated using a desktop computer as an example, the second electronic device B was demonstrated using a laptop computer as an example, and the third electronic device C was demonstrated using a server as an example.

[0084] Figure 4 The partially homomorphic data compilation method of this disclosure is applied to, for example, Figure 3 The flowchart shown in the application scenario is as follows: Figure 4As shown, the method includes:

[0085] S201: The second electronic device encrypts the pre-stored plaintext parameters to generate the first ciphertext parameters.

[0086] For example, in the context of federated learning, the first electronic device and the second electronic device can use each other's information to carry out their respective federated learning training and updates, thereby enabling both parties to make full use of their own information. In order to ensure the security of information interaction, ciphertext can be used during the information interaction process. For example, if the plaintext parameter of the second electronic device is B, then the plaintext parameter B is encrypted to generate the first ciphertext parameter [[b]].

[0087] S202: The second electronic device sends the first encrypted parameter to the first electronic device.

[0088] Accordingly, the first electronic device receives the first encrypted parameter sent by the second electronic device.

[0089] S203: The first electronic device determines the data to be compiled based on the first ciphertext parameter.

[0090] For example, combined with Figure 3 In the application scenario shown, in order to train the federated learning model, the data to be compiled determined by the first electronic device based on the first ciphertext parameter can be (a+b)**2.

[0091] S204: If the encryption logic of the data to be compiled is fully homomorphic encryption, the first electronic device will convert the data to be compiled with the fully homomorphic encryption logic to obtain the converted data to be compiled.

[0092] The encryption logic of the data to be compiled is partial homomorphic encryption, and the converted data to be compiled includes a first ciphertext parameter and a second ciphertext parameter generated by the first electronic device.

[0093] For example, the first electronic device converts (a+b)**2 into [[a]]**2+[[b]]**2+2*[[a]]*[[b]]. Here, the first ciphertext parameter is [[b]], and the second ciphertext parameter is [[a]].

[0094] S205: The first electronic device determines the computation graph that matches the operators of the converted data to be compiled based on the operators between the parameters of each computation graph in the preset parsing library.

[0095] For example, the first electronic device may be equipped with a parsing library, which includes operators between the parameters of each operation graph. When the first electronic device determines the converted data to be compiled, it can determine the operation graph that matches the operators of the converted data to be compiled from each operation graph.

[0096] In some embodiments, the computational graph can be a tree-structured graph including nodes.

[0097] For example, based on the above example, the first electronic device can determine from each operation graph the operation graph that matches the operators (i.e., **2, +) of [[a]]**2+[[b]]**2+2*[[a]]*[[b]], and a schematic diagram of the operation graph that matches the operators of the converted data to be compiled [[a]]**2+[[b]]**2+2*[[a]]*[[b]] ​​can be found in [reference]. Figure 5 .

[0098] like Figure 5 As shown, the computational graph includes multiple nodes, such as... Figure 5 The nodes e, f, g, h, i, j, and k shown can have operational relationships, such as a multiplication relationship between node e and node f, an addition relationship between node h and node i, and so on.

[0099] It is worth noting that by pre-setting the parsing library and determining the computation graph that matches the operators of the converted data to be compiled from the parsing library, the converted data to be compiled can be automatically compiled into a computation graph without manual intervention, saving labor costs and improving the flexibility and efficiency of compilation.

[0100] In some embodiments, the parameters of different computational graphs have computational relationships.

[0101] For example, a computational graph may be the smallest unit of computational graph, or it may be a computational graph that can be further subdivided. A computational graph may include multiple smallest units of computational graphs. When a computational graph includes multiple smallest units of computational graphs, there may be computational relationships between the computational graphs of each smallest unit. That is, the smallest units of computational graphs can be combined into a computational graph based on computational relationships.

[0102] In some embodiments, the parsing library is built based on different computational requirement information, which includes the requirement information on the computational relationships between different parameters.

[0103] In other words, the first electronic device can collect the required information on the operational relationships between different parameters, and based on the different operational requirements, establish one or more operational graphs to obtain a parsing library that includes one or more operational graphs.

[0104] In one example, the first electronic device can build a computational graph based on a computational requirement, and then build multiple computational graphs based on multiple computational requirement information, thereby obtaining a parsing library that includes multiple computational graphs.

[0105] In another example, the first electronic device can build multiple computational graphs based on multiple computational requirement information, thereby obtaining a parsing library containing multiple computational graphs. It is worth noting that in this example, the number of computational requirement information pieces can be greater than, equal to, or less than the number of computational graphs.

[0106] In another example, the first electronic device can build a computational graph based on multiple computational requirements, thereby obtaining a parsing library that includes a computational graph.

[0107] S206: The first electronic device sends a request to the second electronic device to obtain the third ciphertext parameter based on the converted data to be compiled, wherein the third ciphertext parameter is the ciphertext parameter in the converted data to be compiled that is related to the first ciphertext parameter.

[0108] Based on the above example, the converted data to be compiled is [[a]]**2+[[b]]**2+2*[[a]]*[[b]], where [[b]] ​​is the first encrypted parameter sent by the second electronic device, and [[a]] is the second ciphertext parameter of the first electronic device. Since [[a]] is the ciphertext parameter of the first electronic device, the first electronic device can obtain it directly. However, in order to obtain the data compilation result, the first electronic device needs to obtain the third ciphertext parameter [[b]]**2. Therefore, the first electronic device sends a request to the second electronic device to obtain the third ciphertext parameter.

[0109] Of course, in another possible implementation, the first electronic device and the second electronic device, in order to jointly complete the federated learning training, can pre-agree on the interaction information they need to use during the training process and send the corresponding interaction information to each other, thereby avoiding repeated interactions. For example, in this embodiment, when the second electronic device sends the first encrypted parameter to the first electronic device, it can also send the third encrypted parameter to the first electronic device at the same time.

[0110] S207: The second electronic device sends a third encrypted parameter to the first electronic device.

[0111] Accordingly, the first electronic device receives the third encrypted parameter sent by the second electronic device.

[0112] S208: The first electronic device determines the fourth ciphertext parameter for obtaining the data compilation result based on the converted data to be compiled and the second ciphertext parameter.

[0113] Based on the above example, the first electronic device can obtain [a]**2 (i.e., the fourth ciphertext parameter) from [[a]]**2+[[b]]**2+2*[[a]]*[[b]] ​​(i.e., the converted data to be compiled) and [[a]] (i.e., the second ciphertext parameter).

[0114] S209: The first electronic device substitutes the first ciphertext parameter, the second ciphertext parameter, the third ciphertext parameter, and the fourth ciphertext parameter into the nodes in the computation graph corresponding to the converted data to be compiled, so as to execute the computation process of the computation graph corresponding to the converted data to be compiled and obtain the data compilation result.

[0115] The computation graph includes multiple nodes, and the computational relationships between parameters in the computation graph are the computational relationships between nodes. Each node is used to substitute parameters.

[0116] Combination such as Figure 5 In the illustrated embodiment, the operation relationship between node e and node f is a multiplication operation. Therefore, the 2 in [[a]]**2+[[b]]**2+2*[[a]]*[[b]] ​​can be written to node e, the second encryption parameter [[a]] can be written to node f, and so on, to obtain the following... Figure 6 The computational graph shown.

[0117] S210: The first electronic device sends the data compilation result to the third electronic device.

[0118] Accordingly, the third electronic device receives the data compilation results sent by the first electronic device.

[0119] S211: The third electronic device generates gradient parameters based on the data compilation results.

[0120] For example, a third electronic device can decrypt the data compilation results based on a pre-set public key to generate gradient parameters.

[0121] S212: The third electronic device sends gradient parameters to the first electronic device.

[0122] Accordingly, the first electronic device receives the gradient parameters sent by the third electronic device.

[0123] S213: The first electronic device updates the federated learning model based on the gradient parameters.

[0124] Similarly, the principle of training and updating the federated learning model by the second electronic device is the same as that of the first electronic device, and will not be repeated here.

[0125] In some embodiments, the first electronic device is used to execute the Python language, the second electronic device is also used to execute the Python language, and the third electronic device is also used to execute the Python language.

[0126] For example, when the first electronic device interacts with the second and third electronic devices, it generates interaction information based on the Python language and implements the interaction. For instance, the first electronic device's request to the second electronic device to obtain the third encrypted parameter involves generating interaction information for the first electronic device based on the Python language, and so on.

[0127] Similarly, when the second electronic device interacts with the first electronic device, it generates interactive information based on the Python language and implements the interaction. For example, the first encrypted parameter sent by the first electronic device to the second electronic device generates interactive information for the first electronic device based on the Python language, and so on.

[0128] Similarly, when the third electronic device interacts with the first electronic device, it generates interactive information based on the Python language and implements the interaction. For example, the gradient parameters sent by the third electronic device to the first electronic device are used by the first electronic device to generate interactive information based on the Python language, and so on.

[0129] It is worth noting that Python is an interpreted language. Therefore, when analyzing the encryption type of homomorphic encryption instructions, there is no need to combine it with other programming languages ​​or implement it manually. This can improve the accuracy and reliability of the analysis, and especially improve the efficiency of the analysis.

[0130] According to another aspect of the embodiments of this application, an embodiment of this application also provides a data compilation apparatus based on partial homomorphism, the apparatus being applied to a first electronic device. For performing, as... Figure 2 The method described.

[0131] Please see Figure 7 , Figure 7 This is a schematic diagram of a partially homomorphic data compilation apparatus according to an embodiment of the present disclosure.

[0132] like Figure 7 As shown, the device includes:

[0133] The first receiving module 11 is used to receive a first ciphertext parameter sent by the second electronic device, wherein the first ciphertext parameter is used to indicate the processing of data to be compiled, and the encryption logic of the data to be compiled is fully homomorphic encryption;

[0134] The conversion module 12 is used to convert the encryption logic of the data to be compiled into partial homomorphic encryption to obtain the converted data to be compiled, wherein the converted data to be compiled includes the first ciphertext parameter and the second ciphertext parameter generated by the first electronic device.

[0135] The determining module 13 is used to determine the computational graph corresponding to the converted data to be compiled based on a preset parsing library, wherein the parsing library includes at least one computational graph, and each computational graph is used to characterize the computational relationship between multiple parameters.

[0136] The execution module 14 is used to perform an operation graph corresponding to the converted data to be compiled based on the first ciphertext parameter and the second ciphertext parameter to obtain the data compilation result.

[0137] In some embodiments, the converted data to be compiled has operators; the parameters of the computation graph have operators between them;

[0138] The determining module 13 is used to determine the computation graph that matches the operators of the converted data to be compiled, based on the operators between the parameters in each computation graph.

[0139] In some embodiments, there are operational relationships between the parameters of different computational graphs.

[0140] In some embodiments, the computation graph includes multiple nodes, and the computational relationship between parameters in the computation graph is the computational relationship between nodes, with each node used to substitute parameters;

[0141] The execution module 14 is used to substitute the first ciphertext parameter and the second ciphertext parameter into the nodes in the operation graph corresponding to the converted data to be compiled, so as to perform the operation process of the operation graph corresponding to the converted data to be compiled, and obtain the data compilation result.

[0142] In some embodiments, the execution module 14 is configured to obtain a third ciphertext parameter from the second electronic device, wherein the third ciphertext parameter is generated based on the first ciphertext parameter, and substitute the first ciphertext parameter, the second ciphertext parameter, the third ciphertext parameter, and the fourth ciphertext parameter into nodes in the computation graph corresponding to the converted data to be compiled, so as to perform the computation process of the computation graph corresponding to the converted data to be compiled, and obtain the data compilation result, wherein the fourth ciphertext parameter is generated by the first electronic device based on the second ciphertext parameter.

[0143] Combination Figure 8It is understood that, in some embodiments, the first ciphertext parameter is intermediate information generated during the training or application of the federated learning model; the device further includes:

[0144] The sending module 15 is used to send the data compilation result to a third electronic device, wherein the data compilation result is used to determine gradient parameters;

[0145] The second receiving module 16 is used to receive gradient parameters sent by the third electronic device;

[0146] Update module 17 is used to update the federated learning model based on the gradient parameters.

[0147] In some embodiments, the apparatus further includes:

[0148] Module 18 is used to establish each computational graph based on different computational requirement information, wherein the computational requirement information includes the requirement information on the computational relationship between different parameters, so as to obtain the parsing library.

[0149] In some embodiments, the first electronic device is used to execute the Python language, and the second electronic device is used to execute the Python language.

[0150] According to another aspect of the embodiments of this application, the embodiments of this application also provide an electronic device and a readable storage medium.

[0151] Please see Figure 9 , Figure 9 This is a block diagram of an electronic device according to an embodiment of this application.

[0152] The term "electronic device" is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present application described and / or claimed herein.

[0153] like Figure 9As shown, the electronic device includes one or more processors 101, a memory 102, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components are interconnected via different buses and can be mounted on a common motherboard or otherwise as required. The processors can process instructions executed within the electronic device, including instructions stored in or on memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple electronic devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 9 Take a processor 101 as an example.

[0154] The memory 102 is the non-transitory computer-readable storage medium provided in this application. The memory stores instructions executable by at least one processor to cause the at least one processor to perform the partially homomorphic data compilation method provided in this application. The non-transitory computer-readable storage medium of this application stores computer instructions for causing a computer to perform the partially homomorphic data compilation method provided in this application.

[0155] Memory 102, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules. Processor 101 executes various functional applications and data processing of the server by running the non-transitory software programs, instructions, and modules stored in memory 102, thereby implementing the partially homomorphic data compilation method in the above method embodiments.

[0156] The memory 102 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the electronic device. Furthermore, the memory 102 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 102 may optionally include memory remotely located relative to the processor 101, and these remote memories can be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0157] The electronic device may also include an input device 103 and an output device 104. The processor 101, memory 102, input device 103, and output device 104 can be connected via a bus or other means. Figure 9 Take a bus connection as an example.

[0158] Input device 103 can receive input numerical or character information, and generate key signal inputs related to user settings and function control of the electronic device, such as touch screens, keypads, mice, trackpads, touchpads, joysticks, one or more mouse buttons, trackballs, joysticks, etc. Output device 104 may include display devices, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibration motors). The display device may include, but is not limited to, liquid crystal displays (LCDs), light-emitting diode (LED) displays, and plasma displays. In some embodiments, the display device may be a touch screen.

[0159] Various implementations of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, application-specific integrated circuits (ASICs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transferring data and instructions to the storage system, the at least one input device, and the at least one output device.

[0160] These computational programs (also referred to as programs, software, software applications, or code) include machine instructions for a programmable processor and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms “machine-readable medium” and “computer-readable medium” refer to any computer program product, device, and / or apparatus (e.g., disk, optical disk, memory, programmable logic device (PLD)) used to provide machine instructions and / or data to a programmable processor, including machine-readable media that receive machine instructions as machine-readable signals. The term “machine-readable signal” refers to any signal used to provide machine instructions and / or data to a programmable processor.

[0161] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0162] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0163] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.

[0164] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0165] The sequence numbers of the embodiments disclosed above are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0166] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this disclosure.

[0167] The above are merely preferred embodiments of this disclosure and do not limit the patent scope of this disclosure. Any equivalent structural or procedural transformations made using the content of this disclosure and its drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this disclosure.

Claims

1. A data compilation method based on partial homomorphism, characterized in that, The method is applied to a first electronic device, and the method includes: The system receives a first ciphertext parameter sent by a second electronic device, wherein the first ciphertext parameter is used to indicate the processing of data to be compiled, and the encryption logic of the data to be compiled is fully homomorphic encryption. The encryption logic of the data to be compiled is converted into partial homomorphic encryption to obtain the converted data to be compiled, wherein the converted data to be compiled includes the first ciphertext parameter and the second ciphertext parameter generated by the first electronic device; According to the preset parsing library, which includes at least one operation graph, each operation graph is used to characterize the operation relationship between multiple parameters, and the operation graph corresponding to the converted data to be compiled is determined. Based on the first ciphertext parameter and the second ciphertext parameter, perform the operation graph corresponding to the converted data to be compiled to obtain the data compilation result; The computation graph includes multiple nodes, and the computational relationship between the parameters in the computation graph is the computational relationship between the nodes. Each node is used to substitute parameters. Based on the first ciphertext parameter and the second ciphertext parameter, perform the computation graph corresponding to the transformed data to be compiled to obtain the data compilation result, including: The first ciphertext parameter and the second ciphertext parameter are substituted into nodes in the computation graph corresponding to the transformed data to be compiled, to execute the computation process of the computation graph corresponding to the transformed data to be compiled, and to obtain the data compilation result; before substituting the first ciphertext parameter and the second ciphertext parameter into nodes in the computation graph corresponding to the transformed data to be compiled, the process further includes: Obtain a third ciphertext parameter from the second electronic device, wherein the third ciphertext parameter is generated based on the first ciphertext parameter; The first ciphertext parameter and the second ciphertext parameter are substituted into nodes in the computation graph corresponding to the transformed data to be compiled, to execute the computation process of the computation graph corresponding to the transformed data to be compiled, and to obtain the data compilation result, including: The first ciphertext parameter, the second ciphertext parameter, the third ciphertext parameter, and the fourth ciphertext parameter are substituted into the nodes in the computation graph corresponding to the converted data to be compiled, so as to perform the computation process of the computation graph corresponding to the converted data to be compiled and obtain the data compilation result. The fourth ciphertext parameter is generated by the first electronic device based on the second ciphertext parameter.

2. The method according to claim 1, characterized in that, The converted data to be compiled contains operators; the parameters of the computation graph contain operators. The step of determining the computational graph corresponding to the converted data to be compiled based on a preset parsing library includes: Based on the operators between the parameters in each of the aforementioned computation graphs, determine the computation graph that matches the operators of the converted data to be compiled.

3. The method according to claim 1, characterized in that, There are operational relationships between the parameters of the different operational spectra.

4. The method according to claim 1, characterized in that, The first ciphertext parameter is intermediate information generated during the training or application of the federated learning model; After obtaining the data compilation results, the following is also included: The compiled data results are sent to a third electronic device, and the compiled data results are used to determine the gradient parameters; The system receives gradient parameters sent by the third electronic device and updates the federated learning model based on the gradient parameters.

5. The method according to any one of claims 1-4, characterized in that, The method further includes: Based on different computational requirements, including the requirements for computational relationships between different parameters, each computational graph is established to obtain the parsing library.

6. The method according to any one of claims 1-4, characterized in that, The first electronic device is used to execute the Python language, and the second electronic device is used to execute the Python language.

7. A data compilation apparatus based on partial homomorphism, characterized in that, The device is applied to a first electronic device, the device comprising: The first receiving module is used to receive a first ciphertext parameter sent by the second electronic device, wherein the first ciphertext parameter is used to indicate the processing of data to be compiled, and the encryption logic of the data to be compiled is fully homomorphic encryption; A conversion module is used to convert the encryption logic of the data to be compiled into partial homomorphic encryption to obtain the converted data to be compiled, wherein the converted data to be compiled includes the first ciphertext parameter and the second ciphertext parameter generated by the first electronic device; The determination module is used to determine the computational graph corresponding to the converted data to be compiled based on a preset parsing library, wherein the parsing library includes at least one computational graph, and each computational graph is used to characterize the computational relationship between multiple parameters. The execution module is used to execute the computation graph corresponding to the converted data to be compiled based on the first ciphertext parameter and the second ciphertext parameter to obtain the data compilation result; The computation graph includes multiple nodes, and the computational relationship between the parameters in the computation graph is the computational relationship between the nodes. Each node is used to substitute parameters. The execution module is used to substitute the first ciphertext parameter and the second ciphertext parameter into the nodes in the operation graph corresponding to the converted data to be compiled, so as to perform the operation process of the operation graph corresponding to the converted data to be compiled and obtain the data compilation result. The execution module is used to obtain a third ciphertext parameter from the second electronic device, wherein the third ciphertext parameter is generated based on the first ciphertext parameter, and substitute the first ciphertext parameter, the second ciphertext parameter, the third ciphertext parameter, and the fourth ciphertext parameter into the nodes in the computation graph corresponding to the converted data to be compiled, so as to perform the computation process of the computation graph corresponding to the converted data to be compiled, and obtain the data compilation result, wherein the fourth ciphertext parameter is generated by the first electronic device based on the second ciphertext parameter.

8. An electronic device, characterized in that, The electronic device includes: a memory, a processor, and a data compiler stored in the memory and executable on the processor, wherein when the data compiler is executed by the processor, it implements the steps of the partially homomorphic data compilation method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a data compiler program, which, when executed by a processor, implements the steps of the partially homomorphic data compilation method as described in any one of claims 1 to 6.