Encoder adversarial training, privacy protection method and device for anti-named entity recognition

Through the encoding network training method of anti-named entity recognition, text that is difficult to identify but retains its meaning is generated, which solves the problem of privacy leakage caused by named entity recognition technology and achieves anonymization and privacy protection of text information.

CN112199955BActive Publication Date: 2024-10-15ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011173866.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-28
Publication Date
2024-10-15
Estimated Expiration
2040-10-28

AI Technical Summary

Technical Problem

Named entity recognition technology can easily parse personal information in text, leading to privacy leaks. It is difficult for existing technology to effectively anonymize text information without affecting user understanding.

Method used

The encoding network training method for reverse named entity recognition is adopted, and the original text is encoded into feature text through the encoding network, so that the recognition result of the named entity recognition model is greatly different from the original text label, and the reconstruction network reconstructed text is greatly different from the original text. At the same time, the comparison loss is small to combat named entity recognition and reconstruction capabilities, generating text that is difficult to recognize but retains meaning.

Benefits of technology

Without changing the semantics, it effectively anonymizes text information and prevents named entity recognition technology from extracting personal information, while ensuring human understandability and achieving good text privacy protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112199955B_ABST
    Figure CN112199955B_ABST
Patent Text Reader

Abstract

The embodiment of the specification provides a method and device for training an encoding network and protecting privacy for anti-named entity recognition, the method comprising: obtaining a first sample set, including multiple first samples, each first sample corresponding to a section of original text and a label for a named entity therein; for each first sample, inputting the corresponding original text into the encoding network to obtain its feature text; inputting the feature text into a pre-trained named entity recognition network model to obtain a recognition result for the named entity, and determining the recognition loss according to the recognition result and the label corresponding to the first sample; inputting the feature text into a reconstruction network model to obtain a reconstructed text, and determining the reconstruction loss according to the reconstructed text and the original text; determining the comparison loss according to the original text and the feature text; determining the encoding loss, the encoding loss is positively correlated with the comparison loss, and negatively correlated with the recognition loss and the reconstruction loss; updating the encoding network with the goal of reducing the encoding loss.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the fields of machine learning and data security, and in particular, to a method and device for encoding network training and privacy protection for anti-named entity recognition. Background Art

[0002] As a carrier for humans to record thoughts and language, text often contains rich labor value and important personal information. For example, personal notebooks often record personal names, mobile phone numbers, addresses, companies and other information, and text records of some people's chats also retain privacy information about personal social activities. With the development of artificial intelligence technology, named entity recognition technology can easily parse the proper nouns that appear in these texts, such as names of people, places, names of institutions, time and date, etc. However, this also poses a threat to personal privacy. Named entity recognition technology (NER) can easily parse personal information from a large text, and accurately identify personal names, mobile phone numbers, addresses, companies and other information, thereby obtaining personal privacy. Therefore, how to anonymize sensitive information in text information without affecting the user's convenience in understanding their own text content has become the focus of attention of various companies. Summary of the invention

[0003] The embodiments provided in this specification are intended to provide a more effective privacy protection method for anti-named entity recognition, addressing the deficiencies in the prior art.

[0004] According to a first aspect, a method for training an encoding network for reverse named entity recognition is provided, the method comprising:

[0005] Obtaining a labeled first sample set, which includes a plurality of first samples, each of which corresponds to a section of original text and a label for a named entity in the original text;

[0006] For each first sample, inputting the original text corresponding to the first sample into the encoding network to obtain its feature text;

[0007] Inputting the feature text into a pre-trained named entity recognition network model to obtain a recognition result for the named entity, and determining a recognition loss according to the recognition result and a label corresponding to the first sample;

[0008] Inputting the feature text into a reconstruction network model to obtain a reconstructed text, and determining a reconstruction loss based on the reconstructed text and the original text;

[0009] Determine the comparison loss based on the original text and the feature text;

[0010] determining a coding loss, wherein the coding loss is positively correlated with the comparison loss and negatively correlated with the recognition loss and the reconstruction loss;

[0011] The encoding network is updated with the goal of reducing the encoding loss.

[0012] In one embodiment, the named entity recognition network model includes a third-party named entity recognition network model;

[0013] The step of inputting the feature text into a named entity recognition network model to obtain a recognition result for the named entity includes inputting the feature text into an access interface of a third-party named entity recognition network model to obtain the recognition result.

[0014] In one embodiment, the reconstruction network is a pre-trained reconstruction network.

[0015] In one embodiment, the training method further includes: updating the reconstruction network with the goal of reducing the reconstruction loss.

[0016] In one embodiment, the encoding network is based on one of a convolutional neural network and a long short-term memory model.

