A neural network reasoning acceleration method based on secure multi-party computing

Through VOLE technology and GPU parallel computing, the unbalanced matrix multiplication operation of large language models is optimized, solving the problems of low computing efficiency and low communication efficiency in the existing technology, realizing efficient neural network reasoning, and ensuring the security of data privacy. sex.

CN118468967BActive Publication Date: 2024-10-18NANJING UNIV OF POSTS & TELECOMM
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202410910796.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-09
Publication Date
2024-10-18
Estimated Expiration
2044-07-09

AI Technical Summary

Technical Problem

Existing neural network inference methods based on secure multi-party computation have deficiencies in computational efficiency and communication efficiency, especially poor performance in unbalanced matrix operations of large language models, resulting in low system efficiency.

Method used

VOLE technology is used for blind data encryption processing, combined with GPU parallel computing, to optimize unbalanced matrix multiplication operations, reduce the number of communication rounds and communication overhead, and achieve efficient neural processing through data preprocessing, secure computing, GPU parallel computing and secure communication modules. Network reasoning.

Benefits of technology

It significantly improves computing speed and efficiency, reduces communication overhead, ensures the security of data privacy, is suitable for practical applications of large language models, and promotes its widespread use in practical applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118468967B_ABST
    Figure CN118468967B_ABST
Patent Text Reader

Abstract

The present invention relates to a neural network reasoning acceleration method based on secure multi-party computing, which belongs to the field of secure multi-party computing and artificial intelligence security. The method vectorizes user data through a data preprocessing module and shares it secretly; the data pre-computation module generates relevant random vectors that satisfy the VOLE relationship to achieve data encryption blinding; each participant ensures data privacy through a secure computing module, and implements secure computing of complex tasks based on secure computing basic operators; a GPU parallel computing module accelerates and optimizes matrix operations; the calculation results are securely transmitted to multiple parties through a secure communication module; and a result reconstruction module reconstructs the complete reasoning results and returns them to the user. The present invention significantly improves the speed and efficiency of neural network reasoning under the premise of ensuring data privacy, and effectively reduces communication overhead, especially when processing intensive computing tasks such as matrix multiplication, reducing the difference in computing efficiency between plaintext and ciphertext.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a neural network reasoning acceleration method based on secure multi-party computing, and relates to the technical field of secure multi-party computing and the technical field of artificial intelligence security. Background Art

[0002] The development of Large Language Model (LLM) is an important milestone in the field of artificial intelligence. The reasoning service provided by LLM refers to the model generating corresponding output or answer based on its trained parameters and the prompts input by the user. It has been widely used in various tasks such as question answering, text generation, and translation. However, while enjoying these conveniences, the reasoning service of large language models also faces the challenge of data privacy. User input may contain sensitive information, such as personal privacy data or commercial secrets.

[0003] In this context, how to perform efficient and secure neural network reasoning while ensuring data privacy has become an important research hotspot. Cryptography methods based on secure multi-party computing are the mainstream route to achieve secure neural network reasoning. Secure multi-party computing technology allows multiple participants to complete a computing task together without leaking the input data of the participants. Secure neural network reasoning methods should ensure that the server deploying the large language model cannot obtain any information about the client (ie user) input, and the client cannot obtain any information about the model except the reasoning result.

[0004] Although cryptographic methods based on secure multi-party computation have significant advantages in achieving secure neural network reasoning, they still face the following major problems in practical applications:

[0005] (1) Low computational efficiency: Large language models (such as GPT-2, GPT-3, etc.) usually use autoregressive prediction methods when generating text. The basic principle of autoregressive prediction is that the model will predict the next word or character based on the generated content, and concatenate the newly generated content with the previous content to proceed to the next prediction. In the autoregressive prediction process, each prediction involves matrix multiplication operations. Specifically, each step of the prediction requires matrix multiplication of the current input (the long matrix after continuous concatenation) with the model's parameter matrix Y. Because the input length of each prediction increases, these matrix operations are unbalanced and the amount of computation is huge.

[0006] (2) Low communication efficiency: In secure multi-party computation, participants need to communicate frequently to exchange intermediate results. Especially in an environment with large network delays, a high number of communication rounds will seriously affect the performance of multi-party computing. It not only increases the communication overhead, but also leads to a higher delay in the overall computing process.

[0007] At present, the neural network reasoning scheme based on secure multi-party computation is not suitable for secure reasoning of large language models, especially for unbalanced matrix operations of large language models. In the actual application of large language models, unbalanced matrix operations are common computing tasks. Existing schemes perform poorly in handling such tasks, affecting system efficiency.

[0008] In summary, in order to meet the above challenges, this solution introduces VOLE (Vector Oblivious Linear Evaluation) technology, which generates pseudo-random correlation vectors to achieve data encryption blinding processing, and can perform efficient calculations without leaking data content. Furthermore, for the frequent unbalanced matrix operations of large language models, GPU parallel computing is introduced to improve the speed of secure neural network reasoning.

