Sensitive data identification method and device, equipment, medium and product
Through a target model composed of a generator and a discriminator, combined with a two-layer bidirectional long short-term memory network and a conditional random field, the problem of flexibility and data requirements of existing sensitive data identification methods is solved, and efficient identification of sensitive data in the power system is achieved. and management.
Patent Information
- Application Number
- CN202410735856.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-06-07
AI Technical Summary
Existing sensitive data named entity recognition methods lack flexibility in complex situations and require a lot of manual maintenance. Machine learning-based methods require a large amount of annotated data and feature engineering, making it difficult to effectively identify sensitive data in power systems.
Using a target model composed of a generator and a discriminator, the generator and the discriminator are iteratively trained to identify sensitive data through a double-layer bidirectional long short-term memory network and conditional random fields, combined with preset masking sequences and BIO rules.
It improves the robustness and generalization ability of the model, accurately identifies sensitive data in the power system, reduces the need for manual maintenance, and improves identification efficiency and accuracy.
Smart Images

Figure CN118586393A
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of data security technology, and in particular, to a sensitive data identification method, device, equipment, medium and product. Background Art
[0002] The power system is a complex and large network that contains many key devices, components and data. In order to ensure the safe and reliable operation of the power system, the sensitive data in it needs to be protected and managed. These sensitive data include the model, serial number, manufacturer information of the power equipment, as well as data on equipment status, maintenance records, fault reports, etc. Named entity recognition is a task in natural language processing, which aims to identify entities with specific meanings or representing specific categories from text, such as names of people, places, names of organizations, etc. For power sensitive data, it can also be regarded as a special type of named entity. The power sensitive data identification method for named entity recognition method is mainly used to accurately identify sensitive data from text data related to the power system and mark it as a specific entity category. The purpose of this is to improve the security and management efficiency of power system data and prevent sensitive data from being improperly used, leaked or tampered with. This method usually uses machine learning and natural language processing technology, combined with domain knowledge and professional rules, to build a model or algorithm to identify power sensitive data.
[0003] In the era of big data and the Internet, identifying and protecting the privacy and security of sensitive data has become an important challenge. Currently, there are rule-based methods for named entity recognition of sensitive data, which use manually created rules and patterns to match and extract entities. Although this method is simple and direct, it requires a lot of manual work and maintenance, and may not be flexible enough for complex situations. In addition, there is a machine learning-based method that automatically learns the ability to recognize entities by training models. Common machine learning algorithms include conditional random fields, recurrent neural networks, support vector machines, etc. However, these methods usually require a large amount of labeled training data and use feature engineering to extract relevant features of the relevant entities. In order to solve the above problems, a practical sensitive data recognition method based on named entity recognition is urgently needed. Summary of the invention
[0004] Embodiments of the present invention provide a sensitive data identification method, apparatus, device, medium and product to implement sensitive data identification based on named entity recognition.
[0005] According to one aspect of the present invention, a sensitive data identification method is provided, comprising:
[0006] Get the text to be recognized;
[0007] Input the text to be recognized into a target model to obtain a vector sequence corresponding to the text to be recognized, wherein the target model includes a generator and a discriminator, and the target model is obtained by iteratively training the generator and the discriminator with a target sample set, and the target sample set includes: an input sequence sample and a preset masking sequence corresponding to the input sequence sample;
[0008] Sensitive data is determined based on the vector sequence.
[0009] In some embodiments of the present invention, determining sensitive data according to the vector sequence includes:
[0010] Performing encoding operation on the vector sequence through a two-layer bidirectional long short-term memory network to obtain a feature vector corresponding to the vector sequence;
[0011] Input the feature vector into a conditional random field for prediction to obtain a target label sequence;
[0012] Sensitive data is determined according to the target annotation sequence.
[0013] In some embodiments of the present invention, iteratively training the generator and the discriminator through a target sample set includes:
[0014] Build the generator and discriminator;
[0015] Inputting the input sequence samples in the target sample set into the generator to obtain an output masked sequence corresponding to the input sequence samples;
[0016] Inputting the output masking sequence corresponding to the input sequence sample and the preset masking sequence corresponding to the input sequence sample into the discriminator respectively to obtain a predicted probability value;
[0017] If the predicted probability value does not reach the preset threshold, the operation of inputting the input sequence samples in the target sample set into the generator to obtain the output masking sequence corresponding to the input sequence samples is returned until the predicted probability value reaches the preset threshold to obtain the target model.
[0018] In some embodiments of the present invention, inputting the text to be recognized into a target model to obtain a vector sequence corresponding to the text to be recognized includes:
[0019] Inputting the text to be recognized into the generator to obtain a target masking sequence corresponding to the text to be recognized;
[0020] Input the text to be recognized and the target masking sequence into the discriminator respectively to obtain a target probability value;
[0021] If the target probability value reaches the preset threshold, the target masking sequence is determined as the vector sequence corresponding to the text to be recognized.
[0022] In some embodiments of the present invention, the target annotation sequence is marked according to BIO rules.
[0023] In some embodiments of the present invention, determining sensitive data according to the target annotation sequence includes:
[0024] Elements marked as B and I in the target annotation sequence are determined as sensitive data.
[0025] In some embodiments of the present invention, the text to be recognized includes at least one sentence;
[0026] After obtaining the text to be recognized, it also includes:
[0027] The text to be recognized is preprocessed to obtain characters to be recognized, wherein the preprocessing is to decompose each of the sentences into individual characters.
[0028] According to another aspect of the present invention, there is provided a sensitive data identification device, the device comprising:
[0029] An acquisition module is used to acquire the text to be recognized;
[0030] An input module is used to input the text to be recognized into a target model to obtain a vector sequence corresponding to the text to be recognized, wherein the target model includes a generator and a discriminator, and the target model is obtained by iteratively training the generator and the discriminator with a target sample set, and the target sample set includes: an input sequence sample and a preset masking sequence corresponding to the input sequence sample;
[0031] A determination module is used to determine sensitive data according to the vector sequence.
[0032] In some embodiments of the present invention, the determining module includes:
[0033] An encoding unit, used for encoding the vector sequence through a two-layer bidirectional long short-term memory network to obtain a feature vector corresponding to the vector sequence;
[0034] A prediction unit, used for inputting the feature vector into a conditional random field for prediction to obtain a target label sequence;
[0035] The first determining unit is used to determine sensitive data according to the target annotation sequence.
[0036] In some embodiments of the present invention, the input module includes:
[0037] Establish a unit for establishing the generator and the discriminator;
[0038] A first input unit, configured to input an input sequence sample in the target sample set into the generator to obtain an output masking sequence corresponding to the input sequence sample;
[0039] A second input unit is used to input the output masking sequence corresponding to the input sequence sample and the preset masking sequence corresponding to the input sequence sample into the discriminator respectively to obtain a predicted probability value;
[0040] The execution unit is used to return to the operation of inputting the input sequence samples in the target sample set into the generator to obtain the output masking sequence corresponding to the input sequence samples if the predicted probability value does not reach the preset threshold, until the predicted probability value reaches the preset threshold to obtain the target model.
[0041] In some embodiments of the present invention, the input module includes:
[0042] A third input unit, used for inputting the text to be recognized into the generator to obtain a target masking sequence corresponding to the text to be recognized;
[0043] A fourth input unit, used for inputting the text to be recognized and the target masking sequence into the discriminator respectively to obtain a target probability value;
[0044] The second determining unit is configured to determine the target masking sequence as a vector sequence corresponding to the to-be-recognized text if the target probability value reaches the preset threshold.
[0045] In some embodiments of the present invention, the target annotation sequence is marked according to BIO rules.
[0046] In some embodiments of the present invention, the first determining unit is specifically configured to:
[0047] Elements marked as B and I in the target annotation sequence are determined as sensitive data.
[0048] In some embodiments of the present invention, the text to be recognized includes at least one sentence;
[0049] The device also includes:
[0050] A preprocessing module is used to preprocess the text to be recognized to obtain characters to be recognized, wherein the preprocessing is to decompose each of the sentences into individual characters.
[0051] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0052] at least one processor; and
[0053] a memory communicatively connected to the at least one processor; wherein,
[0054] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the sensitive data identification method described in any embodiment of the present invention.
[0055] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the sensitive data identification method described in any embodiment of the present invention when executed.
[0056] According to another aspect of the present invention, an embodiment of the present invention further provides a computer program product, the computer program product includes a computer program, and when the computer program is executed by a processor, it implements the sensitive data identification method described in any embodiment of the present invention.
[0057] The embodiment of the present invention collects input sequence samples and preset shielding sequences corresponding to the input sequence samples as a target sample set, iteratively trains a generator and a discriminator through the target sample set to obtain a target model, obtains the text to be recognized, inputs the text to be recognized into the target model, obtains a vector sequence corresponding to the text to be recognized, and determines sensitive data according to the vector sequence. Through the technical solution of the present invention, the model can be pre-trained through the generator and the discriminator, which can help the model better adapt to the input of the fine-tuning stage, thereby improving the robustness and generalization ability of the model, and accurately realizing sensitive data recognition based on named entity recognition.
[0058] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0060] Figure 1 is a flow chart of a sensitive data identification method in an embodiment of the present invention;
[0061] Figure 2 is a structural schematic diagram of a sensitive data identification device in an embodiment of the present invention;
[0062] Figure 3 It is a schematic diagram of the structure of an electronic device for implementing the sensitive data identification method of an embodiment of the present invention. DETAILED DESCRIPTION
[0063] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0064] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0065] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0066] Embodiment 1
[0067] Figure 1 is a flow chart of a sensitive data identification method in an embodiment of the present invention. This embodiment is applicable to the case of sensitive data identification in a power system. The method can be executed by a sensitive data identification device in an embodiment of the present invention. The device can be implemented in software and / or hardware, such as Figure 1 As shown, the method specifically comprises the following steps:
[0068] S101, obtaining text to be recognized.
[0069] The text to be identified may be text to be identified whether it contains sensitive data. In this embodiment, the text to be identified may be, for example, power grid data, and the sensitive data may include, for example, the model, serial number, manufacturer information of the power equipment, and data on equipment status, maintenance records, fault reports, etc.
[0070] Specifically, the power grid data text to be identified with sensitive data is obtained, and the power sensitive data is identified, that is, sensitive data is accurately identified from the text data related to the power system and marked as a specific entity category, so as to improve the security and management efficiency of the power system data and prevent sensitive data from being improperly used, leaked or tampered with.
[0071] S102: Input the text to be recognized into the target model to obtain a vector sequence corresponding to the text to be recognized.
[0072] The target model includes a generator and a discriminator. The target model is obtained by iteratively training the generator and the discriminator with a target sample set. The target sample set includes: an input sequence sample and a preset masking sequence corresponding to the input sequence sample.
[0073] The input sequence samples may be original text data used to train the generator and the discriminator, and the preset masking sequence may be sequence samples after masking operations are performed on the basis of the input sequence samples.
[0074] For example, a text data set can be collected in advance, and part of the data can be selected for fine-grained annotation to obtain a target sample set. Specifically, the annotated text can be randomly divided into a training set, a validation set, and a test set in a ratio of 8:1:1. The sizes of the training set, validation set, and test set of the data set can be 10748, 1343, and 1345, respectively, and the average sentence length can be 37.4 words, with the longest being 50 words.
[0075] Specifically, the target model includes two neural networks, a generator and a discriminator, each of which is mainly composed of an encoder (such as a transformer network). The target model is obtained by collecting input sequence samples and preset masked sequences corresponding to the input sequence samples as the target sample set, and iteratively training the generator and the discriminator through the target sample set. The acquired text to be recognized is input into the trained target model, and the vector sequence corresponding to the text to be recognized is output.
[0076] S103. Determine sensitive data according to the vector sequence.
[0077] Specifically, according to the vector sequence corresponding to the text to be recognized, the sensitive data is finally obtained through processing with a two-layer bidirectional long short-term memory network and conditional random field.
[0078] The embodiment of the present invention collects input sequence samples and preset shielding sequences corresponding to the input sequence samples as a target sample set, iteratively trains a generator and a discriminator through the target sample set to obtain a target model, obtains the text to be recognized, inputs the text to be recognized into the target model, obtains a vector sequence corresponding to the text to be recognized, and determines sensitive data according to the vector sequence. Through the technical solution of the present invention, the model can be pre-trained through the generator and the discriminator, which can help the model better adapt to the input of the fine-tuning stage, thereby improving the robustness and generalization ability of the model, and accurately realizing sensitive data recognition based on named entity recognition.
[0079] Optionally, sensitive data is determined based on the vector sequence, including:
[0080] The vector sequence is encoded through a two-layer bidirectional long short-term memory network to obtain the feature vector corresponding to the vector sequence.
[0081] LSTM (Long Short-Term Memory) mainly controls the input and output of the unit by three switches:
[0082] (1) Forget gate: The decision of the cell state ct-1 to the current moment ct is retained. The calculation formula is as follows:
[0083] ft=σ(W hf ·h t-1 +W xf ·X t +b f );
[0084] Among them, WHF corresponds to the input item ht-1, Wxf corresponds to the input item Xt, WHF and Wxf constitute the weight matrix Wf of the forget gate, bf is the bias top, and σ is the activation function.
[0085] (2) Input gate: The decision of saving the current input Xt to ct,
[0086] i t =σ(W hi ·h t-1 +W xi ·X t +b i );
[0087] Among them, W hi is the input gate h t-1 Weight matrix, W xi X is the input gate t The weight matrix, bi is the bias term of the input gate. t The cell state representing the current input is determined by the previous output and the current input.
[0088] gt =tanh(W xg ·X t +W hg ·h t-1 +b g );
[0089] Among them, W xg X is the feature extraction process t The weight matrix, W hg h is the feature extraction process t-1 The weight matrix, b g is the bias term for feature extraction.
[0090] The current cell state ct is:
[0091] c t =f t ⊙c t-1 +g t ⊙i t ;
[0092] Among them, ct-1 represents the previous unit state, ft is the forget gate, g t Represents the current input cell state, and the symbol ⊙ represents element-wise multiplication.
[0093] (3) Output gate: The calculation is as follows:
[0094] o t =σ(W xo ·X t +W ho ·h t-1 +b g );
[0095] Among them, W xo X in the output gate t The weight matrix, W ho h is the output gate t-1 The weight matrix, b g is the bias term for feature extraction.
[0096] The input gate and cell state determine the output of the LSTM neural network.
[0097] h t =o t ⊙tanh(c t );
[0098] Neural networks can automatically extract features based on the distributed representation of words in a text.
[0099] In actual operation, the vector sequence corresponding to the text to be recognized output by the target model can be n-dimensional. The n-dimensional vector sequence is used as the input of each time step of BiLSTM (Bi-directional Long Short-Term Memory, a two-layer bidirectional long short-term memory network composed of a forward LSTM and a backward LSTM) to obtain the hidden state sequence of the bidirectional LSTM layer. After the forward LSTM and the backward LSTM are fully processed, each hidden state sequence is spliced according to the position to obtain a complete hidden state sequence recorded as h t =(h1, h2, ..., h n ), t=1,2,...,n, and then the linear output layer maps the complete hidden state sequence to s dimension (s dimension is the number of label categories in the annotation set). A two-layer BiLSTM is used, and the second layer further models and extracts features from the output of the first layer. The final extracted sentence features are recorded as the sequence after all mappings as the matrix L=(l1,l2,...,l n ), each dimension l of the matrix L u , l v Corresponding to the letter a u Corresponding to each category label b v The fractional value of , where u = 1, 2, ..., n, v = 1, 2, ..., n.
[0100] If we directly choose to classify the score values of each position independently at this time, and select the one with the highest score to get the output result directly, the information between adjacent sentences cannot be considered, the global optimality cannot be obtained, and the classification result is not ideal, so the last layer of the model is introduced.
[0101] The feature vector is input into the conditional random field for prediction to obtain the target label sequence.
[0102] Among them, the target annotation sequence can be the annotation sequence with the highest probability.
[0103] In actual operation, given the conditional random field P(Y|X), the weight vector w and the input sequence (observation sequence) x, we can find the output labeling sequence (i.e., the target labeling sequence) y* with the maximum conditional probability, that is, labeling the observation sequence, which can be transformed into the optimal path problem with the maximum non-normalized probability:
[0104]
[0105] F r (y r-1 ,y r ,x)=(f1(y r-1 ,y r ,x,r),f2(y r-1 ,y r,x,r),...,f J (y r-1 ,y r ,x,r)) T is the local eigenvector, r=1,2,...,n.
[0106] Using the Viterbi algorithm: First find the unnormalized probability of each mark d=1,2,...,p at position 1:
[0107] δ1(d)=w·F1(y0=start, y1=d,x), d=1,2,...,p;
[0108] The recursive formula is used to find the maximum value of the non-normalized probability of each mark q = 1, 2, ..., p at position i, i = 1, 2, ..., n, and the path with the maximum non-normalized probability is recorded:
[0109] δ i (q)=max 1≤j≤p {δ i-1 (j)+w·F i (y i-1 =j,y i =q,x)},q=1,2,..,p;
[0110]
[0111] This process ends when i=n. The maximum value of the non-normalized probability is:
[0112]
[0113] The end point of the optimal path is:
[0114]
[0115] The optimal path endpoint is returned from this:
[0116]
[0117] Find the optimal path, that is, the labeling sequence:
[0118] Determine sensitive data based on the target annotation sequence.
[0119] Specifically, the sensitive words annotated in the target annotation sequence can be extracted and formed into phrases to obtain sensitive data.
[0120] The technical solution of the embodiment of the present invention adopts a double-layer BiLSTM, which can improve the model's modeling ability for longer-range dependencies and capture richer contextual information.
[0121] Optionally, the text to be recognized includes at least one sentence.
[0122] After obtaining the text to be recognized, it also includes:
[0123] Preprocess the text to be recognized to obtain the text to be recognized.
[0124] Among them, the preprocessing is to break each sentence into individual words.
[0125] The text to be recognized may be the text obtained by decomposing each sentence in the text to be recognized.
[0126] In the subsequent operation process, the text to be recognized can be preprocessed to obtain the text to be recognized, and then the sensitive data can be recognized.
[0127] Optionally, the generator and discriminator are iteratively trained using the target sample set, including:
[0128] Create the generator and discriminator.
[0129] The input sequence samples in the target sample set are input into the generator to obtain the output masked sequence corresponding to the input sequence samples.
[0130] The output masked sequence may be a sequence output by the generator after masking the input sequence samples in the target sample set.
[0131] In actual operation, the generator will input token x = [x1, ..., x n ] is mapped into a context vector representation sequence h(x) = [h1,...,h n ]. For a given position t (only position x t = [MASK]), the generator outputs a specific token x generated by the softmax layer t Probability:
[0132] p G (x t |x)=exp(e(x t ) T h G (x) t ) / ∑ x′ exp(e(x′) T h G (x) t );
[0133] Where e represents the token embedding. For a given position t, the discriminator predicts whether the token xt is "real", i.e., it comes from real data rather than the generator distribution, with a sigmoid output layer:
[0134] D(x,t)=sigmoid(w T h D (x) t );
[0135] Train the generator to perform masked language modeling MLM (Masked Language Model). Given an input x = [x1, x2, ..., x n ], MLM first selects a set of random positions (integers between 1 and n) to mask m = [m1, ..., m k ]. The mark in the selected position is replaced by the [MASK] mark: denoted by x masked =REPLACE(x,m,[MASK]).
[0136] Assume that an input sequence sample is x = [1,2,3,4,5,6,7,8,9], and positions 2 and 5 are randomly selected for masking, that is, m = [2,5], then the masked sequence x masked It becomes: x masked =[1,[MASK],3,4,[MASK],6,7,8,9], where the positions replaced by the [MASK] mark are the 2nd and 5th elements respectively.
[0137] The output masked sequence corresponding to the input sequence sample and the preset masked sequence corresponding to the input sequence sample are respectively input into the discriminator to obtain the predicted probability value.
[0138] Among them, the predicted probability value can be understood as the similarity probability between the output masked sequence corresponding to the input sequence sample output by the discriminator and the preset masked sequence corresponding to the input sequence sample.
[0139] In practice, the generator learns to predict the original identities of masked tokens. The discriminator is trained to distinguish between tokens in the data and those that have been replaced by generator samples. Specifically, a corrupted example xcorrupd is created by replacing the masked tokens with generator samples, and the discriminator is trained to predict which tokens in xcorrupd match the original input x. Formally, the model input is constructed as follows:
[0140] m i ~unif{1,n}for i=1to kx masked =REPLACE(x,m,[MASK]);
[0141]
[0142] If the predicted probability value does not reach the preset threshold, the operation of inputting the input sequence samples in the target sample set into the generator to obtain the output masked sequence corresponding to the input sequence samples is returned until the predicted probability value reaches the preset threshold to obtain the target model.
[0143] The preset threshold may be a similarity threshold between an output masking sequence corresponding to an input sequence sample output by the discriminator and a preset masking sequence corresponding to an input sequence sample, which is preset in advance according to actual conditions. This embodiment does not limit the size of the preset threshold.
[0144] In models such as BERT (Bidirectional Encoder Representation from Transformers, a language representation model), the pre-training stage includes a special token called [MASK], which indicates that the model needs to predict the word at that position. However, in the fine-tuning stage, the input text does not contain this [MASK] token. Therefore, in order to make the model better adapt to the input of the fine-tuning stage, the technical solution of an embodiment of the present invention proposes a method of destroying the input, that is, replacing some tokens with samples in the proposed distribution. The advantage of this method is that it can help the model better adapt to the input of the fine-tuning stage, thereby improving the robustness and generalization ability of the model.
[0145] Optionally, the text to be recognized is input into the target model to obtain a vector sequence corresponding to the text to be recognized, including:
[0146] Input the text to be recognized into the generator to obtain the target masking sequence corresponding to the text to be recognized.
[0147] The target masked sequence may be a sequence output by the generator after masking the text to be recognized.
[0148] Specifically, the text to be recognized is input into the generator, and the generator outputs a target masking sequence corresponding to the text to be recognized.
[0149] The text to be recognized and the target mask sequence are input into the discriminator respectively to obtain the target probability value.
[0150] The predicted probability value may be the similarity probability between the target masking sequence corresponding to the text to be recognized output by the discriminator and the text to be recognized.
[0151] Specifically, the text to be recognized and the target masking sequence are respectively input into the discriminator, and the discriminator obtains a target probability value between the target masking sequence corresponding to the text to be recognized and the text to be recognized.
[0152] If the target probability value reaches a preset threshold, the target masking sequence is determined as the vector sequence corresponding to the text to be recognized.
[0153] Optionally, the target annotation sequence is labeled according to BIO rules.
[0154] In this embodiment, entities are marked according to the "BIO" rule: non-entities are marked as "O", the first character of an entity is marked as "B entity class", and the other characters of the entity are marked as "I entity class".
[0155] Optionally, sensitive data is determined based on the target annotation sequence, including:
[0156] The elements marked as B and I in the target annotation sequence are identified as sensitive data.
[0157] Specifically, the element marked as B in the target annotation sequence is determined as the first one in the sensitive data, and the I element immediately following the B element is determined as the last few words in the sensitive data.
[0158] In actual operation, the categories of sensitive data may be preset, for example, may include: organization, name, address, company, government, book, game, movie, position and scene.
[0159] Exemplarily, the target label sequence finally output by the conditional random field in a certain recognition process is expressed as follows: ['B-name','I-name','I-name','O','O','O','O','O','O','O','O','O','O','O','O','B-address','I-address','O','O','O','O','O','O','O','O','O','O','O','O','O','O','O','O','O','O','O','O','O','O','O','O']. Then, the sensitive data finally determined may be: the characters represented by the 1st, 2nd and 3rd elements are sensitive data of the name type, and the characters represented by the 16th and 17th elements are sensitive data of the address type.
[0160] The F1 score is the harmonic mean of the precision and recall, and is a commonly used evaluation indicator used to measure the performance of a classification model. For the target model in the sensitive data identification method of the embodiment of the present invention, the F1 score is calculated for each category (such as address, book, company, etc.), and the results are shown in Table 1:
[0161] Table 1
[0162] category F1 Score Is it sensitive data? address 63.15% yes book 81.45% no company 80.62% no game 85.57% no government 81.31% no movie 85.61% no name 88.22% yes organization 80.53% no position 78.82% yes scene 72.86% no
[0163] From Table 1, we can see the F1 scores of each category, which indicates the performance of the target model in identifying these categories. According to the above provisions, name, address, and position are sensitive data, and the scores of these sensitive data are relatively high, indicating that the target model of the embodiment of the present invention has a good performance in identifying sensitive data.
[0164] The technical solution of the embodiment of the present invention first obtains the power grid data set, pre-processes the data, marks the entities according to the "BIO" rule, and specifies which entities belong to sensitive data; then pre-trains the model through an improved replacement tag detection method based on BERT; then encodes the word vectors in the previous step through a two-layer bidirectional long short-term memory network; then predicts these word vectors through the conditional random field module to obtain the most likely label sequence, and finally determines which data belongs to sensitive data based on the label. The technical solution of the embodiment of the present invention can effectively judge power sensitive data and accurately identify power sensitive data that needs to be protected.
[0165] Embodiment 2
[0166] Figure 2 is a schematic diagram of the structure of a sensitive data identification device in an embodiment of the present invention. This embodiment can be applied to the case of sensitive data identification in a power system. The device can be implemented in software and / or hardware. The device can be integrated in any device that provides the function of sensitive data identification, such as Figure 2 As shown, the sensitive data identification device specifically includes: an acquisition module 201, an input module 202 and a determination module 203.
[0167] Wherein, the acquisition module 201 is used to acquire the text to be recognized;
[0168] An input module 202 is used to input the text to be recognized into a target model to obtain a vector sequence corresponding to the text to be recognized, wherein the target model includes a generator and a discriminator, and the target model is obtained by iteratively training the generator and the discriminator with a target sample set, and the target sample set includes: an input sequence sample and a preset masking sequence corresponding to the input sequence sample;
[0169] The determination module 203 is used to determine sensitive data according to the vector sequence.
[0170] Optionally, the determining module 203 includes:
[0171] An encoding unit, used for encoding the vector sequence through a two-layer bidirectional long short-term memory network to obtain a feature vector corresponding to the vector sequence;
[0172] A prediction unit, used for inputting the feature vector into a conditional random field for prediction to obtain a target label sequence;
[0173] The first determining unit is used to determine sensitive data according to the target annotation sequence.
[0174] Optionally, the input module 202 includes:
[0175] Establish a unit for establishing the generator and the discriminator;
[0176] A first input unit, configured to input an input sequence sample in the target sample set into the generator to obtain an output masking sequence corresponding to the input sequence sample;
[0177] A second input unit is used to input the output masking sequence corresponding to the input sequence sample and the preset masking sequence corresponding to the input sequence sample into the discriminator respectively to obtain a predicted probability value;
[0178] The execution unit is used to return to the operation of inputting the input sequence samples in the target sample set into the generator to obtain the output masking sequence corresponding to the input sequence samples if the predicted probability value does not reach the preset threshold, until the predicted probability value reaches the preset threshold to obtain the target model.
[0179] Optionally, the input module 202 includes:
[0180] A third input unit, used for inputting the text to be recognized into the generator to obtain a target masking sequence corresponding to the text to be recognized;
[0181] A fourth input unit, used for inputting the text to be recognized and the target masking sequence into the discriminator respectively to obtain a target probability value;
[0182] The second determining unit is configured to determine the target masking sequence as a vector sequence corresponding to the to-be-recognized text if the target probability value reaches the preset threshold.
[0183] Optionally, the target annotation sequence is labeled according to BIO rules.
[0184] Optionally, the first determining unit is specifically configured to:
[0185] Elements marked as B and I in the target annotation sequence are determined as sensitive data.
[0186] Optionally, the text to be recognized includes at least one sentence;
[0187] The device also includes:
[0188] A preprocessing module is used to preprocess the text to be recognized to obtain characters to be recognized, wherein the preprocessing is to decompose each of the sentences into individual characters.
[0189] The above-mentioned product can execute the sensitive data identification method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0190] Embodiment 3
[0191] Figure 3 A schematic diagram of the structure of an electronic device 30 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0192] like Figure 3 As shown, the electronic device 30 includes at least one processor 31, and a memory connected to the at least one processor 31, such as a read-only memory (ROM) 32, a random access memory (RAM) 33, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 31 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 32 or the computer program loaded from the storage unit 38 to the random access memory (RAM) 33. In the RAM 33, various programs and data required for the operation of the electronic device 30 can also be stored. The processor 31, the ROM 32, and the RAM 33 are connected to each other through a bus 34. An input / output (I / O) interface 35 is also connected to the bus 34.
[0193] A number of components in the electronic device 30 are connected to the I / O interface 35, including: an input unit 36, such as a keyboard, a mouse, etc.; an output unit 37, such as various types of displays, speakers, etc.; a storage unit 38, such as a disk, an optical disk, etc.; and a communication unit 39, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 39 allows the electronic device 30 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0194] The processor 31 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 31 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 31 performs the various methods and processes described above, such as the sensitive data identification method:
[0195] Get the text to be recognized;
[0196] Input the text to be recognized into a target model to obtain a vector sequence corresponding to the text to be recognized, wherein the target model includes a generator and a discriminator, and the target model is obtained by iteratively training the generator and the discriminator with a target sample set, and the target sample set includes: an input sequence sample and a preset masking sequence corresponding to the input sequence sample;
[0197] Sensitive data is determined based on the vector sequence.
[0198] In some embodiments, the sensitive data identification method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 38. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 30 via the ROM 32 and / or the communication unit 39. When the computer program is loaded into the RAM 33 and executed by the processor 31, one or more steps of the sensitive data identification method described above may be performed. Alternatively, in other embodiments, the processor 31 may be configured to perform the sensitive data identification method in any other appropriate manner (e.g., by means of firmware).
[0199] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0200] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0201] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0202] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0203] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0204] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0205] In one embodiment, the embodiment of the present invention also includes a computer program product, the computer program product includes a computer program, and the computer program implements the sensitive data identification method of any embodiment of the present invention when executed by a processor.
[0206] In the process of implementation, the computer program product can be written in one or more programming languages or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0207] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0208] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A sensitive data identification method, characterized in that: include: Get the text to be recognized; Input the text to be recognized into a target model to obtain a vector sequence corresponding to the text to be recognized, wherein the target model includes a generator and a discriminator, and the target model is obtained by iteratively training the generator and the discriminator with a target sample set, and the target sample set includes: an input sequence sample and a preset masking sequence corresponding to the input sequence sample; Sensitive data is determined based on the vector sequence.
2. The method according to claim 1, characterized in that Determining sensitive data according to the vector sequence includes: Performing encoding operation on the vector sequence through a two-layer bidirectional long short-term memory network to obtain a feature vector corresponding to the vector sequence; Input the feature vector into a conditional random field for prediction to obtain a target label sequence; Sensitive data is determined according to the target annotation sequence.
3. The method according to claim 1, characterized in that: Iteratively training the generator and the discriminator through a target sample set includes: Build the generator and discriminator; Inputting the input sequence samples in the target sample set into the generator to obtain an output masked sequence corresponding to the input sequence samples; Inputting the output masking sequence corresponding to the input sequence sample and the preset masking sequence corresponding to the input sequence sample into the discriminator respectively to obtain a predicted probability value; If the predicted probability value does not reach the preset threshold, the operation of inputting the input sequence samples in the target sample set into the generator to obtain the output masking sequence corresponding to the input sequence samples is returned until the predicted probability value reaches the preset threshold to obtain the target model.
4. The method according to claim 3, characterized in that: Inputting the text to be recognized into the target model to obtain a vector sequence corresponding to the text to be recognized, including: Inputting the text to be recognized into the generator to obtain a target masking sequence corresponding to the text to be recognized; Input the text to be recognized and the target masking sequence into the discriminator respectively to obtain a target probability value; If the target probability value reaches the preset threshold, the target masking sequence is determined as the vector sequence corresponding to the text to be recognized.
5. The method according to claim 2, characterized in that: The target annotation sequence is marked according to BIO rules; Accordingly, determining sensitive data according to the target annotation sequence includes: Elements marked as B and I in the target annotation sequence are determined as sensitive data.
6. The method according to claim 1, characterized in that The text to be recognized includes at least one sentence; After obtaining the text to be recognized, it also includes: The text to be recognized is preprocessed to obtain characters to be recognized, wherein the preprocessing is to decompose each of the sentences into individual characters.
7. A sensitive data identification device, characterized in that: include: An acquisition module is used to acquire the text to be recognized; An input module is used to input the text to be recognized into a target model to obtain a vector sequence corresponding to the text to be recognized, wherein the target model includes a generator and a discriminator, and the target model is obtained by iteratively training the generator and the discriminator with a target sample set, and the target sample set includes: an input sequence sample and a preset masking sequence corresponding to the input sequence sample; A determination module is used to determine sensitive data according to the vector sequence.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the sensitive data identification method described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the sensitive data identification method described in any one of claims 1-7 when executed.
10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the sensitive data identification method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method, system and device for sensitive data identification
CN111191275A
Unstructured sensitive data identification method and device based on ELCTRA-wwm + GAN
CN116108168A
Training method of pre-training language model and entity information identification method and device
CN116432646A
Named entity identification method based on ELCTRA and electric power safety regulation data
CN117807998A