[0017] In one embodiment, the reconstruction network model is based on a recurrent neural network.

[0018] In one embodiment, determining the recognition loss according to the recognition result and the annotation label corresponding to the first sample includes determining the recognition loss according to a first text edit distance between the recognition result and the annotation label, wherein the recognition loss is positively correlated with the first text edit distance;

[0019] The determining of the reconstruction loss according to the reconstructed text and the original text includes determining the reconstruction loss according to a second text edit distance between the reconstructed text and the original text, wherein the reconstruction loss is positively correlated with the second text edit distance.

[0020] In one embodiment, determining the comparison loss according to the original text and the feature text includes one of the following:

[0021] Determine the comparison loss based on the user's rating of the content difference between the original text and the feature text;

[0022] The comparison loss is determined based on the mean square error between the encoded values ​​of the original text and the encoded values ​​of the feature text.

[0023] In one embodiment, determining the coding loss includes:

[0024] Subtract the recognition loss and reconstruction loss from the comparison loss to get the encoding loss; or

[0025] The encoding loss is obtained by subtracting the weighted recognition loss and reconstruction loss from the comparison loss.

[0026] According to a second aspect, a method for training an encoding network for reverse named entity recognition is provided, the method comprising:

[0027] Determine the recognition effect of the entity recognition network model;

[0028] When the recognition effect reaches a preset condition, the method described in the first aspect and the encoding network described in the first aspect are executed.

[0029] In one embodiment, determining the recognition effect of the entity recognition network model includes:

[0030] Inputting a predetermined number of labeled text samples into an entity recognition network model, and obtaining a recognition rate of the entity recognition network model for the text samples as the recognition effect;

[0031] The preset condition is that the recognition rate reaches a predetermined threshold.

[0032] According to a third aspect, a privacy protection method for anti-named entity recognition is provided, the method comprising:

[0033] Get the text to be protected;

[0034] The text to be protected is input into the encoding network trained according to the method described in the first aspect, and the encoding network generates the privacy-preserving text.

[0035] In one embodiment, the coding network is deployed on a mobile terminal or a web client.

[0036] According to a fourth aspect, a training device for an encoding network for reverse named entity recognition is provided, the device comprising:

[0037] A sample acquisition unit is configured to acquire a labeled first sample set, which includes a plurality of first samples, each of which corresponds to a section of original text and a label for a named entity in the original text;

[0038] A feature text acquisition unit is configured to, for each first sample, input the original text corresponding to the first sample into the encoding network to obtain its feature text;

[0039] A recognition loss determination unit is configured to input the feature text into a pre-trained named entity recognition network model to obtain a recognition result for the named entity, and determine the recognition loss according to the recognition result and the annotation label corresponding to the first sample;

[0040] A reconstruction loss determination unit is configured to input the feature text into a reconstruction network model to obtain a reconstructed text, and determine a reconstruction loss based on the reconstructed text and the original text;

[0041] A comparison loss determination unit configured to determine a comparison loss based on the original text and the feature text;

[0042] a coding loss determining unit configured to determine a coding loss, wherein the coding loss is positively correlated with the comparison loss and negatively correlated with the recognition loss and the reconstruction loss;

[0043] The coding network updating unit is configured to update the coding network with the goal of reducing the coding loss.

[0044] In one embodiment, the named entity recognition network model includes a third-party named entity recognition network model;

[0045] The reconstruction loss determination unit is configured to input the feature text into an access interface of a third-party named entity recognition network model to obtain a recognition result.

[0046] In one embodiment, the reconstruction loss determination unit is further configured as follows: the reconstruction network is a pre-trained reconstruction network.

[0047] In one embodiment, the reconstruction loss determination unit is further configured to update the reconstruction network with the goal of reducing the reconstruction loss.

[0048] In one embodiment, the encoding network is based on one of a convolutional neural network and a long short-term memory model.

[0049] In one embodiment, the reconstruction network model is based on a recurrent neural network.

[0050] In one embodiment, the recognition loss determining unit is configured to determine the recognition loss according to a first text edit distance between the recognition result and the annotated label, wherein the recognition loss is positively correlated with the first text edit distance;

[0051] The reconstruction loss determining unit is configured to determine the reconstruction loss according to a second text edit distance between the reconstructed text and the original text, wherein the reconstruction loss is positively correlated with the second text edit distance.

[0052] In one embodiment, the encoding network updating unit and the comparison loss determining unit are configured as one of the following:

[0053] Determine the comparison loss based on the user's rating of the content difference between the original text and the feature text;

[0054] The comparison loss is determined based on the mean square error between the encoded values ​​of the original text and the encoded values ​​of the feature text.

[0055] In one embodiment, the coding loss determination unit is configured as follows:

[0056] Subtract the recognition loss and reconstruction loss from the comparison loss to get the encoding loss; or

[0057] The encoding loss is obtained by subtracting the weighted recognition loss and reconstruction loss from the comparison loss.

[0058] According to a fifth aspect, a training device for an encoding network for reverse named entity recognition is provided, the device comprising:

[0059] A recognition effect determination unit configured to determine a recognition effect of the entity recognition network model;

[0060] The training unit is configured to execute the method described in the first aspect and train the encoding network described in the first aspect according to the recognition effect of the entity recognition network model when the recognition effect reaches a preset condition.

[0061] In one embodiment, determining the recognition effect of the entity recognition network model includes: inputting a predetermined number of labeled text samples into the entity recognition network model, and obtaining the recognition rate of the entity recognition network model for the text samples as the recognition effect; the preset condition is that the recognition rate reaches a predetermined threshold.

[0062] According to a sixth aspect, a privacy protection device for anti-named entity recognition is provided, the device comprising:

[0063] A text-to-be-protected acquisition unit, configured to acquire the text-to-be-protected;

[0064] The privacy protection unit is configured to input the text to be protected into the encoding network trained according to the method described in the first aspect; the encoding network generates the privacy protection text.

[0065] In one embodiment, the coding network is deployed on a mobile terminal or a web client.

[0066] According to the seventh aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer executes the methods described in the first, second and third aspects.

[0067] According to the eighth aspect, a computing device is provided, comprising a memory and a processor, wherein executable code is stored in the memory, and when the processor executes the executable code, the methods described in the first, second and third aspects are implemented.

[0068] By utilizing one or more of the methods, apparatuses, computing devices, and storage media in the above aspects, the privacy protection issues brought about by named entity recognition can be solved more effectively. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0070] Figure 1 A schematic diagram showing a coding network training method for reverse named entity recognition according to an embodiment of the present specification;

[0071] Figure 2 A schematic diagram showing the effect of using a client encoder according to an embodiment of this specification;

[0072] Figure 3 A flowchart showing a method for training an encoding network for reverse named entity recognition according to an embodiment of the present specification;

[0073] Figure 4 A flowchart showing a method for training an encoding network for reverse named entity recognition according to another embodiment of the present specification;

[0074] Figure 5 A flowchart showing a privacy protection method for anti-named entity recognition according to an embodiment of this specification;

[0075] Figure 6 A structural diagram of a coding network training device for reverse named entity recognition according to an embodiment of this specification is shown;

[0076] Figure 7 A structural diagram showing a coding network training device for reverse named entity recognition according to another embodiment of the present specification;

[0077] Figure 8 A structural diagram of a privacy protection device for anti-named entity recognition according to an embodiment of this specification is shown; DETAILED DESCRIPTION

[0078] The solution provided in this invention book will be described below in conjunction with the accompanying drawings.

[0079] As mentioned earlier, named entity recognition (NER) technology can easily parse out personal information from a large text, such as accurately identifying a person's name, mobile phone number, address, company, etc. from a personal notebook record or chat message, thus causing personal privacy information problems.

[0080] Taking the above problems into consideration, in the embodiments of this specification, a method and device for encoding network training and privacy protection of anti-named entity recognition are proposed. The basic idea is an anti-named entity recognition (anti-NER) method based on adversarial learning, which can anonymize text by slightly changing the expression or word order of text information without changing the semantics. In layman's terms, the method proposed in this article can output a piece of text, and people can easily understand the content of the text, while machines or NER technology cannot recognize it. The scheme proposed in this article can not only be used as a tool for individual users to anonymize personal text information, but can also be used on websites or APPs as a privacy tool to protect their own text information data, and can also be used in all scenarios containing text information.

[0081] Figure 2 A schematic diagram showing the effect of using a client encoder according to an embodiment of the present specification is shown, wherein the client encoder is a coding network trained according to the training method of the reverse named entity recognition coding network, and is downloaded to the mobile client. Figure 2 It can be seen that the encoder encodes a paragraph of text into a new paragraph of text. From a human perspective, although the new text may be a little strange, its implied meaning can still be understood. However, for the machine recognition model using named entity recognition technology, it is difficult to identify the personal information in this paragraph of text. Therefore, using the encoder to encode the original text can achieve the dual purpose of keeping the machine recognition model using named entity recognition technology confidential, while ensuring that people can still obtain the meaning of the original text from the encoded text, thereby achieving a good text privacy protection effect.

