Privacy leakage risk detection method and device, electronic equipment and storage medium

Through the parameter adjustment of the pre-trained text risk detection model and text interaction model, the problem of privacy information leakage risk in large model training data is solved, the recognition accuracy and processing efficiency are improved, and the security and adaptability of the output text are ensured.

CN118643530APending Publication Date: 2024-09-13CHONGQING CHANGAN TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410779571.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2024-09-13

AI Technical Summary

Technical Problem

Existing private information identification solutions have risks of privacy information leakage when processing complex and diverse large model training data, and static homogeneous semantic collections lead to poor flexibility and accuracy. It is difficult to effectively identify polysemy and new words, and it is easy to misidentify non-private words. The information is private information, resulting in insufficient recognition accuracy.

Method used

A pre-trained text risk detection model is used for risk detection. If there is no privacy leakage risk, the text interaction model is input to generate the output text. If there is a privacy leakage risk, the text interaction model parameters are adjusted according to the privacy category and the output text is regenerated. By interacting with the privacy text Library matching ensures that the output text does not contain private information.

Benefits of technology

It improves processing efficiency, reduces the probability of leakage of private information of the output text, enhances the scalability and scene adaptability of the solution, avoids the limitations of static data set construction, and ensures the security of the output text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118643530A
    Figure CN118643530A
Patent Text Reader

Abstract

The embodiment of the invention relates to a privacy leakage risk detection method and device, electronic equipment and a storage medium, and the method comprises the steps: carrying out the risk detection of a to-be-input text through a pre-trained text risk detection model, and obtaining a detection result representing whether the to-be-input text has a privacy leakage risk and a privacy category or not; if the privacy leakage risk does not exist in the to-be-input text, inputting the to-be-input text into a pre-trained text interaction model to obtain a to-be-output text; if the to-be-input text has the privacy leakage risk, adjusting parameters of a text interaction model based on the privacy category; inputting a to-be-input text into the text interaction model after parameter adjustment to obtain a to-be-output text; and based on the to-be-output text, generating and outputting an output text for interacting with the user. According to the embodiment of the invention, on the basis of ensuring the original semantic understanding, the probability of the privacy leakage risk of the output text is greatly reduced, and the expandability and scene adaptability of the scheme are higher.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a privacy leakage risk detection method, device, electronic device and storage medium. Background Art

[0002] At present, the corpus data used for large model training is often complex and diverse, which contains some private information, such as personal residence and contact information. Especially in the application process of large models such as GPT (Generative Pre-Trained Transformer) and BERT (Bidirectional Encoder Representations from Transformers), large models may inadvertently leak privacy-sensitive information in training data, causing privacy security issues. Therefore, it is particularly important to reduce or avoid the leakage of private information in model output without significantly affecting the original performance of the large model.

[0003] Existing privacy information identification solutions usually need to build similar semantic sets and match the text to be identified with the similar semantic sets to identify whether the current text contains privacy information. The similar semantic sets built by existing solutions are static, which is not conducive to scenario expansion and has poor flexibility and accuracy in handling some polysemous words and new words. In addition, when building semantic sets, there is a risk of misclassifying non-privacy information as privacy information, resulting in insufficient recognition accuracy. Summary of the invention

[0004] In view of this, in order to solve some or all of the above technical problems, the embodiments of the present application provide a privacy leakage risk detection method, device, electronic device and storage medium.

[0005] In a first aspect, an embodiment of the present application provides a privacy leakage risk detection method, the method comprising: using a pre-trained text risk detection model to perform risk detection on an input text, and obtaining a detection result indicating whether the text to be input has a privacy leakage risk and a privacy category; if the detection result indicates that the text to be input does not have a privacy leakage risk, inputting the text to be input into a pre-trained text interaction model to obtain a text to be output; if the detection result indicates that the text to be input has a privacy leakage risk, adjusting the parameters of the text interaction model based on the privacy category; inputting the text to be input into the text interaction model with adjusted parameters to obtain the text to be output; based on the text to be output, generating and outputting an output text for interacting with a user.

[0006] In one possible implementation, based on the text to be output, an output text for interacting with a user is generated and output, including: performing similarity matching between the text to be output and a preset privacy text library to obtain a similarity value between the text to be output and a target privacy text in the privacy text library, wherein the target privacy text is the privacy text in the privacy text library with the greatest similarity to the text to be output; based on the similarity value, determining whether the text to be output meets output conditions; if it does not meet the output conditions, adjusting the parameters of a text interaction model based on a privacy category, and using the text interaction model with the adjusted parameters to generate and output an output text that meets the output conditions.

[0007] In one possible implementation, the text interaction model after adjusting parameters is used to generate and output output text that meets the output conditions, including: re-inputting the text to be input into the text interaction model after adjusting parameters to obtain new text to be output; based on the new text to be output, re-executing the step of similarity matching the text to be output with a preset privacy text library until the current text to be output meets the output conditions.

[0008] In a possible implementation, adjusting the parameters of the text interaction model based on the privacy category includes: determining a target neuron corresponding to the privacy category from the text interaction model; and erasing an output value of the target neuron.

[0009] In one possible implementation, determining a target neuron corresponding to a privacy category from a text interaction model includes: determining a pre-recorded neuron set corresponding to the privacy category from the text interaction model, wherein each neuron in the neuron set corresponds to a pre-counted privacy score, the privacy score represents the degree of influence of the corresponding neuron on the privacy information output by the text interaction model, and the privacy score corresponding to each neuron in the neuron set is greater than or equal to a preset privacy score threshold; and determining a preset proportion of neurons from the neuron set as target neurons according to the size of the privacy score.

[0010] In a possible implementation, the privacy score is obtained in advance based on the following steps: performing the following privacy score calculation steps: obtaining a first sample privacy text belonging to a privacy category and a corresponding first sample input text; inputting the first sample input text into the above-mentioned text interaction model, and calculating the predicted probability value of each privacy text unit contained in the first sample privacy text by the text interaction model; for each privacy text unit contained in the first sample privacy text, adjusting each neuron parameter contained in the text interaction model in turn, and determining the predicted probability change value of each neuron corresponding to the privacy text unit; determining a probability change threshold based on the obtained probability change value set corresponding to the first sample privacy text; for each neuron contained in the text interaction model, determining a target predicted probability change value greater than or equal to the probability change threshold from the N predicted probability change values ​​corresponding to the neuron; determining the number of target predicted probability change values ​​as the privacy impact frequency value of the neuron corresponding to the first sample privacy text; determining an initial privacy score corresponding to the neuron based on the privacy impact frequency value; for the sample privacy text set contained in the privacy category, repeatedly performing the privacy score calculation steps multiple times to obtain multiple initial privacy scores corresponding to each neuron; and calculating the privacy score of each neuron for the privacy category based on the multiple initial privacy scores.

[0011] In one possible implementation, the parameters of each neuron included in the text interaction model are adjusted in turn to determine the predicted probability change value of each neuron corresponding to the private text unit, including: adjusting the parameters of each neuron included in the text interaction model in turn, and recording the predicted probability difference of each neuron corresponding to the private text unit before and after the parameter adjustment; determining the rank of the private text unit in the corresponding candidate text unit set of the text interaction model, and determining the privacy risk factor of the private text unit based on the rank; using the privacy risk factor as a weight, weighting the predicted probability difference of each neuron corresponding to the private text unit, and obtaining the predicted probability change value of each neuron corresponding to the private text unit.

[0012] In one possible implementation, based on the privacy impact frequency value, determining the initial privacy score corresponding to the neuron includes: obtaining the privacy risk factor of each privacy text unit contained in the first sample privacy text; based on the obtained privacy risk factors, determining the privacy risk value corresponding to the first sample privacy text as the privacy score weight; based on the privacy impact frequency value and the privacy score weight, determining the initial privacy score corresponding to the neuron.

[0013] In one possible implementation, a probability change threshold is determined based on a set of probability change values ​​corresponding to the obtained first sample private text, including: determining a maximum probability change value from the set of probability change values, and determining a probability change threshold based on a preset coefficient and the maximum probability change value.

