Data Cleaning Tools for Token Classification Tasks (2021)

Abstract: Human-in-the-loop systems for cleaning NLP training data rely on automated sieves to isolate potentially-incorrect labels for manual review. We have developed a novel technique for flagging potentially-incorrect labels with high sensitivity in named entity recognition corpora. We incorporated our sieve into an end-to-end system for cleaning NLP corpora, implemented as a modular collection of Jupyter notebooks built on extensions to the Pandas DataFrame library. We used this system to identify incorrect labels in the CoNLL-2003 corpus for English-language named entity recognition (NER), one of the most influential corpora for NER model research. Unlike previous work that only looked at a subset of the corpus’s validation fold, our automated sieve enabled us to examine the entire corpus in depth. Across the entire CoNLL-2003 corpus, we identified over 1300 incorrect labels (out of 35089 in the corpus). We have published our corrections, along with the code we used in our experiments. We are developing a repeatable version of the process we used on the CoNLL-2003 corpus as an open-source library.

## introduction human-in-the-loop systems for cleaning nlp training data rely on automated sieves to isolate potentially-incorrect labels for manual review. in this work, a full version of which has been presented in @xcite , we describe how we developed a novel technique for flagging potentially-incorrect labels with high sensitivity in named entity recognition corpora. we implemented our sieve in the context of a set of extensions to the pandas 1 dataframe library. in addition to flagging errors, our extensions provide facilities for comparing nlp model results 1 https://pandas.pydata.org/ and visualizing model outputs and training data in context. because we built these facilities into the primary dataframe library of the python data analysis stack, we were able to construct an end-to-end system for nlp data cleaning as a series of jupyter foot_0 notebooks. this design gives sophisticated users a view of the internals of the data cleaning process and allows for easy customization. our jupyter notebooks comprises a pipeline that starts with training ensembles of models. next, the system analyzes the outputs of the ensembles to identify potentially incorrect labels. additional notebooks provide human annotators with a view of the suspicious labels in context. later stages of the pipeline merge and analyze the results of manual annotation; then construct a corrected dataset and reports on the nature of the corrections. we used this system to identify errors in the conll-2003 ner corpus. the english-language portion of the conll-2003 shared task @xcite is one of the most widely-used benchmarks for named entity recognition (ner) models. it consists of news articles from the reuters rcv1 corpus @xcite . since its debut, conll-2003 has played a central role in nlp research and continues to do so with more than 2300 citations. while researchers have relied heavily on the conll-2003 corpus as a source of ground truth, few have paid attention to the corpus itself. errors in the corpus could potentially mislead and even divert the course of future research. unlike previous analyses of this dataset that only examined small fractions of the conll-2003 corpus, our work leveraged a high level of automation to analyze the entire corpus. we found over 1300 errors. ## process our approach builds on previous work in semisupervised labeling, with some key differences. because we were looking for errors in a corpus that already had many high-quality labels, we needed a sieve with especially high sensitivity. we used ensembles of ner models trained on the corpus, and we focused on cases where the models agreed strongly on a particular label, but that label does not appear in the corpus. one of these ensembles was the outputs of the original 16 entries in the 2003 competition. we also trained two other 17-model ensembles ourselves by applying gaussian random projections to the bert embeddings space. we developed extensions to the pandas dataframe library that enabled us to represent spans within documents as cells within a dataframe. this facility allowed us to use dataframes to track the spans of the entities that each of our models produced and to aggregate together the results across models. using these capabilities, we developed jupyter notebooks that analyzed our ensembles' outputs to identify labels that appeared in the outputs of multiple models but were not in the corpus. we used our pandas extension types' ability to render spans to html to view these spans in the context of the original document from within the same jupyter notebooks.we started with labels that had a strong agreement among models and we progressed to labels with less agreement among models, the fraction of flagged labels that was actually incorrect decreased. when this fraction dropped below 20 percent, we stopped going through the ordered list of flagged labels. we had an inter annotation agreement and audit cycle for each correction made. in total, we made 12 passes (3 ensembles × 2 sets of labels × 2 human reviewers) of manual review over the train and test folds of the corpus and 8 passes over the test fold. when we found that a label was incorrect, we coded the type of error and the required correction so that the error could be corrected automatically later on. we divided errors into several categories as explained in detail in the full version of this paper at @xcite . ## corrections in total, we examined 3182 labels our ensembles had flagged in the three folds of the corpus. we considered any label where fewer than 7 models original models custom models custom models with cross-validation dev + test folds train fold 65 79 240 32 35 39 5 221 93 41 agreed with the corpus label to be "flagged". of these labels, 1274 came from the test fold, 854 came from the dev fold, and 1054 came from the train fold; accounting for 22.6%, 14.3%, and 4.5% of their folds, respectively. figure 1 shows the split of final errors identified by ensemble and source. manual inspection determined that 850 of these 3182 entities (27%) were incorrect. we also found 475 additional incorrect entities in close proximity to the entities that our techniques flagged, for a total of 1320 incorrect labels across the corpus. after identifying incorrect tags, spans and sentence boundaries, we created a corrected version of the original conll-2003 dataset, which we refer to as the corrected conll-2003 dataset. ## ongoing work while preparing our dataset of corrections for release, we identified additional improvements to the corrections. we have released a second version of the dataset containing these improvements plus some additional corrections pointed out by members of the open source nlp community. we have released the code that we used in our experiments so far foot_1 . to facilitate the reuse of this code on other datasets, we are developing a more refined version of this code. key changes that we are working on are reducing the number of passes of manual review required, simplifying the creation of ensembles of models, and extending the approach from ner to other token classification tasks like semantic role labeling. we plan to release these improvements.