Privacy protection method and device for large language model, equipment, medium and program product
By performing data enhancement processing on large language models and activating model editing with patching technology, the problem of privacy leakage in the post-processing stage of large language models is solved, and model performance and privacy protection effects are improved.
Patent Information
- Application Number
- CN202410883114.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-03
- Publication Date
- 2024-09-24
AI Technical Summary
Large language models have the risk of privacy leakage in the post-processing stage. Existing methods such as methods based on forgetting learning are computationally complex and difficult to apply to complex model architectures, and existing privacy neuron editing methods lead to model performance degradation when large-scale privacy leaks occur.
By performing data enhancement processing on the text data set, the privacy attribution score matrix and target privacy neurons are determined, and the large language model is model edited based on the activation patching technology and the technology of adding linear guidance vectors. The edited large language model can be effective Protect private data.
It improves the performance of the model, is suitable for the protection needs of different types of private data, reduces the risk of privacy leakage, and maintains the generalization ability of the model.
Smart Images

Figure CN118690409A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of artificial intelligence technology and privacy protection technology, and more specifically, to a privacy protection method, apparatus, device, medium and program product for a large language model. Background Art
[0002] With the significant progress made by large language models in many fields, such as computer vision, speech recognition, natural language processing, and search recommendation, large language models may remember private information in the data during training, causing the user's private information to be learned and reproduced by the model, resulting in the risk of user confidence being leaked.
[0003] In order to alleviate the privacy leakage problem of large language models, relevant technicians have proposed a variety of protection methods. For example, deleting privacy information in the data during the data processing stage, or reducing the model's memory of training data during the model training stage. However, in the post-processing stage, that is, when the model completes training and starts model inference, the model still has the risk of privacy leakage. If the model is found to have privacy leakage problems during the post-processing stage, the above methods will not be able to protect it.
[0004] In order to alleviate the problem of model privacy leakage in the post-processing stage, relevant technicians have proposed a method based on forgetting learning, which makes the model forget private information. However, this method will produce high computational complexity, and it is very challenging to apply this method to complex model architectures. Summary of the invention
[0005] In view of this, the present disclosure provides a privacy protection method, apparatus, device, medium and program product for a large language model.
[0006] One aspect of the present disclosure provides a privacy protection method for a large language model, comprising: performing data enhancement processing on a text data set using a large language model to obtain a target text data set, wherein the target text data set includes M target text data, and each target text data includes privacy data; for the lth layer in the L layers and the mth target text data in the M target text data, using the mth target text data, determining a privacy attribution score matrix of K neurons in the lth layer to obtain M privacy attribution score matrices in the lth layer, wherein each privacy attribution score matrix includes K privacy attribution scores, the kth privacy attribution score in the K privacy attribution scores is obtained by determining the privacy attribution score of the kth neuron in the K neurons, and the kth privacy attribution score represents the privacy of the kth neuron. The causal correlation degree of the m-th target text data caused by the m-th privacy attribution score matrix is determined, and the target privacy neuron of the l-th layer is obtained according to the M privacy attribution score matrices of the l-th layer, wherein the target privacy neuron is a neuron associated with the privacy data of the target text data; based on the activation patching technology and the technology of adding linear guidance vectors, the target privacy neuron of the L-th layer in the large language model is model edited to obtain the edited large language model, wherein the activation difference value of the target privacy neuron is obtained by calculating the difference between the activation value of the target privacy neuron using the desensitized text data and the activation value of the target privacy neuron using the target text data.
[0007] Another aspect of the present disclosure provides a privacy protection device for a large language model, including: a data enhancement processing module, used to perform data enhancement processing on a text data set using a large language model to obtain a target text data set, wherein the target text data set includes M target text data, and each target text data includes privacy data; a privacy attribution score matrix confirmation module, used to determine the privacy attribution score matrix of K neurons in the lth layer using the mth target text data for the lth layer in the L layers and the mth target text data in the M target text data, to obtain M privacy attribution score matrices in the lth layer, wherein each privacy attribution score matrix includes K privacy attribution scores, the kth privacy attribution score in the K privacy attribution scores is obtained by determining the privacy attribution score of the kth neuron in the K neurons, and the kth privacy attribution score represents the privacy of the kth neuron. The causal correlation degree of the mth target text data privacy leakage caused by the mth target text data caused by the mth target text data privacy attribution score matrix caused by the target privacy neuron, L, K and M are all positive integers ≥ 1, 1≤l≤L, 1≤k≤K, 1≤m≤M; a target privacy neuron confirmation module is used to determine the target privacy neuron of the lth layer according to the M privacy attribution score matrices of the lth layer, and obtain the target privacy neuron of the Lth layer in the large language model, wherein the target privacy neuron is a neuron associated with the privacy data of the target text data; a model editing module is used to edit the model of the target privacy neuron of the Lth layer in the large language model based on the activation patching technology and the technology of adding linear guidance vectors, and obtain the edited large language model, wherein the linear guidance vector is determined by the difference between the activation value of the target privacy neuron calculated by using the desensitized text data and the activation value of the target privacy neuron calculated by using the target text data.
[0008] Another aspect of the present disclosure provides an electronic device, including: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above method.
[0009] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.
[0010] Another aspect of the present disclosure provides a computer program product, which includes computer executable instructions, and the instructions are used to implement the above method when executed.
[0011] According to an embodiment of the present disclosure, a target text data set containing M target text data is obtained by performing data enhancement processing on a text data set with privacy data, and the M target text data are used to determine the privacy attribution score matrix corresponding to each target text data, that is, M privacy attribution score matrices are obtained, and the target privacy neurons are determined according to the obtained M privacy attribution score matrices, and the target privacy neurons are model edited based on the activation patching technology and the activation difference value of the target privacy neurons to obtain the edited large language model. Since data enhancement processing is performed on the text data, and the target privacy neurons are edited using the activation patching technology and the technology of adding linear guide vectors, the technical problem that the existing privacy neuron editing method reduces the model performance and is difficult to cope with the large-scale privacy leakage of the model and the protection requirements of different types of privacy data is at least partially solved, thereby achieving the technical effect of improving the model performance and being widely applicable to the protection requirements of different types of privacy data. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0013] Figure 1 The exemplary system architecture of the privacy protection method, apparatus, device and program product to which the large language model can be applied according to the embodiments of the present disclosure is schematically shown;
[0014] Figure 2 A flowchart of a privacy protection method for a large language model according to an embodiment of the present disclosure is schematically shown;
[0015] Figure 3 A flowchart of a method for model editing of a target privacy neuron according to an embodiment of the present disclosure is schematically shown;
[0016] Figure 4 A schematic diagram schematically shows a privacy protection method for a large language model according to an embodiment of the present disclosure;
[0017] Figure 5 A block diagram schematically shows a privacy protection device for a large language model according to an embodiment of the present disclosure; and
[0018] Figure 6 A block diagram of an electronic device suitable for implementing the privacy protection method of a large language model described above according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0019] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0020] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0021] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0022] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0023] In the embodiments of the present disclosure, the collection, updating, analysis, processing, use, transmission, provision, disclosure, storage, etc. of the data involved (for example, including but not limited to user personal information) are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. In particular, necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security, and national security.
[0024] In the embodiments of the present disclosure, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.
[0025] In the related technology, in order to protect the privacy of the language model in the post-processing stage, technicians have also proposed a method based on privacy neuron editing. This editing method attempts to directly set the activation value of the privacy neuron to zero. However, this method can only make a large language model forget a small amount of privacy data. When a large amount of privacy data needs to be forgotten, a large number of privacy neurons need to be edited. However, the large language model will have a technical problem of a significant decline in model performance due to too many privacy neurons being edited.
[0026] In view of this, an embodiment of the present disclosure provides a privacy protection method for a large language model, wherein the large language model includes L layers, each layer includes K neurons, and the method includes:
[0027] A large language model is used to perform data enhancement processing on a text dataset to obtain a target text dataset, wherein the target text dataset includes M target text data, and each target text data includes privacy data; for the lth layer in the L layer and the mth target text data in the M target text data, the mth target text data is used to determine the privacy attribution score matrix of the K neurons in the lth layer to obtain M privacy attribution score matrices in the lth layer, wherein each privacy attribution score matrix includes K privacy attribution scores, the kth privacy attribution score in the K privacy attribution scores is obtained by determining the privacy attribution score of the kth neuron in the K neurons, and the kth privacy attribution score represents the privacy of the mth target text data caused by the kth neuron. The causal correlation degree of data leakage, L, K and M are all positive integers ≥1, 1≤l≤L, 1≤k≤K, 1≤m≤M; according to the M privacy attribution score matrices of the lth layer, the target privacy neuron of the lth layer is determined to obtain the target privacy neuron of the Lth layer in the large language model, wherein the target privacy neuron is a neuron associated with the privacy data of the target text data; based on the activation patching technology and the technology of adding linear guidance vectors, the target privacy neuron of the Lth layer in the large language model is model edited to obtain the edited large language model, wherein the activation difference value of the target privacy neuron is obtained by calculating the difference between the activation value of the target privacy neuron using the desensitized text data and the activation value of the target privacy neuron using the target text data.
[0028] Figure 1 The exemplary system architecture of the privacy protection method, apparatus, device and program product that can apply the large language model according to the embodiments of the present disclosure is schematically shown. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0029] like Figure 1As shown, the system architecture 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0030] The user may use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software, etc. (only for example).
[0031] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0032] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0033] It should be noted that the privacy protection method of the large language model provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the privacy protection device of the large language model provided in the embodiment of the present disclosure can generally be set in the server 105. The privacy protection method of the large language model provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Correspondingly, the privacy protection device of the large language model provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Alternatively, the privacy protection method of the large language model provided in the embodiment of the present disclosure can also be performed by the first terminal device 101, the second terminal device 102 or the third terminal device 103, or by other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103. Correspondingly, the privacy protection device of the large language model provided in the embodiment of the present disclosure can also be set in the first terminal device 101, the second terminal device 102 or the third terminal device 103, or in other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103.
[0034] For example, the text data set may be originally stored in any one of the first terminal device 101, the second terminal device 102, or the third terminal device 103 (for example, the first terminal device 101, but not limited thereto), or stored in an external storage device and may be imported into the first terminal device 101. Then, the first terminal device 101 may locally execute the privacy protection method for the large language model provided in the embodiment of the present disclosure, or send the text data set to other terminal devices, servers, or server clusters, and the other terminal devices, servers, or server clusters that receive the text data set may execute the privacy protection method for the large language model provided in the embodiment of the present disclosure.
[0035] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0036] Figure 2 The flowchart of the privacy protection method of a large language model according to an embodiment of the present disclosure is schematically shown.
[0037] like Figure 2 As shown, the method 200 includes operations S210 to S240.
[0038] In operation S210, a large language model is used to perform data enhancement processing on the text dataset to obtain a target text dataset, wherein the target text dataset includes M target text data, and each target text data includes privacy data.
[0039] According to an embodiment of the present disclosure, the text data set may be text containing user privacy data. The privacy data may be, for example, different types of data, such as phone number information, email information, medical information, identity information, etc., which are not specifically limited in the present application.
[0040] According to an embodiment of the present disclosure, data enhancement processing of a text dataset may include: performing data enhancement processing on the text dataset using prompt words to generate a simulated text dataset; and mixing the text dataset and the simulated text dataset to obtain a target text dataset.
[0041] According to an embodiment of the present disclosure, a text data set may be input into a large language model, and prompt words may be used to generate simulated text data based on each text data in the text data set to obtain a simulated text data set.
[0042] According to an embodiment of the present disclosure, for example, the text data is "I am a security engineer. If you have any security issues, you can call me at 138****", and the large language model can generate simulated text data related to the text data based on the prompt words, for example, "I am going to city A in the afternoon. If you have any questions, please call me at 157****".
[0043] It should be noted that before obtaining or collecting user personal information, the user's authorization or consent is obtained, and it complies with the provisions of relevant laws and regulations, is used for legal purposes, and does not violate public order and good morals.
[0044] According to an embodiment of the present disclosure, the simulated text dataset and the text dataset are mixed to form a more comprehensive dataset, namely, the target text dataset.
[0045] According to an embodiment of the present disclosure, by expanding a text dataset through data augmentation processing, the diversity and coverage of the data can be increased, thereby enhancing the generalization ability of the model on a wider range of text data.
[0046] In operation S220, for the lth layer in the L layers and the mth target text data in the M target text data, the privacy attribution score matrix of the K neurons in the lth layer is determined using the mth target text data to obtain M privacy attribution score matrices in the lth layer, wherein each privacy attribution score matrix includes K privacy attribution scores, the kth privacy attribution score in the K privacy attribution scores is obtained by determining the privacy attribution score of the kth neuron in the K neurons, the kth privacy attribution score represents the degree of causal correlation of the kth neuron causing the privacy data leakage of the mth target text data, and L, K and M are all positive integers ≥1, 1≤l≤L, 1≤k≤K, 1≤m≤M.
[0047] According to an embodiment of the present disclosure, the large language model may include L layers, each layer including K neurons. The target text data set includes M target text data, and the privacy attribution score matrix of each layer in the L layers may be calculated based on each target text data.
[0048] According to an embodiment of the present disclosure, the privacy attribution score matrix of each layer is a matrix formed by calculating the privacy attribution score of each neuron in each layer based on each target text data.
[0049] According to an embodiment of the present disclosure, for example, determining the privacy attribution score matrix of the lth layer in L layers can be used as an example, and the privacy attribution score matrix of the L layer can be calculated through each target text data in M target text data.
[0050] According to an embodiment of the present disclosure, according to the m-th target text data among the M target text data, the privacy attribution score of the 1st neuron in the l-th layer is calculated to obtain the privacy attribution score corresponding to the 1st neuron; then the privacy attribution score of the 2nd neuron in the l-th layer is calculated to obtain the privacy attribution score corresponding to the 2nd neuron; ...; then the privacy attribution score of the k-th neuron in the l-th layer is calculated to obtain the privacy attribution score corresponding to the k-th neuron; ...; then the privacy attribution score of the K-th neuron in the l-th layer is calculated to obtain the privacy attribution score corresponding to the K-th neuron; based on the privacy attribution scores corresponding to the K neurons, an m-th privacy attribution score matrix corresponding to the m-th target text data is constructed.
[0051] In the same way, M privacy attribution score matrices corresponding to the M target text data are determined, and the specific description is not repeated in this application.
[0052] According to an embodiment of the present disclosure, M privacy attribution score matrices corresponding to the M target text data are obtained, that is, the M privacy attribution score matrices of the lth layer in the L layers.
[0053] According to an embodiment of the present disclosure, the privacy attribution score of each neuron can characterize the degree of causal relationship between the neuron and the privacy data leakage of the target text data. The higher the privacy attribution score, the greater the contribution of the neuron to the leakage of the target text data.
[0054] For example, each neuron in the lth layer is calculated based on the mth target text data. If the attribution score of the kth neuron is the largest, it means that the kth neuron contributes the most to the leakage of the private data of the mth target text data.
[0055] In operation S230, the target privacy neuron of the lth layer is determined according to the M privacy attribution score matrices of the lth layer, and the target privacy neuron of the Lth layer in the large language model is obtained, wherein the target privacy neuron is a neuron associated with the privacy data of the target text data.
[0056] According to an embodiment of the present disclosure, based on a preset threshold range, a privacy attribution score that satisfies the preset threshold range can be selected from each of the M privacy attribution score matrices of the lth layer. The privacy attribution score that satisfies the preset threshold range can be at least one selected from each privacy attribution score matrix, and the corresponding neuron can be determined by the selected privacy attribution score.
[0057] According to an embodiment of the present disclosure, at least one neuron corresponding to at least one privacy attribution score selected from each privacy attribution score matrix may be referred to as a neuron group corresponding to the target text data. M target text data correspond to M privacy attribution score matrices, one target text data corresponds to one neuron group, and M target text data correspond to M neuron groups.
[0058] According to an embodiment of the present disclosure, based on the appearance rate of the same neuron set in advance, neurons that meet the appearance rate can be determined from M neuron groups, and the neurons that meet the appearance rate can be determined as target privacy neurons of the lth layer, and the target privacy neurons corresponding to each layer of the L layers can be obtained.
[0059] In operation S240, based on the activation patching technology and the technology of adding linear steering vectors, the model of the target privacy neuron of the L layer in the large language model is edited to obtain the edited large language model, wherein the linear steering vector is determined by the difference between the activation value of the target privacy neuron calculated using the desensitized text data and the activation value of the target privacy neuron calculated using the target text data.
[0060] According to an embodiment of the present disclosure, the activation patching technology may be used to adjust the original activation value of the target privacy neuron.
[0061] According to the embodiments of the present disclosure, the target text data can be desensitized to obtain desensitized text data, and then the activation value of the target privacy neuron can be calculated based on the desensitized text data and the target text data, respectively. The difference between the activation values is used to construct a steering vector, and the original activation value of the target privacy neuron is adjusted to change the original activation value of the target privacy neuron, thereby obtaining an edited large language model.
[0062] According to an embodiment of the present disclosure, a target text data set containing M target text data is obtained by performing data enhancement processing on a text data set with privacy data, and the M target text data are used to determine the privacy attribution score matrix corresponding to each target text data, that is, M privacy attribution score matrices are obtained, and the target privacy neurons are determined according to the obtained M privacy attribution score matrices, and the target privacy neurons are model edited based on the activation patching technology and the activation difference value of the target privacy neurons to obtain the edited large language model. Since data enhancement processing is performed on the text data, and the target privacy neurons are edited using the activation patching technology and the technology of adding linear guide vectors, the technical problem that the existing privacy neuron editing method reduces the model performance and is difficult to cope with the large-scale privacy leakage of the model and the protection requirements of different types of privacy data is at least partially solved, thereby achieving the technical effect of improving the model performance and being widely applicable to the protection requirements of different types of privacy data.
[0063] According to an embodiment of the present disclosure, the privacy attribution score matrix of K neurons in the lth layer is determined by using the mth target text data, including:
[0064] For the kth neuron among K neurons, based on the gradient attribution algorithm, according to the mth target text data, the activation value of the kth neuron is determined; according to the activation value of the kth neuron, the privacy attribution score of the kth neuron is determined to obtain the privacy attribution scores of K neurons; according to the privacy attribution scores of K neurons, the privacy attribution score matrix of the K neurons in the lth layer is obtained.
[0065] According to an embodiment of the present disclosure, the privacy attribution score of each neuron in the K neurons of the lth layer can be calculated for the mth target text data. The privacy attribution score of the kth neuron of the K neurons calculated for the mth target text data can be used as an example to calculate the privacy attribution score of the kth neuron in the lth layer.
[0066] According to an embodiment of the present disclosure, the probability P of the large language model generating the private data Y in the mth target text data X can be determined based on the mth target text data. m , can be obtained through formula (1):
[0067] (1);
[0068] Among them, Y is the private data in the target text data; X is the target text data; θ is the large language model parameter; is the i-th private data word element of the private data in the target text data; n is the number of words of the private data in the target text data; is the probability of outputting the private data Y in the target text data when the target text data X is input and the model parameter is θ.
[0069] According to an embodiment of the present disclosure, the original activation value of the kth neuron can be calculated based on the mth target text data, and then the privacy attribution score of the kth neuron can be determined based on the adjusted activation value of the kth neuron and the probability calculation in (1) above. , can be obtained through formula (2):
[0070] (2);
[0071] in, is the kth neuron in the lth layer; is the original activation value of the kth neuron in the lth layer; is the adjusted activation value of the k-th neuron in the l-th layer; When the adjusted activation value of the kth neuron in the lth layer is , when text data X is input, the probability of private data Y in the output text data.
[0072] According to an embodiment of the present disclosure, the adjusted activation value of the kth neuron in the lth layer is is the original activation value from 0 to the kth neuron in the lth layer Obtained between.
[0073] According to the embodiments of the present disclosure, in order to simplify the calculation, we can divide the calculation of the continuous integral in the above formula (2) into J discrete small parts, each of which can become an approximate integral step. Generally, J can be 20, that is, the continuous integral can be divided into 20 small parts, each of which corresponds to a small increment.
[0074] According to the embodiments of the present disclosure, the above (2) can be simplified as shown in (3):
[0075] (3);
[0076] Where J is the approximate integration step; When the adjusted activation value of the kth neuron in the lth layer is , when text data X is input, the probability of the i-th private data word in the private data Y in the output text data.
[0077] According to an embodiment of the present disclosure, the privacy attribution score of the kth neuron in the lth layer can be determined based on the above formulas (1) to (3). Based on the above method, the privacy attribution scores of the K neurons in the lth layer can be determined.
[0078] According to an embodiment of the present disclosure, based on the obtained privacy attribution scores of the K neurons corresponding to the m-th target text data, an m-th privacy attribution score matrix corresponding to the m-th target text data can be obtained, and the m-th privacy attribution score matrix contains the privacy attribution scores corresponding to the K neurons.
[0079] According to an embodiment of the present disclosure, according to the M privacy attribution score matrices of the lth layer, the target privacy neuron of the lth layer is determined to obtain the target privacy neuron of the Lth layer in the large language model, including:
[0080] For the mth privacy attribution score matrix among the M privacy attribution score matrices of the lth layer, N privacy attribution scores that meet the first preset condition are determined from the mth privacy attribution score matrix, wherein the N neurons corresponding to the N privacy attribution scores are the mth group of intermediate privacy neurons corresponding to the mth target text data, and M groups of intermediate privacy neurons corresponding to the M target text data are obtained, N is a positive integer ≥1, and there is a corresponding relationship between the mth privacy attribution score matrix and the mth target text data; the intermediate privacy neurons that meet the second preset condition are determined from the M groups of intermediate privacy neurons, and the intermediate privacy neurons that meet the second preset condition are used as the target privacy neurons of the lth layer, and the target privacy neurons of the L layer in the large language model are obtained.
[0081] According to an embodiment of the present disclosure, the first preset condition may be determined by the following method: firstly, the maximum value of the privacy attribution score in each privacy attribution score matrix is determined, then a result of a preset percentage of the maximum value of the privacy attribution score is calculated, and the result is set as a threshold value of the first preset condition. That is, for different privacy attribution score matrices, the calculated threshold value of the first preset condition may be different.
[0082] According to an embodiment of the present disclosure, for the mth privacy attribution score matrix of the M privacy attribution score matrices of the lth layer, a privacy attribution score that is higher than a threshold of the first preset condition can be determined from the mth privacy attribution score matrix through a first preset condition.
[0083] According to an embodiment of the present disclosure, there may be at least one privacy attribution score determined from the mth privacy attribution score matrix that is higher than the threshold of the first preset condition. Each privacy attribution score that is higher than the threshold of the first preset condition corresponds to a corresponding neuron. The at least one neuron is called an intermediate privacy neuron, that is, the mth group of intermediate privacy neurons corresponding to the mth target text data, thereby determining M groups of intermediate privacy neurons corresponding to M target text data.
[0084] According to an embodiment of the present disclosure, the second preset condition can be determined by the following method: first determine the data set length of the target text data, then calculate the result of a preset percentage of the data set length, and set the result as the threshold of the second preset condition.
[0085] According to an embodiment of the present disclosure, it is possible to count whether the number of occurrences of the same intermediate privacy neuron among all the intermediate privacy neurons of the M group is greater than or equal to the threshold of the second preset condition. If it is greater than the threshold of the second condition, the intermediate privacy neuron that is greater than or equal to the threshold of the second condition is determined as the target privacy neuron of the lth layer.
[0086] According to an embodiment of the present disclosure, for example, the number M of target text data is 3, and the above method is used to determine the first privacy attribution score matrix corresponding to the first target text data, the second privacy attribution score matrix corresponding to the second target text data, and the second privacy attribution score matrix corresponding to the second target text data. The threshold of the first preset condition of the first privacy attribution score matrix, the threshold of the first preset condition of the second privacy attribution score matrix, and the threshold of the first preset condition of the third privacy attribution score matrix are determined respectively. Determine three privacy attribution scores that meet the first preset threshold from the first privacy attribution score matrix, for example, the three privacy attribution scores correspond to the first, second, and third neurons respectively; determine three privacy attribution scores that meet the first preset threshold from the second privacy attribution score matrix, for example, the three privacy attribution scores correspond to the third, fourth, and fifth neurons respectively; determine three privacy attribution scores that meet the first preset threshold from the third privacy attribution score matrix, for example, the three privacy attribution scores correspond to the first, second, and seventh neurons respectively, and the first, second, and third neurons, the third, fourth, and fifth neurons, and the first, second, and seventh neurons can be called intermediate privacy neurons. The second preset threshold can be, for example, 2, then from the above-mentioned first, second, and third neurons, the third, fourth, and fifth neurons, and the intermediate privacy neurons of the first, second, and seventh neurons, it can be determined that the number of occurrences of the first, second, and third neurons is equal to the second preset threshold, and the first, second, and third neurons can be determined as the target privacy neurons of the first layer.
[0087] According to an embodiment of the present disclosure, the above method can be used to determine the target privacy neurons of the L layer of the large language model.
[0088] Figure 3 The flowchart of the method for model editing of a target privacy neuron according to an embodiment of the present disclosure is schematically shown.
[0089] like Figure 3 As shown, the method 300 includes operations: S310~S340.
[0090] In operation S310, with respect to the target privacy neurons of the lth layer, the target text data is desensitized to obtain desensitized text data.
[0091] In operation S320, a target privacy neuron activation difference value of the lth layer is determined according to the desensitized text data and the target text data.
[0092] In operation S330, an initial activation value of a target privacy neuron of the l-th layer is determined.
[0093] In operation S340, according to the initial activation value of the target privacy neuron of the lth layer and the activation difference value of the target privacy neuron of the lth layer, the model of the target privacy neuron of the lth layer is edited, and the model of the target privacy neuron of the Lth layer in the large language model is edited to obtain the edited large language model.
[0094] According to an embodiment of the present disclosure, the desensitization process may be to hide the privacy data in the target text data, and thus obtain desensitized text data.
[0095] According to an embodiment of the present disclosure, determining the target privacy neuron activation difference value of the lth layer according to the desensitized text data and the target text data may include: for the rth target privacy neuron of the lth layer of the L layer, calculating the desensitized text data neuron activation value of the rth target privacy neuron according to the desensitized text data, where R is a positive integer ≥1, 1≤r≤R; calculating the target text data neuron activation value of the rth target privacy neuron according to the target text data; determining the activation difference value of the rth target privacy neuron according to the desensitized text data neuron activation value of the rth target privacy neuron and the target text data neuron activation value of the rth target privacy neuron, to obtain the activation difference values of R target privacy neurons; determining the target privacy neuron activation difference value of the lth layer according to the difference values of the R target privacy neurons.
[0096] According to an embodiment of the present disclosure, for the rth target privacy neuron among the R target privacy neurons of the lth layer, and for the mth target text data among the M target text data and the desensitized text data corresponding to the mth target text data, the mth target text data neuron activation value of the rth target privacy neuron can be calculated according to the mth target text data, and the mth desensitized text data neuron activation value of the rth target privacy neuron can be calculated according to the desensitized text data corresponding to the mth target text data, and based on the mth target text data neuron activation value and the mth desensitized text data neuron activation value, the mth neuron activation difference value of the rth target privacy neuron can be determined. Thus, M neuron activation difference values are determined.
[0097] According to an embodiment of the present disclosure, the activation difference value of the rth target privacy neuron may be determined based on the M neuron activation difference values.
[0098] According to an embodiment of the present disclosure, the activation difference value V of the rth target privacy neuron r , can be obtained through formula (4):
[0099] (4);
[0100] in, is the activation value of the neuron of the mth target text data; is the activation value of the mth desensitized text data neuron.
[0101] According to an embodiment of the present disclosure, the initial activation value of the rth target privacy neuron in the lth layer can be determined, and based on the activation value and the activation difference value of the rth target privacy neuron, the adjusted activation value of the rth target privacy neuron can be determined. . It can be obtained by formula (5).
[0102] (5);
[0103] in, is the original activation value of the rth target privacy neuron; γ is the weight, which is usually set to 10.
[0104] According to the embodiments of the present disclosure, the above formula (4) can be used to determine the neuron activation difference values corresponding to the R target privacy neurons respectively; and the above formula (5) can be used to determine the adjusted activation values corresponding to the R target privacy neurons respectively.
[0105] According to an embodiment of the present disclosure, the edited large language model can be obtained by adjusting the activation values of the R target privacy neurons determined in the large language model.
[0106] According to an embodiment of the present disclosure, Table 1 shows a performance comparison between the existing model privacy protection method and the present application, as shown in Table 1:
[0107] Table 1
[0108]
[0109] Among them, in Table 1, the original model is a model with obvious privacy leakage risks, for example, it can be a GPT2 model; NR is non-privacy retraining. In order to obtain the upper limit of privacy protection, all private data in the training set is cleared, and the model is retrained on this cleaned non-privacy data set; DEPN is a baseline method based on privacy neurons; APNEAP is an enhanced privacy neuron editing method based on activation value correction proposed in this application.
[0110] As can be seen from Table 1, when comparing the performance of different privacy protection methods, the results show that the present method (APNEAP) performs well in all aspects. When protecting phone numbers, the present method minimizes the model's leakage risk (9.23), and the effective PPL (8.92) is close to the original model (8.83), showing minimal performance loss. In terms of email protection, although the leakage risk of the present method is slightly higher (71.55), it is still better than DEPN, and the effective PPL (9.08) is closer to the original model than DP and NR. For MIMIC (personal medical information) data, APNEAP is comparable to NR and DP in terms of leakage risk, but outperforms all other methods in terms of effective PPL (8.95), showing the best model performance retention.
[0111] It can be seen that compared with other methods, this method can maintain high model performance while implementing privacy protection measures. Moreover, this method is not only applicable to the protection of traditional private data such as phone numbers and emails, but also to the protection of sensitive information such as medical reports. This shows that this method has wide applicability and can handle various types of private data.
[0112] Figure 4 A schematic diagram of a privacy protection method for a large language model according to an embodiment of the present disclosure is schematically shown.
[0113] like Figure 4As shown, in the schematic diagram 400, a text data set 401 and a simulated text data set 402 are mixed and processed to obtain a target text data set 403. The target text data set 403 includes M target text data. The target text data set 403 is input into the large language model 404. The M target text data in the target text data 403 are used to calculate the M privacy attribution score matrices 405 of the lth layer corresponding to each target text data. Each privacy attribution score matrix includes K privacy attribution scores, each privacy attribution score corresponds to a neuron, and each privacy attribution score matrix corresponds to K neurons 405-1. According to the M privacy attribution score matrices 405 of the lth layer, the R target privacy neurons 406 of the lth layer are determined. The target text data 403 and the desensitized text data 407 are input into the large language model 404, and the target text data neuron activation value of the rth target neuron among the R target privacy neurons is calculated respectively. 408 and desensitized text data neuron activation value 409, determine the activation difference value V of the rth target privacy neuron r 411. According to the activation difference value V of the rth target privacy neuron r 410 and the original activation value H of the rth target privacy neuron r 411, the adjusted activation value of the rth target privacy neuron can be determined 412. Thus, the adjusted activation values of the R target privacy neurons 406 can be determined, and the editing of each of the R target privacy neurons 406 can be achieved.
[0114] Figure 5 A block diagram of a privacy protection device for a large language model according to an embodiment of the present disclosure is schematically shown.
[0115] like Figure 5 As shown, the device 500 may include: a data enhancement processing module 510, a privacy attribution score matrix confirmation module 520, a target privacy neuron confirmation module 530 and a model editing module 540.
[0116] The data enhancement processing module 510 is used to perform data enhancement processing on the text data set using a large language model to obtain a target text data set, wherein the target text data set includes M target text data, and each target text data includes privacy data.
[0117] The privacy attribution score matrix confirmation module 520 is used to determine the privacy attribution score matrix of K neurons in the lth layer for the lth layer in the L layers and the mth target text data in the M target text data, using the mth target text data, to obtain M privacy attribution score matrices in the lth layer, wherein each privacy attribution score matrix includes K privacy attribution scores, the kth privacy attribution score in the K privacy attribution scores is obtained by determining the privacy attribution score of the kth neuron in the K neurons, the kth privacy attribution score represents the degree of causal correlation between the kth neuron and the privacy data leakage of the mth target text data, and L, K and M are all positive integers ≥1, 1≤l≤L, 1≤k≤K, 1≤m≤M.
[0118] The target privacy neuron confirmation module 530 is used to determine the target privacy neuron of the lth layer according to the M privacy attribution score matrices of the lth layer, and obtain the target privacy neuron of the Lth layer in the large language model, wherein the target privacy neuron is a neuron associated with the privacy data of the target text data.
[0119] The model editing module 540 is used to perform model editing on the target privacy neuron of the L layer in the large language model based on the activation patching technology and the technology of adding a linear steering vector to obtain the edited large language model, wherein the linear steering vector is determined by the difference between the activation value of the target privacy neuron calculated using the desensitized text data and the activation value of the target privacy neuron calculated using the target text data.
[0120] According to an embodiment of the present disclosure, the model editing module 540 includes: a desensitization processing submodule, an activation difference value determination submodule, an initial activation value determination submodule and a model editing submodule.
[0121] The desensitization processing submodule is used to perform desensitization processing on the target text data for the target privacy neuron of the lth layer of the L layer to obtain desensitized text data.
[0122] The activation difference value determination submodule is used to determine the activation difference value of the target privacy neuron in the lth layer according to the desensitized text data and the target text data.
[0123] The initial activation value determination submodule is used to determine the initial activation value of the target privacy neuron in the lth layer.
[0124] The model editing submodule is used to perform model editing on the target privacy neurons in the lth layer according to the initial activation values of the target privacy neurons in the lth layer and the activation difference values of the target privacy neurons in the lth layer, and to perform model editing on the target privacy neurons in the Lth layer in the large language model to obtain the edited large language model.
[0125] According to an embodiment of the present disclosure, the desensitization processing submodule includes: a first activation value calculation unit, a second activation value calculation unit, a first activation difference value determination unit, and a second activation difference value determination unit.
[0126] The first activation value calculation unit is used to calculate the desensitized text data neuron activation value of the rth target privacy neuron in the lth layer of the L layer according to the desensitized text data, where R is a positive integer ≥1, and 1≤r≤R.
[0127] The second activation value calculation unit is used to calculate the target text data neuron activation value of the rth target privacy neuron according to the target text data.
[0128] The first activation difference value determination unit is used to determine the activation difference value of the rth target privacy neuron according to the desensitized text data neuron activation value of the rth target privacy neuron and the target text data neuron activation value of the rth target privacy neuron, so as to obtain the activation difference values of R target privacy neurons.
[0129] The second activation difference value determining unit is used to determine the activation difference value of the target privacy neuron in the lth layer according to the difference values of the R target privacy neurons.
[0130] According to an embodiment of the present disclosure, the privacy attribution score matrix confirmation module 520 includes: an activation value determination submodule, a privacy attribution score first determination submodule, and a privacy attribution score matrix acquisition submodule.
[0131] The activation value determination submodule is used to determine the activation value of the kth neuron among the K neurons based on the gradient attribution algorithm and according to the mth target text data.
[0132] The first privacy attribution score determination submodule is used to determine the privacy attribution score of the kth neuron according to the activation value of the kth neuron, and obtain the privacy attribution scores of K neurons.
[0133] The privacy attribution score matrix acquisition submodule is used to obtain the privacy attribution score matrix of K neurons in the lth layer according to the privacy attribution scores of K neurons.
[0134] According to an embodiment of the present disclosure, the target privacy neuron confirmation module 530 includes:
[0135] The second privacy attribution score determination submodule is used to determine N privacy attribution scores that meet the first preset condition from the m-th privacy attribution score matrix of the M privacy attribution score matrices of the l-th layer, wherein the N neurons corresponding to the N privacy attribution scores are the m-th group of intermediate privacy neurons corresponding to the m-th target text data, and M groups of intermediate privacy neurons corresponding to the M target text data are obtained, N is a positive integer ≥1, and there is a corresponding relationship between the m-th privacy attribution score matrix and the m-th target text data.
[0136] The intermediate privacy neuron determination submodule is used to determine the intermediate privacy neurons that meet the second preset condition from the M groups of intermediate privacy neurons, and use the intermediate privacy neurons that meet the second preset condition as the target privacy neurons of the lth layer to obtain the target privacy neurons of the L layer in the large language model.
[0137] According to an embodiment of the present disclosure, the data enhancement processing module 510 includes: a simulated text data set generation submodule and a target text data set acquisition submodule.
[0138] The simulated text dataset is generated from the submodule, which is used to perform data enhancement processing on the text dataset using prompt words to generate a simulated text dataset.
[0139] The target text data set acquisition submodule is used to mix the text data set and the simulated text data set to obtain the target text data set.
[0140] According to an embodiment of the present disclosure, any multiple of the data enhancement processing module 510, the privacy attribution score matrix confirmation module 520, the target privacy neuron confirmation module 530, and the model editing module 540 can be combined in one module / sub-module / unit for implementation, or any one of the modules / sub-modules / units can be split into multiple modules / sub-modules / units. Alternatively, at least part of the functions of one or more of these modules / sub-modules / units can be combined with at least part of the functions of other modules / sub-modules / units and implemented in one module / sub-module / unit. According to an embodiment of the present disclosure, at least one of the data enhancement processing module 510, the privacy attribution score matrix confirmation module 520, the target privacy neuron confirmation module 530, and the model editing module 540 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware or in an appropriate combination of any of them. Alternatively, at least one of the data enhancement processing module 510, the privacy attribution score matrix confirmation module 520, the target privacy neuron confirmation module 530, and the model editing module 540 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be performed.
[0141] Figure 6 A block diagram of an electronic device suitable for implementing the method described above according to an embodiment of the present disclosure is schematically shown.
[0142] like Figure 6 As shown, the electronic device 600 according to an embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 to a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include an onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0143] In RAM 603, various programs and data required for the operation of electronic device 600 are stored. Processor 601, ROM 602 and RAM 603 are connected to each other via bus 604. Processor 601 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 602 and / or RAM 603. It should be noted that the program can also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in one or more memories.
[0144] According to an embodiment of the present disclosure, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to the bus 604. The electronic device 600 may further include one or more of the following components connected to the input / output (I / O) interface 605: an input portion 606 including a keyboard, a mouse, etc.; an output portion 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 608 including a hard disk, etc.; and a communication portion 609 including a network interface card such as a LAN card, a modem, etc. The communication portion 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage portion 608 as needed.
[0145] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0146] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.
[0147] An embodiment of the present disclosure also includes a computer program product, which includes a computer program, which contains program code for executing the method provided by the embodiment of the present disclosure. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the privacy protection method for the large language model provided by the embodiment of the present disclosure.
[0148] When the computer program is executed by the processor 601, the above functions defined in the system / device of the embodiment of the present disclosure are executed. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0149] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 609, and / or installed from a removable medium 611. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0150] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A privacy protection method for a large language model, wherein the large language model comprises L layers, each layer comprises K neurons, and the method comprises: Performing data enhancement processing on the text dataset using a large language model to obtain a target text dataset, wherein the target text dataset includes M target text data, and each of the target text data includes privacy data; For the lth layer in the L layers and the mth target text data in the M target text data, using the mth target text data, determine the privacy attribution score matrix of the K neurons in the lth layer, and obtain the M privacy attribution score matrices in the lth layer, wherein each of the privacy attribution score matrices includes K privacy attribution scores, the kth privacy attribution score in the K privacy attribution scores is obtained by determining the privacy attribution score of the kth neuron in the K neurons, and the kth privacy attribution score represents the causal correlation degree of the kth neuron causing the privacy data leakage of the mth target text data, and L, K and M are all positive integers ≥1, 1≤l≤L, 1≤k≤K, 1≤m≤M; Determine the target privacy neuron of the lth layer according to the M privacy attribution score matrices of the lth layer, and obtain the target privacy neuron of the Lth layer in the large language model, wherein the target privacy neuron is a neuron associated with the privacy data of the target text data; Based on the activation patching technology and the technology of adding a linear steering vector, the target privacy neuron of the L layer in the large language model is model edited to obtain the edited large language model, wherein the linear steering vector is determined by the difference between the activation value of the target privacy neuron calculated by using the desensitized text data and the activation value of the target privacy neuron calculated by using the target text data.
2. The method according to claim 1, wherein: Based on the activation patching technology and the technology of adding linear guidance vectors, the target privacy neurons of the L layer in the large language model are edited to obtain the edited large language model, including: For the target privacy neuron of the lth layer of the L layer, desensitizing the target text data to obtain the desensitized text data; Determining a target privacy neuron activation difference value of the first layer according to the desensitized text data and the target text data; Determining an initial activation value of the target privacy neuron of the lth layer; According to the initial activation value of the target privacy neuron of the lth layer and the activation difference value of the target privacy neuron of the lth layer, model editing is performed on the target privacy neuron of the lth layer, and model editing is performed on the target privacy neuron of the Lth layer in the large language model to obtain the edited large language model.
3. The method according to claim 2, wherein: The target privacy neurons of the lth layer include R target privacy neurons; The step of determining the target privacy neuron activation difference value of the first layer according to the desensitized text data and the target text data includes: For the r-th target privacy neuron of the l-th layer of the L layer, calculate the desensitized text data neuron activation value of the r-th target privacy neuron according to the desensitized text data, where R is a positive integer ≥1, 1≤r≤R; Calculate the target text data neuron activation value of the rth target privacy neuron according to the target text data; Determine the activation difference value of the rth target privacy neuron according to the desensitized text data neuron activation value of the rth target privacy neuron and the target text data neuron activation value of the rth target privacy neuron, and obtain the activation difference values of R target privacy neurons; According to the difference values of the R target privacy neurons, the activation difference value of the target privacy neuron of the lth layer is determined.
4. The method according to claim 1, wherein: The method of using the mth target text data to determine the privacy attribution score matrix of the K neurons in the lth layer includes: For a kth neuron among the K neurons, based on a gradient attribution algorithm and according to the mth target text data, determining an activation value of the kth neuron; Determine the privacy attribution score of the k-th neuron according to the activation value of the k-th neuron, and obtain the privacy attribution scores of K neurons; According to the privacy attribution scores of the K neurons, a privacy attribution score matrix of the K neurons in the lth layer is obtained.
5. The method according to claim 1, wherein: Determining the target privacy neuron of the lth layer according to the M privacy attribution score matrices of the lth layer, and obtaining the target privacy neuron of the Lth layer in the large language model, includes: For the mth privacy attribution score matrix among the M privacy attribution score matrices of the lth layer, determine N privacy attribution scores that meet the first preset condition from the mth privacy attribution score matrix, wherein the N neurons corresponding to the N privacy attribution scores are the mth group of intermediate privacy neurons corresponding to the mth target text data, and M groups of intermediate privacy neurons corresponding to the M target text data are obtained, N is a positive integer ≥1, and there is a corresponding relationship between the mth privacy attribution score matrix and the mth target text data; An intermediate privacy neuron that meets a second preset condition is determined from the M groups of intermediate privacy neurons, and the intermediate privacy neuron that meets the second preset condition is used as the target privacy neuron of the lth layer to obtain the target privacy neuron of the L layer in the large language model.
6. The method according to claim 1, wherein: The method of using a large language model to perform data enhancement processing on text data to obtain a target text data set includes: Performing data enhancement processing on the text dataset using prompt words to generate a simulated text dataset; The text data set and the simulated text data set are mixed to obtain a target text data set.
7. A privacy protection device for a large language model, comprising: A data enhancement processing module, used to perform data enhancement processing on a text data set using a large language model to obtain a target text data set, wherein the target text data set includes M target text data, each of which includes privacy data; A privacy attribution score matrix confirmation module is used to determine the privacy attribution score matrix of the K neurons in the lth layer and the mth target text data in the M target text data using the mth target text data, and obtain M privacy attribution score matrices in the lth layer, wherein each of the privacy attribution score matrices includes K privacy attribution scores, the kth privacy attribution score in the K privacy attribution scores is obtained by determining the privacy attribution score of the kth neuron in the K neurons, and the kth privacy attribution score represents the causal correlation degree of the kth neuron causing the privacy data leakage of the mth target text data, and L, K and M are all positive integers ≥1, 1≤l≤L, 1≤k≤K, 1≤m≤M; a target privacy neuron confirmation module, configured to determine the target privacy neuron of the lth layer according to the M privacy attribution score matrices of the lth layer, and obtain the target privacy neuron of the Lth layer in the large language model, wherein the target privacy neuron is a neuron associated with the privacy data of the target text data; A model editing module is used to perform model editing on the target privacy neuron of the L layer in the large language model based on the activation patching technology and the technology of adding a linear steering vector to obtain the edited large language model, wherein the linear steering vector is determined by the difference between the activation value of the target privacy neuron calculated by using the desensitized text data and the activation value of the target privacy neuron calculated by using the target text data.
8. An electronic device, comprising: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.
Citation Information
Cited By
Privacy protection text generation method and system based on large language model
CN119691802A
Hardening Machine Learning Models Against Prompt Input Attacks That Trigger Trojans
US20260111541A1