[0014] In one possible implementation, before using a pre-trained text risk detection model to perform risk detection on the input text, the method further includes: obtaining a second sample privacy text, a second sample input text, and a corresponding annotated privacy category; inputting the second sample input text into the initial text risk detection model to obtain a predicted privacy category; inputting the second sample input text into the text interaction model, and calculating the predicted probability value of each privacy text unit contained in the second sample privacy text by the text interaction model; for each privacy text unit contained in the second sample privacy text, determining the rank of the privacy text unit in the corresponding candidate text unit set of the text interaction model based on the predicted probability value of the privacy text unit; determining the privacy risk factor of the privacy text unit based on the rank; determining the privacy risk value corresponding to the second sample privacy text based on the obtained privacy risk factors; using the privacy risk value as the weight of a preset loss function to calculate a loss value representing the error between the predicted privacy category and the annotated privacy category; adjusting the parameters of the initial text risk detection model based on the loss value; in response to the initial text risk detection model after adjusting the parameters meeting the preset training end condition, determining the initial text risk detection model after adjusting the parameters as the trained text risk detection model.

[0015] In one possible implementation, obtaining a second sample privacy text, a second sample input text, and a corresponding annotated privacy category includes: obtaining the second sample privacy text and an initial sample input text; inputting the initial sample input text into a text interaction model to obtain a sample output text; matching the second sample privacy text with the sample output text to obtain a matching result; based on the matching result, determining whether the sample output text includes all privacy text units of the second sample privacy text; if the sample output text includes all privacy text units in the second sample privacy text, determining the initial sample input text as a positive sample input text, and obtaining a positive sample annotated privacy category set for the positive sample input text; if the sample output text does not include all privacy text units in the second sample privacy text, determining the initial sample input text as a negative sample input text, and obtaining a negative sample annotated privacy category set for the negative sample input text, indicating that the negative sample input text has no privacy leakage risk.

[0016] In one possible implementation, the second sample private text is matched with the sample output text, including: determining the first private text unit in the second sample private text as the private text unit to be matched, and performing the following matching steps based on the private text unit to be matched and the initial sample input text: inputting the initial sample input text into the text interaction model to obtain a set of candidate text units located at the position of the first private text unit of the output; determining whether there is a private text unit to be matched in the candidate text unit set; if not, adding the text unit corresponding to the first probability order in the candidate text unit set to the end of the initial sample input text to form a new initial sample input text; based on the new initial sample input text, continuing to perform the matching step; if present, adding the private text unit to be matched to the end of the initial sample input text to form a new initial sample input text, and determining the next private text unit of the private text unit to be matched in the second sample private text as the new private text unit to be matched; and continuing to perform the matching step based on the new initial sample input text and the new private text unit to be matched.

[0017] In a second aspect, an embodiment of the present application provides a privacy leakage risk detection device, which includes: a first detection module, which is used to use a pre-trained text risk detection model to perform risk detection on the input text, and obtain a detection result indicating whether the text to be input has a privacy leakage risk and a privacy category; a first interaction module, which is used to input the text to be input into a pre-trained text interaction model to obtain a text to be output if the detection result indicates that the text to be input does not have a privacy leakage risk; a first adjustment module, which is used to adjust the parameters of the text interaction model based on the privacy category if the detection result indicates that the text to be input has a privacy leakage risk; a second interaction module, which is used to input the text to be input into the text interaction model after adjusting the parameters to obtain the text to be output; and a generation module, which is used to generate and output an output text for interacting with a user based on the text to be output.

[0018] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory for storing a computer program; a processor for executing the computer program stored in the memory, and when the computer program is executed, the method of any embodiment of the privacy leakage risk detection method of the first aspect of the present application is implemented.

[0019] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, a method as in any embodiment of the privacy leakage risk detection method of the first aspect described above is implemented.

[0020] In a fifth aspect, an embodiment of the present application provides a computer program, which includes a computer-readable code. When the computer-readable code runs on a device, the processor in the device implements a method as in any embodiment of the privacy leakage risk detection method of the first aspect above.

[0021] The privacy leakage risk detection method, device, electronic device and storage medium provided in the embodiment of the present application, by constructing a text risk detection model, performs risk detection on the input text, if there is no privacy leakage risk, uses the text interaction model to generate the text to be output; if there is a privacy leakage risk, based on the predicted privacy category, adjusts the parameters of the text interaction model, and then uses the text interaction model after adjusting the parameters to generate the text to be output, and finally generates and outputs the output text for interaction with the user based on the text to be output. The embodiment of the present application can directly obtain the output text according to the input text, without too much intermediate data processing process, and the processing efficiency is greatly improved. Before using the large model for interaction, the text risk detection model is used to judge the privacy leakage risk, and the semantic understanding ability of the model to the text is fully utilized. When there is a privacy leakage risk, the parameters of the text interaction model are adjusted, which can greatly reduce the probability of the output text having the privacy leakage risk on the basis of ensuring the original semantic understanding, and is not limited to the static data set construction, and the scalability and scenario adaptability of the solution are stronger. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0023] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0024] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0025] Figure 1 A flowchart of a privacy leakage risk detection method provided in an embodiment of the present application;

[0026] Figure 2 A flowchart of another privacy leakage risk detection method provided in an embodiment of the present application;

[0027] Figure 3A flowchart of another privacy leakage risk detection method provided in an embodiment of the present application;

[0028] Figure 4 A flowchart of another privacy leakage risk detection method provided in an embodiment of the present application;

[0029] Figure 5 A flowchart of another privacy leakage risk detection method provided in an embodiment of the present application;

[0030] Figure 6 A flowchart of another privacy leakage risk detection method provided in an embodiment of the present application;

[0031] Figure 7 A schematic diagram of a process for determining a predicted probability change value corresponding to each neuron provided in an embodiment of the present application;

[0032] Figure 8 A flowchart of another privacy leakage risk detection method provided in an embodiment of the present application;

[0033] Fig. 9 A flowchart of another privacy leakage risk detection method provided in an embodiment of the present application;

[0034] Fig.10 A flowchart of another privacy leakage risk detection method provided in an embodiment of the present application;

[0035] Fig.11 A flowchart of another privacy leakage risk detection method provided in an embodiment of the present application;

[0036] Fig.12 A flowchart of another privacy leakage risk detection method provided in an embodiment of the present application;

[0037] Fig.13 A schematic diagram of the structure of a privacy leakage risk detection device provided in an embodiment of the present application;

[0038] Fig.14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. It should be noted that unless otherwise specifically stated, the relative arrangement of the components and steps, the numerical expressions and the numerical values ​​described in these embodiments do not limit the scope of the present application.

[0040] Those skilled in the art will understand that the terms "first" and "second" in the embodiments of the present application are only used to distinguish between different steps, devices, modules and other objects, and do not represent any specific technical meanings, nor do they indicate the logical order between them.

[0041] It should also be understood that in this embodiment, “plurality” may refer to two or more than two, and “at least one” may refer to one, two or more than two.

[0042] It should also be understood that any component, data or structure mentioned in the embodiments of the present application can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.

[0043] In addition, the term "and / or" in this application is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this application generally indicates that the associated objects before and after are in an "or" relationship.

[0044] It should also be understood that the description of the various embodiments in this application focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.

[0045] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present application, its application, or uses.

[0046] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the above-mentioned technologies, methods, and equipment should be considered as part of the specification.

[0047] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0048] It should be noted that, in the absence of conflict, the embodiments in this application and the features in the embodiments can be combined with each other. To facilitate the understanding of the embodiments of the present application, the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0049] In order to solve the technical problems of low efficiency, low accuracy and poor scenario adaptability of privacy leakage risk detection in the prior art, the present application provides a privacy leakage risk detection method, which can achieve more efficient data processing, greatly reduce the probability of the model outputting privacy information, and has stronger scenario adaptability.

[0050] Figure 1 A flowchart of a privacy leakage risk detection method provided in an embodiment of the present application. This method can be applied to one or more electronic devices such as vehicles (e.g., smart driving vehicles), smart phones, laptops, desktop computers, portable computers, servers, etc. For example, when this method is applied on a server, it can receive text to be input sent by a terminal device, use a text risk detection model and a text interaction model to output text with a low privacy leakage risk, and feed the output text back to the terminal device.

[0051] In addition, the execution subject of the present method may be hardware or software. When the execution subject is hardware, the execution subject may be one or more of the electronic devices. For example, a single electronic device may execute the present method, or a plurality of electronic devices may cooperate with each other to execute the present method. When the execution subject is software, the present method may be implemented as a plurality of software or software modules, or as a single software or software module. No specific limitation is made herein.