[0082] Figure 1 A schematic diagram of the encoding network training method for anti-named entity recognition according to an embodiment of the present specification is shown. The encoding network (encoder) is used to encode the original text into a feature text. The basic training idea for the encoding network is to make the difference between the recognition result of the text form of the feature text encoded by the encoding network after being recognized by a named entity recognition model and the label of the original text as much as possible, and the difference between the text reconstructed by another reconstruction network and the original text as much as possible. At the same time, the difference between the feature text and the original text calculated by a comparison method (for example, using a user rating method, or an algorithm replacement method) is as small as possible. Mathematically speaking, the loss function of the training of the encoding network is:

[0083] L Encoder =L Compare - ( L Reconstructor +L Recognizer) (1)

[0084] Among them, LCompare is the comparison loss, which is used to measure the difference between the feature text calculated by the comparison method and the original text. Reconstructor is the reconstruction loss, which is used to measure the difference between the text reconstructed by the reconstruction network and the original text. Recognizer L is the recognition loss, which is used to measure the difference between the recognition result of the named entity recognition model and the label of the original text. Encoder is the encoding loss, and the training of the encoding network makes L Encoder Tends to become smaller. In different embodiments, an independently established and trained named entity recognition model or a model established and trained by a third party may be used. It only needs to have the ability to recognize named entities, and this specification does not limit this. In addition, in different embodiments, there may be multiple methods for calculating text differences. For example, in one embodiment, the text edit distance of two texts may be calculated, and in another embodiment, the difference between two texts may be measured based on a mean square error algorithm. This specification does not limit this method for calculating text differences.

[0085] Figure 3 A flowchart of a coding network training method for anti-named entity recognition according to an embodiment of this specification is shown. Figure 3 As shown, the method comprises the following steps:

[0086] In step S31, a labeled first sample set is obtained, which includes a plurality of first samples, each of which corresponds to a section of original text and a label for a named entity in the original text.

[0087] As mentioned above, the original text is, for example, a personal account in a personal notebook, which often records some personal name, mobile phone number, address, company and other information. It is also a text record of a chat, which also retains private information about the individual's social activities. Of course, these are just exemplary descriptions of the original text and are not intended to limit the scope of the embodiments of this specification. In addition, each original text in the first sample set has a corresponding annotation label, and this label itself is also in text form. In one embodiment, the label can be a text that extracts accurate named entity information from the original text. In different examples, the above-mentioned labels can be generated by manual annotation by annotators, or they can be identified by a named entity recognition model with verified accuracy.

[0088] In step S32, for each first sample, the original text corresponding to the first sample is input into the encoding network to obtain its feature text.

[0089] The feature text is a piece of text obtained after encoding the original text. The purpose of obtaining this piece of text is that people can easily understand the text content, but the machine model using entity recognition technology cannot recognize it.

[0090] The encoding network is essentially a model for feature extraction. In one embodiment, the encoding network can be a convolutional neural network model or a long short-term memory model. It can be understood that in different embodiments, the encoding network can be based on different neural network models, such as a Transformer encoder suitable for natural language processing, a BERT model, etc. This specification does not limit the specific implementation of the encoding network.

[0091] In step S33, the feature text is input into a pre-trained named entity recognition network model to obtain a recognition result for the named entity, and the recognition loss is determined according to the recognition result and the annotation label corresponding to the first sample.

[0092] Similar to the labels of the original text, the recognition result itself is also in text form. In one embodiment, the recognition result can be the text of named entity information (often key personal privacy information) in the feature text extracted by the entity recognition network model. By comparing the recognition result and the labels of the original text, the difference between the two is determined, thereby determining the recognition loss, which is used in the subsequent training process, and its specific role will be explained later.

[0093] In one embodiment, the recognition loss can be determined based on the text edit distance between the recognition result and the label of the original text. The text edit distance, also known as the Levenshtein distance, refers to the minimum number of edit operations required to convert two strings (texts) from one to another. The larger the distance, the more different they are. The edit operation may include replacing one character with another, inserting a character, deleting a character,

[0094] In the actual production process, there are named entity recognition models trained by different manufacturers or institutional frameworks (third parties), and their access interfaces are made public. The recognition results can be obtained by passing the samples to be tested into these public interfaces. In one embodiment, the above-mentioned named entity recognition model can use the named entity recognition model trained by a third party. In this case, the feature text can be input into the access interface of the third-party named entity recognition network model to obtain the recognition results.

[0095] In step S34, the feature text is input into the reconstruction network model to obtain the reconstructed text, and the reconstruction loss is determined based on the reconstructed text and the original text.

[0096] The purpose of the reconstruction network model is to restore the original text from the feature text. The purpose of adding the reconstruction network to the training method of this specification is to increase the difficulty of restoring or reconstructing the original text from the feature text output by the encoding network. If the original text can be easily reconstructed from the feature text, it is convenient to use the named entity recognition technology to extract the user's personal privacy information from the reconstructed original text, thereby increasing the difficulty of reconstructing the original text based on the feature text, which can essentially achieve the purpose of anti-named entity recognition technology. In one example, the reconstruction network model can be based on a recurrent neural network, and this specification does not limit the specific form of the reconstruction network model.