[0009] The present invention proposes a neural network reasoning acceleration method based on secure multi-party computing, aiming to solve the problems of low computing efficiency and high communication overhead in the prior art. The method uses VOLE technology and GPU parallel computing to optimize unbalanced matrix multiplication operations, significantly improve the calculation speed, and effectively reduce the number of communication rounds and communication overhead. Through the method of the present invention, the secure reasoning task of a large language model can be efficiently completed under the premise of ensuring data privacy, promoting its widespread use in practical applications. Summary of the invention

[0010] In order to solve the above technical problems, the present invention provides a neural network reasoning acceleration system 100 based on secure multi-party computing. The system includes a data preprocessing module, a data pre-computation module, a secure computing module, a GPU parallel computing module, a secure communication module and a result reconstruction module.

[0011] The data preprocessing module 101 is responsible for preprocessing the original input data, converting the data into vector or matrix form, and performing secret sharing processing.

[0012] The data pre-calculation module 102 generates a random seed using functional secret sharing (FSS) and a pseudo-random number generator of VOLE, and generates a random number related to the secret data according to the random seed.

[0013] The secure computing module 103 includes secure addition, multiplication and matrix multiplication operation modules to ensure data privacy protection during the computing process.

[0014] The GPU parallel computing module 104 utilizes the parallel computing capability of the GPU to accelerate intensive matrix operations.

[0015] The secure communication module 105 is responsible for secure communication between all participants, ensuring the secure transmission of intermediate calculation results.

[0016] The result reconstruction module 106 reconstructs the final reasoning result based on the calculation results of each participant.

[0017] The data flow process of this system is as follows:

[0018] (1) User input data is processed by the data preprocessing module, converted into vector form and secret shared.

[0019] (2) The data pre-calculation module generates a pseudo-random correlation vector of the secret data sharing share to achieve encryption blinding of the data.

[0020] (3) The preprocessed data enters the secure computing module, and each participant performs addition, multiplication, and matrix multiplication operations based on the secret sharing share to further complete complex computing tasks.

[0021] (4) The intensive matrix operations required in the calculation process are accelerated by the GPU parallel computing module.

[0022] (5) The calculation results are securely transmitted between the participants through the secure communication module.

[0023] (6) The final result is reconstructed through the result reconstruction module to obtain the complete reasoning result and return it to the user.

[0024] Note the participants For clients (users) using large language model inference services, participants The server side that provides large language model inference services, TTP is a trusted third-party server (auxiliary computing server). In practice, in order to achieve high concurrency, load balancing and other business requirements, the server side that provides large language model inference services may be a server cluster. It can be considered as its proxy server.

[0025] The present invention provides a neural network reasoning acceleration method based on secure multi-party computing, which ensures the security and efficiency of high-level machine learning components and typical algorithms by implementing secure optimization of underlying basic operators based on secure multi-party computing technology and GPU parallelization algorithm implementation.

[0026] A neural network reasoning acceleration method based on secure multi-party computing, the method comprising the following steps:

[0027] Step S1, each participant performs initialization settings, data preprocessing and precalculation;

[0028] Step S2: input the data into the secure computing module for multi-party secure computing. The GPU accelerated computing module accelerates matrix operations. The calculation results are transmitted through the secure communication module. The result reconstruction module returns the complete reasoning result.

[0029] In step S1, each participant performs initialization settings, data preprocessing and precalculation, and the specific implementation steps are as follows:

[0030] S11. All participating parties negotiate and determine the preset shared value.

[0031] S12. Obtaining Participants The original input data is preprocessed: the input data is converted into a series of vectors, that is, the input data is converted into numerical, vector, and matrix forms that can be processed by the model; and the input data is converted into a secret sharing form.

[0032] S13. Participants The model parameter matrix data is preprocessed and converted into the form of additive secret sharing.

[0033] S14. All parties involved cooperate to pre-calculate and generate random seeds.

[0034] S15. Each participant extracts parameters from the random seed and locally pre-calculates and generates relevant random numbers for secret data.

[0035] Further, in step S11, each participant negotiates to determine a preset shared value, including a security parameter , finite field function , column vector dimension , the number of column vectors , determine the public matrix ,

[0036] In step S12, the participants The original input data (such as text or image data) is converted into a series of vectors through word embedding and position embedding, and then converted into a numerical vector form processed by the large model. Then, the input data is converted into the form of additive secret sharing, and the participating parties are recorded. The privacy data is , for the privacy data , sharing its secret as , that is, dividing the input data into two secret sharing shares,

[0037] Further extended to the secret sharing of vector data and matrix data, the data secret sharing method adopted is the same, but the dimension of the data is different.

[0038] In step S13, pre-processing participants The model parameter matrix data is converted into the form of additive secret sharing, and the data is divided into two matrix shares, recording the participation party The privacy data is , for the privacy data , sharing its secret as , that is, dividing the input data into two secret sharing shares, and further extending it to the secret sharing of vector data and matrix data, the data secret sharing method adopted is the same, but the dimension of the data is different.

[0039] Among them, the secret sharing share , All obey uniform distribution, 。