[0052] like Figure 1 As shown, the method specifically includes:

[0053] Step 101 , using a pre-trained text risk detection model, performs risk detection on the input text to obtain a detection result indicating whether the input text has a privacy leakage risk and a privacy category.

[0054] In this embodiment, the text risk detection model can be constructed based on a neural network that can perform natural language semantic understanding, and the text risk detection model can be pre-trained based on a machine learning method. For example, the text risk detection model can include modules such as word vector embedding, transformer encoder, and classifier. The output detection result can indicate whether the input text has a privacy leakage risk. When there is a privacy leakage risk, the privacy category can include categories such as name, phone number, address, etc. When there is no privacy leakage risk, the privacy category can be a risk-free category.

[0055] Step 102: If the detection result indicates that there is no privacy leakage risk in the text to be input, the text to be input is input into a pre-trained text interaction model to obtain the text to be output.

[0056] In this embodiment, the text interaction model can be a generative natural language model for semantic understanding and interaction. The text interaction model can generate a response message corresponding to the input text according to the semantics of the input text, and the response message is the text to be output.

[0057] Step 103: If the detection result indicates that the text to be input has a privacy leakage risk, the parameters of the text interaction model are adjusted based on the privacy category.

[0058] In this embodiment, the response degree of the neurons that respond to the input text of different privacy categories in the text interaction model is different. Therefore, the positions of neurons corresponding to different privacy categories can be recorded in advance. When it is detected that there is a risk of privacy leakage in the input text, the data output by the neurons corresponding to the privacy category can be adjusted (for example, cleared). As an example, when determining the correspondence between the privacy category and the position of the neuron, a sample privacy text of a privacy category can be input into the model, and each neuron can be adjusted in turn, and the probability change of the output privacy information before and after the adjustment is recorded, and the neuron with a larger probability change is used as the neuron corresponding to the privacy category.

[0059] Step 104, input the text to be input into the text interaction model after adjusting the parameters to obtain the text to be output.

[0060] In this embodiment, the probability of the text interaction model outputting private information is greatly reduced after the parameters are adjusted, that is, the probability that the obtained text to be output contains private information is low.

[0061] Step 105: Generate and output output text for interacting with the user based on the text to be output.

[0062] In this embodiment, the text to be output can be directly output as the output text, or the text to be output can be processed again before output. For example, it can be matched with a preset private text library. If the private text cannot be matched, the text to be output can be output. If the private text is matched, the parameters of the text interaction model can be adjusted until the output text cannot match the private text.

[0063] The privacy leakage risk detection method provided in the embodiment of the present application constructs a text risk detection model to perform risk detection on the input text. If there is no privacy leakage risk, the text interaction model is used to generate the text to be output; if there is a privacy leakage risk, the parameters of the text interaction model are adjusted based on the predicted privacy category, and the text interaction model after adjusting the parameters is used to generate the text to be output. Finally, based on the text to be output, the output text for interaction with the user is generated and output. The embodiment of the present application can directly obtain the output text according to the input text, without too much intermediate data processing process, and the processing efficiency is greatly improved. Before using a large model for interaction, a text risk detection model is used to judge the privacy leakage risk, and the semantic understanding ability of the model to the text is fully utilized. When there is a privacy leakage risk, the parameters of the text interaction model are adjusted, which can greatly reduce the probability of the output text having the privacy leakage risk on the basis of ensuring the original semantic understanding, and is not limited to the construction of static data sets, and the scalability and scenario adaptability of the solution are stronger.

[0064] In some optional implementations of this embodiment, such as Figure 2 As shown, the above step 105 includes:

[0065] Step 1051 , performing similarity matching between the text to be output and a preset private text library, and obtaining a similarity value between the text to be output and a target private text in the private text library.

[0066] The target private text is the private text in the private text library that has the greatest similarity to the text to be output. The private text library contains private texts of various categories. For example, one of the private texts may be "Zhang San's contact number is 123456789".

[0067] The electronic device may use an existing similarity calculation method to determine the similarity between the text to be output and each private text, and determine the target private text with the greatest similarity.

[0068] Step 1052: Determine whether the text to be output meets the output condition based on the similarity value.

[0069] Specifically, if the similarity is less than or equal to a preset similarity threshold, it can be determined that the output condition is met, and the text to be outputted can be directly outputted. Otherwise, it is determined that the output condition is not met, and step 1053 is executed.

[0070] Step 1053: If the output condition is not met, the parameters of the text interaction model are adjusted based on the privacy category, and the text interaction model with the adjusted parameters is used to generate and output an output text that meets the output condition.

[0071] The method for adjusting the parameters of the text interaction model may be the same as the above step 103. The above text to be input may continue to be input into the text interaction model after adjusting the parameters, and the new text output may be directly used as the output text that meets the output condition, or it may be determined again whether the output condition is met, and the parameters may be adjusted multiple times until the output text meets the output condition.

[0072] This embodiment sets up a privacy text library to further judge the output text after the text interaction model outputs the text. When it is determined through privacy text matching that the output conditions are not met, the parameters of the text interaction model are adjusted again to ensure that the output text does not have the risk of privacy leakage, thereby further reducing the risk of privacy leakage.

[0073] In some optional implementations of this embodiment, such as Figure 3 As shown, the above step 1053 includes:

[0074] Step 10531, if the output condition is not met, the parameters of the text interaction model are adjusted based on the privacy category, and the text to be input is re-input into the text interaction model after the parameters are adjusted to obtain a new text to be output.

[0075] Usually, the parameter amount adjusted each time may be the same as the preset parameter amount, that is, a small amount of parameters is adjusted. After each adjustment of the parameters of the text interaction model, a new text to be output is regenerated, and step 10532 is performed based on the new text to be output.

[0076] Step 10532: based on the new text to be output, re-execute the step of performing similarity matching between the text to be output and the preset private text library until the current text to be output meets the output condition.

[0077] That is, the above steps 1051-1052 are executed again. When it is determined that the output condition is not met again, step 10531 is executed again. When it is determined that the output condition is met, the above new text to be output is output.

[0078] This embodiment can ensure that the text output by the model does not contain private information by adjusting the parameters of the text interaction model multiple times, thereby further reducing the risk of privacy leakage during text interaction.

[0079] In some optional implementations of this embodiment, such as Figure 4 As shown, step 103 includes:

[0080] Step 1031, determining the target neuron corresponding to the privacy category from the text interaction model.

[0081] The corresponding relationship between the privacy category and the target neuron can be determined in advance through calibration. As an example, when determining the corresponding relationship between the privacy category and the position of the neuron, a sample privacy text of a privacy category can be input into the model, and each neuron can be adjusted in turn, and the probability change of the output privacy information before and after the adjustment is recorded, and the neuron with a larger probability change is used as the neuron corresponding to the privacy category.

[0082] Step 1032, erasing the output value of the target neuron.

[0083] Specifically, the method of erasing the output value of the target neuron may be to set the output value of the target neuron to zero or other fixed values. In this embodiment, the output value of the target neuron may be completely erased, or it may be erased in batches, that is, a portion is erased each time, and another portion is erased when the text to be output does not meet the output condition.

[0084] This embodiment erases the neurons corresponding to the privacy category, so that the text interaction model can adjust some neurons specifically according to the privacy category of the input text, so that the output text avoids outputting privacy information close to the privacy category while keeping other semantic information intact, thereby generating high-quality text without privacy information, improving privacy security during interaction, and maintaining a good interaction effect.

[0085] In some optional implementations of this embodiment, such as Figure 5 As shown, step 1031 includes:

[0086] Step 10311, determine the pre-recorded neuron set corresponding to the privacy category from the text interaction model.

[0087] Among them, each neuron in the neuron set corresponds to a pre-calculated privacy score, and the privacy score represents the degree of influence of the corresponding neuron on the privacy information output by the text interaction model. The privacy score corresponding to each neuron in the neuron set is greater than or equal to the preset privacy score threshold.

[0088] As an example, when calculating the privacy score, you can input a sample privacy text of a privacy category into the model, adjust each neuron in turn, record the change in the probability of each neuron outputting privacy information (that is, the probability of each privacy token output) before and after the adjustment, and set the corresponding privacy score according to the size of the probability change (the probability change value can be used as the privacy score, or a weight can be set for the probability change value to calculate the privacy score). That is, the larger the privacy score of a neuron, the greater the impact of the neuron on the output privacy information after the parameter adjustment.