[0097] As an independent network, the reconstruction network can be trained independently. For the training of the reconstruction network itself, the goal is to achieve better and better reconstruction results. Therefore, in one embodiment, the reconstruction network can be updated with the goal of reducing the reconstruction loss. In this case, the training of the reconstruction network and the training of the encoding network form a confrontation.

[0098] In another embodiment, the reconstruction network may also be a pre-trained reconstruction network. In this case, the reconstruction network remains fixed throughout the entire process of encoding network training and does not need to be updated.

[0099] The reconstruction loss determined as described above is used for subsequent training of the encoding network. How to specifically use the reconstruction loss will be described later. Here, only how to determine the reconstruction loss is described. Since the reconstruction loss can be regarded as a measure of the difference between the reconstructed text and the original text, in one embodiment, the reconstruction loss can be determined based on the text editing distance between the reconstructed text and the original text.

[0100] In step S35, the comparison loss is determined based on the original text and the feature text.

[0101] In different implementations, different specific methods may be used to measure the text difference between the original text and the feature text to determine the comparison loss. For example:

[0102] According to one embodiment, the comparison loss can be determined based on the user's rating of the content difference between the original text and the feature text. Since the purpose of the comparison loss itself is to measure the difference between the original text and the feature text from the perspective of human understanding, the comparison loss can be determined based on the user's rating of the difference between the original text and the feature text, and the user rating can be obtained by, for example, sending a sample sampling survey to random users. The users here are not limited to the direct users who use this model, and any human user whose difference rating can be obtained can be regarded as a user.

[0103] Although the use of user ratings is most consistent with the design intent of comparative loss, and the comparative loss determined based on them is also the most accurate, user ratings are often not easy to obtain. Therefore, in different implementations, the comparative loss can also be determined algorithmically. According to one implementation, the comparative loss can be determined by measuring the mean square error between the encoded values ​​of the original text and the feature text. The mean square error (MSE) refers to the expected value of the square of the difference between the estimated value and the true value, which can evaluate the degree of change in the data. The smaller the value of MSE, the better the accuracy of the prediction model in describing the experimental data. In this implementation, the mean square error can be used to measure the difference between the original text and the feature text to determine the comparative loss. In an example, the difference between the two can be measured by the following formula:

[0104]

[0105] Among them, xi is the encoding value of the feature text, yi is the encoding value of the original text, and MSE is the mean square error of the encoding values ​​of the original text and the feature text.

[0106] It should be noted that the above step S33 of determining the recognition loss, the step S34 of determining the reconstruction loss and the step S35 of determining the comparison loss can be performed in any reasonable relative order or in parallel. The order described above is only an example.

[0107] On the basis of respectively determining the recognition loss, reconstruction loss and comparison loss, in step S36, the coding loss is determined. The coding loss is positively correlated with the comparison loss and negatively correlated with the recognition loss and the reconstruction loss.

[0108] In one example, the encoding loss is equal to the comparison loss minus the recognition loss and the reconstruction loss, as previously combined Figure 1 The described formula (1) is shown. In another example, the comparison loss can be subtracted from the weighted recognition loss and reconstruction loss to obtain the coding loss. When calculating the coding loss, the recognition loss and reconstruction loss are weighted, and the training process can be adjusted according to the recognition effect and the privacy protection effect of the coding.

[0109] Next, in step S37, the encoding network is updated with the goal of reducing the encoding loss.

[0110] In this step, the training goal of the encoding network is to reduce the encoding loss, which is positively correlated with the comparison loss and negatively correlated with the recognition loss and reconstruction loss. Therefore, the training of the encoding network actually depends on the feedback given by the output of the named entity recognition model and the reconstruction network model. In other words, the training of the encoding network is essentially to counter the recognition ability of the named entity recognition model and the reconstruction ability of the reconstruction network model. Specifically, since the encoding loss is negatively correlated with the recognition loss and the reconstruction loss, the stronger the recognition ability of the named entity recognition model, the smaller the recognition loss will be, and the larger the encoding loss will be; the stronger the reconstruction ability of the reconstruction network, the smaller the reconstruction loss will be, and the larger the encoding loss will be. At the same time, the encoding loss is positively correlated with the comparison loss, that is, the smaller the comparison loss, the smaller the encoding loss. Therefore, the process of training the encoding network with the encoding loss tending to become smaller will increase the recognition difficulty of the encoding result (feature text) for the named entity recognition model (reconstruction difficulty for the reconstruction network), thereby increasing the recognition loss (reconstruction loss for the reconstruction network), and reducing the recognition difficulty for humans, thereby reducing the comparison loss. This is also the essence of adversarial training in this training method.

