Client-cloud collaborative training method, system and apparatus
By stripping the representation layer to the terminal and encrypting it in edge-cloud collaborative training, the problem of client data leakage during transmission is solved, thus achieving data privacy protection and improved training efficiency.
Patent Information
- Application Number
- PCT/CN2025/083945
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-04-30
- Filing Date
- 2025-03-21
- Publication Date
- 2025-11-06
AI Technical Summary
In the process of edge-cloud collaborative training, how can we improve data privacy and security, especially to prevent client data from being leaked and parsed into plaintext during transmission?
The client's representation layer is stripped away to the terminal for training. The embedded representation and representation vector are encrypted to avoid plaintext transmission. Low-rank matrices and feedforward neural networks are used for data dimensionality reduction and nonlinear transformation to ensure data privacy protection on the cloud platform side.
It improves the privacy and security of client data, reduces the amount of data transmitted, improves training and data transmission efficiency, and ensures the security of data during transmission.
Smart Images

Figure CN2025083945_06112025_PF_FP_ABST
Abstract
Description
An end-cloud collaborative training method, system and device
[0001] The present application claims priority from the Chinese patent application No. 202410548751.0 filed on April 30, 2024, and entitled "An end-cloud collaborative training method, system and device", the whole content of which is incorporated herein by reference. TECHNICAL FIELD
[0002] The present application relates to the field of artificial intelligence, and in particular to an end-cloud collaborative training method, system and device. BACKGROUND
[0003] The field of artificial intelligence (AI) and deep learning has undergone tremendous changes, among which natural language processing is one of the hotspots. End-cloud collaborative training is becoming more and more common, especially for large language models, maximizing the use of computing power of different devices and platforms, and realizing flexible deployment and collaborative computing of data and models in the cloud and on the side.
[0004] In the environment of end-cloud collaboration, privacy protection is particularly critical. Data-invisible protection strategies ensure the security and privacy of user data during storage, processing and transmission, and through encryption technology, for example, data is not illegally stolen or used during transmission. Model-invisible privacy protection is mainly based on the need for commercial protection. For example, large models such as GPT series usually only provide API service calls, while the internal model structure, parameters, training and fine-tuning of specific processes and other information are strictly confidential.
[0005] Therefore, how to improve the data privacy in the process of end-cloud collaborative training is a problem to be solved. SUMMARY
[0006] The present application provides an end-cloud collaborative training method, system and device, which can be used to strip the embedding layer to the terminal training in the process of end-cloud collaborative training to improve the privacy and security of the data on the side.
[0007] Therefore, in a first aspect, the present application provides an end-cloud collaborative training method applied to an end-cloud collaborative training system, the end-cloud collaborative training system comprising a client and a cloud platform. The method comprises the following steps: first, the client uses training data as the input of a representation layer to obtain a representation vector, the representation layer being configured to obtain a vector corresponding to the input data from a representation vocabulary stored in the client; then the client sends the representation vector to the cloud platform, so that the cloud platform takes the representation vector as the input of a language model deployed on the cloud platform to obtain an output feature; the client receives the output feature sent by the cloud platform, the output feature being obtained by inputting the representation vector into the language model by the cloud platform; the client calculates a loss value using the output feature, updates the representation layer according to the loss value, and sends the loss value to the cloud platform, the loss value being used to update the language model by the cloud platform to obtain an updated language model.
[0008] In the method provided by the present application, the representation layer is updated locally on the client side, so that the representation vocabulary on the client side is not exposed to the client, and when the client sends data to the cloud platform, the extracted features, i.e. hidden states, are sent, which can avoid the client data from being leaked and parsed into plaintext during transmission, thereby improving the privacy security of the client data.
[0009] In a possible implementation, the foregoing client uses the training data as the input of the representation layer to obtain the representation vector, comprising: the client inputs the training data into the representation layer to output an embedding representation; and the client encrypts the embedding representation to obtain the representation vector.
[0010] In the embodiment of the present application, when the client generates the representation vector, the embedding representation can be encrypted, so that the data transmitted by the client to the cloud platform is the data after encryption, even if the data transmitted by the client to the cloud platform is leaked, it can be further avoided to be parsed into plaintext, thereby improving the privacy security of the client data.
[0011] In a possible implementation, the foregoing client inputs the training data into the representation layer to output the embedding representation, comprising: the client encrypts the representation vocabulary to obtain an encrypted representation vocabulary; and the client inputs the training data into the representation layer to determine the embedding representation from the encrypted representation vocabulary through the representation layer.
[0012] In the embodiments of the present application, the client can encrypt the representation word table, and output the embedding representation by using the encrypted representation word table, so that the output embedding representation is encrypted, thereby further avoiding the embedding representation from being parsed into plaintext when being leaked, and improving the privacy security of the client. Even if the representation word table used in the previous round of collaborative training on the client side is leaked, in the current round of collaborative training, the representation word table used in the previous round of collaborative training is encrypted, and the output embedding representation can only be parsed based on the encrypted representation word table, so that the embedding representation can be further avoided from being parsed into plaintext when being leaked, and the privacy security of the client is improved.
[0013] In a possible implementation, the foregoing client encrypts the representation word table to obtain an encrypted representation word table, including: the client adding a low-rank matrix in the representation word table to obtain the encrypted representation word table.
[0014] In the embodiments of the present application, the specific encryption method of the representation word table can use a low-rank matrix (Lora), so that the representation word table can be fine-tuned based on the added Lora in the training process, and the fine-tuning of the model is realized.
[0015] In a possible implementation, the foregoing client encrypts the embedding representation to obtain a representation vector, including: the client performing dimension reduction processing on the embedding representation to obtain the representation vector.
[0016] In the embodiments of the present application, the embedding representation can be subjected to dimension reduction processing to reduce the data transmission amount between the client and the cloud platform, improve the data transmission efficiency, and further improve the training efficiency. In addition, the dimension reduction processing on the embedding representation can also be equivalent to encrypting the embedding representation, which can further avoid the embedding representation from being parsed into plaintext when being leaked, and improve the privacy security of the client.
[0017] In a possible implementation, the foregoing client encrypts the embedding representation to obtain a representation vector, including: the client taking the embedding representation as an input of a feedforward neural network (FNN) to obtain the representation vector, and the FNN is used for linear transformation processing on the input embedding representation.
[0018] Therefore, in the embodiments of the present application, the FNN can be specifically used to output the representation vector, and the FNN is used to realize the dimension reduction processing to reduce the transmission data amount between the client and the cloud platform. The embedding representation can be further avoided from being parsed into plaintext when being leaked, and the privacy security of the client is improved.
[0019] In a possible implementation, the method further includes: performing, by the client, a nonlinear transformation on the representation vector, and taking the transformed vector as a new representation vector.
[0020] In the embodiments of the present application, the representation vector can be further nonlinearly transformed, and the representation vector can be further encrypted, so as to further avoid the embedded representation from being parsed into plaintext when being leaked, and improve the privacy security of the client.
[0021] In a possible implementation, the client calculates the loss value by using the output feature, including: the client obtains, according to the output feature, a prediction score of each vector in the representation word table as the next vector; and the client calculates the loss value according to the prediction score of each vector as the next vector and the label corresponding to the training data.
[0022] In the embodiments of the present application, the client can perform a prediction task by using the output feature sent by the cloud platform, so as to calculate the corresponding loss value based on the prediction branch of the prediction task, so as to realize the end-cloud collaborative model training process.
[0023] In a second aspect, the present application provides an end-cloud collaborative training method, applied to an end-cloud collaborative training system, the end-cloud collaborative training system including a client and a cloud platform. The method includes: receiving, by the cloud platform, a representation vector sent by the client, the representation vector being obtained by inputting, by the client, training data into a representation layer, the representation layer being configured to obtain a vector corresponding to the input data from a representation word table stored by the client; inputting, by the cloud platform, the representation vector into a language model to obtain an output feature, and sending, by the cloud platform, the output feature to the client; receiving, by the cloud platform, a loss value sent by the client, the loss value being calculated by the client according to the output feature; and updating, by the cloud platform, the language model by using the loss value to obtain an updated language model.
[0024] In the method provided by the present application, the representation layer is updated locally on the client side, so that the representation word table on the client side is not out of the client, and when the client sends data to the cloud platform, the extracted feature, i.e., the hidden state, is sent, so as to avoid the client data from being parsed into plaintext after being leaked in the transmission process, thereby improving the privacy security of the client data.
[0025] In a possible implementation, the representation vector is obtained by performing encryption processing on the embedded representation output by the representation layer. In the embodiments of the present application, the client can perform encryption processing on the embedded representation when generating the representation vector, so that the data transmitted by the client to the cloud platform is the data after the encryption processing, and even if the data transmitted by the client to the cloud platform is leaked, the data can be further avoided from being parsed into plaintext, thereby improving the privacy security of the client data.
[0026] In a third aspect, the present application provides a client, comprising:
[0027] an input module configured to use the training data as an input of a representation layer to obtain a representation vector, the representation layer being configured to obtain a vector corresponding to the input data from a representation vocabulary stored by the client;
[0028] a transceiver configured to send the representation vector to a cloud platform, and receive an output feature sent by the cloud platform, the output feature being obtained by inputting the representation vector into a language model by the cloud platform;
[0029] a processing module configured to calculate a loss value using the output feature, and update the representation layer according to the loss value;
[0030] the transceiver is further configured to send the loss value to the cloud platform, and the loss value is used by the cloud platform to update the language model to obtain an updated language model.
[0031] Effects of the third aspect and any possible implementation of the third aspect of the present application can refer to the description of the first aspect or any possible implementation of the first aspect, which will not be repeated here.
[0032] In a possible implementation, the input module is specifically configured to input the training data into the representation layer to output an embedding representation, and encrypt the embedding representation to obtain the representation vector.
[0033] In a possible implementation, the input module is specifically configured to encrypt the representation vocabulary to obtain an encrypted representation vocabulary, and input the training data into the representation layer to determine the embedding representation from the encrypted representation vocabulary.
[0034] In a possible implementation, the input module is specifically configured to add a low-rank matrix to the representation vocabulary to obtain the encrypted representation vocabulary.
[0035] In a possible implementation, the input module is specifically configured to perform dimension reduction processing on the embedding representation to obtain the representation vector.
[0036] In a possible implementation, the input module is specifically configured to use the embedding representation as an input of a feedforward neural network (FNN) to obtain the representation vector, and the FNN is configured to perform linear transformation processing on the input embedding representation.
[0037] In a possible implementation, the input module is further configured to perform nonlinear transformation on the representation vector, and use the vector obtained after the transformation as a new representation vector.
[0038] In a possible implementation, the processing module is specifically configured to: acquire, according to the output feature, a prediction score of each vector in the representation word table as the next vector; and calculate, according to the prediction score of each vector as the next vector, a loss value corresponding to the label of the training data.
[0039] In a fourth aspect, the present application provides a cloud platform, comprising:
[0040] The transceiver module is configured to receive a representation vector sent by the client, the representation vector being obtained by inputting training data into a representation layer by the client, the representation layer being configured to acquire a vector corresponding to the input data from a representation word table stored by the client.
[0041] The input module is configured to input the representation vector into a language model to obtain an output feature, and send the output feature to the client.
[0042] The transceiver module is further configured to receive a loss value sent by the client, the loss value being calculated by the client according to the output feature.
[0043] The update module is configured to update the language model by using the loss value to obtain an updated language model.
[0044] In a possible implementation, the representation vector is obtained by encrypting an embedding representation output by the representation layer by the client.
[0045] In a fifth aspect, the present application provides an end-cloud collaborative training method, applied to an end-cloud collaborative training system, the end-cloud collaborative training system comprising a client and a cloud platform, the method comprising: inputting, by the client, training data into a representation layer to obtain a representation vector, and sending the representation vector to the cloud platform, the representation layer being configured to acquire a vector corresponding to the input data from a representation word table stored by the client; inputting, by the cloud platform, the representation vector into a language model to obtain an output feature, and sending the output feature to the client; subsequently, calculating, by the client, a loss value by using the output feature, updating a representation layer locally stored by the client according to the loss value, and sending the loss value to the cloud platform; and updating, by the cloud platform, the language model by using the loss value to obtain an updated language model.
[0046] In the method provided by the present application, the representation layer is updated locally on the client side, so that the representation word table on the client side is not exposed to the client, and when the client sends data to the cloud platform, the extracted feature, i.e., the hidden state, is sent, which can avoid the client data from being leaked and parsed into plaintext in the transmission process, thereby improving the privacy security of the client data.
[0047] In a possible implementation, the foregoing client uses the training data as input of the representation layer to obtain the representation vector, including: the client inputs the training data to the representation layer to output the embedding representation, and then encrypts the embedding representation to obtain the representation vector.
[0048] In the implementation of the application, the client can encrypt the embedding representation when generating the representation vector, so that the data transmitted by the client to the cloud platform is the data after encryption. Even if the data transmitted by the client to the cloud platform is leaked, it can be further avoided to be parsed into plaintext, and the privacy security of the client data is improved.
[0049] In a possible implementation, the foregoing client inputs the training data to the representation layer to output the embedding representation, including: the client encrypts the representation vocabulary to obtain the encrypted representation vocabulary, inputs the training data to the representation layer, and determines the embedding representation from the encrypted representation vocabulary through the representation layer.
[0050] In the implementation of the application, the client can encrypt the representation vocabulary and output the embedding representation by using the encrypted representation vocabulary. Accordingly, the output embedding representation is the encrypted embedding representation, so that the embedding representation can be further avoided to be parsed into plaintext when being leaked, and the privacy security of the client is improved. Moreover, even if the representation vocabulary used in the previous round of collaborative training of the client side is leaked, the embedding representation output in the current round of collaborative training is only parsed based on the encrypted representation vocabulary, so that the embedding representation can be further avoided to be parsed into plaintext when being leaked, and the privacy security of the client is improved.
[0051] In a possible implementation, the foregoing client encrypts the representation vocabulary to obtain the encrypted representation vocabulary, including: the client adds a low-rank matrix to the representation vocabulary to obtain the encrypted representation vocabulary.
[0052] In the implementation of the application, the specific encryption method of the representation vocabulary can use a low-rank matrix (Lora), so that the representation vocabulary can be fine-tuned based on the added Lora in the training process, and the fine-tuning of the model is realized.
[0053] In a possible implementation, the foregoing client encrypts the embedding representation to obtain the representation vector, including: the client performs dimension reduction processing on the embedding representation to obtain the representation vector.
[0054] In the embodiments of the present application, the embedding representation can be dimensionally reduced to reduce the data transmission amount between the client and the cloud platform, improve the data transmission efficiency, and further improve the training efficiency. Moreover, the dimensionally reduced embedding representation can be equivalent to an encrypted embedding representation, which can further avoid the embedding representation from being parsed into plaintext when leaked, and improve the privacy security of the client.
[0055] In a possible implementation, the client dimensionally reduces the embedding representation to obtain the representation vector, including: the client takes the embedding representation as an input of a feedforward neural network (FNN), and obtains the representation vector, the FNN being used to perform linear transformation processing on the input embedding representation.
[0056] Therefore, in the embodiments of the present application, the FNN can be specifically used to output the representation vector, and the FNN can be used to implement the dimension reduction processing to reduce the transmission data amount between the client and the cloud platform. Further, the embedding representation can be avoided from being parsed into plaintext when leaked, and the privacy security of the client can be improved.
[0057] In a possible implementation, the method further includes: the client performs nonlinear transformation on the representation vector, and takes the vector obtained after the transformation as a new representation vector.
[0058] In the embodiments of the present application, the representation vector can be further nonlinearly transformed, and the representation vector can be further encrypted, so that the embedding representation can be further avoided from being parsed into plaintext when leaked, and the privacy security of the client can be improved.
[0059] In a possible implementation, the client calculates the loss value by using the output feature, including: the client obtains, according to the output feature, a prediction score of each vector in the representation vocabulary as a next vector, and calculates the loss value according to the prediction score of each vector as a next vector and a label corresponding to the training data.
[0060] In the embodiments of the present application, the client can perform a prediction task by using the output feature sent by the cloud platform, so as to calculate the corresponding loss value based on a prediction branch of the prediction task, to implement the end-cloud collaborative model training process.
[0061] In a sixth aspect, the present application provides an end-cloud collaborative training system, which is applied to an end-cloud collaborative training system, and the end-cloud collaborative training system includes a client and a cloud platform.
[0062] The client is configured to use the training data as an input of a representation layer to obtain a representation vector, and the representation layer is configured to obtain a vector corresponding to the input data from a representation vocabulary stored by the client.
[0063] The client is further configured to send the representation vector to the cloud platform.
[0064] the cloud platform is further configured to send the output feature to the client;
[0065] the cloud platform is further configured to send the output feature to the client;
[0066] the client is further configured to calculate a loss value by using the output feature, update the representation layer according to the loss value, and send the loss value to the cloud platform;
[0067] the cloud platform is further configured to update the language model by using the loss value to obtain an updated language model.
[0068] Effects achieved by the sixth aspect and any optional implementation of the sixth aspect can refer to the description of the fifth aspect or any optional implementation of the fifth aspect, which will not be described here.
[0069] In a possible implementation, the client is specifically configured to: input the training data to the representation layer to output an embedding representation; and encrypt the embedding representation to obtain the representation vector.
[0070] In a possible implementation, the client is specifically configured to: encrypt the representation vocabulary to obtain an encrypted representation vocabulary; and input the training data to the representation layer to determine the embedding representation from the encrypted representation vocabulary.
[0071] In a possible implementation, the client is specifically configured to: add a low-rank matrix to the representation vocabulary to obtain the encrypted representation vocabulary.
[0072] In a possible implementation, the client is specifically configured to: perform dimension reduction processing on the embedding representation to obtain the representation vector.
[0073] In a possible implementation, the client is specifically configured to: input the embedding representation to a feedforward neural network (FNN) to obtain the representation vector, the FNN being configured to perform linear transformation processing on the input embedding representation.
[0074] In a possible implementation, the client is further configured to perform nonlinear transformation on the representation vector, and use the vector obtained after the transformation as a new representation vector.
[0075] In a possible implementation, the client is specifically configured to: obtain a prediction score of each vector in the representation vocabulary as a next vector according to the output feature; and calculate a loss value according to the prediction score of each vector as a next vector and a label corresponding to the training data.
[0076] In a seventh aspect, the present application provides a computing device, comprising a processor and a memory; the processor of the computing device is configured to execute instructions stored in the memory of the computing device, so that the computing device performs the method steps performed by the client in the first aspect and any implementation manner thereof.
[0077] In an eighth aspect, the embodiments of the present application provide a computing device cluster, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of the computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster performs the method steps performed by the cloud platform in the second aspect and any implementation manner thereof.
[0078] In a ninth aspect, the embodiments of the present application provide a computer program product comprising instructions, which, when executed by a computing device cluster, cause the computing device cluster to perform the method in any implementation manner of the first aspect or the second aspect.
[0079] In a tenth aspect, the embodiments of the present application provide a computer-readable storage medium comprising computer program instructions, which, when executed by a computing device cluster, cause the computing device cluster to perform the method in any implementation manner of the first aspect or the second aspect.
[0080] In an eleventh aspect, the embodiments of the present application provide a chip, comprising at least one processor and an interface; the at least one processor acquires program instructions or data through the interface; the at least one processor is configured to execute the program instructions to implement the method in any implementation manner of the first aspect or the second aspect. BRIEF DESCRIPTION OF DRAWINGS
[0081] FIG. 1 is a schematic diagram of an architecture of an end-cloud collaborative training system provided by the present application;
[0082] FIG. 2 is a schematic diagram of a flow of an end-cloud collaborative training method provided by the present application;
[0083] FIG. 3 is a schematic diagram of a flow of another end-cloud collaborative training method provided by the present application;
[0084] FIG. 4 is a schematic diagram of a flow of another end-cloud collaborative training method provided by the present application;
[0085] FIG. 5 is a schematic diagram of a flow of another end-cloud collaborative training method provided by the present application;
[0086] FIG. 6 is a schematic diagram of a flow of another end-cloud collaborative training method provided by the present application;
[0087] FIG. 7 is a schematic diagram of a flow of another end-cloud collaborative training method provided by the present application;
[0088] FIG. 8 is a schematic diagram of an architecture of another end-cloud collaborative training system provided by the present application;
[0089] FIG. 9 is a schematic diagram of a structure of a client provided by the present application;
[0090] FIG. 10 is a schematic diagram of a structure of a cloud platform provided by the present application;
[0091] FIG. 11 is a schematic diagram of a structure of another client provided by the present application;
[0092] FIG. 12 is a schematic diagram of a structure of another cloud platform provided by the present application. DETAILED DESCRIPTION
[0093] The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of the present application.
[0094] First, the embodiments of the present application relate to neural networks and related applications of natural language processing (NLP). In order to better understand the solutions of the embodiments of the present application, the related terms and concepts of neural networks that may be involved in the embodiments of the present application will be introduced below.
[0095] (1) Neural network
[0096] A neural network can be composed of neural units, which can refer to an operation unit taking x s (i.e., input data) and an intercept 1 as input. The output of the operation unit can be:
[0097] where s = 1, 2, … n, n is a natural number greater than 1, W s is a weight parameter of x s , b is a bias of the neural unit. f is an activation function of the neural unit, which is used to introduce a nonlinear characteristic into the neural network to convert the input signal in the neural unit into an output signal. The output signal of the activation function can be used as the input of the next convolutional layer. The activation function can be a sigmoid function. The neural network is a network formed by connecting multiple single neural units together, i.e., the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field, and the local receptive field can be a region composed of several neural units.
[0098] The work of each layer in the neural network can be described by the mathematical expression y = a(Wx + b): from a physical perspective, the work of each layer in the neural network can be understood as completing the transformation of the input space (a set of input vectors) to the output space (i.e., the row space of the matrix to the column space) by five operations on the input space, which include: 1, dimensionality increase / decrease; 2, magnification / reduction; 3, rotation; 4, translation; 5, "bending". Among them, the operations of 1, 2, and 3 are completed by Wx, the operation of 4 is completed by +b, and the operation of 5 is completed by a(). The reason why "space" is used here is that the objects to be classified are not single things, but a class of things, and the space refers to the set of all individuals of this class of things. Among them, W is a weight vector, and each value in the vector represents the weight value of a neuron in the neural network of the layer. The vector W determines the spatial transformation of the input space to the output space described above, that is, the weight W of each layer controls how to transform the space. The purpose of training the neural network is to obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by the vectors W of many layers). Therefore, the training process of the neural network is essentially learning the way to control the spatial transformation, more specifically, learning the weight matrix.
[0099] (2) Loss function
[0100] In the process of training a deep neural network, because it is desired that the output of the deep neural network is as close as possible to the value that is truly intended to be predicted, the weight vector of each layer of the neural network can be updated according to the difference between the predicted value of the current network and the target value that is truly intended to be predicted (of course, before the first update, there is usually a process of initialization, i.e., pre-configuring parameters for each layer in the deep neural network), for example, if the predicted value of the network is too high, the weight vector is adjusted to make it predict lower, and the adjustment is continuously made until the deep neural network can predict the target value that is truly intended to be predicted or a value very close to it. Therefore, it is necessary to define "how to compare the difference between the predicted value and the target value", which is the loss function or the objective function, which is an important equation for measuring the difference between the predicted value and the target value. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, and then the training of the deep neural network becomes a process of trying to minimize the loss. The loss function can usually include error square mean square, cross-entropy, logarithm, exponential, etc. For example, the error mean square can be used as the loss function, which is defined as Specific loss functions can be selected according to actual application scenarios.
[0101] (3) Backpropagation algorithm
[0102] An algorithm for calculating the gradient of model parameters according to a loss function, updating the model parameters. The neural network can use the back propagation (BP) algorithm to correct the size of the parameters in the initial neural network model during the training process, so that the reconstruction error loss of the neural network model becomes smaller and smaller. Specifically, the forward propagation of the input signal until the output will produce an error loss, and the parameters in the initial neural network model are updated by back propagating the error loss information, so as to make the error loss converge. The back propagation algorithm is a back propagation movement dominated by error loss, aiming to obtain the optimal parameters of the neural network model, such as the weight matrix.
[0103] In the embodiments of the present application, the BP algorithm can be used to train the model during the training phase or inference phase of the large language model to obtain the trained model.
[0104] (4) Language model (LM)
[0105] For NLP, which plays an important role in NLP, its task is to predict the probability of a sentence appearing in language. For example, a language model is usually constructed as a probability distribution p(s) of a string s, where p(s) attempts to reflect the frequency of the string s as a sentence. It can be applied to text recognition or machine translation scenarios.
[0106] It can be applied to text recognition or machine translation scenarios.
[0107] (5) Neural machine translation: Neural machine translation is a typical task of natural language processing. The task is to give a source language sentence and output its corresponding target language sentence. In the commonly used neural machine translation model, the words in the source language and target language sentences are encoded into vector representations, and the association between words and sentences in the vector space is calculated to perform the translation task.
[0108] (6) Self-attention model: refers to effectively encoding a sequence data (such as a natural language corpus "Your phone is very good.") into a plurality of multi-dimensional vectors, which facilitates numerical operation. The multi-dimensional vector integrates the similarity information between each element in the sequence, and the similarity is called self-attention.
[0109] (7) pre-trained language model (PLM): a natural language sequence encoder that encodes each word in a natural language sequence into a vector representation, so as to perform downstream tasks, such as the word vector conversion network, the action vector conversion network or the action generation network mentioned below in this application, etc. The training of the PLM includes two stages, i.e. a pre-training stage and a fine-tuning stage. In the pre-training stage, the model is trained on large-scale unsupervised text for language model tasks, thereby learning the word representation method. In the fine-tuning stage, the model uses the parameters learned in the pre-training stage for initialization, and performs a few-step training on downstream tasks such as text classification or sequence labeling, so as to successfully transfer the semantic information obtained by pre-training to the downstream tasks.
[0110] In addition, fine-tuning can also include full fine-tuning, i.e. fine-tuning of all parameters of the language model.
[0111] (8) transformer
[0112] The transformer structure is a feature extraction network (similar to a convolutional neural network) containing an encoder and a decoder. Of course, in some cases, the transformer structure can not include an encoder, but include a decoder.
[0113] Encoder: learn features such as pixel features in a global receptive field through self-attention.
[0114] Decoder: learn features of required modules such as output frame features through self-attention and cross-attention.
[0115] The attention (which can also be referred to as attention mechanism) is described as follows:
[0116] Attention mechanism can quickly extract important features of sparse data. Attention mechanism occurs between encoder and decoder, or between input sentence and generated sentence. While self-attention mechanism in self-attention model occurs within the encoding matrix, or within the output sequence, which can extract the relationship between words far apart in the same sentence, such as syntactic features (phrase structure). Self-attention mechanism provides an effective modeling method for capturing global context information through QKV. Assuming the input is Q (query), and the context is stored in the form of key-value pair (K, V). Then the attention mechanism is actually a mapping function from query to a series of key-value pairs. The essence of attention function can be described as a mapping from query to a series of (key, value) pairs. Attention essentially assigns a weight coefficient to each element in the sequence, which can also be understood as soft addressing. If each element in the sequence is stored in the form of (K, V), then attention completes the addressing by calculating the similarity between Q and K. The similarity calculated by Q and K reflects the importance of the extracted V value, that is, the weight, and then the weighted sum is obtained. The final feature value.
[0117] The calculation of attention mainly includes three steps. The first step is to calculate the similarity between query and each key to obtain the weight. The commonly used similarity function is dot product, concatenation, perception, etc. Then the second step is to normalize these weights using a softmax function (on the one hand, it can be normalized to get a probability distribution whose sum of all weight coefficients is 1. On the other hand, the characteristic of softmax function can highlight the weight of important elements); Finally, the weighted sum of the weight and the corresponding key value value is obtained to get the final feature value. The specific calculation formula can be as follows:
[0118] Where d is the dimension of the matrix QK.
[0119] In addition, attention includes self-attention and cross-attention. Self-attention can be understood as a special attention, that is, the input of QKV is consistent. While the input of QKV in cross-attention is inconsistent. Attention uses the similarity (such as inner product) between features as a weight to integrate the queried features as the updated value of the current feature. Self-attention is the attention extracted based on the attention of the feature map itself.
[0120] For convolution, the setting of the convolution kernel limits the size of the receptive field, resulting in the network often needing multiple layers of stacking to focus on the entire feature map. The advantage of self-attention is that its attention is global, and it can obtain the global spatial information of the feature map through simple query and assignment. The special point of self-attention in the query, key, and value (QKV) model is that the input corresponding to QKV is consistent.
[0121] (9) Large language model (LLM)
[0122] refers to a language model containing hundreds of billions (or more) of parameters, which are trained on a large amount of text data. It is a natural language processing model based on deep learning. These models can process a large amount of text data, thereby learning the grammar and semantic rules of natural language. LLM can be applied to text generation, machine translation, question and answer systems, text summarization, or sentiment analysis, etc., and has the advantages of strong generation ability, strong adaptability, accurate prediction, and strong scalability. For example, in the movie recommendation scenario, the large language model can generate a description of the movie scene, including movie type, leading actor, plot, etc., so that the system can better recommend similar movies. The large language model can also generate a recommendation reason, for example, an e-commerce website can generate a reason for recommending a product through a large language model, such as the quality, price, and function of the product, etc., so that users can better understand the value of the product. In addition, by externally connecting a candidate list given by a traditional recommendation system, the large language model can also sort and summarize the recommendation results, generating results that are easy for users to read and browse.
[0123] (10) Embedding
[0124] Embedding refers to the feature representation of a sample or the word embedding representation.
[0125] (11) Embedding table
[0126] The embedding table can be understood as a collection of word embedding representations.
[0127] The application scenarios and architectures provided by the present application are introduced as follows.
[0128] Large language models, such as OpenAI's GPT series, have become a hot topic in the technology industry due to their excellent natural language processing capabilities. These models not only support chatbots, automatic writing, and other applications, but also exhibit strong performance in text summarization, sentiment analysis, and other fields. Fine-tuning strategies for pre-trained models have gradually become a mainstream method, which involves pre-training the model on a large amount of text data and then fine-tuning it on data specific to a particular domain to optimize the model for that task. In this context, end-to-cloud / cell-to-cloud collaboration technology has emerged, which maximizes the use of computing power on different devices and platforms, enabling flexible deployment and collaborative computing of data and models on the cloud and edge, thereby expanding the scenarios of AI applications and greatly optimizing user experience. For example, lightweight models running on IoT devices and mobile devices can respond to user requests in real time, while complex model training and inference tasks can be offloaded to the cloud for execution, achieving efficient use of computing resources. At the same time, this collaborative computing mode also brings new challenges to data security and privacy protection, and how to ensure data security while achieving efficient training and inference of models has become the focus of the industry.
[0129] In the context of end-to-cloud collaboration, privacy protection is particularly critical. Data invisibility protection strategies ensure the security and privacy of user data during storage, processing, and transmission, and through encryption technology, for example, data is not illegally stolen or exploited during transmission. Model invisibility privacy protection is mainly based on the need for commercial protection. For example, large models such as the GPT series usually only provide API service calls, while the internal model structure, parameters, training, and fine-tuning processes are strictly confidential. This is not only to protect the intellectual property rights of the model, but also to prevent potential malicious attacks and ensure the stability and security of the model service.
[0130] In view of the model privacy problem, when the backbone of the model is hosted on the cloud side for training, the model can be considered invisible to the user. The key question is how to maximize the protection of user data used for fine-tuning from being leaked and not be analyzed in plaintext on the cloud side.
[0131] In some existing solutions, such as differential privacy solutions, the privacy of clients is protected by introducing randomness to protect the privacy of individual information. The core idea is to add certain random noise in the process of data publishing or querying to ensure that the addition or removal of a single data record will not significantly affect the output result, thereby protecting the privacy of individuals. However, since only the data level is added with noise on the end side, and the embedding layer weights on the cloud side are reused, the impact of plaintext cannot be eliminated; and in this scenario, the end side does not participate in training and cannot take advantage of the computing power of the end side.
[0132] For another example, homomorphic encryption (HE) is a unique encryption technology that has the core advantage of being able to perform calculations on encrypted data without prior decryption. This technology not only has theoretical appeal, but also has great potential in practical applications. For example, in the fine-tuning training scenario, the end side can synchronize data to the cloud side through homomorphic encryption, and the cloud side can directly train on encrypted data and pass the calculation results (still in encrypted state) to the end side. After decryption, the end side can obtain the final calculation results. However, compared with traditional encryption methods, homomorphic encryption brings higher computational complexity; the decryption process also brings additional computational overhead; in deep learning, especially in transformer architecture models, most operators cannot implement homomorphic encryption; and multiple calculations on encrypted data may accumulate errors. In addition, applying homomorphic encryption to large language models, i.e., models with transformer architecture, is theoretically feasible, but in practical applications, it faces some challenges and limitations, such as computational efficiency, model accuracy, etc. This determines that this solution is difficult to meet most user scenarios.
[0133] For example, federal learning (FL) is actually an encrypted distributed machine learning technology. FL can span multiple devices, and participating parties can jointly build a model without disclosing underlying data and underlying data encryption (obfuscation) forms. Through encryption mechanisms, the data of each enterprise can be exchanged without leaving the local, and a common model can be built without violating data privacy. However, in language model fine-tuning training, if federal learning is used for model training, when an attacker obtains the embedding parameters, the token can be parsed into plaintext, thereby leaking user data. In large language models, due to model size limitations, it is difficult to completely load on the end side. In the federal learning scenario, the end side is part of the computing power, and the model is shared with all end sides, which does not meet the principle that the model is not visible to the user. That is, although federal learning is a popular privacy protection method, when dealing with large language models, model parameters are shared between all participating end side devices. This contradicts the requirement that large language models be closed source, especially when the model should not be visible to the user. In addition, if an attacker obtains the embedding parameters of the model, there is a risk of token parsing into plaintext and leakage of user data.
[0134] Fine-tuning training of language models, especially large language models, requires a large amount of computing power, and due to the reasons for model closure, there are a large number of users collecting data on the cloud provider's model and computing power for fine-tuning training. Usually, users want their data not to be collected and used by others, and do not want to be parsed in plaintext on the cloud side.
[0135] Therefore, in view of the foregoing defects, the present application provides an end-cloud collaborative training method that realizes a strategy of protecting both the model architecture and the user data from being visible to the cloud side in an end-cloud collaborative environment. The method provided by the present application migrates key components such as the Embedding layer of the model from the cloud side to the end side for training, and additionally adds trainable parameters, aiming to ensure that the data output by the end side network cannot be reversely parsed by the cloud side without affecting the model accuracy, thereby achieving double protection of the model and the data to some extent.
[0136] First, the architecture of the end-cloud collaborative training system provided by the present application can be as shown in FIG. 1. The end-cloud collaborative training system can include a cloud platform 11 and a client 12.
[0137] The cloud platform 11 and the client 12 can be connected through wired or wireless connection.
[0138] The cloud platform 11 can specifically include a server cluster with storage and processing functions. In the embodiments of the present application, a transformer model can be deployed in the cloud platform 11, which can be a language model or a large language model, etc., and can be used to receive data sent by the client. In the embodiments of the present application, the data sent by the client can include at least two kinds, one is the representation vector output by the client side, which is taken as the input of the transformer by the cloud platform, and the output feature is returned to the client; the other is the loss value uploaded by the client, which is used by the cloud platform to update the transformer to realize end-to-cloud collaborative training.
[0139] The client 12 can realize collaborative training of the model by interacting with the cloud platform 11. The client can specifically include, but is not limited to, for example, a personal computer, a computer workstation, a smart phone, a tablet computer, a notebook computer, and a smart car, etc. In the embodiments of the present application, in order to avoid data leakage on the client side, an Embedding table can be deployed on the client side, and an Embedding layer can be deployed in the client 12 to extract the corresponding representation vector from the Embedding table and transmit it to the cloud platform; after receiving the output feature fed back by the cloud platform, the prediction result can be obtained based on the output feature, and the loss value is calculated and fed back to the cloud platform, so that the cloud platform can train the model based on the loss value to realize end-to-cloud collaborative training.
[0140] In combination with the foregoing end-to-cloud collaborative training architecture, the method flow provided by the present application will be introduced as follows.
[0141] Referring to FIG. 2, a flowchart of an end-to-cloud collaborative training method provided by the present application is as follows.
[0142] 201. The client uses the training data as the input of the representation layer to obtain the representation vector.
[0143] The training data can be data in a training set, which includes data used for model training. The training set can be divided into training data and labels corresponding to the training data, or true values. The training data can specifically include text, voice, image, or point cloud data, etc.
[0144] The representation layer is a model structure deployed on the client side, which can be used to query the representation corresponding to the training data from the Embedding table, and obtain the representation vector according to the query result. The queried embedding representation can be taken as the representation vector, or the representation vector can be obtained by processing the queried embedding representation.
[0145] Specifically, in order to improve the data privacy security of the client, the embedding representation obtained by querying the Embedding table can be encrypted, and the encrypted embedding representation is used as the representation vector. Specifically, the encryption method can include multiple methods, which will be introduced below.
[0146] Method one, encryption in the Embedding table.
[0147] In a possible implementation, the client can encrypt the Embedding table to obtain an encrypted Embedding table, and input the training data into the representation layer to determine the embedding representation from the encrypted representation vocabulary through the representation layer.
[0148] Therefore, in the embodiments of the present application, the Embedding table can be encrypted, and the embedding representation can be output based on the encrypted Embedding table, so that the embedding representation is not parsed as the plaintext corresponding to the Embedding table when the embedding representation is lost, and the data security of the client side is improved.
[0149] Optionally, in order to realize the model fine-tuning on the client side, a low-rank matrix can be added to the representation vocabulary to obtain an encrypted representation vocabulary. For example, a low-rank training (Low-Rank Adaptation, LoRA) can be introduced to introduce a low-rank matrix into the Embedding table for encryption, so that the Embedding table with the introduced low-rank matrix can be fine-tuned subsequently.
[0150] Method two, dimension reduction processing
[0151] In a possible implementation, the client can perform dimension reduction processing on the embedding representation to obtain the representation vector.
[0152] Optionally, the dimension reduction processing can be implemented by using FFN. For example, the client takes the embedding representation as the input of the feedforward neural network FNN to obtain the representation vector, and the FNN is used to perform linear transformation processing on the input embedding representation.
[0153] In the embodiments of the present application, the embedding representation can be processed by dimension reduction, which can change the embedding representation while reducing the communication overhead, so that the embedding representation is not parsed as the plaintext corresponding to the Embedding table when the embedding representation is lost, and the data security of the client side is improved.
[0154] Method three, nonlinear transformation
[0155] In a possible implementation, the client performs a nonlinear transformation on the representation vector, and takes the transformed vector as a new representation vector.
[0156] In the embodiments of the present application, the nonlinear transformation can be further performed, which can help capture complex patterns in the input data and avoid the existence of the embedding representation being parsed as the corresponding plaintext of the Embedding table, thereby improving the data security on the client side.
[0157] 202. The client sends the representation vector to the cloud platform.
[0158] After obtaining the representation vector on the client side, the representation vector can be sent to the cloud platform, so that the cloud platform performs a corresponding natural language processing task based on the representation vector.
[0159] 203. The cloud platform takes the representation vector as an input of a language model to obtain an output feature.
[0160] After receiving the representation vector from the client, the cloud platform takes the representation vector as an input of a language model deployed locally on the cloud platform to obtain an output feature.
[0161] The language model can be specifically a natural language processing model, such as a model for predicting the probability of a corpus appearing in a language, or the probability of each word being the next word, etc. For example, if the input text of the user includes "today the weather is really good", and the keywords can be divided into "today", "weather", and "really good", the language model can be used to identify whether the semantic composition of the input text is "today really good weather" or "today weather really good", so as to identify the semantics in the input data.
[0162] In a possible implementation, the language model can be specifically a large language model, thereby having very strong processing capability. Generally, a large language model has very strong performance, but has high complexity and requires high computing power of a device, and therefore the large language model can be deployed on the cloud platform, so that the cloud platform is used to run the large language model.
[0163] 204. The cloud platform sends the output feature to the client.
[0164] After the cloud platform obtains the output feature through the language model, the output feature can be sent to the client.
[0165] In the embodiments of the present application, the hidden state is transmitted between the cloud platform and the client, and the plaintext does not need to be transmitted, which can greatly improve the data security between the client and the cloud platform.
[0166] 205、The client calculates a loss value using the output feature, updates the representation layer according to the loss value, and sends the loss value to the cloud platform.
[0167] After receiving the output feature, the client can calculate a loss value using the output feature, then update the model structure deployed locally by the client using the loss value, and send the loss value to the cloud platform, so that the cloud platform can update the language model using the loss value.
[0168] Specifically, the client can obtain the prediction score of each vector in the representation word table as the next vector according to the output feature, in other words, the probability of each word as the next word; the client calculates a loss value according to the prediction score of each vector as the next vector and the label corresponding to the training data. It can be understood that the client can use the output feature sent by the cloud platform to calculate the prediction result, and calculate the difference between the prediction result and the true value to obtain the loss value.
[0169] 206、The cloud platform updates the language model using the loss value to obtain an updated language model.
[0170] After receiving the loss value sent by the client, the cloud platform can update the language model using the loss value to obtain an updated language model.
[0171] In the end-cloud collaborative training scenario in the embodiments of the present application, the Embedding table is deployed on the client, and non-plain data is transmitted between the client and the cloud platform, which can avoid the Embedding table of the client being decoded into plain text when it is leaked, thereby improving the data transmission security between the client and the cloud platform and improving the data privacy security of the client. Moreover, the computing resources of the cloud can be fully utilized under the premise of protecting privacy. By performing preliminary data processing and model training on the end side, it can be ensured that sensitive data has been converted into hidden state that cannot be directly analyzed before leaving the local device, which effectively avoids direct exposure of sensitive data in the cloud.
[0172] The foregoing has summarized the method provided by the present application, and the method process provided by the present application will be further introduced in combination with specific application scenarios.
[0173] Firstly, the method provided by the application can include multiple parts. It can be understood that in the case of training of the Embedding table on the client side, the Embedding table stripping is further performed to encrypt the transmission data. For ease of understanding, the method provided by the application will be introduced in the following multiple parts. For example, it can be divided into Embedding layer stripping training, Embedding table encryption, dimension reduction processing, etc., which will be introduced respectively.
[0174] I. Embedding layer stripping training
[0175] Referring to FIG. 3, a flowchart of another end-cloud collaborative training method provided by the application is as follows.
[0176] 301. Input Token to the Embedding layer.
[0177] The token can be a sequence composed of words in the text corresponding to the input data.
[0178] The input data can be text, image, voice or other types of input data input by the user, etc. After obtaining the input data, the input data can be preprocessed. For example, if the input data includes an image, the image can be recognized to obtain one or more keywords (or key words) corresponding to the image, that is, the token; if the input data includes voice data, the voice data can be recognized to obtain one or more keywords (or key words) corresponding to the voice, that is, the token; if the input data includes text data, the text data can be divided into one or more keywords (or key words), that is, the token, etc.
[0179] For the Embedding layer: in natural language processing (NLP), the Embedding layer is a basic and key component, which mainly functions to map discrete words to continuous vector space so that neural networks can more effectively process text data. The Embedding layer can be understood as a lookup table, which maps each word or vocabulary (usually represented in the form of one-hot encoding) to a fixed-length dense vector. These vectors are trainable parameters that can learn the semantic representation of each word in the vector space during model training.
[0180] 302. The Embedding layer obtains the Embedding vector by using the Embedding table and uploads it to the cloud platform.
[0181] The embedding layer obtains the embedding vector, i.e., the representation vector, by using the embedding table saved locally by the client.
[0182] For example, when the model structure starts training, token_ids, which represent unique identifiers of each word or character in the input text, are input. The token_ids are usually indexes in the vocabulary. These Token Ids are input into the model, and are first converted into corresponding vector representations by the embedding layer.
[0183] The mathematical representation of the embedding layer is: v i = E token_ids[i]
[0184] wherein E is an embedding matrix (Embedding Table), token_ids[i] is the index of the i-th token, and v i is the corresponding token vector (Token Embeddings). That is, the Embedding Table provides a vector representation in a multi-dimensional space for each unique Token Id, and outputs the token vector.
[0185] In the embodiments of the present application, the Embedding table on the client side is only saved locally on the client, and the client needs to upload the embedding vector, i.e., the hidden state, to the cloud platform, so as to avoid the transmission of the Embedding table to outside the client and improve the data security of the client.
[0186] 303. The cloud outputs the feature vector by the transformer layer and sends it to the client.
[0187] The embedding vector is sent to the cloud transformer layer. The transformer layer processes sequence data based on the self-attention mechanism, and each layer can capture the complex relationship between different tokens within the sequence. In the transformer layer, the embedding vector is converted into a new vector representation, i.e., a feature vector, or Token State, by a series of self-attention and feedforward networks. At the same time, the input and output of the transformer layer can be regarded as hidden states (Hidden states), i.e., deep semantic representations of tokens, rather than plaintext features.
[0188] 304. The client calculates logits by using the feature vector.
[0189] After processing by the Transformer layer, the final Hidden States are converted into Logits by an output layer (usually a linear layer) deployed on the client side. Logits can be understood as a score prediction for each Token of the input as the next Token.
[0190] For example, the calculation of Logits can be represented as: logits = E H
[0191] where E is the Embedding Table and H is the Hidden States output by the Transformer, i.e., the output features.
[0192] Finally, the logits can be further processed by a Softmax function to obtain the probability distribution of the next Token for each Token.
[0193] 305、The client calculates the loss value based on the Logits, and uses the loss value for backpropagation.
[0194] Then, the client compares with the real next Token label and calculates the loss value. Specifically, the cross-entropy loss (Loss) can be calculated. This loss value is used to update the model parameters, including the weights of the Embedding Table and the Transformer layer, through the backpropagation algorithm during the training process.
[0195] Specifically, when updating the model, the model deployed on the client side can be updated, and the transformer layer deployed on the cloud platform can also be updated. The client can send the loss value to the cloud platform, or feedback the gradient calculated based on the loss value to the cloud platform, so that the cloud platform can update the Transformer layer based on the data feedback by the client, to realize the model update on the cloud.
[0196] In some scenarios, in the traditional large language model training process, the Embedding layer is responsible for mapping the input discrete symbols (such as words or characters) to continuous vector space. These vectors are then used as input to the model, passed to the subsequent Transformer layer for processing. However, this method has privacy risks, as the original data needs to be transmitted to the cloud server, which may be intercepted or illegally accessed.
[0197] In the method provided in the application, the embedding table is only deployed locally on the client side, and the hidden states are transmitted between the client and the cloud platform instead of being transmitted in plaintext, so that data leakage on the client side can be avoided and the data security on the client side can be improved. It can be understood that the embedding table is the first portal for processing text data in the NLP model, and plays a key role in protecting user privacy and data security by converting sensitive text into abstract vector representation. In cloud collaborative training, this conversion is particularly important because it allows the privacy of user data to be protected without sacrificing computing power and model performance. Through the method provided in the application, the embedding layer is stripped to the end side for training, that is, in the end-cloud collaborative training architecture provided in the embodiments of the application, the embedding table resides locally on the client side (i.e., the user's device) to generate and update the embedding vector. This means that sensitive raw data does not need to be transmitted to the cloud and can be protected on the end side without transmitting plaintext to the outside, which has very strong client privacy protection.
[0198] Therefore, the method provided in the application strips the embedding layer and the like from the cloud side to the end side for training, while additionally adding trainable parameters to it. This implementation does not affect the model accuracy, while ensuring that the hidden state output by the end-side network cannot be reversely analyzed by the cloud side, thereby ensuring the privacy and security of the client data.
[0199] II. Encryption of embedding table
[0200] On the basis of the foregoing embedding layer stripping training, when transmitting data between the client and the cloud platform, the data to be transmitted can be further encrypted to further improve the data security of the client.
[0201] For example, referring to FIG. 4, the flowchart of another end-cloud collaborative training method provided in the application is as follows.
[0202] The difference from the foregoing FIG. 3 is that in the process of generating the embedding vector, the embedding table can be encrypted, as in step 40 in FIG. 4, so as to generate the embedding vector based on the encrypted embedding table.
[0203] In most scenarios at present, most users choose to perform incremental fine-tuning training based on a large model provided by a cloud vendor that has been pre-trained. In the end-cloud collaborative training scenario provided by the application embodiment, the model deployed by the client and the cloud platform can also be a pre-trained model, and the cloud side also holds an initial Embedding Table. During incremental fine-tuning training, the Embedding Table may not be updated, that is, the Embedding Table remains the same on the cloud side and the end side. Once the Embedding Table on the cloud side is leaked, an attacker can directly use the Embedding Table to reverse the Hidden States during training to plaintext, thereby obtaining the personal data of the user for fine-tuning training, causing user privacy leakage.
[0204] Therefore, in the application embodiment, considering that the Embedding Table is not updated during training, the application proposes an encryption module based on a parameter-efficient fine-tuning method, which ensures that the Embedding Table is updated during end-side training, thereby forming a difference from the original Embedding Table on the cloud side.
[0205] As shown in FIG. 4, during the Embedding layer training process on the end side, LoRA can be introduced to generate and adjust the embedding vectors, such as adding an additional layer, or expanding or reducing the vocabulary table, etc. LoRA is a parameter-efficient model fine-tuning method that allows fine-tuning without significantly increasing the model size. This is achieved by adding low-rank updates to the original model weights. This update is very efficient relative to the complete model parameters.
[0206] The way to update the Embedding Table using LoRA can be represented as: E' = E + ΔE ΔE = LoRA A × LoRA B
[0207] where LoRA A and LoRA B are low-rank matrices, and their product ΔE provides an update to the original Embedding Table E. This allows the model to be fine-tuned while maintaining the pre-trained parameters, rather than training the entire Embedding Table from scratch. ΔE can be considered as an encrypted part, and the encryption effect depends on the data distribution and the number of training rounds on the end side, which ensures that the encrypted part has differences during the training process of different user data. Moreover, this encrypted part is relatively sensitive, and different hyperparameters, training data, and model structures will affect the encrypted part. This greatly ensures that user data is not leaked during fine-tuning training based on a pre-trained model.
[0208] When the client iteratively updates the model, the DE can also be updated, so that as the number of iterations increases, the E at the end side and the Embedding Table at the cloud side are different, so that even if the Embedding vector transmitted between the client and the cloud platform is leaked, the Embedding Table at the end side can be avoided to be parsed into plaintext, and the data security of the client is improved. Therefore, in the embodiments of the application, trainable parameters are additionally added to the Embedding layer, that is, the original Embedding table is adjusted by the LoRA (matrix low rank decomposition) method. This method not only improves the efficiency of model training, but also reduces the demand for computing power at the end side.
[0209] III. Dimensionality reduction processing
[0210] Further, on the basis of the foregoing Embedding layer stripping training, dimensionality reduction processing can also be added.
[0211] For example, referring to FIG. 5, the flowchart of another end-cloud collaborative training method provided by the application is as follows.
[0212] The difference from the foregoing FIG. 3 is that in the process of generating the Embedding vector, dimensionality reduction processing can be performed on the Embedding table, as shown in step 50 in FIG. 5, which can reduce the amount of transmitted data and can realize encryption of the transmitted data to improve the data transmission security between the client and the cloud platform.
[0213] While ensuring user data privacy during end-cloud collaborative training, the performance of training cannot be ignored. If additional training time is brought when using a separate structure for training, or even several times the time when training directly on the cloud side. This will directly affect the overall length of the user end-to-end training, thereby reducing the user's training experience.
[0214] In some common scenarios, the parameter quantity of a large model is often 10B-500B, and the size of the word vector calculated by the Embedding Table is [vocab_size, embedding_size]. Usually, vocab_size is 10 4 ~ 10 6 , and embedding_size is 10 3 ~ 10 5 , that is, the word vector stored in FP32 will reach 10KB-100MB. This means that the communication overhead between the end side and the cloud side will be difficult to ignore, especially in the case of limited communication bandwidth, the communication time will be much longer than the single-step training time, that is, the communication time becomes the bottleneck of the entire training process.
[0215] In the method provided in the embodiments of the present application, the vectors extracted from the Embedding Table can be processed in dimension reduction, thereby reducing the communication overhead, and the encryption of data can also be implemented, improving the data privacy security of the client.
[0216] As shown in FIG. 5, the vector then passes through the FFN layer, and the conventional FFN layer usually includes a linear transformation, such as "Down-project" in which the first linear transformation is usually referred to as projecting the high-dimensional representation of each Token into a lower-dimensional space. This process can be understood as a kind of data compression, which reduces the amount of information required to represent each Token. In the method provided in the embodiments of the present application, the FFN layer is used for dimension reduction. The dimension reduction manner is represented as: z = W down H + b down
[0217] where H is the original word vector, W down is the dimension reduction weight matrix, and b down is the bias thereof, and finally the dimension-reduced vector z is obtained. By adjusting the size of the dimension reduction weight matrix, different degrees of dimension reduction can be achieved.
[0218] By dimension reduction, the dimension reduction of the Embedding table is achieved by adding an MLP (Multi-Layer Perceptron) layer on the original Embedding table, which effectively reduces the amount of data required for communication, thereby reducing the communication overhead in the end-to-cloud collaborative training process, thereby optimizing the overall training time and improving the user experience. Through the dimension reduction processing manner provided in the embodiments of the present application, the training efficiency can be improved while the privacy is protected.
[0219] In addition, on the basis of the aforementioned FIG. 5, nonlinear processing can also be added, as shown in FIG. 6. After the dimension reduction processing, the representation vector obtained after the dimension reduction processing can be further processed in nonlinear transformation, i.e., step 60, i.e., after the "Down-project" step, an activation function such as ReLU can be added. This entire process enables the FFN layer to reduce the data dimension while increasing the nonlinear processing, which is helpful for capturing complex patterns in the input data.
[0220] The aforementioned multiple parts can also be combined for implementation, as shown in FIG. 7. By combining the encryption processing with the dimension reduction processing, the encryption effect is ensured, and the performance of the training is ensured to a certain extent. The entire training scheme can be effectively accepted and used by the user. Specifically, the end side includes an Embedding layer, which is responsible for converting the input data into a word vector representation. When generating the Embedding Table, in order to achieve the data encryption effect, the word vector needs to pass through the encryption module, i.e., the parameter efficient fine-tuning layer, which is equivalent to adding additional trainable parameters. Subsequently, the word vector is processed by the Feed Forward down-project layer for dimension reduction, reducing the data transmission amount. Subsequently, the Nonlinearity layer introduces nonlinearity, enhancing the expression ability of the model, for ensuring that the model precision does not decrease. The Transformer layer on the cloud side processes the word vector from the end side to generate the prediction score (logits) and calculate the error (loss) for gradient sharing of the model. The overall architecture design ensures that the sensitive data is transmitted to the cloud side after being converted into a hidden state, and the data security is guaranteed through dimension reduction and encryption parameter updating / parameter encryption, preventing the original information from being recovered, achieving the full utilization of cloud computing resources while effectively protecting user privacy.
[0221] Therefore, in the embodiments of the present application, through the end-cloud collaborative separation type training structure, the preliminary processing of the data and the generation of the embedding vector can be performed on the local device, and the complex training process of the model can be completed on the cloud side, thereby protecting the user data privacy without sacrificing the training effect. At the same time, through the encryption processing, the data security is guaranteed even if the data needs to be transmitted between the local device and the cloud side, reducing the risk of data leakage and improving the security of the entire model training process. In addition, by reducing the dimension of the embedding vector through the dimension reduction processing, the communication overhead in the end-to-end training process is significantly reduced, especially in the case of limited bandwidth, effectively alleviating the communication bottleneck and accelerating the model training and parameter updating speed.
[0222] In addition, in order to facilitate the introduction of the effects achieved by the method provided in the embodiments of the present application, the effects achieved by the method provided in the present application are compared and introduced in combination with more specific application scenarios and the training effects of existing schemes.
[0223] The accuracy effect of the current experiment is shown in Table 1.
[0224] Table 1
[0225] By adding parameters to the embedding layer, the two downstream tasks can achieve experimental accuracy of 80% and 92% respectively, which is very close to the effect of full-parameter fine-tuning of the whole model (84% and 94%), and the encryption effect experiment shows that the accuracy of cloud measurement reverse inference of user data uploaded on the side is only 1%, that is, 99% of the user content data cannot be obtained by cloud measurement reverse inference, greatly improving the encryption effect of large model end-cloud collaborative fine-tuning.
[0226] Therefore, the method provided by the embodiments of the present application can ensure the data security of the user to a certain extent in the context of current large model end-cloud collaborative fine-tuning, and also avoid the risk of closed-source model leakage; due to the trainability of adding parameters to the embedding layer, it is ensured that different types of data can be well fine-tuned, that is, the stability of the model accuracy is ensured; in addition, the embedding vector can be reduced in dimension, reducing the communication overhead between the end and the cloud, and improving the training efficiency.
[0227] The foregoing introduces the method steps provided by the present application, and the following introduces a system and device for executing the method steps provided by the present application.
[0228] Referring to FIG. 8, another structure schematic diagram of an end-cloud collaborative training system provided by the present application is shown, which includes a cloud platform 82 and a client 81. Among them,
[0229] The client 81 is configured to use the training data as the input of the representation layer to obtain a representation vector, and the representation layer is configured to obtain a vector corresponding to the input data from a representation vocabulary stored in the client 81.
[0230] The client 81 is further configured to send the representation vector to the cloud platform 82.
[0231] The cloud platform 82 is configured to use the representation vector as the input of the language model to obtain an output feature.
[0232] The cloud platform 82 is further configured to send the output feature to the client 81.
[0233] The client 81 is further configured to calculate a loss value using the output feature, update the representation layer according to the loss value, and send the loss value to the cloud platform 82.
[0234] The cloud platform 82 is further configured to update the language model using the loss value to obtain an updated language model.
[0235] In a possible implementation, the client 81 is specifically configured to input the training data to the representation layer to output an embedding representation, and encrypt the embedding representation to obtain the representation vector.
[0236] In a possible implementation, the client 81 is specifically configured to: encrypt the representation word table to obtain an encrypted representation word table; and input the training data into the representation layer, and determine the embedding representation from the encrypted representation word table by the representation layer.
[0237] In a possible implementation, the client 81 is specifically configured to: add a low-rank matrix to the representation word table to obtain the encrypted representation word table.
[0238] In a possible implementation, the client 81 is specifically configured to: perform dimension reduction processing on the embedding representation to obtain the representation vector.
[0239] In a possible implementation, the client 81 is specifically configured to: take the embedding representation as an input of a feedforward neural network (FNN) to obtain the representation vector, and the FNN is configured to perform linear transformation processing on the input embedding representation.
[0240] In a possible implementation, the client 81 is further configured to perform nonlinear transformation on the representation vector, and take the vector obtained after the transformation as a new representation vector.
[0241] In a possible implementation, the client 81 is specifically configured to: obtain a prediction score of each vector in the representation word table as a next vector according to the output feature; and calculate a loss value according to the prediction score of each vector as a next vector and a label corresponding to the training data.
[0242] The foregoing describes the method and system architecture provided by the present application. The structure of the client and the cloud platform provided by the present application for executing the foregoing method steps is further described below.
[0243] Referring to FIG. 9, the structure of a client provided by the present application is shown in the figure. The client includes:
[0244] The input module 901 is configured to use the training data as an input of the representation layer to obtain the representation vector, and the representation layer is configured to obtain a vector corresponding to the input data from a representation word table stored by the client;
[0245] The transceiver module 902 is configured to send the representation vector to the cloud platform, and the client receives an output feature sent by the cloud platform, the output feature being obtained by inputting the representation vector into a language model by the cloud platform.
[0246] The processing module 903 is configured to calculate a loss value by using the output feature, and update the representation layer according to the loss value.
[0247] The transceiver module 902 is further configured to send the loss value to the cloud platform, and the loss value is used by the cloud platform to update the language model to obtain an updated language model.
[0248] In a possible implementation, the input module 901 is specifically configured to: input the training data to the representation layer to obtain an embedding representation; and encrypt the embedding representation to obtain a representation vector.
[0249] In a possible implementation, the input module 901 is specifically configured to: encrypt the representation vocabulary to obtain an encrypted representation vocabulary; and input the training data to the representation layer to determine the embedding representation from the encrypted representation vocabulary.
[0250] In a possible implementation, the input module 901 is specifically configured to add a low-rank matrix to the representation vocabulary to obtain the encrypted representation vocabulary.
[0251] In a possible implementation, the input module 901 is specifically configured to perform dimension reduction processing on the embedding representation to obtain the representation vector.
[0252] In a possible implementation, the input module 901 is specifically configured to take the embedding representation as an input of a feedforward neural network (FNN) to obtain the representation vector, and the FNN is configured to perform linear transformation processing on the input embedding representation.
[0253] In a possible implementation, the input module 901 is further configured to perform nonlinear transformation on the representation vector, and take the vector obtained after the transformation as a new representation vector.
[0254] In a possible implementation, the processing module 903 is specifically configured to: obtain a prediction score of each vector in the representation vocabulary as a next vector according to the output feature; and calculate a loss value according to the prediction score of each vector as a next vector and a label corresponding to the training data.
[0255] Referring to FIG. 10, the present application provides a structural diagram of a cloud platform, which includes:
[0256] The transceiver module 1001 is configured to receive a representation vector sent by a client, the representation vector being obtained by inputting training data by the client to a representation layer, the representation layer being configured to obtain a vector corresponding to the input data from a representation vocabulary stored by the client;
[0257] The input module 1002 is configured to input the representation vector to a language model to obtain an output feature, and send the output feature to the client.
[0258] The transceiver module 1001 is further configured to receive a loss value sent by the client, the loss value being calculated by the client according to the output feature.
[0259] The update module 1003 is configured to update the language model by using the loss value to obtain an updated language model.
[0260] In a possible implementation, the feature vector is obtained by encrypting the embedding feature output by the client to the feature layer.
[0261] As shown in FIG. 11, it is a hardware structure diagram of a client 100 provided by an embodiment of the present application. The client 100 can be used to implement the steps performed by the client in the methods shown in FIGS. 2 to 8.
[0262] The client 110 shown in FIG. 11 can include a processor 1101, a memory 1102, a communication interface 1103, and a bus 1104. The processor 1101, the memory 1102, and the communication interface 1103 can be connected through the bus 1104.
[0263] The processor 1101 is the control center of the client 110, which can be a general central processing unit (CPU), or other general-purpose processors, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc., which can specifically include a GPU or an NPU, etc., and can be adaptively set according to actual application scenarios.
[0264] As an example, the processor 1101 can include one or more CPUs, and can also include other processors, such as the CPU, NPU, or GPU shown in FIG. 11, etc.
[0265] The memory 1102 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0266] In a possible implementation, the memory 1102 can exist independently of the processor 1101. The memory 1102 can be connected to the processor 1101 through the bus 1104, for storing data, instructions, or program codes. When the processor 1101 invokes and executes the instructions or program codes stored in the memory 1102, the method provided by the embodiments of the present application can be implemented, for example, the steps performed by the client in the methods shown in FIGS. 2 to 8.
[0267] In another possible implementation, the memory 1102 can also be integrated with the processor 1101.
[0268] The communication interface 1103 is configured to connect the client 110 with other devices through a communication network, which can be an Ethernet, a radio access network (RAN), a wireless local area network (WLAN), or the like. The communication interface 1103 can include a receiving unit configured to receive data, and a sending unit configured to send data.
[0269] The bus 1104 can be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, an extended industry standard architecture (EISA) bus, or the like. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in FIG. 11, but it does not mean that there is only one bus or only one type of bus.
[0270] It should be noted that the structure shown in FIG. 11 does not constitute a limitation on the client 110. In addition to the components shown in FIG. 11, the client 110 can include more or fewer components than shown, or combine certain components, or different arrangement of components.
[0271] As shown in FIG. 12, a hardware structure diagram of a cloud platform 120 provided by an embodiment of the present application is shown. The cloud platform 120 can be used to implement the steps of the cloud platform in the methods of FIGS. 2 to 8.
[0272] The cloud platform 120 shown in FIG. 12 can include a processor 1201, a memory 1202, a communication interface 1203, and a bus 1204. The processor 1201, the memory 1202, and the communication interface 1203 can be connected through the bus 1204.
[0273] The processor 1201 is the control center of the cloud platform 120, which can be a general central processing unit (CPU), or other general-purpose processors, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc., which can specifically include a GPU or an NPU, etc., and can be adaptively set according to actual application scenarios.
[0274] As an example, the processor 1201 can include one or more CPUs, and can also include other processors such as CPUs, NPUs, or GPUs shown in FIG. 12, and the like.
[0275] The memory 1202 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a magnetic disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.
[0276] In one possible implementation, the memory 1202 can exist independently of the processor 1201. The memory 1202 can be connected to the processor 1201 through the bus 1204, and is used to store data, instructions, or program code. When the processor 1201 invokes and executes the instructions or program code stored in the memory 1202, the method provided by the embodiments of the present application can be implemented, for example, the methods shown in FIGS. 2 to 8.
[0277] In another possible implementation, the memory 1202 can also be integrated with the processor 1201.
[0278] The communication interface 1203 is used for connecting the cloud platform 120 to other devices through a communication network, which can be an Ethernet, a radio access network (RAN), a wireless local area network (WLAN), and the like. The communication interface 1203 can include a receiving unit for receiving data, and a sending unit for sending data.
[0279] The bus 1204 can be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, an extended industry standard architecture (EISA) bus, or other bus. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in FIG. 12, but it does not mean that there is only one bus or only one type of bus.
[0280] It should be noted that the structure shown in FIG. 12 does not constitute a limitation on the cloud platform 120. In addition to the components shown in FIG. 12, the cloud platform 120 can include more or fewer components than shown, or combine certain components, or different arrangement of components.
[0281] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software and the necessary general hardware, and of course can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, and the like. Generally, functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure for implementing the same function can also be various, such as analog circuits, digital circuits, or special circuits. However, for the present application, software program implementation is a better embodiment. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc., including a plurality of instructions to make a device (which can be a personal computer, server, or network equipment, etc.) execute the methods described in various embodiments of the present application.
[0282] In the above embodiments, all or part can be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, it can be implemented in the form of a computer program product in whole or in part.
[0283] The computer readable storage medium in the embodiments of the present application stores a program for training a model or performing an inference task, and when the program runs on a computer, it makes the computer execute all or part of the steps of the method described in the foregoing embodiments shown in FIGS. 2 to 8.
[0284] The embodiments of the present application also provide a digital processing chip. The digital processing chip integrates a circuit for implementing the processor or the function of the processor and one or more interfaces. When the digital processing chip integrates a memory, the digital processing chip can complete the method steps of any one or more of the preceding embodiments. When the digital processing chip does not integrate a memory, the digital processing chip can be connected with an external memory through a communication interface. The digital processing chip implements the method steps of any one or more of the preceding embodiments according to program codes stored in the external memory.
[0285] The embodiments of the present application also provide a computer program product including one or more computer instructions. When the computer instructions are loaded and executed on a computer, the computer instructions completely or partially generate the flow or function described in the embodiments of the present application. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through a wired (for example, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (for example, infrared, wireless, microwave, etc.) manner. The computer readable storage medium can be any available medium that can be used by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)), etc.
[0286] The data comparison device provided by the embodiments of the present application can be a chip, which includes a processing unit and a communication unit. The processing unit can be a processor, and the communication unit can be an input / output interface, a pin, a circuit, etc. The processing unit can execute computer execution instructions stored in a storage unit, so that the chip in the server executes the method described in the embodiments shown in FIG. 3 to FIG. 8. Alternatively, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit can also be a storage unit outside the chip in the wireless access device, such as a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM), etc.
[0287] In particular, the aforementioned processing unit or processor can be a central processing unit (CPU), a neural-network processing unit (NPU), a graphics processing unit (GPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), or a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0288] In addition, it should be noted that the apparatus embodiments described above are merely illustrative, and the units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, i.e., can be located in one place or distributed to multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments. In addition, in the apparatus embodiments provided in the present application, the connection relationship between the modules indicates that there is a communication connection between them, which can be implemented as one or more communication buses or signal lines.
[0289] Those skilled in the art can clearly understand that the application can be implemented by means of software plus necessary universal hardware, and of course can also be implemented by means of dedicated hardware including special-purpose integrated circuits, special-purpose CPUs, special-purpose memories, special-purpose components, etc. Generally, any function completed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure for implementing the same function can also be various, such as analog circuits, digital circuits, or special-purpose circuits, etc. However, for the present application, software program implementation is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a readable storage medium, such as a floppy disk, a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc., and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present application.
[0290] In the above embodiments, all or part can be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part can be implemented in the form of a computer program product.
[0291] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)), etc.
[0292] The terms "first", "second", and the like in the description and in the claims of the present application and above drawings are used for distinguishing between similar objects and not necessarily for describing a specific sequential or chronological order. It is to be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of orderly or inverse order, depending upon the circumstances. The term "and / or" in the present application is merely used to represent an association between associated objects, and it is possible that three relationships exist, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone. In addition, the character " / " in the present application generally represents an "or" relationship between the associated objects. Furthermore, the terms "comprising" and "having" and any variations thereof are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device that includes a list of steps or modules as an example is not necessarily limited to those steps or modules that are clearly listed, but can include other steps or modules that are not clearly listed or inherent to such process, method, product or device. The naming or numbering of steps in the present application does not mean that the steps in the method flow must be executed in the time / logical order indicated by the naming or numbering, and the named or numbered flow steps can be executed in a different order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved. The division of modules in the present application is a logical division, and in actual application, there can be another division manner, for example, multiple modules can be combined or integrated in another system, or some features can be ignored or not executed, in addition, the coupling or direct coupling or communication connection between the displayed or discussed modules can be through some ports, and the indirect coupling or communication connection between the modules can be electrical or other similar forms, which are not limited in the present application. Furthermore, the modules or sub-modules described as separate components can or can not be physically separated, and can or can not be physical modules, or can be distributed to multiple circuit modules, and part or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the present application.
Claims
1. An end-to-cloud collaborative training method, characterized in that, The method is applied to an end-cloud collaborative training system, and the end-cloud collaborative training system comprises a client and a cloud platform. The client uses training data as input of a representation layer to obtain a representation vector, and the representation layer is used to obtain a vector corresponding to the input data from a representation vocabulary saved by the client. The client sends the representation vector to the cloud platform, receives output features sent by the cloud platform, and the output features are obtained by inputting the representation vector into a language model by the cloud platform. The client calculates a loss value by using the output features, updates the representation layer according to the loss value, and sends the loss value to the cloud platform, and the loss value is used to update the language model by the cloud platform to obtain an updated language model.
2. The method of claim 1, wherein, The client uses training data as input of a representation layer to obtain a representation vector, and the representation layer is used to obtain a vector corresponding to the input data from a representation vocabulary saved by the client. The client inputs the training data into the representation layer to output an embedding representation. The client encrypts the embedding representation to obtain the representation vector.
3. The method of claim 2, wherein, The client inputs the training data into the representation layer to output an embedding representation, and the client encrypts the representation vocabulary to obtain an encrypted representation vocabulary. The client inputs the training data into the representation layer to output an embedding representation, and the client encrypts the representation vocabulary to obtain an encrypted representation vocabulary. The client encrypts the representation vocabulary to obtain an encrypted representation vocabulary.
4. The method of claim 3, wherein, The client adds a low-rank matrix to the representation vocabulary to obtain the encrypted representation vocabulary. The client encrypts the embedding representation to obtain the representation vector.
5. The method according to any one of claims 2-4, characterized in that, The client reduces the dimension of the embedding representation to obtain the representation vector. The client reduces the dimension of the embedding representation to obtain the representation vector.
6. The method of claim 5, wherein, The client inputs the embedding representation into a feedforward neural network (FNN) to obtain the representation vector, and the FNN is used to perform linear transformation processing on the input embedding representation. The method further comprises:
7. The method according to any one of claims 4-6, characterized in that, The client performs nonlinear transformation on the representation vector, and takes the vector obtained after the transformation as a new representation vector. The client calculates a loss value by using the output features, and the client obtains a prediction score of each vector in the representation vocabulary as a next vector according to the output features.
8. The method according to any one of claims 1-7, characterized in that, The client calculates the loss value according to the prediction score of each vector as a next vector and a label corresponding to the training data. The method is applied to an end-cloud collaborative training system, and the end-cloud collaborative training system comprises a client and a cloud platform. The cloud platform receives a representation vector sent by the client, and the representation vector is obtained by inputting training data into a representation layer by the client, and the representation layer is used to obtain a vector corresponding to the input data from a representation vocabulary saved by the client.
9. A method for end-cloud collaborative training, comprising: The cloud platform inputs the representation vector into a language model to obtain output features, and sends the output features to the client. The cloud platform receives the loss value sent by the client, the loss value being calculated by the client according to the output feature; The cloud platform updates the language model by using the loss value, to obtain an updated language model.
10. The method of claim 9, wherein, The representation vector is obtained by the client performing encryption processing on the embedding representation output by the representation layer.
11. A client, characterized in that, Comprise: An input module configured to use training data as input of a representation layer to obtain a representation vector, the representation layer being configured to obtain a vector corresponding to the input data from a representation word table stored by the client; A transceiver module configured to send the representation vector to the cloud platform, and receive an output feature sent by the cloud platform, the output feature being obtained by inputting the representation vector into a language model by the cloud platform; A processing module configured to calculate a loss value by using the output feature, and update the representation layer according to the loss value; The transceiver module is further configured to send the loss value to the cloud platform, the loss value being used to update the language model by the cloud platform to obtain an updated language model.
12. The client of claim 11, wherein, The input module is specifically configured to: input the training data into the representation layer to output an embedding representation; and perform encryption processing on the embedding representation to obtain the representation vector.
13. The client of claim 12, wherein, The input module is specifically configured to: perform encryption processing on the representation word table to obtain an encrypted representation word table; and input the training data into the representation layer to determine the embedding representation from the encrypted representation word table by the representation layer.
14. The client of claim 13, wherein: The input module is specifically configured to add a low-rank matrix to the representation word table to obtain the encrypted representation word table.
15. The client of any one of claims 12-14, wherein: The input module is specifically configured to perform dimension reduction processing on the embedding representation to obtain the representation vector.
16. The client of claim 15, wherein: The input module is specifically configured to use the embedding representation as input of a feedforward neural network (FNN) to obtain the representation vector, the FNN being configured to perform linear transformation processing on the input embedding representation.
17. The client of any one of claims 14-16, wherein: The input module is further configured to perform nonlinear transformation on the representation vector, and use the vector obtained after the transformation as a new representation vector.
18. The client of any of claims 11-17, wherein, The processing module is specifically configured to: obtain a prediction score of each vector in the representation word table as a next vector according to the output feature; and calculate the loss value according to the prediction score of each vector as a next vector and a label corresponding to the training data.
19. A cloud platform, characterized by Comprise: A transceiver module configured to receive a representation vector sent by the client, the representation vector being obtained by inputting training data into a representation layer by the client, the representation layer being configured to obtain a vector corresponding to the input data from a representation word table stored by the client; An input module configured to input the representation vector into a language model to obtain an output feature, and send the output feature to the client; and An input module configured to input the representation vector into a language model to obtain an output feature, and send the output feature to the client; and The transceiving module is further configured to receive a loss value sent by the client, the loss value being calculated by the client according to the output feature; The updating module is configured to update the language model by using the loss value to obtain an updated language model.
20. The cloud platform of claim 19, wherein, The representation vector is obtained by encrypting an embedding representation output by the representation layer by the client.
21. A computing device, comprising: The computing device includes a processor and a memory; The processor is configured to execute instructions stored in the memory to cause the computing device to perform the operation steps performed by the client in the method of any one of claims 1 to 8.
22. A cluster of computing devices, characterized in that, The computing device includes a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the computing device cluster to perform the operation steps of the cloud platform in the method of any one of claims 9 to 10.
23. An end-to-cloud cooperative training system, comprising: The computing device cluster includes: The client and the cloud platform; The client is configured to perform the operation steps performed by the client in the method of any one of claims 1 to 8; The cloud platform is configured to perform the operation steps of the cloud platform in the method of any one of claims 9 to 10.
24. A computer program product comprising instructions, characterized in that, When the instructions are executed by the computing device cluster, the computing device cluster performs the operation steps of the method of any one of claims 1 to 8 or 9 to 10.
25. A computer readable storage medium, characterized in that, The computer program instructions, when executed by the computing device cluster, cause the computing device cluster to perform the operation steps of the method of any one of claims 1 to 8 or 9 to 10.
Citation Information
Patent Citations
Cooperative training method and device, and service prediction method and device
CN116432039A
Fine tuning method and device for federal learning large model
CN117056962A
Federal training method and device of terminal recommendation model and storage medium
CN117150122A
Method and apparatus for training natural language pre-training model, device, and storage medium
WO2024045318A1
Cited By
Large model-oriented split privacy protection training method
CN121561979A