[0040] In step S14, all parties cooperate to pre-calculate and generate random seeds. Pre-calculating and generating random seeds is specifically divided into the following three steps:

[0041] S141, the trusted third party TTP generates two random vectors , , randomly generate error vectors ,

[0042] Using the generated vector and the input secret data , calculated ,

[0043] in, , , , and satisfies certain Hamming weight conditions, the number of non-zero elements in the vector, , is the noise ratio,

[0044] S142. Generate a pair of keys using function secret sharing FSS , , and ensure that they meet specific calculation conditions, using PRF (pseudo-random function) and FSS (function secret sharing) to generate a pair of keys , , defined as:

[0045] ,

[0046] Based on given security parameters and function , The function generates a pair Bit length of the key , , and the output of the function satisfies the following conditions:

[0047]

[0048] Among them, the function Allow two parties for FSS , Collaborative computing functions Valuation at a certain point After the calculation is completed, The secret sharing share obtained is , The secret sharing share obtained is ,satisfy ,

[0049] S143, Pseudo-random number generator using VOLE Generate random seeds , sent to the participants , ,

[0050] ,

[0051] Among them, seeds ,

[0052] seed , Contains secret data .

[0053] Further, in step S15: each participant extracts parameters from the random seed, locally pre-calculates and generates random numbers related to secret data, and the participant use

[0054] Calculated , further calculated to obtain , Participants ,

[0055] use Calculated , further calculated to obtain , among which, satisfy , , Participants All must be executed Steps S14 and S15 are the local secret data sharing shares. Generate relevant random numbers to achieve encryption blinding of secret data: In a multi-party computing environment, the original secret data is not transmitted directly, only the secret sharing share of the data is transmitted. When performing subsequent security reasoning, the calculation results can be reconstructed based on the secret data share and its related random numbers held locally by the participating parties.

[0056] The method of generating random numbers related to secret data in steps S14 and S15 can also be further extended to vector data and matrix data to generate related random vectors and related random matrices. Only through a small amount of communication, a large amount of random numbers related to secret data can be generated.

[0057] In summary, the main work of step S1 is: each participant negotiates to determine the shared parameters and completes the initialization settings. Furthermore, each participant obtains a short random seed through a small amount of communication exchange, and then each uses these random seeds locally to independently generate a large number of related random numbers of the secret data held. Through a small amount of communication in this step, the random numbers related to the secret data of each participant are generated, reducing the number of interactive communications in the online neural network reasoning stage.

[0058] Furthermore, the secure calculation module of step S2 includes a secure addition operation module , secure multiplication module , secure matrix multiplication module , GPU accelerated computing module .

[0059] Suppose there are two secret data inputs and , For participants secret data, For participants In a secure computing environment, the participants Each holds or The secret sharing share and , and the participants The secret sharing share or ,in, ,

[0060] Safe addition module Implements safe calculation of addition operation. Calculation result The definition is as follows: ,

[0061] Participants Compute locally Subsequently, the participants exchanged the calculation results through a secure communication protocol and reconstructed the final .

[0062] Secure multiplication module Implement secure computation of multiplication. Suppose two secret data are input and , the calculation results The definition is as follows:

[0063]

[0064] for and

[0065] can be calculated locally by the participants, and the multiplication cross terms and The relevant random numbers pre-calculated based on step S1 are calculated during result reconstruction.

[0066] Secure matrix multiplication module Implement secure computation of matrix multiplication. Suppose there are two input matrices and , the calculation result matrix The definition is as follows:

[0067] ,

[0068] By pre-calculating the secret data in step S1, the encryption blinding effect of the input data can be achieved during multi-party computing. Furthermore, the encryption blinding processing of the data can be extended from the vector level of a single data point to the entire matrix level. By pre-calculating and generating a large number of related random vectors that satisfy the VOLE construction relationship and organizing them into a matrix, the encryption blinding of each element in the matrix can be achieved. Secure Matrix Multiplication It is a compound operation consisting of multiple safe additions and multiplications.

[0069] Furthermore, the GPU accelerated computing module of step S2 It is mainly used to accelerate matrix operations. Its optimization methods include blocking, reduction, merged memory access, shared memory and continuous data access. For unbalanced matrix multiplication, the matrix is ​​divided into smaller balanced sub-matrices and the sub-matrices are calculated independently on different processing units.

[0070] Let matrix and matrix , the resulting matrix is:

[0071] Furthermore, for matrix block calculation, the definition is as follows:

[0072] ,

[0073] Will and Divide into sub-matrices and , computing the submatrix products on separate processing units:

[0074] ,

[0075] Furthermore, for shared memory optimization, the matrix A row of fixed size The data is pre-read into the shared memory, and the corresponding data is read from the shared memory during the operation:

[0076] ,

[0077] Furthermore, for For matrices that are divisible by (thread block size), the optimized method of aligned memory access is used:

[0078] ,

[0079] When allocating matrix space, blank space is added after each row to ensure that the next row of data is aligned for memory access.

[0080] Furthermore, low-thread reduction and loop unrolling are used to reduce some results:

[0081] ,

[0082] Use shared memory to speed up data access, reduce loop iterations through loop unrolling technology, and improve thread execution efficiency:

[0083]

[0084] In each iteration of the loop, each thread sums two elements separated by the current stride, producing a partial sum:

[0085]

[0086] in, Indicates the size of the shared memory. Indicates the thread block size, Represents data in shared memory, Indicates the matrix row after aligned memory access, Represents the calculation result of a partial sum.

[0087] Safe addition module Sum multiplication module Allows multiple parties to compute the sum and product of their inputs without revealing their inputs. Secure addition and secure multiplication are the basis for all other computations. By combining basic addition and multiplication operations, any complex computational task can be achieved. Secure Matrix Multiplication It is a composite operation consisting of multiple secure additions and multiplications. GPU accelerated computing module Use the parallel computing power of GPU to accelerate intensive matrix operations. By distributing matrix operations to multiple GPU cores for parallel computing, the computing speed can be significantly improved.

[0088] Furthermore, in step S2, the result reconstruction module is responsible for receiving and verifying the partial calculation results transmitted by each participant through the secure communication module, ensuring that the data has not been tampered with, and merging these results, and finally generating a complete reasoning result and returning it to the user. The secure communication module ensures the security of data transmission between the participants, prevents data from being eavesdropped or tampered with during transmission, and transmits the intermediate and final calculation results through an encrypted communication channel.

[0089] By implementing secure addition, multiplication, and matrix operations at the bottom layer, these basic operators can be combined to complete complex neural network reasoning. The neural network reasoning process mainly relies on the repeated application of matrix operations and nonlinear activation functions. Matrix operations can be decomposed into basic addition and multiplication operations. Secure addition and multiplication operators ensure the privacy protection of individual calculation steps, and the matrix operations implemented by these secure operators ensure the security of the reasoning process. At the same time, when processing unbalanced matrix operations, the GPU parallel computing module greatly improves the computing efficiency through optimization methods such as blocking, reduction, and shared memory, supporting efficient and secure neural network reasoning.

[0090] A terminal includes a processor, a memory, and a program of a neural network reasoning acceleration method based on secure multi-party computing stored in the memory. When the neural network reasoning acceleration program based on secure multi-party computing is executed by the processor, the steps of the neural network reasoning acceleration method based on secure multi-party computing are implemented.

[0091] A computer-readable storage medium stores computer instructions, which, when executed by a processor, implement the steps of the neural network reasoning acceleration method based on secure multi-party computing.

[0092] Compared with the prior art, the advantages of the present invention are as follows:

[0093] (1) Data is available but invisible: Based on secure multi-party computing technologies such as vector oblivious linear evaluation and secret sharing mechanism, data is kept in an encrypted blind state during transmission and processing, ensuring that the calculation process does not leak any information about the original data, thereby protecting data privacy.

[0094] (2) Reduce communication interactions: By using vector inadvertent linear evaluation, each participant can pre-calculate a large number of related random vectors that satisfy the VOLE construction relationship based on random seeds and secret keys, and then implement local secure addition and other operations, reducing the amount of data transmitted between participants and the number of communication interactions. It has very low communication complexity and further improves the overall performance.

[0095] (3) Improve computing efficiency: The autoregressive prediction characteristics of large language model reasoning require the execution of a large number of unbalanced matrix multiplication operations. The present invention uses GPU multithreading to process unbalanced matrix multiplication and parallelizes matrix multiplication calculations, making full use of the parallel computing capabilities of GPUs, significantly improving computing speed and efficiency, efficiently executing large-scale computing tasks, and accelerating the implementation of privacy-preserving machine learning systems based on secure multi-party computing.

[0096] (4) Efficient encryption calculation method under secure reasoning mechanism: An efficient encryption calculation method is proposed to perform reasoning on the neural network model without leaking sensitive information, especially when processing intensive computing tasks such as matrix multiplication, to reduce the difference in computing efficiency between plaintext and ciphertext.

[0097] (5) This solution has a wide range of applications. For example, in the medical field, the system of the present invention can be used to quickly infer disease diagnosis models while protecting patient privacy. The user inputs the patient's symptom data, and the system performs inference through modules such as data preprocessing, precomputation, and secure computing, and finally outputs the diagnosis result. During the entire process, the patient data remains encrypted to ensure that data privacy is not leaked. BRIEF DESCRIPTION OF THE DRAWINGS

[0098] Figure 1 is a flowchart of the steps of the method of the present invention,

[0099] Figure 2 is a system structure diagram of the system of the present invention,

[0100] Figure 3 This is a schematic diagram of multi-threaded block processing of an unbalanced matrix in an embodiment of the present invention.

[0101] Figure 4 Schematic diagram of the GPU low-thread reduction method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0102] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by those skilled in the art without paying creative work belong to the scope of protection of the present invention. In order to make the content of the present invention easier to understand clearly, the present invention is further described in detail below according to specific embodiments and in conjunction with the accompanying drawings.

[0103] Embodiment 1:

[0104] Figure 1 This is the data flow process of this system.

[0105] (1) User input data is processed by the data preprocessing module, converted into vector form and secret sharing is performed: The user input data first enters the data preprocessing module. This module converts the original input data (such as text, images, etc.) into vector form through specific preprocessing techniques (such as word embedding, position embedding, etc.). These vector representations can be directly used as input for neural network models. The converted vector data needs to be secret shared to ensure the privacy of the data in subsequent calculations. Specifically, the data preprocessing module converts the input data Converted to two secret shares and , and distributed to different participants after pre-calculation,

[0106] (2) The data pre-computation module generates a pseudo-random correlation vector of the secret data sharing share to achieve encryption blinding of the data. In the data pre-computation stage, the system uses VOLE (vector oblivious linear evaluation) to generate a pseudo-random correlation vector to achieve encryption blinding of the secret data. The specific implementation steps include initializing security parameters, generating keys through function secret sharing, generating random seeds, etc. The participants generate related random numbers based on these random seeds and keys. These random numbers are used to blind the secret data held by the participants, thereby ensuring data privacy.

[0107] (3) The preprocessed data enters the secure computing module, and each participant performs addition, multiplication, and matrix multiplication based on the secret shared share to further complete complex computing tasks: Each participant holds a share of the secret shared data and enters the secure computing module for calculation. The secure computing module contains multiple basic operators, such as secure addition, multiplication, and matrix multiplication. Each participant uses the secret shared data it holds locally to perform calculations and exchanges the calculation results through a secure communication protocol to ensure the security of the calculation process.

[0108] (4) The intensive matrix operations required during the calculation process are accelerated by the GPU parallel computing module: The GPU parallel computing module divides the matrix into blocks and distributes these sub-matrix blocks to multiple GPU cores for parallel processing. By using shared memory and optimizing memory access (aligned memory access), the calculation efficiency and speed are significantly improved. For unbalanced matrix multiplication, the module divides the matrix into smaller balanced sub-matrices, calculates them independently on different processing units, and uses shared memory to reduce global memory access, thereby speeding up the calculation process.

[0109] (5) The calculation results are securely transmitted between the participants through the secure communication module: After each participant completes the calculation locally, it is necessary to exchange some of the calculation results in order to reconstruct the final result. This step is achieved through the secure communication module. The secure communication module uses an encrypted communication protocol to ensure that the privacy and integrity of the data are not leaked or tampered with during the data transmission process. Each participant sends and receives the intermediate results that have been blinded, and calculates the final result through the reconstruction algorithm.

[0110] (6) The final result is reconstructed through the result reconstruction module to obtain the complete reasoning result and return it to the user: After the participants complete the exchange of calculation results, the result reconstruction module is responsible for collecting and reconstructing the final reasoning result. The result reconstruction module uses the partial results provided by each participant and combines the pre-calculated pseudo-random correlation vector to reconstruct the result and obtain the complete reasoning result. The final reasoning result is returned to the user, and the privacy of user data and model parameters is ensured throughout the process.

[0111] like Figure 2 As shown, a neural network reasoning acceleration system 100 based on secure multi-party computing is provided. The system includes a data preprocessing module, a data pre-computation module, a secure computing module, a GPU parallel computing module, a secure communication module and a result reconstruction module.

[0112] The data preprocessing module 101 is responsible for preprocessing the original input data, converting the data into vector or matrix form, and performing secret sharing processing to generate two secret sharing shares.

[0113] The data pre-calculation module 102 generates a random seed using functional secret sharing (FSS) and a pseudo-random number generator of VOLE, and generates a random number related to the secret data according to the random seed.

[0114] The secure computing module 103 includes secure addition, multiplication and matrix operation modules to ensure data privacy protection during the computing process.

[0115] The GPU parallel computing module 104 utilizes the parallel computing capability of the GPU to accelerate intensive matrix operations.

[0116] The secure communication module 105 is responsible for secure communication between all participants, ensuring the secure transmission of intermediate calculation results.

[0117] The result reconstruction module 106 reconstructs the final reasoning result based on the calculation results of each participant.

[0118] The technical solution provided in this embodiment is described in the following embodiment 2 and will not be repeated here.

[0119] Embodiment 2:

[0120] For the secure addition module , Calculation results Defined as: ,

[0121] Specific implementation steps:

[0122] (1) Input and preprocessing: Suppose there are two secret data inputs and , For participants secret data, For participants of secret data.

[0123] (2) Secret sharing: In a secure computing environment, the participants Each holds or The secret sharing share and , and the participants The secret sharing share or ,in, ,

[0124] (3) Calculation: Each participant calculates locally ,

[0125] (4) Result reconstruction: The participants exchange calculation results through the secure communication module. The result reconstruction module reconstructs the partial results sent by each participant. Merge and reconstruct the final , the final result By combining the results of each part Get, that is The result reconstruction module ensures the accuracy and completeness of the output results and displays the results to the user.

[0126] For the secure multiplication module , the calculation results Defined as: ,

[0127] Specific implementation steps:

[0128] (1) Suppose there are two secret data inputs and , For participants secret data, For participants of secret data.

[0129] (2) Secret sharing and pre-computation: In a secure computing environment, the participants Each holds or The secret sharing share and , and the participants The secret sharing share or ,in, , generate the relevant random numbers of the secret sharing shares that satisfy the VOLE construction.

[0130] (3) Calculation: For and

[0131] can be calculated locally by the participants, and the multiplication cross terms and The relevant random numbers generated based on the pre-calculation in step S1 can also be calculated during the result reconstruction. Calculate the cross term In step S1, the pseudo-random correlation number that satisfies the VOLE construction relationship is calculated in advance for the secret sharing share. Specifically, for the participants and participants The secret sharing share and , using the VOLE generator component The VOLE relation that satisfies the conditions is constructed as follows: ,

[0132] Participants Based on random seed Calculate , Participants Based on random seed Calculate , then the cross term can also be obtained by reconstructing the resulting shares of the secret sharing by each party.

[0133] (4) Result reconstruction: Each participant sends the partial results of the calculation to other participants through the secure communication module. The result reconstruction module receives the partial results of all participants and verifies them to ensure that the results have not been tampered with. The result reconstruction module merges the partial results of each participant and calculates the final result. The result reconstruction module ensures the accuracy and completeness of the output results and displays the results to the user.

[0134] For the secure matrix multiplication module , the calculation result matrix Defined as: ,

[0135] Specific implementation steps:

[0136] (1) Input and preprocessing: Suppose there are two input matrices and matrix , For participants Secret data held, For participants Holding secret data.

[0137] (2) Secret sharing and pre-computation: In a secure computing environment, the participants Each holds or The secret sharing share and , and the participants The secret sharing share or .in Generates secret sharing shares of related random numbers that satisfy the VOLE construction. The encryption blinding of data can be extended from the vector level of a single data point to the entire matrix level. A large number of pseudo-random related vectors that satisfy the VOLE construction relationship are generated by pre-calculation and organized into a matrix to achieve encryption blinding of each element in the matrix.

[0138] (3) Computation: Matrix multiplication is implemented through the composite operation of multiple secure addition and multiplication modules.

[0139] (4) Result reconstruction: The participants exchange calculation results through the secure communication module and reconstruct the final .

[0140] Furthermore, the security matrix multiplication calculation module For the calculation of step (3), the participants The private input matrix of , Participants The private model parameter matrix In reasoning with large language models, For participants A matrix consisting of a series of numeric vectors converted from the input prompt. For participants Known model parameter matrix. Compute matrix multiplication The specific steps are as follows:

[0141] (1) In step S1, the known Based on VOLE generator Pre-generate a matrix that satisfies the VOLE construction relationship , , , satisfying the VOLE relationship , where the participants hold , , Participants hold .

[0142] (2) Participants calculate , linearly transform the private input matrix to encrypt the blinded secret data. Then, the participants The intermediate calculation results Send to participants .

[0143] (3) Participants Receive intermediate calculation results After that, calculate , then, the participants The calculated results , and then send it to the participants ,

[0144] (4) Participants Upon receiving Then, using the matrix you have Reconstruct the results, that is , and get the final matrix multiplication result .

[0145] It can be verified that it satisfies the VOLE construction relationship:

[0146] , then:

[0147] ,

[0148] Substituting this relationship, the result is simplified to:

[0149] ,

[0150] Through the above steps, the two parties do not directly share their private data (participants Input and participants Model parameters ) under the condition that the secure matrix multiplication task is completed.

[0151] The GPU parallel computing module is mainly used for matrix operations, and the optimization methods include blocking, reduction, merged memory access, shared memory, continuous data access, etc. Almost all computing modules in security reasoning may involve matrix operations, including direct matrix multiplication and addition, as well as other operations indirectly implemented through matrix operations, such as convolution operations, forward propagation, normalization layer and other modules. Specifically, for unbalanced matrix multiplication, the matrix is ​​divided into smaller balanced sub-matrices, and the sub-matrices are processed independently by different thread blocks. The calculation process is optimized for a specific hardware configuration, and each thread block is responsible for processing and calculating a balanced sub-matrix. The schematic diagram is shown in the figure. Figure 3 As shown. Shared memory and registers are used to reduce global memory access. When performing matrix multiplication operations, all threads in a thread block will use the matrix. A row of The row multiplexing matrix columns, so consider a fixed size for a row of matrix X The data of is pre-read into the shared memory, and the corresponding data is read from the shared memory during the operation. Specifically, an additional loop is introduced, called the shared storage loop, which converts the matrix into a fixed size. Load a row of data into shared memory and use this data with the matrix All corresponding column element operations are performed to reduce the number of accesses to global memory. The choice of needs to be based on the specific hardware architecture and the size of the matrix, and the best value can be determined through experiments. If the matrix involved in the operation is a matrix of any dimension, that is, for matrices that cannot be For matrices that are divisible by (thread block size), an aligned memory access optimization method is used. When allocating matrix space, blank space is added after each row to ensure that the memory access of the next row of data is aligned. Reduction is used to optimize the cumulative sum operation when each thread calculates a single element in the output matrix Z. Low-thread reduction and loop unrolling are used to reduce partial results within each thread block, and shared memory is used to speed up data access. At the same time, the number of loop iterations is reduced through loop unrolling technology, thereby reducing the number of instruction executions and improving thread execution efficiency. Each reduction operation is located in the first half of all current threads (low threads), and is executed in a loop, and the final result is finally obtained in thread 0. The span between two elements is initialized to half the thread block size, and then reduced by half in each loop. In each loop, each thread sums two elements separated by the current span to produce a partial sum. Specifically, if Figure 4 As shown, in the first iteration, the first half of the threads in the thread block are forced to perform the summation operation, in the second iteration, the first quarter of the thread block, and so on, gradually reducing the number of threads involved in the calculation, halving each iteration, until the summation result of the entire block is finally obtained at the first location of the shared memory. The pseudo code of the implementation process of the optimization is as follows.