[0111] In this way, the encoding network trained through the above training process can achieve the effect of keeping the encoded feature text confidential for named entity recognition technology while ensuring that people can still obtain the original meaning from it.

[0112] Figure 4 FIG. 1 is a flowchart showing a method for training an encoding network for reverse named entity recognition according to another embodiment of the present specification. Figure 4 As shown, the method comprises the following steps:

[0113] In step 41, the recognition effect of the entity recognition network model is determined.

[0114] In one embodiment, a predetermined number of labeled text samples can be input into the entity recognition network model, and the recognition rate of the entity recognition network model for the text samples can be obtained as the recognition effect. In other embodiments, the recognition effect can also be determined based on other performance measurement indicators, such as the false recognition ratio, the missed recognition ratio, etc.

[0115] In step 42, when the recognition effect reaches the preset condition, execute Figure 3 The method shown is to train the encoding network.

[0116] In practice, from the perspective of named entity recognition models, their recognition capabilities tend to get better and better. However, as the recognition capabilities of named entity recognition models become stronger, the anti-named entity recognition capabilities of the encoding network become weaker. Therefore, when it is detected that the recognition capabilities of named entity recognition models become stronger, the training of the encoding network can be started adversarially. In one embodiment, after the recognition rate of the entity recognition network model for text samples exceeds a predetermined threshold, or after, for example, the false recognition ratio / missed recognition ratio drops to a certain set value, the encoding network can be trained to detect the error. Figure 3 The method shown starts the training of the encoding network.

[0117] Figure 5 A flowchart of a privacy protection method for anti-named entity recognition according to an embodiment of this specification is shown. Figure 5 As shown, the method includes:

[0118] In step 51, the text to be protected is obtained;

[0119] In step 52, the text to be protected is input according to Figure 3 The method shown in the figure trains an encoding network, which generates privacy-preserving text.

[0120] In one embodiment, the trained coding network can be deployed on a mobile terminal or a web client. The coding network can be deployed on the cloud during the training process. In a specific example, the coding network trained on the cloud is downloaded and deployed on the mobile terminal or the web client. It is easy to understand that since the aforementioned coding network can restart the training process according to the threshold, the retrained coding network can also be redeployed.

[0121] Figure 6 FIG. 2 shows a structural diagram of a coding network training device for reverse named entity recognition according to an embodiment of the present specification. Figure 6 As shown, the coding network training device 600 includes:

[0122] A sample acquisition unit 61 is configured to acquire a labeled first sample set, which includes a plurality of first samples, each of which corresponds to a section of original text and a label for a named entity in the original text;

[0123] The feature text acquisition unit 62 is configured to input the original text corresponding to each first sample into the encoding network to obtain the feature text thereof;

[0124] The recognition loss determination unit 63 is configured to input the feature text into a pre-trained named entity recognition network model, obtain a recognition result for the named entity, and determine the recognition loss according to the recognition result and the annotation label corresponding to the first sample;

[0125] The reconstruction loss determination unit 64 is configured to input the feature text into the reconstruction network model to obtain a reconstructed text, and determine the reconstruction loss according to the reconstructed text and the original text;

[0126] A comparison loss determination unit 65, configured to determine a comparison loss based on the original text and the feature text;

[0127] a coding loss determination unit 66 configured to determine a coding loss, wherein the coding loss is positively correlated with the comparison loss and negatively correlated with the recognition loss and the reconstruction loss;

[0128] The coding network updating unit 67 is configured to update the coding network with the goal of reducing the coding loss.

[0129] In one embodiment, the named entity recognition network model may be a third-party named entity recognition network model; the reconstruction loss determination unit is further configured to input feature text into an access interface of the third-party named entity recognition network model to obtain recognition results.

[0130] In one embodiment, the reconstruction loss determination unit 64 may be further configured as follows: the reconstruction network is a pre-trained reconstruction network.

[0131] In one embodiment, the reconstruction loss determination unit 64 may be further configured to update the reconstruction network with the goal of reducing the reconstruction loss.

[0132] In one embodiment, the encoding network can be based on one of a convolutional neural network and a long short-term memory model.

[0133] In one embodiment, the reconstruction network model may be based on a recurrent neural network.

[0134] In one embodiment, the recognition loss determining unit 63 may be further configured to determine the recognition loss according to the first text edit distance between the recognition result and the annotated label, wherein the recognition loss is positively correlated with the first text edit distance;

[0135] The reconstruction loss determining unit 64 may be further configured to determine a reconstruction loss according to a second text edit distance between the reconstructed text and the original text, wherein the reconstruction loss is positively correlated with the second text edit distance.