[0089] The neuron set corresponding to the privacy category can be determined based on the privacy score of the privacy text records of the same category during statistics. For example, the probability change value of each neuron before and after adjustment can be counted when the privacy text of the same category is calibrated, and the neurons with probability change values ​​greater than the threshold are determined as the neuron set corresponding to the current privacy category.

[0090] Step 10312, according to the size of the privacy score, determine a preset proportion of neurons from the neuron set as target neurons.

[0091] As an example, the preset ratio can be 25%, that is, each time a neuron is erased, 25% of the neurons with higher privacy scores in the neuron set corresponding to the above privacy category will be erased, and then it is determined whether the text to be output meets the output conditions. The erasing is repeated many times until all neuron sets are erased or meet the output conditions.

[0092] This embodiment sets the neuron set corresponding to the privacy category according to the privacy score in advance, thereby accurately determining the neurons that have a greater impact on the output privacy information for different privacy categories in the text interaction model, and adjusting the parameters of the neurons according to the size of the privacy score. The neuron parameters can be adjusted more accurately for the current input text, thereby more accurately reducing the risk of outputting privacy information while retaining the original semantics to the greatest extent.

[0093] In some optional implementations of this embodiment, such as Figure 6 As shown, the privacy score is obtained in advance based on the following steps:

[0094] Step 601: Obtain a first sample privacy text belonging to a privacy category and a corresponding first sample input text.

[0095] The first sample privacy text may be a pre-set text containing a certain category of privacy information. For example, a sample privacy text may be "Zhang San's phone number: 123456789". The corresponding first sample input text may be "Tell me Zhang San's contact information".

[0096] Step 602: Input the first sample input text into a text interaction model, and use the text interaction model to calculate a predicted probability value of each private text unit included in the first sample private text.

[0097] The text unit is the smallest semantic expression unit in the text, such as a Chinese character, an English word, a punctuation mark, etc. Figure 7As shown, an autoregressive approach can be adopted to process the first sample input text using the text interaction model. That is, each time a privacy token (i.e., a privacy text unit included in the first sample privacy text) is added to the end of the sample input text, and then the first sample input text with the added privacy token is input into the text interaction model. The model outputs the predicted probability value of the next privacy token. Repeating this process can calculate the predicted probability values of each privacy text unit included in the first sample privacy text.

[0098] Step 603: For each privacy text unit included in the first sample privacy text, adjust each neuron parameter included in the text interaction model in sequence, and determine the predicted probability change value corresponding to each neuron for this privacy text unit.

[0099] As Figure 7 shown, each neuron included in each FFN (Feed Forward Neural Network) layer of the model is erased in sequence, and the impact on the probability value of outputting the next privacy token before and after erasure is compared. For example, the first sample privacy text can be "Zhang San's phone number: 123456789". First, input the first sample input text "Tell me Zhang San's contact information", and record the predicted probability change value of each neuron for outputting the first privacy token "Zhang" before and after erasure. Then, connect "Zhang" to the first sample input text and input it into the model again, and record the predicted probability change value of each neuron for outputting the second privacy token "San" before and after erasure, and so on until all privacy tokens are processed. That is, for each privacy token, there are M predicted probability change values corresponding to it, where M is the number of neurons.

[0100] Step 604: Based on the obtained set of probability change values corresponding to the first sample privacy text, determine the probability change threshold.

[0101] The set of probability change values corresponding to the first sample privacy text is the set of predicted probability change values respectively corresponding to all privacy tokens. Let the number of privacy tokens be N, and each privacy token corresponds to M predicted probability change values.

[0102] The above probability change threshold can be statistically obtained from the set of probability change values. For example, the average value of the probability change values can be calculated as the probability change threshold.

[0103] Step 605: For each neuron included in the text interaction model, determine a target predicted probability change value that is greater than or equal to the probability change threshold from the N predicted probability change values ​​corresponding to the neuron; determine the number of target predicted probability change values ​​as the privacy impact frequency value of the neuron corresponding to the first sample privacy text; and determine the initial privacy score corresponding to the neuron based on the privacy impact frequency value.

[0104] Wherein, N is the number of private text units contained in the first sample private text, that is, the number of private tokens. After the above steps, for each neuron, N predicted probability change values ​​can be statistically obtained. If there are n values ​​greater than or equal to the probability change threshold, then n can be determined as the privacy impact frequency value of the neuron for the first sample private text.

[0105] It should be understood that this step is performed for each neuron, that is, M neurons can perform this step M times to obtain M initial privacy scores.

[0106] Step 606, for the sample privacy text set included in the privacy category, repeatedly perform the privacy score calculation step multiple times to obtain multiple initial privacy scores corresponding to each neuron.

[0107] The privacy score calculation step is the above-mentioned step 601 to step 605. For each sample privacy text in the sample privacy text set, the sample privacy text corresponds to a sample input text. Using each set of sample privacy texts and sample input texts, multiple initial privacy scores corresponding to each neuron can be calculated. These initial privacy scores reflect the privacy scores of the privacy category.

[0108] Step 607: Calculate the privacy score corresponding to each neuron for the privacy category based on the multiple initial privacy scores.

[0109] Specifically, the privacy score corresponding to each neuron for the privacy category can be obtained by summing or averaging multiple initial privacy scores corresponding to each neuron. The correspondence between the position of each neuron and the privacy score can be recorded in a correspondence table.

[0110] This embodiment uses sample privacy texts included in a privacy category to record the predictions of the neurons of the text interaction model before and after adjustment, so that the calculated privacy score can accurately reflect the influence of each neuron on a privacy category. Using the privacy score, the neuron corresponding to the current privacy category can be found more accurately from the text interaction model, which helps to adjust the output text more accurately and reduce the risk of privacy leakage.

[0111] In some optional implementations of this embodiment, such as Figure 8 As shown in the figure, step 603 includes:

[0112] Step 6031: Adjust the parameters of each neuron included in the text interaction model in sequence, and record the difference in the prediction probability of each neuron corresponding to this private text unit before and after the parameter adjustment.

[0113] As Figure 7 shown, for each private text unit (i.e., private token) included in the first sample private text, adjust the parameters of each neuron (such as the output data of the erasure neuron) in sequence, record the prediction probability value before adjustment and the prediction probability value after adjustment of each neuron, and subtract the two prediction probability values to obtain the difference in the prediction probability of each neuron.

[0114] Step 6032: Determine the rank of this private text unit in the set of corresponding candidate text units of the text interaction model, and determine the privacy risk factor of this private text unit based on the rank.

[0115] Specifically, when the text interaction model outputs a predicted token, it can output multiple candidate tokens (i.e., the set of candidate text units) at the same time. If there are private tokens among these candidate tokens, the rank of the private token among the multiple candidate tokens can be determined according to the probability of each candidate token. For example, if the set of candidate text units includes ["Wang": 0.6, "Zhang": 0.3, "Li": 0.1], then "Zhang" is the private text unit, and its rank among the candidate text units is 2, and the privacy risk factor can be determined according to the rank.

[0116] Optionally, the reciprocal of the rank can be used as the privacy risk factor.

[0117] Step 6033: Use the privacy risk factor as a weight to weight the difference in the prediction probability of each neuron corresponding to this private text unit to obtain the change value of the prediction probability of each neuron corresponding to this private text unit.

[0118] That is, for a private text unit and the currently adjusted neuron, the above-mentioned difference in the prediction probability can be multiplied by the above-mentioned weight to obtain the change value of the prediction probability corresponding to this neuron.

[0119] In this embodiment, by calculating the privacy risk factor corresponding to the private text unit and using the privacy risk factor as a weight to weight the difference in the prediction probability, the change value of the prediction probability can introduce the risk situation of the model actually outputting the private text unit, and the change value of the prediction probability can more accurately reflect the association between the neuron and the output private information, thereby improving the accuracy of calculating the privacy score.

[0120] In some optional implementations of this embodiment, such as Fig. 9 As shown, step 605 includes:

[0121] Step 6051: Obtain the privacy risk factor of each privacy text unit contained in the first sample privacy text.

[0122] The privacy risk factor is calculated in step 6032.

[0123] Step 6052: Based on the obtained privacy risk factors, determine the privacy risk value corresponding to the first sample privacy text as the privacy score weight.