[0152]

[0153] The underlying implementation of secure addition, multiplication and matrix operations, combined with these basic operators, can achieve complex neural network reasoning tasks. The reasoning process of a neural network is essentially a large number of matrix operations and repeated applications of nonlinear activation functions, and matrix operations can be decomposed into basic addition and multiplication operations. Therefore, by ensuring the security of each basic operator, an overall secure computing framework can be constructed. In this framework, any calculation involving private data can be performed in an encrypted form to avoid leaking any sensitive information. Specifically, secure addition and multiplication operators ensure the privacy protection of a single calculation step, and matrix operations, as the core computing mode of neural network reasoning, can ensure that the entire reasoning process is completed under the premise of strict protection of data privacy through the secure implementation of these basic operators. In addition, the GPU parallel computing module plays an important role in processing unbalanced matrix operations, and significantly improves the computing efficiency and reduces the computing time through optimization methods such as blocking, reduction and shared memory, thereby supporting efficient secure neural network reasoning. Therefore, the implementation of the underlying secure operators and the acceleration of the GPU parallel computing module provide a solid foundation for high-level secure neural network reasoning, ensuring the security, privacy and efficiency of the entire reasoning process.

[0154] It should be understood by professionals in the field that the implementation of the present invention can be embodied as a method, system or computer program product. The solution of the present invention can be implemented in a pure hardware manner or in a combination of software and hardware. In addition, the present invention can also be implemented in the form of a computer-readable storage medium containing program codes used by a computer, and the storage medium includes but is not limited to various forms such as disk storage, CD-ROM, optical storage, etc. In the GPU parallel computing module of the present invention, the GPU platform can be replaced by FPGA or other hardware accelerators.

Claims