[0136] In one embodiment, the comparison loss determination unit 65 may be further configured as one of the following:

[0137] Determine the comparison loss based on the user's rating of the content difference between the original text and the feature text;

[0138] The comparison loss is determined based on the mean square error between the encoded values ​​of the original text and the encoded values ​​of the feature text.

[0139] In one embodiment, the coding loss determination unit 66 may be further configured to obtain the coding loss by subtracting the identification loss and the reconstruction loss from the comparison loss; or

[0140] The encoding loss is obtained by subtracting the weighted recognition loss and reconstruction loss from the comparison loss.

[0141] Figure 7 FIG. 2 shows a structural diagram of a coding network training device for reverse named entity recognition according to another embodiment of the present specification. Figure 7 As shown, the device comprises:

[0142] A recognition effect determination unit 71, configured to determine the recognition effect of the entity recognition network model;

[0143] The training unit 72 is configured to execute when the recognition effect reaches a preset condition. Figure 3 The method shown is to train the encoding network.

[0144] In one embodiment, a predetermined number of labeled text samples may be input into an entity recognition network model, and a recognition rate of the entity recognition network model for the text samples may be obtained as the recognition effect; in this case, the preset condition is that the recognition rate reaches a predetermined threshold.

[0145] Figure 8 The structure diagram of the privacy protection device for anti-named entity recognition according to the embodiment of this specification is shown. Figure 8 As shown, the device comprises:

[0146] A text to be protected acquiring unit 81 is configured to acquire the text to be protected;

[0147] The privacy protection unit 82 is configured to input the text to be protected according to Figure 3 The method shown trains an encoding network; the encoding network generates privacy-preserving text.

[0148] In one embodiment, the trained encoding network can be deployed on a mobile terminal or a web client.

[0149] On the other hand, the present specification provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute any one of the above methods.

[0150] Another aspect of the present specification provides a computing device, including a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, any one of the above methods is implemented.

[0151] It should be understood that the descriptions such as “first” and “second” in this article are only used to distinguish similar concepts for the sake of simplicity of description and do not have any other limiting effect.

[0152] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, firmware or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0153] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.

Claims

1. A training method for an encoding network for anti-named entity recognition, the method comprising: Obtaining a labeled first sample set, which includes a plurality of first samples, each of which corresponds to a section of original text and a label for a named entity in the original text; For each first sample, inputting the original text corresponding to the first sample into the encoding network to obtain its feature text; Inputting the feature text into a pre-trained named entity recognition network model to obtain a recognition result for the named entity, and determining a recognition loss according to the recognition result and a label corresponding to the first sample; Inputting the feature text into a reconstruction network model to obtain a reconstructed text, and determining a reconstruction loss based on the reconstructed text and the original text; Determine the comparison loss based on the original text and the feature text; determining a coding loss, wherein the coding loss is positively correlated with the comparison loss and negatively correlated with the recognition loss and the reconstruction loss; The encoding network is updated with the goal of reducing the encoding loss.

2. The training method according to claim 1, wherein the named entity recognition network model comprises a third-party named entity recognition network model; The step of inputting the feature text into a named entity recognition network model to obtain a recognition result for the named entity includes inputting the feature text into an access interface of a third-party named entity recognition network model to obtain the recognition result.

3. The training method according to claim 1, wherein the reconstruction network is a pre-trained reconstruction network.

4. The training method according to claim 1, further comprising: The reconstruction network is updated with the goal of reducing the reconstruction loss.

5. The training method according to claim 1, wherein: The encoding network is based on a convolutional neural network or a long short-term memory model.

6. The training method according to claim 1, wherein: The reconstruction network model is based on a recurrent neural network.

7. The training method according to claim 1, wherein: Determining a recognition loss according to the recognition result and the annotation label corresponding to the first sample, including determining the recognition loss according to a first text edit distance between the recognition result and the annotation label, wherein the recognition loss is positively correlated with the first text edit distance; The determining of the reconstruction loss according to the reconstructed text and the original text includes determining the reconstruction loss according to a second text edit distance between the reconstructed text and the original text, wherein the reconstruction loss is positively correlated with the second text edit distance.

8. The training method according to claim 1, wherein: The determining of the comparison loss according to the original text and the feature text includes one of the following: Determine the comparison loss based on the user's rating of the content difference between the original text and the feature text; The comparison loss is determined based on the mean square error between the encoded values ​​of the original text and the encoded values ​​of the feature text.

9. The training method according to claim 1, wherein: Determine coding losses, including: Subtract the recognition loss and reconstruction loss from the comparison loss to get the encoding loss; or The encoding loss is obtained by subtracting the weighted recognition loss and reconstruction loss from the comparison loss.