[0124] Optionally, the privacy risk value corresponding to the first sample privacy text may be determined as the privacy score weight by summing up or averaging the privacy risk factors of each privacy text unit.

[0125] For example, the privacy score weight can be calculated as shown in the following formula (1):

[0126]

[0127] Where N is the number of private text units in the first sample private text, e i represents the i-th private text unit, Rank(e i ) means e i The rank in the candidate text unit set. That is, the higher the position of a privacy text unit in the candidate text set, the greater the current privacy score weight. The above privacy score weight can represent the influence of neurons on the prediction of privacy tokens when the text interaction model generates prediction tokens.

[0128] Step 6053: Determine the initial privacy score corresponding to the neuron based on the privacy impact frequency value and the privacy score weight.

[0129] Specifically, the privacy impact frequency value and the privacy score weight can be multiplied to obtain the initial privacy score corresponding to the neuron.

[0130] This embodiment calculates the privacy risk value of the first sample privacy text as the privacy score weight, effectively utilizing the association of the privacy risk value with the output privacy information, so that the initial privacy score of each neuron can more accurately represent its impact on the output privacy information, thereby helping to more accurately adjust neurons of a certain privacy category and reduce the probability of outputting privacy information.

[0131] In some optional implementations of this embodiment, the above step 604 may be performed as follows:

[0132] From the probability change value set, a maximum probability change value is determined, and based on a preset coefficient and the maximum probability change value, a probability change threshold is determined.

[0133] For example, the preset coefficient may be 10%, that is, 10% of the maximum probability change value is set as the probability change threshold. Neurons with a value less than the threshold have little impact on the output privacy information.

[0134] This embodiment determines the probability change threshold by setting the coefficient of the maximum probability change value, so that the probability change threshold can be flexibly adjusted. Therefore, when recording the relationship between the privacy category and the neuron, the sensitivity of the neuron to the output privacy information can be more flexibly adjusted, thereby improving the efficiency of the model adjustment.

[0135] In some optional implementations of this embodiment, such as Fig.10 As shown, before the above step 101, the method further includes:

[0136] Step 106, obtaining the second sample privacy text, the second sample input text and the corresponding annotated privacy category.

[0137] Among them, the second sample privacy text and the second sample input text may be the same as or different from the first sample privacy text and the first sample input text. The source of the second sample input text may be a random selection of the training corpus of the large model, or it may be a public corpus, and the screened corpus is not limited to whether it contains privacy information. The marked privacy category may represent the true privacy category of the second sample input text. It should be understood that when the second sample input text is a text that does not contain privacy information, the marked privacy category is a category with no privacy leakage risk.

[0138] Step 107: input the second sample input text into the initial text risk detection model to obtain a predicted privacy category.

[0139] The predicted privacy category may indicate that the privacy category of the second sample input text is name, address, telephone number, etc., or may indicate that the privacy category of the second sample input text is a category with no privacy leakage risk.

[0140] Step 108: Input the second sample input text into the text interaction model, and use the text interaction model to calculate the predicted probability value of each private text unit included in the second sample private text.

[0141] Specifically, this step is similar to the above Figure 6 The execution process of step 602 of the corresponding embodiment is basically the same. For the meaning of the predicted probability value, please refer to Figure 6 The corresponding embodiments are not described in detail here.

[0142] Step 109: For each privacy text unit included in the second sample privacy text, based on the prediction probability value of this privacy text unit, determine the rank of this privacy text unit in the corresponding candidate text unit set of the text interaction model; based on the rank, determine the privacy risk factor of this privacy text unit.

[0143] Specifically, this step is basically the same as the execution process of step 6032 in the corresponding embodiment above. That is, when the text interaction model outputs a predicted token, it can simultaneously output multiple candidate tokens (i.e., the candidate text unit set). If there are privacy tokens among these candidate tokens, the rank of the privacy token among the multiple candidate tokens can be determined according to the prediction probability value of each candidate token. For example, if the candidate text unit set includes ["Wang": 0.6, "Zhang": 0.3, "Li": 0.1], then "Zhang" is the privacy text unit, its prediction probability value is 0.3, and its rank among the candidate text units is 2, so the privacy risk factor can be determined according to the rank. Figure 8 Specifically, this step is basically the same as the execution process of step 6032 in the corresponding embodiment above. That is, when the text interaction model outputs a predicted token, it can simultaneously output multiple candidate tokens (i.e., the candidate text unit set). If there are privacy tokens among these candidate tokens, the rank of the privacy token among the multiple candidate tokens can be determined according to the prediction probability value of each candidate token. For example, if the candidate text unit set includes ["Wang": 0.6, "Zhang": 0.3, "Li": 0.1], then "Zhang" is the privacy text unit, its prediction probability value is 0.3, and its rank among the candidate text units is 2, so the privacy risk factor can be determined according to the rank.

[0144] Generally, the number of candidate text units in the candidate text unit set can be set, that is, set Rank-N, and N is the set number. For example, N = 3.

[0145] Step 110: Based on the obtained privacy risk factors, determine the privacy risk value corresponding to the second sample privacy text.

[0146] Specifically, the method for determining the privacy risk value is basically the same as the method for determining the privacy risk value corresponding to the first sample privacy text in the corresponding embodiment above. For example, the algorithm shown in the above formula (1) can be used to calculate the privacy risk value corresponding to the second sample privacy text. Fig. 9 Specifically, the method for determining the privacy risk value is basically the same as the method for determining the privacy risk value corresponding to the first sample privacy text in the corresponding embodiment above. For example, the algorithm shown in the above formula (1) can be used to calculate the privacy risk value corresponding to the second sample privacy text.

[0147] Step 111: Use the privacy risk value as the weight of a preset loss function, and calculate the loss value representing the error between the predicted privacy category and the labeled privacy category.

[0148] Among them, this loss function can be a loss function for classification, such as the cross-entropy loss function.

[0149] As an example, the weighted loss function is shown in the following formula (2):

[0150]

[0151] Among them, n represents the number of training samples in a batch, λ i represents the privacy risk value of the i-th sample, CE represents the cross-entropy loss function, represents the predicted privacy category, and y i represents the labeled privacy category.

[0152] Step 112: adjusting the parameters of the initial text risk detection model based on the loss value.

[0153] Specifically, the gradient descent method and the back propagation method can be used to iteratively update the parameters of the initial text risk detection model so that the above loss value is gradually reduced. Usually, each iteration requires executing the above steps 106 to 112 once, that is, iteratively training the model using multiple sets of training samples. The adjusted model obtained after each iteration is used as the initial text risk detection model for the next iteration, and the iteration is repeated multiple times until the adjusted initial text risk detection model meets the preset training end condition.

[0154] Step 113: in response to the initial text risk detection model after adjusting parameters meeting a preset training end condition, the initial text risk detection model after adjusting parameters is determined as a trained text risk detection model.

[0155] Specifically, the above-mentioned training end conditions may include but are not limited to at least one of the following: the training time exceeds the preset duration; the number of training times exceeds the preset number of times; the calculated loss value converges; the recognition accuracy rate obtained by testing the model using the test sample exceeds the accuracy threshold.

[0156] This embodiment can make the model parameters more closely match the actual application scenarios by pre-training the text risk detection model. By using the privacy risk value as a weight and performing weighted loss calculation, it can help the text risk detection model analyze which type of input text is more likely to cause the large model to leak privacy information, thereby facilitating the training of a text risk detection model with high prediction accuracy.

[0157] In some optional implementations of this embodiment, such as Fig.11 As shown, step 106 includes:

[0158] Step 1061, obtaining the second sample private text and the initial sample input text.

[0159] The initial sample input text can be any text extracted from the corpus.

[0160] Step 1062, input the initial sample input text into the text interaction model to obtain sample output text.

[0161] Step 1063, matching the second sample private text with the sample output text to obtain a matching result.

[0162] Specifically, all text units in the sample output text and all private text units in the second sample private text may be compared to determine whether the sample output text includes all private text units of the second sample private text.

[0163] Step 1064: Based on the matching result, determine whether the sample output text includes all the private text units of the second sample private text.

[0164] If it is determined that the sample output text includes all the private text units of the second sample private text, step 1065 may be executed; otherwise, step 1066 may be executed.

[0165] Step 1065 , determining the initial sample input text as the positive sample input text, and obtaining the positive sample annotation privacy category set for the positive sample input text.

