Machine learning-based models for labeling text data
Patent Information
- Application Number
- JP2024526952
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2021-11-10
- Filing Date
- 2022-11-10
- Publication Date
- 2025-11-17
AI Technical Summary
Current anonymization techniques for sensitive information in text data face challenges such as resource-intensive manual processes, rule-based methods lacking contextual understanding, and difficulties in training machine learning models due to limited labeled data, particularly in one-shot or few-shot learning scenarios, leading to unstable and unbalanced models.
A computer-implemented method using active learning to train machine learning engines by generating synthetic sentences, predicting labels, selecting subsamples for human review, and iteratively updating the training data until performance meets user requirements, incorporating techniques like priming, tokenization, and confusion sampling to enhance model accuracy.
This approach reduces the need for extensive human labeling, improves model performance by focusing on most valuable samples, and ensures balanced representation of classes, resulting in high-accuracy sensitive information labeling.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
[Technical field]
[0001] 1.Technical Field The field of the invention relates to methods for training models using active learning, in particular, machine learning models are trained to label text data.
[0002] A portion of the disclosure of this patent document contains material that is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction of the patent document or the patent disclosure, as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever. [Background technology]
[0003] 2. Description of the Prior Art Anonymization refers to a set of data privacy techniques that hide or obscure sensitive values in textual data by replacing the original values with modified content. Sensitive values in textual data must first be detected and / or labeled.
[0004] Current de-identification techniques use either manual, rule-based, or machine learning approaches. However, manual processes require significant resources. Rule-based processes rely on word patterns, which often need to be fine-tuned for each specific piece of sensitive information, and do not take into account the context of the words.
[0005] Training a machine learning model typically requires a large amount of labeled data, and finding large amounts of data that contain sensitive or identifying information is not easy. As a result, training a machine learning model to de-identify sensitive information is a difficult task.
[0006] Data labeling is an important pre-processing step in developing a machine learning model, because the quality of the labeled data ensures the performance of the machine learning model. Data labeling can be performed in several different ways. The choice of labeling approach can depend on a number of parameters, such as the complexity of the problem, time resources, training data, or the type of machine learning process.
[0007] One or few shot learning is a type of machine learning method in which the training dataset contains limited information. Thus, such a learning process reduces the need to train a model on many similar examples of the same class. However, one or few shot learning is often not sufficient to minimize the labeling effort, and it is still necessary to show the machine learning model the full diversity of examples within a given class.
[0008] Active learning refers to a machine learning process that picks or selects data to learn from and uses a human oracle. As a simplification, humans are asked to provide labels for unlabeled samples that are deemed most valuable in improving the accuracy of the model. However, current active learning models still often result in unstable or imbalanced models, for example, where the training dataset contains classes that are represented by significantly fewer instances than others.
[0009] The present invention addresses the vulnerabilities mentioned above, as well as other problems not mentioned above. Summary of the Invention
[0010] An implementation of the invention is a computer-implemented method for training a machine learning engine to label sensitive information from text data, the method comprising: (i) receiving text data and a list of classes defining sensitive information to be labeled; (ii) generating a set of synthetic sentences and using the set of synthetic sentences to train a machine learning engine; (iii) predicting labels for entities in the sample of text data, selecting a sub-sample of labeled sentences from the sample of text data and providing them to an annotator for review, and updating the training data with the user-reviewed sentences; (iv) training the machine learning engine with the updated training data and repeating step (iii) until the performance of the machine learning engine meets the end-user requirements.
[0011] term Text Sequence Classification Text sequence classification is a term used for the natural language processing (NLP) problem also known as named entity recognition (NER). Given a sentence of text in a given language, text sequence classification attempts to split the sentence into a list of segments (words, subwords, or characters) and apply a class label to each segment.
[0012] Tokenizer Tokenizers are a standard part of NLP. They are responsible for splitting sentences (text sequences) into segments. Simple tokenizers split text sequences into whole words (by splitting on space characters) or single characters. The choice of tokenizer is important because it affects the granularity of the predictions the model makes. The methods and systems described below may use any tokenizer approach.
[0013] segment The unit into which a text sequence is divided. This can be one or more words, subwords, or characters. A subword is a part of a word. For example, the word "cannot" can be split into two subwords "can" and "not" (which are also words in themselves). A word-level tokenizer can leave these as one word, while a subword tokenizer splits a text sequence into smaller components.
[0014] Priming Priming generally refers to deep learning models that are trained on a small number of examples. Such models may achieve poor performance as classifiers (with recall / precision somewhere in the 10% range). However, the priming step is designed to allow the confusion sampler to find enough candidate sentences for annotation and further training.
[0015] sampling Sampling is the technique of selecting a large number of representative examples from a population. Several probability sampling approaches, such as stratified sampling, may be used.
[0016] Entities, classes, and labels These terms are all closely related and, depending on the context, refer to the type of sensitive or identifying information contained in the block of text. These are standard named entity recognition and machine learning terminology.
[0017] Entities / Classes A class is a generalization that can be applied to any classification problem. A class is a category of things that a machine learning model is learning to classify. For image classification, this might be "cat" or "dog", for a sensitive data classification model, these would be "name" or "social security ID". We use entities when talking about instances of classes in text sequence classification, and classes when talking about classifications in general. As another example, the entity "London" is an instance of the class "city".
[0018] label A label indicates whether an entity (made up of one or more segments) belongs to a class.
[0019] Pool A set of samples and / or text sequences that can be annotated.
[0020] Deterministic Finite Automata Regular Expressions A deterministic finite automaton is a well-defined concept from computer science. Representing a given regular expression as a deterministic finite automaton allows the patterns matched by the regular expression (i.e., sequences of characters) to be indexed by ordinal numbers. Also, regular expressions can be represented and analyzed as graphical structures.
[0021] context From the perspective of text sequence processing, the context of a given text segment is the text segments that occur before and after it.
[0022] support Support is the actual number of occurrences of a class in a given dataset. Unbalanced support in the training data may indicate a structural weakness in the reported scores of a classifier and may indicate the need for stratified sampling or rebalancing.
[0023] embedded Natural language word embeddings are responsible for taking a word (that is, its characters) and mapping it to a numerical vector that can be processed by an algorithm (often a neural network). In our case, word embeddings operate on the text segments generated by the tokenizer.
[0024] Center (or center of gravity) Given an embedding that maps text segments to vectors, we can map the set of all segments that belong to the same class into the vector space and compute the center (or centroid) of this set of points.
[0025] Word Span An entity in a text sequence may consist of more than one text segment. For example, the name entity "Kieron Ginamar wrote this" consists of the two words "Kieron" and "Ginamar". A word span is the list of text segments that belong to a given entity.
[0026] confusion matrix In predictive analytics, a confusion matrix (sometimes called a confusion table) is a table with rows and columns that report predicted classes for the corresponding true classes. This allows a more detailed analysis than simply observing the percentage of correct classifications (accuracy). Accuracy can give misleading results when a dataset is unbalanced, i.e. when the number of observations in different classes differs significantly. [Brief description of the drawings]
[0027] Aspects of the invention will now be described, by way of example only, with reference to the following drawings, each of which illustrates features of the invention:
[0028] [Figure 1] 1 shows a table providing an example sentence segmented into words (or tokens) with the classes (1A) and class predictions (1B) that the system is expected to return. [Diagram 2] A diagram showing the active learning cycle is shown. [Diagram 3] An example is given containing sentences with three class predictions. [Figure 4] We show the sentences with the most confused scores for each class pair. [Diagram 5] 1 shows the confusion matrix for a two-class sequence stagger with classes A and B and a null category. [Figure 6] 1 shows the confusion matrix ignoring the diagonal information. [Figure 7] The total number of errors of any type is summed up and the error normalized confusion matrix is shown. [Figure 8] The result is shown as a sum of corresponding cells on either side of the diagonal of the matrix in FIG. [Figure 9] We present a PCA decomposition of the vector representation of the classes representing the sign-off at the end of the message. [Figure 10] Provide a table with a worked example showing how both methods can be combined [Figure 11] 13 shows a screenshot of a custom UI to support the labeling process. [Figure 12] 13 illustrates another example of a screenshot of a custom UI for supporting the labeling process. [Figure 13] Provides an overview of a system that combines regular expressions and neural networks. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0029] A method is presented for training a model using active learning, in which annotators, such as human or machine annotators, are asked to provide labels for the samples that are most valuable in improving the accuracy of the model. In particular, the trained machine learning model can be a named entity recognition model or a sequence classifier for use in an anonymization pipeline.
[0030] Advantageously, using an active learning process reduces the amount of samples that require labeling from a human reviewer. The benefit is that the initial models generated are cheap and time consuming to create. The benefit for end users is that there is less need to customize the model to achieve high accuracy for their unique use case. When customizing a model, end users need to define only the classes that they need to identify.
[0031] This Detailed Description section is divided into the following subsections: 1. High-level approach 2. Priming for active learning 3. Sampler 4. Labeling 5. Further Applications 6. Named entity recognition (NER) combined with neural networks.
[0032] 1. High-level approach Advanced approaches use batch samplers to select sets of records to be labeled by humans to improve performance in client workflows, and more importantly, models used for sequence classification are optimally refined on batches of data (rather than updating one record at a time). The batch size may typically be set to a multiple of the number of combinations of class pairs that the model is learning to classify. Learning one record (or sentence) at a time is inefficient because the sampling process involves evaluating the model on a pool of unlabeled data, and this must be redone each time the model is further trained on samples.
[0033] Figure 1 shows a table providing an example sentence split into words (or segments) ready for analysis by a named entity recognition (NER) process. The second row of the table in Figure 1A is the label the system is expected to return. Figure 1B provides the predicted confidence score of each entity in the sentence for two classes: "person" and "null".
[0034] As an example, "Bob Smith" is a single entity. Provided the correct class or label is expected the model to return in output. The first half of the entity has been assigned the class label B-PERSON, where the B indicates the start of the entity. The second half has the class label "E-PERSON", indicating the end. Both words are part of a single entity with the class label "PERSON".
[0035] The model is first primed with some records for each class we want to detect. That is, the model is refined with a set of data containing the records. The sampler then looks for unlabeled sentences that are likely to contain entities matching these classes. In particular, the sampler identifies sentences where the model cannot distinguish between a pair of classes of a given entity. For example, the sentence "Kieron went to see Paris" contains two entities, "Kieron" and "Paris". "Kieron" is easily identified as a person, but "Paris" in this context could be a city or a person. The entities here could be confused into one of two different classes. The sampler ranks the sentences and draws a fixed batch of the highest rankings (e.g., the most confused ones) from the pool of unlabeled sentences and passes them to the labeler. Empirical studies have shown that errors in labeling cause significant delays in the learning rate, so before using the labeled data to refine the model, the system employs several methods to look for possible errors in labeling and may pass them to reviewers to correct or remove the sentences from consideration.
[0036] Figure 2 gives an overview of the main steps of the active learning cycle. A list of classes is first chosen or selected 21, the list of classes defining the sensitive information that the end user wants to label. Based on the chosen list of classes, a set of synthetic sentences (or word sequences) containing entities belonging to one or more classes is generated 22. Each sentence may then contain one or more examples of sensitive information that the end user wants to label. The generated set of synthetic sentences is then used to prime the machine learning model (this corresponds to initial training) 23. The synthetic sentences are also automatically labeled by the grammar that generates them. The machine learning model is then used for sampling 24, where sentences (or word sequences) in the text data are selected. As described below, sampling can be achieved using different approaches. Labels of entities and / or sentences in the sample of text data are then predicted and provided to an annotator for review 25. The training data is then updated and the model is refined until the end user requirements are achieved.
[0037] A sentence, such as a generated synthetic sentence or a sentence selected from the original text data, generally includes a text sequence of words or segments that provide context, usually including at least two words or segments, but not necessarily including a subject, verb, or predicate.
[0038] As shown in Figure 2, an outlier detector may then be used to identify mislabeled sentences 26. The machine learning model may then be refined using the newly labeled and reviewed sentences 27. Recently labeled (and reviewed) sentences are then added to the training data 28 and the model may be further refined 29. Steps 27 and 29 may be performed using different learning rates. Alternatively, one or both of steps 27 and 29 may be performed.
[0039] 2. Priming for active learning 2.1 Handling new entities The output layer of the neural network is fixed. This means that the number of different entities that the sequence classifier can tag is fixed. It is not non-trivial to add additional output classes to an existing network, since some of the previous layers of the neural network may need to be modified. To avoid this, the initial models provided have a set number of entities in the output. In most cases, these correspond to standard entities that all clients need to detect. Since it is not possible to predict all possible entities that a user may need to detect, many outputs of the network are reserved for unused custom entities.
[0040] Custom entities have placeholder names such as "CUST-1", "CUST-2", etc. When a user of the system needs to add a new entity, the system relabels the next unused custom entity and uses it when training the model.
[0041] 2.2 Priming the Active Learning Cycle To improve detection of a new entity (e.g., a reservation reference), we first need to know what the system looks like. Model refinement is when a trained model is further trained using a new and different training set, usually with the goal of fine-tuning it to handle a new task. If a model is refined using a small number of examples of a new entity, it will be able to detect more examples in a pool of unlabeled sentences.
[0042] for example, The booking reference will look like this: "BK-AR100002323" The unlabeled sentence is as follows: 1. "Time until delivery to SW31AB" 2. "Payable to GB29 NWBK 6016 1331 9268 19" 3. "I ordered a new synthesizer keyboard last week, but was unable to get a delivery confirmation. The reservation reference is BK-AZ100002320." 4. "Reservation reference: BK-AR100002323" 5. "My name is Robert Smith."
[0043] If the model has already learned that a reserved reference is alphanumeric, similar patterns will generate a prediction for that class label. The closer the pattern in the unlabeled sentence is to known examples, the higher the confidence of the prediction. Initially, if the model has seen few examples of the new entity, the example in the unlabeled sentence will generate a low confidence score. The more examples there are, the stronger the confidence the model will generate, for example, a word in the sentence that is similar to it. If the model has not seen any examples before, the system will rely on random sampling for its initial iterations. Empirical results show that this makes learning minority classes very slow. In the above example, "BK-AR100002323" has already been seen by the model at the time of priming. This word receives a high confidence level prediction of the new class.
[0044] In the following sections, we present three methods for priming the active learning process with examples of new entities.
[0045] 2.2.1 Priming with synthetic sentences This section describes a system that allows customers to define synthetic sentences to prime the active learning process. The technique uses a combination of grammar rules or models, lookup lists, and regular expressions. These synthetic sentences can be self-labeled.
[0046] A set of synthetic sentences is generated to mimic real data and includes keywords. Keywords are entities that belong to a set of classes that the end user wants to anonymize. For example, the end user may want to remove a name or a city from a certain text data. The generated set of sentences will then include different examples of names or cities with various contexts. Thus, the model can learn how to distinguish between names and cities in order to anonymize the text data.
[0047] Synthetic sentences are generated based on grammar rules or models to generate sequences of words or tokens in a context.
[0048] We now describe an example in which the system uses a combination of NLTK (Natural Language Toolkit) grammar files and a sensitive term generator that can be either regular expressions (to generate pattern-based identifiers such as reserved references) or lookup lists (e.g., names of people and places), or a combination of the two (e.g., generating email addresses).
[0049] An NLTK grammar defines the branching structure of all possible sentences. An example grammar is shown below. contactme -> contact-action me a message at contact | you can contact-action me at contact | this is name ',' contact-action me at contact | at contact | my email is contact contact-action -> 'send' | 'drop' this->'this' is->'is' me -> 'me' my->'my' a -> 'a' you -> 'you' can -> 'can' at->‘at’|‘on’ email->‘email’|‘email address’|‘e-mail’|’e-mail address’ message->‘message’|‘note’|‘email’|‘mail’ contact->‘ <email-split> ’|‘ <email-nosplit> ’|‘ <eml-account> ’‘ <eml-at> ’‘ <eml-domain>’ name->‘ <firstname>'
[0050] Words in quotes are terminal nodes, words without quotes are nodes that need to be expanded and refer to later lines of the grammar. Words in square brackets are generators. A sentence generator takes a list of generators and a grammar file and generates all possible sentences according to the grammar (i.e. all possible branches), with a configurable number of calls to the generators, i.e. each different sentence n versions of it are created with different randomly generated permutations.
[0051] For example, a sentence with a single grammar: "My name is <name>If you define "is", the user will request two versions of each sentence, then <name>Two sentences are produced by calling the generator twice. If the generator is a regular expression generator, a new secure random number is passed to the regular expression automaton representation for each requested version of the sentence. This ensures that each version of the sentence gets a randomly selected example of the entity. If the generator is a lookup, a randomly selected value from the lookup list is chosen each time. The generator is also assigned a class label. If the generator returns multiple words, each word is labeled as part of the span with its class label. If multiple generators with the same class label are adjacent to each other with no separating unlabeled words, the span spans all of them. In the above grammar, ' <eml-account> ’‘ <eml-at> ’‘ <eml-domain>' are all email generators, so the span starts with the account generator and ends with the domain generator, and all the words receive the same entity label.
[0052] Algorithm Overview The user passes in a grammar file, a list of generators (such as regular expressions for reserved references, or name lookup lists), and a count n (to determine the number of versions of each sentence). 1. Make sure that all generators defined in the grammar are configured correctly 2. The Natural Language Toolkit (NLTK) generates all the different sentences possible under the provided grammar 3. For each sentence, create n copies of the sentence by calling each generator n times. 4. The result of the above is a sequence of words with class labels, which is converted into a data format such as the CoNLL-X format (as defined by the annual Natural Language Learning conference) or some other labeled data format.
[0053] Additionally, typos in the generated text may be included to introduce noise into the synthetic data.
[0054] Additionally, the sentences may be generated in different languages. The language may also be automatically selected depending on the class of interest. For example, an end user may want to identify or classify UK and Spanish social security numbers. Thus, the sentences may be generated in both English and Spanish. The language may also be selected based on the type of original text data to be analyzed.
[0055] Additionally, the system may also select appropriate grammar rules based on the type of original text data to be analyzed. For example, the original text data may include Twitter data. Thus, synthetic sentences are generated to mimic the actual Twitter data.
[0056] 2.2.2 Priming with the Vault A token vault may be used for consistent masking, where masking refers to the process of replacing sensitive values with non-sensitive values, i.e., tokens. However, every time a sensitive value is encountered, the same non-sensitive value is used for the replacement (hence consistent). In vault-based masking, a vault database may store tokens corresponding to sensitive values as well as non-sensitive values. An active learning (AL) system only requires the original sensitive value.
[0057] Each entity vault is used to create single (or a few) word-labeled sentences. These single words provide a contextless representation of the identifier, but the large size of the vault means that it can capture a wide variety of examples. For pattern-based identifiers (e.g., reservation references), the model quickly learns a representation of the pattern in the character-level encoding used by the model.
[0058] Next, an example of the algorithm is provided. CoNLL format files are space-delimited columns consisting of words and labels with sentences separated by blank lines. The system creates JsonL or CoNLL files from the vault for use in model priming. An example of a CoNLL sentence is shown below. For example, Kieron B-PER Ginamar E-PER says 0 hello 0
[0059] For a file full of a single value retrieved from the token vault, the system first tokenizes the raw value to split the value into its component words. Consider the following zip code example: SW1 B-ZIP 1AA E-ZIP SW32ZP S-ZIP
[0060] If masking results in more than two words (as in the first example above), the system creates multi-word sentences with all word parts of the same class, otherwise each entry in the vault will be a single word sentence.
[0061] Each token vault is associated with an entity class. To prime an active learning model for a given class, we do the following: 1. Select all vaults associated with the target class 2. Concatenate all values and remove duplicates 3. [Optional] Take a random sample of size n 4. Tokenize all values in the sample and split them into words. 5. Create a CoNLL file as above, with one sentence for each value in the Token Vault.
[0062] Once the CoNLL files for all target classes are ready, the model can be refined for up to 50 epochs on the complete set of sentences.
[0063] 2.2.3 Priming by Vaultless Masking As techniques are developed for consistent, reversible masking without using a vault to manage consistency, it becomes clear that watermarks can be embedded directly into the masked data without requiring the use of a vault. Vault-less masking has many advantages, especially in distributed deployments where a centralized vault cannot be invoked. However, no vault is involved.
[0064] Instead, an active learning system can be primed using the constructs of vaultless masking. In order to generate consistent masking, embed watermarks, and generate formats that resemble the input, vaultless masking requires the user to provide a regular expression that describes any constraints on the input. For example, if a UK National Insurance number needs to be masked using vaultless technology, the regular expression would indicate that the input consists of two letters followed by three pairs of digits, and finally a single character, optionally separated by a space.
[0065] In this case, the system uses regular expressions directly from the vaultless configuration to generate a sample of random strings that match. The sample size must be smaller than when using vaults, because the pattern does not necessarily represent the actual distribution of values.
[0066] 2.3 Active Learning The priming method defines a starting point for training a machine learning model, such as a sequence tagger. The active learning process looks for these words in context to see how (if at all) the context affects the label. This model is then used to predict the class of samples from unlabeled text sequences.
[0067] A sequence tagger does not output a single class label, but actually outputs probabilities for every single class. For example, a word might be considered by the model to be 75% likely to be a place name and 25% likely to be a company name. When two entities have similar representations in their word embeddings, they are "confused", meaning that the probabilities for each class are often similar. A "confusion sampler", described below, can look for examples where this occurs, and a human oracle teaches the model how to distinguish between them.
[0068] If the context influences the meaning of words in a text sequence, this will be reflected in the predictions made by the model during the sampling process and thus in the samples generated.
[0069] 3. Sampler Pairwise Confusion Sampler In this section, we describe a family of samplers used in active learning systems that are designed to outperform confidence or entropy samplers in finding "good" examples of sentences (or word sequences) for training and refining NER models.
[0070] Advantageously, the developed pairwise confusion sampler provides a balanced and smooth learning curve and improves the performance of the minority classes by ensuring that each class has equal representation compared to the other classes.
[0071] In comparison, existing samplers struggle with either representation or bias of minority classes. For example, entropy samplers often favor examples with high information gain and can perform poorly on minority classes. Although simpler, confidence samplers can achieve unstable behavior, but precision and recall become anti-correlated.
[0072] The pairwise confusion sampler scans the text for examples where model predictions for pairs of classes are confused with each other (e.g., currency amounts are confused with dates). By focusing on labeling the most confused examples, we rapidly improve accuracy as the model learns to assign correct classes to entities represented in segments of text sequences.
[0073] Algorithm Overview 1. Tokenize all sentences in the pool (split them into a sequence of "words") 2. The model makes predictions for all sentences in the pool and returns confidence scores for each class of every word. 3. Sum the confidence scores for each "part" of each word's class label (start, interior, end, or singleton). 4. For each pair of [entity and associated] classes, a. Find the difference between the sums of the confidence scores of the two classes b. If the confidence score is below a certain threshold (e.g. 0.01), set the difference to infinity 5. For all words, rank the sentences with the smallest confidence difference for each class pair (e.g., determine confusion scores as described below) 6. Run a round robin on each class pair and select the most confused sentences (as indicated by the ranking in the previous step) for each class pair to create samples of the desired size. Each variation of the sampler has a different method for choosing the ranking sentences. a. If there are no confused sentences for the class pair, choose a random sentence ranked infinitely.
[0074] Therefore, the method also includes a step of generating a "confusion score" indicating the confusion of the labels between the two different classes. To generate the confusion score, the method relies on the classifier outputting a confidence score for each possible label or class. For example, consider a classifier that can predict four classes (cat, dog, rabbit, other) and is calibrated to output a confidence (or probability) for each label. For a given entity, the confidence scores are as follows: cat=0.4, dog=0.1, rabbit=0.4, and other=0.1, then the confusion score between cat and rabbit is the difference in the confidence scores between the two labels, 0.4-0.4=0. This is the most confused two-label situation, where the classifier could not decide whether the input was a cat or a rabbit. The higher the absolute confusion score, the less confused the classifier is for the input (in terms of the two classes). The confusion score may be calculated pairwise for all possible combinations of predicted classes.
[0075] Figure 3 shows an example containing a sentence with three class predictions. The word "Paris" is somewhat confused for a person. When generating a person / place confusion score, "Paris" is the closest word to both scores, so we report this difference as the confusion score for this sentence's class pair. Class predictions below a threshold are ignored, so the difference between the person in Paris and the company is not returned as the most confused score for the person / company.
[0076] Figure 4 shows a table showing the sentences with the most confused scores for each class pair. "Kieron cycled from London to Paris" has a person / place score of 0.4, the difference between the predictions for person and place in Paris. This is a smaller score than the difference between the persona and place predictions for any other word. If class pairs cannot be compared because no prediction for one of the pairs exceeds the threshold, a score of infinity is returned.
[0077] When ranking sentences, we can choose the ones with the smallest scores first. For people / places, sentences from London to Paris are ranked the highest. In this context, a human can help improve the model by verifying that Paris actually refers to a city.
[0078] Note that a sentence contains many words, and a single sentence may be highly ranked in multiple class pairs. There may be some words in a sentence that have strong, unambiguous predictions, but still need labels. The resulting sample should have at least n / pc words, where n = sample size and pc = number of class pairs, where the two classes are confused. However, it is possible that some classes contain more examples. The advantage of this approach is that the minority class gets more representation than in a random sample. However, this approach does not ensure that all classes are weighted equally.
[0079] A further variant for implementing the sampling step will now be described.
[0080] Balanced Sampler A balanced sampler can be used that ensures equal representation of each class pair. As an example, in step 6 of the algorithm above, when round-robining the pairs, one can always choose a sentence.
[0081] Weighted Sampler Also, a weighted sampler may be implemented, which does not necessarily pick sentences when round-robining across class pairs. Instead, for each class pair, sentences are picked according to a user-specified proportion. This allows the sampler to prioritize entity classes of particular interest. For example, a model may predict four classes, one class having 99% precision / recall and the other class poorly at 60% - the user may specify a weighting of 33% for the poorly performing class and 0% for the well-performing class.
[0082] Confusion-Matrix Weighted Sampler Weighted samplers require the end user to decide which weight to give each class pair. Because the active learning process is iterative, the confusion matrix from the previous sampling round can be used to determine the weighting for each class pair. Class pairs that are often confused can then be prioritized over class pairs that the model can effectively distinguish.
[0083] Algorithm Overview To create a weighted sampler, the system must first calculate the appropriate weights, and for this it uses the confusion matrix generated when human annotators revised the labels generated by a previous version of the model.
[0084] As an example, Figure 5 provides a confusion matrix for a two-class sequence tagger with classes A and B (e.g., people or places) and a null category (for unidentified words). The diagonal represents true positives ((A,A) and (B,B)) and true negatives (0,0). White boxes correspond to false negatives, dotted boxes correspond to false positives, and diagonal filled boxes are other types of errors (e.g., when a person is confused with a place). The system generates such a matrix when human annotators correct the labels assigned by the sampler.
[0085] When trying to improve the model, we are less interested in places where the model is already right (grey). As shown in Figure 5, the model's call for discrimination is improved by reducing the error on (0,A) and (0,B), and the model's accuracy is improved by reducing the error on (B,A) and (A,B) (see the boxes filled with diagonals) and (A,0) and (B,0) (see the boxes filled with dots). To determine what sentences the sampler should focus on, we ignore the diagonals as shown in Figure 6.
[0086] The system then sums up the total number of errors of any type (in this case 29). Finally, the system normalizes the errors as shown in Figure 7.
[0087] The confusion matrix shows each time a true example of class A is confused with class B, and indicates how many times a true example of class B is confused with class A. The sampler only considers pairs (A, B) and not the order. As a result, the system sums corresponding cells on either side of the diagonal, as shown in Figure 8.
[0088] The sampler then selects sentence combinations where classes A and B are most confused 31%, A and 0 are most confused 45%, and finally B and 0 are most confused 24%. The sampler round robins between class pairs, picking the (A,B) class pair 31% of the time. This is done by randomly inputting a list of 100 Boolean values with 31 true values and 69 false values. For samples of size multiples of 100 this is deterministic, for less than 100 the selected class pair may not accurately reflect the desired mixture.
[0089] The system supports two ways of using these ratios. 1. Use the weights from the previous round (called M N-1 (called M ). This can be delayed, as the model improves after training and refinement on newly labeled data. The confusion matrix we compute corresponds to the model before the active learning training round and used to sample the data. However, that model is refined based on this data, and M N and then use it to generate other samples. 2. A two-phase sampling approach can also be implemented with a balanced sampler that first generates a small sample where all pairs are given equal priority. A human annotator labels this small set. Once a sample of data has been annotated, we have a "ground truth" that can be used to compare with the model's predictions. From this, we obtain a proxy for the model's performance (precision / recall, relevant in this case: confusion matrix). This information is then used to determine what proportions should make up the larger set.
[0090] The second option may often be the recommended mode and therefore may be set as the default behavior.
[0091] Precision and recall are two performance metrics that an end user may be interested in. Recall refers to the proportion of examples of a class that the model correctly labels. 100% recall of a class may be obtained by labeling all entities as that class. Precision is the proportion of entities that the model labels as a class that are actually in that class. In the previous example, if we received 100 recalls, the precision would have been very low. Ideally, both precision and recall may need to be improved. Advantageously, the confusion sampler is configured to improve precision and recall simultaneously.
[0092] If you use the model for anonymization, a high recall rate but low precision is not very useful because low precision means removing more information than you would like. However, if you train the model using active learning, it is useful if the model can flag more examples as likely for a given class.
[0093] In the opposite case, when recall is very low, the sampler will make the set closer to a random sample: for a minority class, it is unlikely that it will contain many examples of that class.
[0094] If the user only wants to improve recall, the desired percentage of sentences can be set by considering only the false negatives highlighted in grey (see Figure 6), i.e. those where the model predicted 0 (not identified) instead of the correct class. This is the recommended option when the model has just started learning new classes.
[0095] When comparing the performance of the model to ground truth information, false negatives can be determined.
[0096] A false negative (for a class) is when the model predicts something other than that class. If you want to improve accuracy for a given task, you need to look at all cases where a class was confused with a model that gave a different prediction. If it is unbalanced, the system uses the confusion matrix to weight the samples (drawing more examples of pairs of classes that the model confuses, instead of pairs that the model does not confuse). For example, if a model often confuses people and places, but never people and phone numbers, the sampler can be weighted to draw many examples of person / place confusion, but no examples of person / phone number confusion.
[0097] As another example, if one is only interested in improving recall, the model can be configured to only look at cases where a person is confused with the null category: precision will not improve much (the model may continue to get the person / place wrong), but recall will improve for people who were previously predicted incorrectly as null.
[0098] Thus, the model may be trained and the training steps repeated until a specific required user-defined performance is achieved. The user-defined performance may include one or more of a predefined recall rate between classes, a precision level, a specific class performance, or a confusion score. Alternatively, the model may be trained until a predefined number of iterations is reached.
[0099] 4. Labeling Poor quality labels cause problems for model training: mislabeled data confuses models, and they require large amounts of correctly labeled data to unlearn potentially contradictory information.
[0100] 4.1 Algorithmic detection of labeling errors In this section, we describe how to detect potential labeling errors and alert human labelers so that they can verify or correct the applied labels. By clustering the labels in an embedding space, we can identify outliers that may not belong to a class.
[0101] Word embeddings, at the front of a named entity recognition model, are responsible for mapping words in a sentence to numbers (vectors) that can be processed by the model. The rest of the model is a bidirectional long-term short-term network that allows it to take into account the context that words have in a sentence. Different embeddings have different properties: basic embeddings only map known words to vectors (e.g. Word2Vec), more complex embeddings work at the character level and can detect subwords, and finally, the most fully featured word embeddings give different vectors for words depending on the context in which they are found (the words on either side).
[0102] As an example, consider the one-hot encoded word embeddings of the following vocabulary: {"cat", "dog", "fish", "badger", "alpaca", out_of_vocabulary}. All words other than cat, dog, fish, badger, and alpaca are mapped to out_of_vocabulary, and all other words are mapped to that particular word. The mapping of words in a sentence to points in the embedding space looks like this: Cat->(1,0,0,0,0,0) Dog->(0,1,0,0,0,0) Rabbit->(0,0,0,0,0,1) Frog->(0,0,0,0,0,1)
[0103] Every word is mapped to a six-dimensional vector. Words such as "rabbit" and "frog" that are not in the vocabulary are mapped to the same vector. In practice, one-hot encoded embeddings are never used; for useful vocabulary sizes, the dimensionality of the vector quickly becomes unusable. Most modern embeddings, from Word2Vec to the state-of-the-art, are more compact learned representations. How they are generated is outside the scope of this document.
[0104] A stacked embedding is when multiple embeddings are concatenated (Akbik, Alan, Duncan Blythe, and Roland Vollgraf. "Contextual string embeddings for sequence labelling." In Proceedings of the 27th international conference on computational linguistics, pp. 1638-1649. 2018). The resulting vector for each word consists of the representation from one embedding concatenated with the representation from the other. For example, consider an additional one hot embedding for the vocabulary {"Rabbit", "Frog", out_of_vocabulary}. Concatenating this with the previous example, we get the following representation for the word rabbit: (0,0,0,0,0,1,1,0,0). This is a nine-dimensional vector. The sixth dimension has a value of 1, meaning "rabbit" is not in the first vocabulary. The seventh dimension has a value of 1, meaning "rabbit" is the first word in the second vocabulary. "Cat" has the representation of the concatenated embedding (1,0,0,0,0,0,0,0,1), where the first six dimensions match the representation of the first embedding and the last dimension has a value of 1, and "cat" is not in the second embedding vocabulary. As an example, for English outlier detection, the system uses both Flare News Forward and News Backward context embeddings, which produces a stacked embedding with dimension 4096.
[0105] The Flare framework is built on top of Pytorch and makes it easy to compute embeddings for each word in a sentence: sentences can be passed one-by-one to the embed() call for a stacked embedding.
[0106] FIG. 9 shows a PCA decomposition (into two dimensions) of word vectors such as an entity labeled as an email.
[0107] To create a cluster for a class of entities, we need a set of sentences containing the entity in context, called support. This can be generated from all known good examples of the class from previous labeling rounds or a small subset. Given a cluster of supports, the system finds the center of this cluster in a given vector space by mapping each word (with its context) using a concatenation of word embeddings and computing the average of all the resulting vectors. With sufficient support, the center of the cluster will represent the entire class, and words that map close to the center are more likely to be members of the class, and words that are further away are more likely to be of a different class.
[0108] Working with word span Sequence prediction differs from single classification models: instead of returning a single class for the entire sentence, our model returns a "span" that covers all the words in the sentence that belong to a single entity. For example, Kieron Guinnamar cycles to Cambridge on the weekend B-PER E-PER 0 0 S-LOC 0 0 0 0 0
[0109] The first two words of a sentence form a span and represent a single entity of the class "person". The system needs to consider the entire span. For simplicity, the system needs to take the average of the embedding vectors of both words to get a vector for the entire span.
[0110] False positives and false negatives For each labeled word in a sentence, the distance from the vector space to the cluster center can be calculated. In the implementation, we use cosine distance. Other metrics include Euclidean distance, Manhattan distance, and Hamming distance, and the appropriate metric to use depends on how similar the sentences are to each other. Since sentences can vary in length, the prototype implementation used cosine distance. The system should ensure that the metric is configurable. If a word is far away from the center, it may be a false positive. We can rank all the labeled words and choose a percentage threshold that is farthest from the cluster center to double check.
[0111] However, this only detects cases where a label has been incorrectly assigned to a word. It does not detect cases where a human labeler fails to assign a class label. To do that, we need to determine false negatives. For each word that has not been given a class label, we also calculate its distance to the cluster center. To double-check, we consider the ones that are closer to the cluster center.
[0112] Algorithm Overview For every word in every sentence: Calculate cluster centers from the support: For all text in the support set: Tokenize sentences into words ●Assign spans to words Embedding sentences using stacked embedding ●About each entity class ● Select all spans of a class and return an embedding vector. 1. If a span of words is found, find the arithmetic mean of the embedding vectors of all the words in the span. 2. Otherwise, return a vector of the words in the span. Compute the arithmetic mean of all the spans of a class. This is the cluster center of this class in the embedding space.
[0113] Each sentence in the pool of labeled data is assigned an ID, and for each ID a double-check count is stored that indicates the number of times the sentence has been double-checked.
[0114] For every class, the model can predict: 1. Compute the distance between the word span in the embedding space and the center of the class cluster 2. Rank all word spans by their distance to the cluster 3. For each class cluster, a. For word spans with the same class label as a cluster: mark the top n% furthest from the cluster center as needing relabeling (false positives) b. Else, for word spans with different class labels: mark the top n% closest to the cluster center as needing relabeling (false negative). 4. Upload all marked sentences that have not yet been double-checked into the labeling tool and double-check them along with the IDs of the master training set. The IDs of the sentences are checked against a master list that indicates which sentences have already been double-checked. 5. Human relabeling of selected sentences 6. The relabeled sentences are merged into the master pool of labeled data and the checked status of all these sentences is updated.
[0115] Recalculating cluster centers As more examples of a class are found, better representative clusters can be computed. As more precisely labeled data is assembled, the cluster centers are recomputed. This process is the same as computing the original cluster centers, and there is no limit to the size of the support used (i.e., the number of examples considered).
[0116] Complex Classes Some classes may be a composite of different subclasses. Analysis of the clusters by projecting them into a lower dimensional representation (e.g. 2d) may demonstrate the possibility of splitting the classes. For example, a reference number may consist of both a booking reference and a delivery reference, each with a different prefix. These form two different clusters.
[0117] For example, Figure 9 shows a PCA decomposition of a vector representation of classes representing sign-offs at the end of a message. In most cases, these are all emails, but some are initials with a ^ sign. The initials form a different subgroup, and the two groups can be turned into separate classes (e.g., email and initials).
[0118] The system supports bulk relabeling by allowing users to select entities from a 2d decomposition with a rectangle or lasso. Although context is often missing, this is an effective way to assign labels when the total number of entities in a class is small.
[0119] 4.2 Label Consensus When two or more human annotators provide a label for a word, the degree of consensus can be used to inform the likelihood that the label is correct. If all human labelers agree, the word label is more likely to be correct than if none of the human labelers agree. The system uses this information to provide a number of ways to reduce the time required to double-check the accuracy of human-provided labels.
[0120] A single pass by many human labelers can be done just as cheaply as multiple passes by a few labelers, but much faster. Where they all agree, you can have high confidence that the assigned labels are correct. Where humans disagree, that could point to either human error, a contentious word (e.g., uncertainty about whether it is the name of a brand or the name of a person or organization), or a misleading label. Finally, some sentences may be redundant if no sensible label exists.
[0121] As an example, the degree of consensus may refer to the proportion of majority predictions to the total predictions: if four annotators label a word as "person", a fifth as "place", and the sixth and final annotator label it as "null", the degree of consensus would be 4 / 6 (which is expressed as a percentage of 67%).
[0122] Simple consensus only The simplest form of the algorithm involves selecting only sentences where all labelers agree on all labels, which works best when a small number of manual labelers (four or fewer) are available. 1. For each sentence, pass in the dataset a. Record a Boolean value next to each sentence to indicate whether all labelers agree on all labels (true if all labelers assign the same label to each word) 2. Filter statements that have a Boolean value set to false.
[0123] If more human labelers are available, the labeled sentences are more likely to contain examples where not all human labelers agree, but most do. For example, if 3 / 4 human labelers agree on a label, the 3 / 4 majority can be used to define the correct label. This is the preferred method, as it avoids the odd data entry error that causes a sentence to be dropped. If only 1 / 2-3 / 4 labelers agree, the sentence can be sent for double checking. The system takes these thresholds as parameters, and the user can modify them based on the complexity or quality of the raw data (low quality raw data may require a higher agreement threshold).
[0124] The system includes a UI for labeling sentences that highlights which words in the sentence have a controversial label.
[0125] Finally, this can be combined with automated outlier detection. Outliers that all human labelers agree on do not require double-checking. This allows relabeling to focus on outliers where humans disagree. If the level of human disagreement is very high, it may indicate unwanted sentences; these should be removed from the training data. High levels of disagreement also indicate that class boundaries are unclear to humans. In this case, the labeling guidelines need to be rechecked, and the system escalates these sentences to an administrator in charge of the labeling guidelines.
[0126] FIG. 10 provides a table with a working example showing how both methods (human disagreement and outlier rank) are combined (the percentages in this example are arbitrary and can be configured by the user of the system).
[0127] The label shortcuts used in the system are the same for all labelers and are randomized for all human labelers to avoid labeling errors due to poor UX.
[0128] 4.2 User Interface (UI) Labeling A custom UI is required to support the labeling process, within which users should be able to define new entity classes and document labeling guidelines.
[0129] Labelers can log in and view the samples that have been assigned to them.
[0130] When providing initial labels, there are labels predicted by the model used to select the samples, and the user is prompted to confirm or change each label in turn. Keyboard shortcuts should be available for each action.
[0131] Figure 11 shows a screenshot of a custom UI to support the labeling process. As shown, the shortcuts h (for hashtags) and u (for urls) are a natural choice. However, this does not scale beyond a few labels. Phone numbers, people, and zip codes would all compete for shortcuts. Instead, the system assigns each user a random shortcut. This increases the learning curve but makes it less likely that a systematic error will affect all labels (e.g., all labelers mislabeling a phone number as a zip code).
[0132] When correcting a label, only the label needing correction is highlighted, while the other labels become more opaque (and can also be edited if errors are found). Upon clicking on a disputed label, the user is shown the previous label and the top three manually assigned labels with the percentage of associated labels displayed next to each label, as shown in Figure 12. As before, labeling guidelines are displayed when candidate labels are selected next to the panel.
[0133] 5. Further Applications confidential information Sensitive information relates to information about a person, company, or other entity whose privacy must be protected. Sensitive information may include identifiers, such as social security numbers or passport numbers, as well as quasi-identifiers, such as gender, age, height, weight, location data, travel data, financial data, or medical data. Sensitive information may also include private communication data.
[0134] Most generally, the methods and systems can be applied to label any information that can be defined as belonging to a class.
[0135] Unstructured or structured text data The examples provided above focus on classifying identifiers or quasi-identifiers from unstructured data. However, the presented methods and systems can be generalized to apply to any type of data, including structured data, unstructured data, or a combination of structured and unstructured data. As an example, the methods can be used to analyze structured data, such as a payment table to flag fraudulent or non-fraudulent payments. In particular, the use case application provides an active learning process that outputs a confidence score for each label.
[0136] Text data may include any unstructured files, such as log files, chat / email messages, call records, or contracts, and may include information related to internet or web browsing.
[0137] The text data may also include streaming data from one or more streaming sources, such as micro-batch data or event streaming data.
[0138] The text data may also include any text data within image or video-based data.
[0139] In the previous section, we describe how an active learning process is applied to natural language models used to de-identify text data. The described process can also be generalized beyond the anonymization of text data. For example, it can be used in the following areas:
[0140] Data Classification To understand the risks present in a dataset, one needs to understand what information is in the dataset. Often this is a manual process that requires a lot of effort from the data owners. Using automated classification algorithms and the same active learning process, models can be trained and refined to classify datasets. While this is not a sequence classification problem, it is similar enough that the same approach can be taken as for text classification.
[0141] Automating Policy Construction The privacy protections given to a dataset are described by a policy, which is a set of rules that indicate how the dataset should be transformed to make it more secure, which can be time consuming.
[0142] Elements of the active learning process can be adapted so that only the most uncertain parts of the policy are shown to the user. Each time the process sees more data, it improves the construction of the policy, saving the user time. Unlike the data classification use case, this does not utilize the batch sampling process mentioned earlier.
[0143] 6. NER Combined with Neural Networks Regular expressions (Regex) are a common technique in NLP. They can be used to identify sensitive information such as passport numbers, credit card numbers, social security numbers, etc. Identifiers or quasi-identifiers are often generated to match regular expressions.
[0144] Unfortunately, regular expressions do not always generalize well; a regular expression must be defined for all synonyms of an entity. As an example, the date December 5, 1980 can be represented in several different ways. 5 / 12 / 80 and 12 / 5 / 80 would both be picked up by the same regular expression. 05-12-1980 has a different delimiter, while 5 / 12 / 1980 might not. "December 5, 1980" would not be picked up by most regular expressions as a matching date. As another example, Krampusnacht eve would not be picked up by any regular expression, requiring a lookup list.
[0145] As a result, regular expressions and lookups are often by definition brittle: trying to catch all possible formats is like playing whack-a-mole.
[0146] Modern neural networks based on either word embeddings + bidirectional LSTM or Transformers generalize much better, however, they are only as powerful as the large amounts of unlabeled data they are trained on.
[0147] Transformers are deep learning models that employ a mechanism of self-attention to differentially weight the importance of each part of the input data. They are primarily used in the fields of natural language processing (NLP) and computer vision (CV). Like recurrent neural networks (RNNs), Transformers are designed to process sequential input data, such as natural language, and applications oriented to tasks such as translation and text summarization. However, unlike RNNs, Transformers process the entire input at once. The attention mechanism provides context for any position in the input sequence. For example, if the input data is a sentence of natural language, Transformers do not need to process one word at a time. This allows for more parallelization than RNNs, and therefore faster training times.
[0148] This presents us with the problem that sensitive and identifying information cannot in most cases form part of the training data. There are no large corpora of textual data that contain sensitive and identifying data. For this reason, networks built using transformers or embeddings do not perform well on more structured identifiers. To make matters worse, once the data is tokenized, for example by SpaCy or BERT, standard regular expressions no longer apply.
[0149] Next, a method is presented in which confidential and / or identifying information is represented in a neural network by regular expressions. A schematic diagram of a system combining regular expressions and neural networks is shown in Figure 13.
[0150] In addition to word embeddings, a parallel arm of the network implements regular expression embeddings, which are one-hot encodings in which if a token matches the embedding, then the vector is set to "1" at that point, and "0" otherwise. Unfortunately, tokenizers may split words and identifiers into their component parts and remove whitespace. For example, kieron.guinamard@privitar.com becomes "kieron", ".", "guinamard", "@", "privitar", ".", and "com". 15-04-01 becomes "15", "-", "04", "-", "01" To indicate that it belongs to the same word as the following word, we use subwords that were part of a larger word that hold the indicator in the tokenized sentence.
[0151] So the key is to take a large number of regular expressions and express them as subexpressions (subregex), by building an automaton graph for each regular expression and re-expressing them as a combination of common subgraphs (if a subgraph matches a term that is not at the end of a word, we modify the subregex to also match consecutive characters). Because the subregex may be too small, we can (optionally) apply a tokenizer to a representative sample produced by the regular expressions, and test that the subregex exactly matches an entire subword.
[0152] Now we can construct new regex embeddings that contain sub-regex that match the sub-words generated by the tokenizer for more structured identifiers.
[0153] Appendix - Summary of main features The main features are generalized. Each feature also lists various optional sub-features. Note that any feature can be combined with any one or more sub-features (whether or not attributable to that feature), and every sub-feature can be combined with one or more other sub-features.
[0154] Feature 1: Overall workflow A method is provided for training a machine learning model or engine to label sensitive information from text data. First, the machine learning model is primed with a set of generated synthetic or artificial sentences or text sequences. A balanced sampler is then implemented that predicts labels for entities in a sample of the original text data and determines a confidence score for each predicted label. A subsample of the predicted pre-labeled entities is then sent to an annotator, such as a human annotator or a machine annotator. The annotator then selects the most appropriate labels for the pre-labeled entities. Advantageously, the labeling performance for all classes is improved at the same rate through the iterative process.
[0155] In particular, the machine learning engine can then be used to automatically de-identify the labeled sensitive data. Thus, the original text data to be analyzed (i.e., de-identified with the final trained model or engine) can also form the basis of training data used to improve the machine learning engine. The original text data from the active learning process samples is then used to further train the model.
[0156] It can be generalized as follows: 1. A computer-implemented method for training a machine learning engine to label sensitive information from text data, the method comprising: (i) receiving text data and a list of classes defining sensitive information to be labeled; (ii) generating a set of synthetic sentences that include entities that belong to one or more classes, and using the generated set of sentences to train a machine learning engine; (iii) predicting labels for entities in the sample of text data, selecting labeled sentences from the sample of text data, providing them to annotators for review, and updating the training data with the user-reviewed sentences; (iv) training the machine learning engine with the updated training data and repeating step (iii) until performance of the machine learning engine meets end-user requirements.
[0157] Optional Features: ● The labelled sentences selected in step (iii) form a subsample of the original sample of text data. - Received text data refers to a sequence of words or a sequence of characters. ● The received text data includes unstructured text data, structured text data, or a combination of unstructured and structured text data. - The received text data does not contain any annotations or labels. ● The method includes a step of providing a confidence score for each labeled sentence or entity, the confidence score being a value corresponding to the probability or likelihood that the entity belongs to one or more classes. Each entity may be mapped to multiple labels, with a confidence score associated with each label mapped to the entity. - The method includes the step of outputting the annotated text data. ● End user requirements include a predefined number of iterations to be reached. ● End-user requirements include a predetermined confidence score reached on the labeled sentences. ● End-user requirements include one or more of a specified recall rate, precision level, class performance, or confusion score between classes. • The sample of text data is selected based on a probability sampling approach, such as a stratified sampling approach. ● Sensitive information includes identifying data such as social security numbers or passport numbers. ● Sensitive information includes quasi-identifying data such as gender, age, weight, height, location data, travel data, financial data, or medical data. ● Confidential information includes private communications data. - Sensitive information includes any information that can be defined as belonging to a class.
[0158] Feature 2: Synthetic sentence generation Each sentence is synthetically or artificially generated as an approximation to a real sentence by selecting each successive word or entity based on a set of predefined classes that the end user wants to identify. The sentence contains one or more entities that belong to the set of predefined classes. The entities can be generated based on regular expressions that give an ordered list of possible output tokens (to generate pattern-based identifiers), or using lookup lists (e.g., names of people or places), or using a combination of the two (e.g., email addresses). The sentences are generated based on grammar rules or models to generate sequences of words or tokens in a context. Then, different sentences for a particular entity can be provided in various contexts. Thus, the model learns how to distinguish between classes even if they have similar formats, such as phone numbers and credit card numbers. Advantageously, the set of artificial sentences can be selected such that the model is presented with only a varying number of examples without bias in the distribution of the generated set of synthetic data. The synthetic data can also contain noise that can be introduced, for example, by including typos in the sentences.
[0159] It can be generalized as follows: 1. A computer-implemented method for training a machine learning engine to label sensitive information from text data, the method comprising: (i) receiving text data and a list of classes defining sensitive information to be labeled; (ii) generating a set of synthetic sentences that include entities that belong to one or more classes, and using the generated set of sentences to train a machine learning engine, where the synthetic sentences are generated based on grammar rules or models to generate sequences of words or tokens in a context; and (iii) predicting labels for entities in the sample of text data, selecting labeled sentences from the sample of text data, providing them to annotators for review, and updating the training data with the user-reviewed sentences; (iv) training the machine learning engine with the updated training data and repeating step (iii) until performance of the machine learning engine meets end-user requirements.
[0160] Optional Features: ● Entities are generated based on regular expressions and / or using lookup lists. The method includes the step of introducing noise into the synthetic sentence, such as generating typos. The language of the synthesized sentence is selected automatically based on analyzing the received text data. ● Grammar rules are selected automatically based on analyzing the received text data.
[0161] Feature 3: Confusion Sampler Existing samplers struggle with either minority class representation or bias towards certain entities. A balanced confusion sampler is provided that improves performance for all types or classes of entities, even when some classes have very little representation in the original text data. As an example, the text data may be social media data, such as Twitter data, that may contain many instances of names or Twitter handles and very few instances of zip codes. However, the provided sampler ensures that each class has equal representation compared to other classes. Each entity identified in the original text data is mapped to one or more labels, and each label is linked to a confidence score that corresponds to the probability or likelihood that the entity belongs to the class associated with the label. If an entity has a similar probability of belonging to two or more classes, the entity is reviewed by an annotator, who revises the label as necessary.
[0162] It can be generalized as follows: 1. A computer-implemented method for training a machine learning engine to label sensitive information from text data, the method comprising: (i) receiving text data and a list of classes defining sensitive information to be labeled; (ii) generating a set of synthetic sentences that include entities that belong to one or more classes, and using the generated set of sentences to train a machine learning engine, where the synthetic sentences are generated based on grammar rules or models to generate sequences of words or tokens in a context; and (iii) predicting labels for entities in samples of the text data, selecting labeled sentences and providing them to annotators for review, and updating the training data with the user-reviewed sentences; (iv) generating a confusion matrix representing a comparison between the predicted labels and the labels reviewed by the annotators; (v) training the machine learning engine with the updated training data and repeating step (iii) until performance of the machine learning engine meets end-user requirements, wherein the selection of labeled sentences is based on the generated confusion matrix.
[0163] Optional Features: ● The confusion score is a value that indicates how close the prediction of a given class is to another class. A confusion score is determined for each sentence based on the confusion scores determined for each entity in the sentence. The ML engine ranks each sentence based on analysis of the confusion matrix and / or confusion scores. ●A weight is assigned to each class or class pair. The confusion matrix is updated for each iteration of step (iii). The confusion score is updated for each iteration of step (iii).
[0164] Feature 4. Weighted sampler 1. A computer-implemented method for training a machine learning engine to label sensitive information from text data, the method comprising: (i) receiving text data and a list of classes defining sensitive information to be labeled, where each class or class pair is assigned a weight; (ii) generating a set of synthetic sentences that include entities that belong to one or more classes, and using the set of synthetic sentences to train a machine learning engine, where the synthetic sentences are generated based on grammar rules or models to generate sequences of words or tokens in a context; and (iii) predicting labels for entities in the sample of text data, selecting labeled sentences and providing them to annotators for review based on the assigned weights, and updating the training data with the user-reviewed sentences; (iv) training the machine learning engine with the updated training data and repeating step (iii) until performance of the machine learning engine meets end-user requirements.
[0165] Optional Features: Weights are assigned by the end user. Weights are assigned automatically. ● The weights are updated at each iteration of step (iii). ● The method includes a step of comparing the performance of the machine learning engine to ground truth information and selecting a sample of text data based on the comparison results. ● The method includes generating a confusion matrix, which represents a comparison between the predicted labels and the labels reviewed by the annotators. This shows where, on average, the model makes the most mistakes. It is then used to weight which sentences are selected by the sampler (in the next round of sampling (iii)) in favor of sentences in which the model made more errors. ●The weights are updated based on the generated confusion matrix and / or confusion scores.
[0166] Feature 5. Consensus for correct labeling 1. A computer-implemented method for training a machine learning engine to label sensitive information from text data, the method comprising: (i) receiving text data and a list of classes defining sensitive information to be labeled; (ii) generating a set of synthetic sentences that include entities that belong to one or more classes and using the set of synthetic sentences to train a machine learning engine; (iii) predicting labels for entities in the sample of text data, selecting labeled sentences from the sample of text data, and providing them to a plurality of annotators for review, and updating the training data with the user-reviewed sentences; (iv) training the machine learning engine with the updated training data and repeating step (iii) until performance of the machine learning engine meets end-user requirements.
[0167] Optional Features: ●Labels are corrected or verified only when multiple annotators reach a predefined consensus percentage.
[0168] Feature 6: Outlier detection Once an annotator has completed one round of labeling, the ML process uses an outlier predictor to analyze the labels / entities projected into the embedding space. As an example, Twitter handles and emails are similar in the embedding space.
[0169] 1. A computer-implemented method for training a machine learning engine to label sensitive information from text data, the method comprising: (i) receiving text data and a list of classes defining sensitive information to be labeled; (ii) generating a set of synthetic sentences that include entities that belong to one or more classes, and using the generated set of sentences to train a machine learning engine; (iii) predicting labels for entities in the sample of text data, selecting labeled sentences from the sample of text data, providing them to annotators for review, and updating the training data with the user-reviewed sentences; (iv) training the machine learning engine with the updated training data and repeating step (iii) until the performance of the machine learning engine meets the end-user requirements; The method then comprises using an outlier detector between steps (iii) and (iv) to detect outliers in the reviewed sentences.
[0170] Optional Features: - The method includes the step of representing each entity in a vector space. • The method includes the step of determining support for each class, where support refers to the set of labeled sentences that contain that class. The method includes the steps of representing the support for each class in a vector space and determining a center within the vector space. The outlier detector analyzes each entity in relation to the centroid of each class.
[0171] Feature 7: Representing complex classes 1. A computer-implemented method for training a machine learning engine to label sensitive information from text data, the method comprising: (i) receiving text data and a list of classes defining sensitive information to be labeled; (ii) generating a set of synthetic sentences that include entities that belong to one or more classes, and using the generated set of sentences to train a machine learning engine; (iii) predicting labels for entities in the sample of text data, selecting labeled sentences from the sample of text data, providing them to annotators for review, and updating the training data with the user-reviewed sentences; (iv) training the machine learning engine with the updated training data and repeating step (iii) until the performance of the machine learning engine meets the end-user requirements; The method, wherein the machine learning engine is configured to learn to represent a complex class into multiple subclasses.
[0172] Optional Features: ●The machine learning engine identifies complex classes by analyzing their vector space representation. ●Any of the above methods can be applied to train a machine learning engine to anonymize text data. ● Any of the above methods may be applied to train a machine learning engine to anonymize text data within image or video based data. ● Any of the above methods may be applied to train a machine learning engine to classify any input type in text data that corresponds to multiple classes.
[0173] Feature 8. Method for generating regular expression embeddings Machine learning models built to classify or identify sensitive information require large amounts of labeled data. However, in many cases, little data is directly available about identifiers or quasi-identifiers. A solution is provided in which the machine learning engine also includes a regular expression module that automatically generates training data corresponding to regular expressions based on automata / graphs.
[0174] It can be generalized as follows: 1. A computer-implemented method for generating a regular expression embedding for a set of regular expressions, the method comprising: (i) receiving a list of possible regular expressions, each received regular expression being capable of being represented as an automaton / graph; (ii) representing all regular expressions as combinations of common subgraphs from the possible regular expression graphs.
[0175] Optional Features: The method includes generating training data to detect or classify sensitive and / or identifying information in text data. Regular expression embeddings are used as part of a machine learning engine that is trained to detect or classify sensitive and / or identifying information in text data and is used in combination with traditional unsupervised learning trained word embeddings. ●The regular expression embeddings are provided as input to a machine learning engine. Regular expression embeddings are a subset of stack embeddings, which also include traditional word embeddings. ● Step (ii) is learned from analysis of the received list of regular expressions.
[0176] Note It is to be understood that the above-referenced configurations are merely illustrative of the application of the principles of the present invention. Numerous modifications and alternative arrangements can be devised without departing from the spirit and scope of the invention. While the invention has been illustrated in the drawings and fully described above with specificity and detail in connection with what are presently considered to be the most practical and preferred embodiments of the invention, it will be apparent to those skilled in the art that numerous modifications can be made without departing from the principles and concepts of the invention as set forth herein. < / eml-at> < / eml-account> < / name> < / name> < / firstname> < / eml-at> < / eml-account> < / email-nosplit> < / email-split>
Claims
1. 1. A computer-implemented method for training a machine learning engine to label sensitive information from text data, the method comprising: (i) receiving text data and a list of classes defining the sensitive information to be labeled; (ii) generating a set of synthetic sentences and using the set of synthetic sentences as training data to train the machine learning engine; (iii) predicting labels for entities in the sample of text data, selecting a sub-sample of labeled sentences from the sample of text data and providing them to annotators for review, and updating the training data with the reviewed sentences; (iv) training the machine learning engine with updated training data and repeating step (iii) until the performance of the machine learning engine meets end-user requirements.
2. The method of claim 1, wherein the received text data includes unstructured text data, structured text data, or a combination of unstructured text data and structured text data.
3. The method of claim 1, wherein the received text data does not include any annotations or labels.
4. 10. The method of claim 1, wherein the method comprises providing a confidence score for each labeled sentence or entity, the confidence score being a value corresponding to a probability or likelihood that the entity belongs to one or more classes.
5. The method of claim 1 , wherein each entity is mapped to multiple labels, with a confidence score associated with each label mapped to the entity.
6. The method of claim 1 , wherein the method includes outputting the annotated text data.
7. 10. The method of claim 1, wherein the end-user requirements include one or more of a predetermined number of iterations reached, a predetermined confidence score reached for labeled sentences, a predetermined recall rate, precision level, class performance, or confusion score.
8. The method of claim 1 , wherein the sample of text data is selected based on a probability sampling approach.
9. 10. The method of claim 1, wherein the synthetic sentence is generated based on grammar rules or models to generate sequences of words or tokens in a context, and the grammar rules or models are automatically selected based on analyzing received text data.
10. The method of claim 1 , wherein the synthetic sentences include one or more entities belonging to one or more received classes, the entities being generated based on regular expressions and / or using lookup lists.
11. The method of claim 1 , wherein the method includes introducing noise into the synthetic sentence, the noise including generating typos.
12. 2. The method of claim 1, wherein the method comprises generating a confusion matrix representing a comparison of the predicted labels and the labels reviewed by the annotators.
13. 13. The method of claim 12, wherein the selection of labeled sentences in step (iii) is based on the generated confusion matrix, and the method comprises providing a confusion score for each labeled entity of the selected sentences, the confusion score being a value indicating how close a prediction for a given class is to a prediction for another class.
14. The method of claim 13 , wherein the confusion score is determined for each selected sentence based on the confusion score determined for each entity in the sentence.
15. The method of claim 13 or 14, wherein the machine learning engine is configured to rank each selected sentence based on an analysis of the confusion matrix and / or the confusion scores.
16. 14. The method of claim 13, wherein a weight is assigned to each class or class pair, and the labeled sentences provided to the annotators are selected based on the assigned weights.
17. The method of claim 13 , wherein the confusion matrix and / or the confusion scores are updated for each iteration of step (iii).
18. The method of claim 13 , wherein the weights are updated based on the confusion matrix and / or the confusion scores.
19. 2. The method of claim 1, wherein the method comprises representing each entity of a selected sentence in a vector space, the entity belonging to one or more classes defining the sensitive information to be labeled.
20. 2. The method of claim 1, wherein the method comprises determining support for each class, the support referring to the set of labeled sentences that contain that class, and the method comprises representing the support for each class in a vector space and determining a center within the vector space.
21. The method of claim 20, further comprising using an outlier detector to detect outliers in the reviewed sentences, the outlier detector analyzing each entity of the selected sentence in relation to the center of each class.
22. 10. The method of claim 1, wherein the machine learning engine is configured to learn to represent complex classes into multiple subclasses, and wherein the machine learning engine is configured to identify complex classes by analyzing their vector space representations.
23. The method of claim 1 , wherein the machine learning engine is trained to anonymize text data.
24. The method of claim 1 , wherein the machine learning engine is trained to anonymize text data within image or video-based data.
25. 1. A computing-implemented system configured to train a machine learning engine to label sensitive information from text data, the system comprising: one or more processors; one or more non-transitory computer-readable media that collectively store instructions that, when executed by the one or more processors, cause the computing-implemented system to perform operations, the operations including: (i) receiving text data and a list of classes defining the sensitive information to be labeled; (ii) generating a set of synthetic sentences and using the set of synthetic sentences as training data to train the machine learning engine; (iii) predicting labels for entities in the sample of text data, selecting a sub-sample of labeled sentences from the sample of text data and providing them to annotators for review, and updating the training data with the reviewed sentences; (iv) training the machine learning engine with updated training data and repeating step (iii) until the performance of the machine learning engine meets end-user requirements.