10. A method for training an encoding network for anti-named entity recognition, the method comprising: Determine the recognition effect of the entity recognition network model; When the recognition effect reaches a preset condition, the method according to claim 1 is executed to train the encoding network.

11. The training method according to claim 10, wherein: The determining the recognition effect of the entity recognition network model includes: Inputting a predetermined number of labeled text samples into an entity recognition network model, and obtaining a recognition rate of the entity recognition network model for the text samples as the recognition effect; The preset condition is that the recognition rate reaches a predetermined threshold.

12. A privacy protection method for anti-named entity recognition, the method comprising: Get the text to be protected; The text to be protected is input into the encoding network trained according to the method of claim 1, and the encoding network generates the privacy-preserving text.

13. The privacy protection method according to claim 12, wherein: The coding network is deployed on a mobile terminal or a web client.

14. A training device for an encoding network for reverse named entity recognition, the device comprising: A sample acquisition unit is configured to acquire a labeled first sample set, which includes a plurality of first samples, each of which corresponds to a section of original text and a label for a named entity in the original text; The feature text acquisition unit is configured to input the original text corresponding to each first sample into the encoding network to obtain its feature text ; A recognition loss determination unit is configured to input the feature text into a pre-trained named entity recognition network model to obtain a recognition result for the named entity, and determine the recognition loss according to the recognition result and the annotation label corresponding to the first sample; A reconstruction loss determination unit is configured to input the feature text into a reconstruction network model to obtain a reconstructed text, and determine a reconstruction loss based on the reconstructed text and the original text; A comparison loss determination unit configured to determine a comparison loss based on the original text and the feature text; a coding loss determining unit configured to determine a coding loss, wherein the coding loss is positively correlated with the comparison loss and negatively correlated with the recognition loss and the reconstruction loss; The coding network updating unit is configured to update the coding network with the goal of reducing the coding loss.

15. The training device according to claim 14, wherein the named entity recognition network model comprises a third-party named entity recognition network model; The reconstruction loss determination unit is configured to input the feature text into an access interface of a third-party named entity recognition network model to obtain the recognition result.

16. The training device according to claim 14, wherein the reconstruction loss determination unit is further configured as follows: the reconstruction network is a pre-trained reconstruction network.

17. The training device according to claim 14, wherein the reconstruction loss determination unit is further configured to update the reconstruction network with the goal of reducing the reconstruction loss.

18. The training device according to claim 14, wherein: The encoding network is based on a convolutional neural network or a long short-term memory model.

19. The training device according to claim 14, wherein: The reconstruction network model is based on a recurrent neural network.

20. The training device according to claim 14, wherein: a recognition loss determining unit configured to determine a recognition loss according to a first text edit distance between a recognition result and the annotation label, wherein the recognition loss is positively correlated with the first text edit distance; The reconstruction loss determining unit is configured to determine the reconstruction loss according to a second text edit distance between the reconstructed text and the original text, wherein the reconstruction loss is positively correlated with the second text edit distance.

21. The training device according to claim 14, wherein: The comparison loss determination unit is configured as one of the following: Determine the comparison loss based on the user's rating of the content difference between the original text and the feature text; The comparison loss is determined based on the mean square error between the encoded values ​​of the original text and the encoded values ​​of the feature text.

22. The training device according to claim 14, wherein: The coding loss determination unit is configured as follows: Subtract the recognition loss and reconstruction loss from the comparison loss to get the encoding loss; or The encoding loss is obtained by subtracting the weighted recognition loss and reconstruction loss from the comparison loss.

23. A training device for an encoding network for reverse named entity recognition, the device comprising: A recognition effect determination unit configured to determine a recognition effect of the entity recognition network model; A training unit is configured to execute the method according to claim 1 and train the encoding network according to claim 1 when the recognition effect reaches a preset condition.

24. The training device according to claim 23, wherein: The determining the recognition effect of the entity recognition network model includes: Inputting a predetermined number of labeled text samples into an entity recognition network model, and obtaining a recognition rate of the entity recognition network model for the text samples as the recognition effect; The preset condition is that the recognition rate reaches a predetermined threshold.

25. A privacy protection device for anti-named entity recognition, the device comprising: A text-to-be-protected acquisition unit, configured to acquire the text-to-be-protected; The privacy protection unit is configured to input the text to be protected into the encoding network trained according to the method of claim 1; the encoding network generates the privacy protection text.

26. The privacy protection device according to claim 25, wherein: The coding network is deployed on a mobile terminal or a web client.

27. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 13.

28. A computing device comprising a memory and a processor, characterized in that: The memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 13 is implemented.