[0166] The positive sample annotated privacy category may be a manually set annotated privacy category, which indicates that the positive sample input text is a text containing private information and represents a true privacy category.

[0167] Step 1066: determine the initial sample input text as the negative sample input text, and obtain a negative sample annotated privacy category set for the negative sample input text, indicating that the negative sample input text has no privacy leakage risk.

[0168] The negative sample annotated privacy category may be a manually set annotated privacy category, which indicates that the negative sample input text is a text that does not contain privacy information, that is, the negative sample input text has no privacy leakage risk.

[0169] This embodiment utilizes the output text of the text interaction model to classify the samples used in the training text risk detection model to efficiently obtain positive samples and negative samples, thereby helping to improve the efficiency of the training text risk detection model. This embodiment can obtain a large number of positive samples and negative samples, which can improve the predictive generalization ability of the text risk detection model.

[0170] In some optional implementations of this embodiment, such as Fig.12 As shown, step 1063 includes:

[0171] Step 10631, determine the first private text unit in the second sample private text as the private text unit to be matched, and perform the following matching steps (including steps 10632-10633) based on the private text unit to be matched and the initial sample input text.

[0172] As an example, the second sample private text is "Zhang San's phone number: 123456789", and "Zhang" is the current private text unit to be matched.

[0173] Step 10632, input the initial sample into the text input text interaction model to obtain a set of candidate text units located at the first private text unit position of the output.

[0174] As an example, assume that the initial sample input text is "Tell me Zhang San's contact information". After inputting this text into the text interaction model, the set of candidate text units corresponding to the position of the first predicted token in the output can be obtained as ["Okay": 0.7, "No": 0.2, "Sure": 0.1]. Among them, the candidate text units are sorted according to the predicted probability values.

[0175] Step 10633, determine whether there is a privacy text unit to be matched in the set of candidate text units.

[0176] If not, execute Step 10634; if so, execute Step 10635.

[0177] As an example, the privacy text unit to be matched determined for the first time is "Zhang". In the set of candidate text units ["Okay": 0.7, "No": 0.2, "Sure": 0.1] output for the first time, there is no "Zhang".

[0178] Step 10634, add the text unit corresponding to the first probability rank in the set of candidate text units to the end of the initial sample input text to form a new initial sample input text; based on the new initial sample input text, continue to execute the matching step.

[0179] As an example, since there is no "Zhang" in the set of candidate text units output for the first time, the text unit "Okay" corresponding to the first probability rank in the set of candidate text units is added to the end of "Tell me Zhang San's contact information" to form a new initial sample input text "Tell me Zhang San's contact information Okay".

[0180] Then input the new initial sample input text into the above text interaction model. After executing the matching step again, the probability ranks of the second predicted token are output as ["of": 0.7, "ah": 0.2, "oh": 0.1]. It can be found that none of these three characters match the privacy text unit to be matched "Zhang".

[0181] Then select the current first probability rank "of" as the second predicted token output by the text interaction model and execute the matching step again, that is, input the new initial sample input text "Tell me Zhang San's contact information Okay of" into the text interaction model.

[0182] Next, the probability ranks of the third predicted token output by the text interaction model are ["Wang": 0.6, "Zhang": 0.3, "Li": 0.1]. It can be found that among these three characters, "Zhang" matches the privacy text unit to be matched "Zhang". Therefore, after executing Step 10633 above, Step 10635 can be selected for execution.

[0183] Step 10635: Add the privacy text unit to be matched to the end of the initial sample input text to form a new initial sample input text, and determine the next privacy text unit of the privacy text unit to be matched in the second sample privacy text as the new privacy text unit to be matched; based on the new initial sample input text and the new privacy text unit to be matched, continue to execute the matching step.

[0184] Continuing with the above example, the matched "Zhang" is used as the third predicted token output by the text interaction model, rather than choosing "Wang" with the first probability rank as the third predicted token. Next, the input to the text interaction model is "Tell me Zhang San's contact information. Okay, Zhang". In this way, when the privacy text "Zhang San's phone number: 123456789" can be fully matched, the loop ends. At this time, it is considered that the above initial sample input text will cause a privacy leakage risk to the model, and this initial sample input text is used as a positive sample.

[0185] In this embodiment, by adopting an autoregressive method, each predicted token is trained and output, and the next token is predicted based on the predicted token, so that the output text is more matched with the input text, and the accuracy of the output text is higher. Therefore, during the prediction process, it can accurately determine whether there is privacy information in the output text, improving the efficiency and accuracy of extracting positive and negative samples from numerous sample input texts, and further improving the efficiency of training the text risk detection model.

[0186] Fig.13 It is a schematic structural diagram of a privacy leakage risk detection device provided by an embodiment of the present application. Specifically, it includes: a first detection module 1301, configured to use a pre-trained text risk detection model to perform risk detection on the text to be input, and obtain a detection result indicating whether there is a privacy leakage risk and the privacy category of the text to be input; a first interaction module 1302, configured to, if the detection result indicates that there is no privacy leakage risk in the text to be input, input the text to be input into a pre-trained text interaction model to obtain the text to be output; a first adjustment module 1303, configured to, if the detection result indicates that there is a privacy leakage risk in the text to be input, adjust the parameters of the text interaction model based on the privacy category; a second interaction module 1304, configured to input the text to be input into the text interaction model with adjusted parameters to obtain the text to be output; a generation module 1305, configured to generate and output an output text for interacting with the user based on the text to be output.

[0187] In one possible implementation, the generation module includes: a first matching unit, used to perform similarity matching between the text to be output and a preset privacy text library to obtain a similarity value between the text to be output and a target privacy text in the privacy text library, wherein the target privacy text is the privacy text in the privacy text library with the greatest similarity to the text to be output; a first determination unit, used to determine whether the text to be output meets the output conditions based on the similarity value; an adjustment unit, used to adjust the parameters of the text interaction model based on the privacy category if the output conditions are not met, and use the text interaction model after the parameters are adjusted to generate and output an output text that meets the output conditions.

[0188] In one possible embodiment, the adjustment unit includes: a first interaction subunit, used to re-input the text to be input into the text interaction model after adjusting the parameters to obtain new text to be output; a first execution subunit, used to re-execute the step of similarity matching the text to be output with a preset privacy text library based on the new text to be output, until the current text to be output meets the output conditions.

[0189] In a possible implementation, the first adjustment module includes: a second determination unit, used to determine a target neuron corresponding to a privacy category from a text interaction model; and an erasing unit, used to erase an output value of the target neuron.

[0190] In one possible embodiment, the second determination unit includes: a first determination subunit, used to determine a pre-recorded neuron set corresponding to a privacy category from a text interaction model, wherein each neuron in the neuron set corresponds to a pre-counted privacy score, the privacy score represents the degree of influence of the corresponding neuron on the privacy information output by the text interaction model, and the privacy score corresponding to each neuron in the neuron set is greater than or equal to a preset privacy score threshold; a second determination subunit, used to determine a preset proportion of neurons as target neurons from the neuron set according to the size of the privacy score.

[0191] In one possible implementation, the privacy score is obtained in advance based on the following steps: performing the following privacy score calculation steps: obtaining a first sample privacy text belonging to a privacy category and a corresponding first sample input text; inputting the first sample input text into a text interaction model, and calculating the predicted probability value of each privacy text unit contained in the first sample privacy text by the text interaction model; for each privacy text unit contained in the first sample privacy text, adjusting each neuron parameter contained in the text interaction model in turn, and determining the predicted probability change value of each neuron corresponding to the privacy text unit; determining a probability change threshold based on the obtained probability change value set corresponding to the first sample privacy text; for each neuron contained in the text interaction model, determining a target predicted probability change value greater than or equal to the probability change threshold from the N predicted probability change values ​​corresponding to the neuron; determining the number of target predicted probability change values ​​as the privacy impact frequency value of the neuron corresponding to the first sample privacy text; determining an initial privacy score corresponding to the neuron based on the privacy impact frequency value; for the sample privacy text set contained in the privacy category, repeatedly performing the privacy score calculation steps multiple times to obtain multiple initial privacy scores corresponding to each neuron; and calculating the privacy score of each neuron for the privacy category based on the multiple initial privacy scores.