1. A neural network reasoning acceleration method based on secure multi-party computing, characterized in that: A secure neural network reasoning acceleration system is used, the system comprising: Data preprocessing module, data pre-calculation module, security calculation module, GPU parallel calculation module, security communication module and result reconstruction module, The data preprocessing module is responsible for preprocessing the original input data, converting the data into vector or matrix form, and performing secret sharing processing; The data pre-calculation module uses the pseudo-random number generator of the function secret sharing FSS and VOLE to generate random seeds, and generates random numbers related to the secret data according to the random seeds; The secure computing module includes secure addition, multiplication, and matrix multiplication modules to ensure data privacy protection during the computing process; The GPU parallel computing module uses the parallel computing capabilities of the GPU to accelerate intensive matrix operations; The secure communication module is responsible for secure communication between all participants, ensuring the secure transmission of intermediate calculation results; The result reconstruction module reconstructs the final reasoning result based on the calculation results of each participant; The data flow process of the security reasoning acceleration system is as follows: (1) User input data is processed by the data preprocessing module, converted into vector form and secret shared. (2) The data pre-calculation module generates a pseudo-random correlation vector of the secret data sharing share to achieve encryption blinding of the data. (3) The preprocessed data enters the secure computing module, where each participant performs addition, multiplication, and matrix multiplication operations based on the secret sharing share to further complete complex computing tasks. (4) The intensive matrix operations required in the calculation process are accelerated by the GPU parallel computing module. (5) The calculation results are securely transmitted between the participants through the secure communication module. (6) The final result is reconstructed by a result reconstruction module to obtain a complete reasoning result and return it to the user; the method comprises the following steps: Step S1, each participant performs initialization settings, data preprocessing and precalculation; Step S2: input the data into the secure computing module for multi-party secure computing, the GPU accelerated computing module accelerates the matrix operation, the calculation result is transmitted through the secure communication module, and the result reconstruction module returns the complete reasoning result; In step S1, each participant performs initialization settings, data preprocessing and precalculation, and the specific implementation steps are as follows: S11. The participants negotiate to determine the preset shared value. The participants negotiate to determine the preset shared value, including the security parameter λ, the finite domain Function f, column vector dimension k, number of column vectors n, determine the public matrix S12, obtain the original input data of the participant P0, and perform data preprocessing: convert the input data into a series of vectors, that is, convert the input data into the numerical, vector, and matrix form processed by the model; and convert the input data into the form of secret sharing, S13, pre-process the model parameter matrix data of participant P1 and convert it into the form of additive secret sharing, S14. All parties cooperate to pre-calculate and generate random seeds. S15. Each participant extracts parameters from the random seed and locally pre-calculates and generates random numbers related to the secret data; Among them, in step S12, the original input data of the participant P0 is converted into a series of vectors through word embedding and position embedding, and then converted into a numerical vector form processed by the large model. Then, the input data is converted into the form of additive secret sharing. The private data of the participant P0 is x. For the private data x, its secret sharing is x≡ <x> 0+ <x> 1, that is, divide the input data into two secret sharing shares,< / x> < / x> In step S13, the model parameter matrix data of the participant P1 is preprocessed, and the model parameter matrix data is converted into the form of additive secret sharing, and the data is divided into two matrix shares. The private data of the participant P1 is y, and for the private data y, its secret sharing is y≡ <y> 0+ <y> 1, that is, divide the input data into two secret sharing shares,< / y> < / y> Among them, the secret sharing share <x> i 、 <y> i All obey uniform distribution, i∈{0,1},< / y> < / x> The step S14: all parties cooperate to pre-calculate and generate a random seed, which is specifically divided into the following three steps: S141, the trusted third party TTP generates two random vectors a and b, and randomly generates an error vector α. Using the generated vector and the input secret data S, we can calculate c = a s + b. in, and satisfies a specific Hamming weight condition, the number of non-zero elements in the vector, HW(α) = r·n, r is the noise ratio, S142. Generate a pair of keys K0 and K1 using the function secret sharing FSS and ensure that they meet specific calculation conditions. Generate a pair of keys K0 and K1 using the pseudo-random function PRF and the function secret sharing FSS, which are defined as: FSS PRF .GEN(1 λ ,f)→(K0,K1), Based on a given security parameter λ and function f, FSS PRF The GEN function generates a pair of keys K0 and K1 of length λ bits, and the output of the function satisfies the following conditions: FSS PRF ·Evaluate(0,K0)+FSS PRF ·Evaluate(1,K1)=s·α Among them, function f is a function that FSS allows two participants P0 and P1 to cooperate in calculating the valuation f(·) of function f at a certain point. After the calculation is completed, P0 obtains a secret sharing share of f0(·), and P1 obtains a secret sharing share of f1(·), satisfying f(·)=f0(·)+f1(·), S143, Pseudo-random number generator PCG using VOLE VOLE Generate a random seed σ , sent to participant P i ,σ,i∈{0,1}, PCG VOLE .Setup(1 λ ,s)→(seed0,seed1)→((K0,α,a,b),(K1,s,c)) Among them, seed seed0 = (K0, α, a, b), seed seed1 = (K1, s, c), seed1 contains secret data s, Step S15: Each participant extracts parameters from the random seed, locally pre-calculates and generates random numbers related to secret data, and the participant P i Using FSS PRF Evaluate(0, K i ) Calculate β i , further calculations yield u = a·C + α, v = b·C - β i , participant P 1-i Using FSS PRF .Evaluate(1, K 1-i ) Calculate β 1-i , further calculation yields w=c·C+β 1-i , where β i +β 1-i =s·α,i∈{0,1}, Participant P i All need to execute steps S14 and S15 (i∈{0,1}), and their local secret data sharing share x≡ <x> 0+ <x> 1、y≡ <y> 0+ <y> 1 Generate relevant random numbers to realize encryption blinding of secret data: In a multi-party computing environment, the original secret data is not transmitted directly, but only the secret sharing share of the data is transmitted. When performing subsequent security reasoning, the calculation results can be reconstructed based on the secret data share and its related random numbers held locally by the participating parties.< / y> < / y> < / x> < / x> The safety calculation module of step S2 includes a safety addition operation module II Add , secure multiplication module Π Mult , secure matrix multiplication module Π MatMul 、GPU accelerated computing module Π GPU .

2. A terminal, characterized in that: The invention comprises a processor, a memory and a program of a neural network reasoning acceleration method based on secure multi-party computing stored in the memory. When the secure neural network reasoning acceleration program based on secure multi-party computing is executed by the processor, the steps of the neural network reasoning acceleration method based on secure multi-party computing as claimed in claim 1 are implemented.

3. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the computer instruction is executed by the processor, the steps of the neural network reasoning acceleration method based on secure multi-party computing as described in claim 1 are implemented.

Citation Information

Patent Citations

  • Fair multi-party privacy set intersection algorithm based on enhanced VOLE

    CN115276985A

  • Conciseness multi-party privacy set intersection algorithm based on enhanced VOLE

    CN115314194A

  • Self-adaptive safe two-party computing method and system based on GPU (Graphics Processing Unit)

    CN117150524A

  • Multi-party machine learning safety reasoning pipeline method and system based on GPU

    CN117195984A

  • Neural network training reasoning method and system based on function secret sharing

    CN117291258A