[0192] In one possible implementation, the parameters of each neuron included in the text interaction model are adjusted in turn to determine the predicted probability change value of each neuron corresponding to the private text unit, including: adjusting the parameters of each neuron included in the text interaction model in turn, and recording the predicted probability difference of each neuron corresponding to the private text unit before and after the parameter adjustment; determining the rank of the private text unit in the corresponding candidate text unit set of the text interaction model, and determining the privacy risk factor of the private text unit based on the rank; using the privacy risk factor as a weight, weighting the predicted probability difference of each neuron corresponding to the private text unit, and obtaining the predicted probability change value of each neuron corresponding to the private text unit.

[0193] In one possible implementation, based on the privacy impact frequency value, determining the initial privacy score corresponding to the neuron includes: obtaining the privacy risk factor of each privacy text unit contained in the first sample privacy text; based on the obtained privacy risk factors, determining the privacy risk value corresponding to the first sample privacy text as the privacy score weight; based on the privacy impact frequency value and the privacy score weight, determining the initial privacy score corresponding to the neuron.

[0194] In one possible implementation, a probability change threshold is determined based on a set of probability change values ​​corresponding to the obtained first sample privacy text, including: determining a maximum probability change value from the set of probability change values, and determining a probability change threshold based on a preset coefficient and the maximum probability change value.

[0195] In a possible implementation, the device further includes: a second acquisition module, used to acquire a second sample privacy text, a second sample input text, and a corresponding annotated privacy category; a second detection module, used to input the second sample input text into an initial text risk detection model to obtain a predicted privacy category; a third interaction module, used to input the second sample input text into a text interaction model, and calculate the predicted probability value of each privacy text unit contained in the second sample privacy text by the text interaction model; a first determination module, used to determine, for each privacy text unit contained in the second sample privacy text, the corresponding candidate text of the privacy text unit in the text interaction model based on the predicted probability value of the privacy text unit; The rank in this unit set; based on the rank, determine the privacy risk factor of the privacy text unit; a second determination module, used to determine the privacy risk value corresponding to the second sample privacy text based on the obtained privacy risk factors; a calculation module, used to use the privacy risk value as the weight of a preset loss function to calculate the loss value representing the error between the predicted privacy category and the labeled privacy category; a second adjustment module, used to adjust the parameters of the initial text risk detection model based on the loss value; a third determination module, used to determine the initial text risk detection model after adjusting the parameters as the trained text risk detection model in response to the initial text risk detection model after adjusting the parameters meeting the preset training end conditions.

[0196] In one possible implementation, the second acquisition module includes: an acquisition unit, used to acquire a second sample private text and an initial sample input text; an interaction unit, used to input the initial sample input text into a text interaction model to obtain a sample output text; a second matching unit, used to match the second sample private text with the sample output text to obtain a matching result; a third determination unit, used to determine whether the sample output text includes all the private text units of the second sample private text based on the matching result; a fourth determination unit, used to determine the initial sample input text as a positive sample input text if the sample output text contains all the private text units in the second sample private text, and obtain a positive sample annotated privacy category set for the positive sample input text; a fifth determination unit, used to determine the initial sample input text as a negative sample input text if the sample output text does not contain all the private text units in the second sample private text, and obtain a negative sample annotated privacy category set for the negative sample input text, indicating that the negative sample input text has no privacy leakage risk.

[0197] In one possible implementation, the second matching unit includes: a third determination subunit, which is used to determine the first private text unit in the second sample private text as the private text unit to be matched, and perform the following matching steps based on the private text unit to be matched and the initial sample input text: a second interaction subunit, which is used to input the initial sample input text into the text interaction model to obtain a set of candidate text units located at the position of the first private text unit output; a fourth determination subunit, which is used to determine whether there is a private text unit to be matched in the candidate text unit set; a second execution subunit, which is used to add the text unit corresponding to the first probability order in the candidate text unit set to the end of the initial sample input text to form a new initial sample input text if it does not exist; and continue to perform the matching step based on the new initial sample input text; a third execution subunit, which is used to add the private text unit to be matched to the end of the initial sample input text to form a new initial sample input text if it exists, and determine the next private text unit of the private text unit to be matched in the second sample private text as the new private text unit to be matched; and continue to perform the matching step based on the new initial sample input text and the new private text unit to be matched.

[0198] The privacy leakage risk detection device provided in this embodiment can be as follows Fig.13 The privacy leakage risk detection device shown in can execute all the steps of the above privacy leakage risk detection methods, and thus achieve the technical effects of the above privacy leakage risk detection methods. For details, please refer to the above related description. For the sake of brevity, it will not be repeated here.

[0199] Fig.14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Fig.14 The electronic device 1400 shown includes: at least one processor 1401, a memory 1402, at least one network interface 1404 and other user interfaces 1403. The various components in the electronic device 1400 are coupled together via a bus system 1405. It is understood that the bus system 1405 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 1405 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 1405 is not described in detail. Fig.14 Various buses are labeled as bus system 1405.

[0200] The user interface 1403 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touch pad, or a touch screen).

[0201] It can be understood that the memory 1402 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus random access memory (DRRAM). The memory 1402 described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0202] In some implementations, the memory 1402 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 14021 and an application program 14022 .

[0203] Among them, the operating system 14021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 14022 includes various application programs, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present application can be included in the application 14022.

[0204] In this embodiment, by calling the program or instruction stored in the memory 1402, specifically, the program or instruction stored in the application 14022, the processor 1401 is used to execute the method steps provided by each method embodiment, for example, including:

[0205] A pre-trained text risk detection model is used to perform risk detection on the input text to obtain a detection result indicating whether the text to be input has a privacy leakage risk and a privacy category; if the detection result indicates that the text to be input does not have a privacy leakage risk, the text to be input is input into a pre-trained text interaction model to obtain a text to be output; if the detection result indicates that the text to be input has a privacy leakage risk, the parameters of the text interaction model are adjusted based on the privacy category; the text to be input is input into the text interaction model with adjusted parameters to obtain the text to be output; based on the text to be output, an output text for interacting with a user is generated and output.

[0206] The method disclosed in the above embodiment of the present application can be applied to the processor 1401, or implemented by the processor 1401. The processor 1401 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 1401. The above processor 1401 can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software units in the decoding processor can be executed. The software unit can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1402, and the processor 1401 reads the information in the memory 1402 and completes the steps of the above method in combination with its hardware.

[0207] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPDevice, DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the above functions of the present application, or a combination thereof.

[0208] For software implementation, the technology described above in this article can be implemented by a unit that performs the functions described above in this article. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0209] The electronic device provided in this embodiment may be Fig.14 The electronic device shown in can execute all the steps of the privacy leakage risk detection methods described above, and thus achieve the technical effects of the privacy leakage risk detection methods described above. Please refer to the above related description for details. For the sake of brevity, it will not be repeated here.

[0210] The embodiment of the present application also provides a storage medium (computer-readable storage medium). The storage medium here stores one or more programs. The storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory.

[0211] When one or more programs in the storage medium can be executed by one or more processors, the above-mentioned privacy leakage risk detection method executed on the electronic device side can be implemented.

[0212] The processor is used to execute the program stored in the memory to implement the following steps of the privacy leakage risk detection method performed on the electronic device side:

[0213] A pre-trained text risk detection model is used to perform risk detection on the input text to obtain a detection result indicating whether the text to be input has a privacy leakage risk and a privacy category; if the detection result indicates that the text to be input does not have a privacy leakage risk, the text to be input is input into a pre-trained text interaction model to obtain a text to be output; if the detection result indicates that the text to be input has a privacy leakage risk, the parameters of the text interaction model are adjusted based on the privacy category; the text to be input is input into the text interaction model with adjusted parameters to obtain the text to be output; based on the text to be output, an output text for interacting with a user is generated and output.

[0214] The professionals should also be further aware that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0215] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0216] It should be understood that the terms used in the text are only for the purpose of describing specific example embodiments, and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used in the text may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.

[0217] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.

Claims

1. A privacy leakage risk detection method, characterized in that: The method comprises: Using a pre-trained text risk detection model, risk detection is performed on the input text to obtain a detection result indicating whether the input text has a privacy leakage risk and a privacy category; If the detection result indicates that the text to be input does not have a privacy leakage risk, inputting the text to be input into a pre-trained text interaction model to obtain a text to be output; If the detection result indicates that the text to be input has a privacy leakage risk, adjusting the parameters of the text interaction model based on the privacy category; Inputting the text to be input into the text interaction model after adjusting parameters to obtain text to be output; Based on the text to be output, an output text for interacting with a user is generated and output.

2. The method according to claim 1, characterized in that The step of generating and outputting output text for interacting with a user based on the text to be output includes: Performing similarity matching between the text to be output and a preset private text library to obtain a similarity value between the text to be output and a target private text in the private text library, wherein the target private text is the private text in the private text library with the greatest similarity to the text to be output; Based on the similarity value, determining whether the text to be output meets the output condition; If the output condition is not met, the parameters of the text interaction model are adjusted based on the privacy category, and the text interaction model with the adjusted parameters is used to generate and output an output text that meets the output condition.

3. The method according to claim 2, characterized in that The step of using the text interaction model after adjusting parameters to generate and output an output text that meets the output condition includes: Re-inputting the text to be input into the text interaction model after adjusting the parameters to obtain a new text to be output; Based on the new text to be output, the step of performing similarity matching between the text to be output and a preset private text library is re-executed until the current text to be output meets the output condition.

4. The method according to claim 1, characterized in that: The adjusting the parameters of the text interaction model based on the privacy category includes: Determining a target neuron corresponding to the privacy category from the text interaction model; The output value of the target neuron is erased.

5. The method according to claim 4, characterized in that Determining the target neuron corresponding to the privacy category from the text interaction model includes: Determine, from the text interaction model, a pre-recorded neuron set corresponding to the privacy category, wherein each neuron in the neuron set corresponds to a pre-stated privacy score, the privacy score represents the degree of influence of the corresponding neuron on the privacy information output by the text interaction model, and the privacy score corresponding to each neuron in the neuron set is greater than or equal to a preset privacy score threshold; According to the size of the privacy score, a preset proportion of neurons are determined from the neuron set as the target neurons.

6. The method according to claim 5, characterized in that The privacy score is obtained in advance based on the following steps: Perform the following privacy score calculation steps: Acquire a first sample privacy text belonging to the privacy category and a corresponding first sample input text; Inputting the first sample input text into the text interaction model, and using the text interaction model to calculate a predicted probability value of each private text unit included in the first sample private text; For each private text unit included in the first sample private text, sequentially adjust each neuron parameter included in the text interaction model to determine a predicted probability change value of each neuron corresponding to the private text unit; Determining a probability change threshold based on the obtained probability change value set corresponding to the first sample private text; For each neuron included in the text interaction model, determine a target predicted probability change value that is greater than or equal to a probability change threshold value from the N predicted probability change values ​​corresponding to the neuron; determine the number of the target predicted probability change values ​​as the privacy impact frequency value of the neuron corresponding to the first sample private text; and determine an initial privacy score corresponding to the neuron based on the privacy impact frequency value; For the sample privacy text set included in the privacy category, repeatedly executing the privacy score calculation step multiple times to obtain multiple initial privacy scores corresponding to each neuron; Based on the multiple initial privacy scores, a privacy score of each neuron for the privacy category is calculated.

7. The method according to claim 6, characterized in that The step of sequentially adjusting the parameters of each neuron included in the text interaction model to determine the predicted probability change value of each neuron corresponding to the private text unit includes: Adjusting the parameters of each neuron included in the text interaction model in turn, and recording the difference in the predicted probability of each neuron corresponding to the private text unit before and after the parameter adjustment; Determine the rank of the private text unit in the set of corresponding candidate text units in the text interaction model, and determine the privacy risk factor of the private text unit based on the rank; The privacy risk factor is used as a weight to weight the predicted probability difference of each neuron corresponding to the privacy text unit, so as to obtain the predicted probability change value of each neuron corresponding to the privacy text unit.

8. The method according to claim 7, characterized in that The determining, based on the privacy impact frequency value, an initial privacy score corresponding to the neuron includes: Obtaining a privacy risk factor of each privacy text unit contained in the first sample privacy text; Based on the obtained privacy risk factors, determining a privacy risk value corresponding to the first sample privacy text as the privacy score weight; Based on the privacy impact frequency value and the privacy score weight, an initial privacy score corresponding to the neuron is determined.

9. The method according to claim 6, characterized in that The determining the probability change threshold based on the obtained probability change value set corresponding to the first sample private text includes: A maximum probability change value is determined from the probability change value set, and the probability change threshold is determined based on a preset coefficient and the maximum probability change value.

10. The method according to claim 1, characterized in that Before performing risk detection on the input text using the pre-trained text risk detection model, the method further includes: Obtaining a second sample privacy text, a second sample input text, and a corresponding annotated privacy category; Inputting the second sample input text into the initial text risk detection model to obtain a predicted privacy category; Inputting the second sample input text into the text interaction model, and using the text interaction model to calculate a predicted probability value of each private text unit included in the second sample private text; For each private text unit included in the second sample private text, determine the rank of the private text unit in the corresponding candidate text unit set of the text interaction model based on the predicted probability value of the private text unit; and determine the privacy risk factor of the private text unit based on the rank; Based on the obtained privacy risk factors, determining a privacy risk value corresponding to the second sample private text; Using the privacy risk value as a weight of a preset loss function, calculating a loss value representing an error between the predicted privacy category and the annotated privacy category; Based on the loss value, adjusting the parameters of the initial text risk detection model; In response to the initial text risk detection model after adjusting parameters meeting a preset training end condition, the initial text risk detection model after adjusting parameters is determined as a trained text risk detection model.

11. The method according to claim 10, characterized in that The obtaining of the second sample privacy text, the second sample input text and the corresponding annotated privacy category includes: Obtaining a second sample private text and an initial sample input text; Inputting the initial sample input text into the text interaction model to obtain a sample output text; Matching the second sample private text with the sample output text to obtain a matching result; Based on the matching result, determining whether the sample output text includes all the private text units of the second sample private text; If the sample output text contains all the private text units in the second sample private text, the initial sample input text is determined as a positive sample input text, and a positive sample annotated privacy category set for the positive sample input text is obtained; If the sample output text does not include all the private text units in the second sample private text, the initial sample input text is determined as a negative sample input text, and a negative sample annotated privacy category is obtained for the negative sample input text, indicating that the negative sample input text has no privacy leakage risk.

12. The method according to claim 11, characterized in that The matching the second sample privacy text with the sample output text includes: The first private text unit in the second sample private text is determined as the private text unit to be matched, and the following matching steps are performed based on the private text unit to be matched and the initial sample input text: Inputting the initial sample input text into the text interaction model to obtain a set of candidate text units located at the first private text unit position of the output; Determining whether the privacy text unit to be matched exists in the candidate text unit set; If it does not exist, adding the text unit corresponding to the first probability order in the candidate text unit set to the end of the initial sample input text to form a new initial sample input text; and continuing to perform the matching step based on the new initial sample input text; If it exists, the privacy text unit to be matched is added to the end of the initial sample input text to form a new initial sample input text, and the next privacy text unit of the privacy text unit to be matched in the second sample privacy text is determined as the new privacy text unit to be matched; based on the new initial sample input text and the new privacy text unit to be matched, the matching step is continued.

13. A privacy leakage risk detection device, characterized in that: The device comprises: A first detection module is used to perform risk detection on the input text using a pre-trained text risk detection model to obtain a detection result indicating whether the input text has a privacy leakage risk and a privacy category; A first interaction module is used to input the text to be input into a pre-trained text interaction model to obtain a text to be output if the detection result indicates that the text to be input does not have a privacy leakage risk; A first adjustment module, configured to adjust the parameters of the text interaction model based on the privacy category if the detection result indicates that the text to be input has a privacy leakage risk; A second interaction module, used for inputting the text to be input into the text interaction model after adjusting parameters to obtain the text to be output; A generating module is used to generate and output an output text for interacting with a user based on the text to be output.

14. An electronic device, characterized in that: include: Memory for storing computer programs; A processor is used to execute the computer program stored in the memory, and when the computer program is executed, the privacy leakage risk detection method described in any one of claims 1 to 12 is implemented.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the privacy leakage risk detection method described in any one of claims 1 to 12 is implemented.

Citation Information

Cited By

  • Anti-poisoning federal privacy leakage detection method based on local personalized learning

    CN119377949A

  • Anti-poisoning federated privacy leakage detection method based on local personalized learning

    CN119377949B

  • Text processing method and device, electronic equipment and storage medium

    CN121598392A