Anonymization of German financial documents using neural network-based language models with contextual word representations
Paper · 2021 · David Biesner, Rajkumar Ramamurthy, Robin Stenzel et al.
Summary
A financial report can be useful for developing document-processing software even when its names and other identifying details cannot be shared with the people building that software. Removing those details by hand takes time and requires reviewers with access to the originals. Biesner and colleagues develop an automated approach for German financial documents that aims to preserve readable prose and the structure of the original file. A web application lets users inspect the passages selected for removal, and an interface for batch processing supports the same operation across a collection of documents.
The approach combines named entity recognition with rules for forms such as dates and email addresses. The recognition system examines words in context. In German, Vogel can be a surname or the ordinary word for a bird, and the words around it can help distinguish the two uses. The system also checks for repeated text within a document. If it finds a name in a passage where the context makes the identification clear, it can hide the same text in another passage where the evidence is weaker. The application can show the types of information detected, replace sensitive text with category markers, or mask it in the preview.
On a held-out set of 45 German financial documents, the strongest recall after the document-wide consistency check was 0.990, with precision of 0.903. These scores concern tokens annotated as belonging to person, organization, or location names. Recall measures how much of the annotated sensitive text was caught, while precision measures how frequently the text flagged for removal belonged to one of those categories. The configuration with the highest recall after the check differed from the one with the highest F1 before it. That distinction matters because the consistency check typically catches additional sensitive words while also hiding some words the annotators would have kept.
The experiments compare general German pretraining with training on financial publications, and simpler word classifiers with classifiers that process a sequence of words. Financial pretraining gave some recurrent classifiers a small advantage on the financial documents, and smaller financial encoders could substantially reduce processing time. On GermEval, a benchmark drawn from a wider range of German text, recurrent classifiers performed better with the general German representation. The study’s strongest evidence therefore concerns the detection of specific kinds of names in financial writing. It leaves open how much identifying information remains in a finished document and how useful that document is for subsequent analysis.
Deep dive: Anonymization of German financial documents using neural network-based language models with contextual word representations
The paper tests how contextual word representations and document-wide rules help remove names and other sensitive details from German financial documents. · about 36 minutes to read
The problem and its context
Why access to a document can matter as much as its contents
A company can have digitized contracts, financial reports, and other business records and still have difficulty using them to develop software. The documents contain language and structure that might be valuable for information extraction, the task of turning selected details in a text into information software can use. They also contain material about people and organizations. Someone authorized to handle a record for its original business purpose may have a different role from the developer who needs examples to understand how the record is written. The availability of digital files makes document processing possible, while the restrictions on access still govern who can work with those files.
Anonymization is intended to preserve the parts of a document that make it useful while removing details that disclose identities. In a report, a reader may still need to understand how a sentence describes the relationship between a person and an organization. A marker in place of each name can retain the grammatical roles and indicate which kind of reference appeared there. The surrounding prose, the order of the passages, and, where the file format permits it, the layout can survive the change. The authors are therefore interested in editing a document in place so that it can still be read as a document.
Manual editing has an access problem of its own. The person doing the editing must see the original to decide what to remove, so the pool of possible reviewers is constrained by the same permissions that govern the original records. Every document also takes some amount of attention to review, including repeated appearances of the same identifying detail. The paper addresses that combination of scale and access with a system an authorized user can apply to an individual file or to a collection. The proposed workflow places the transformation before distribution to people who would work with the resulting material.
The motivating distinction is between obscuring selected identifiers and making a document anonymous in the broader sense. The paper introduces both pseudonymization and full anonymization as possible responses to restricted access. Its system makes a concrete part of that distinction testable by asking which pieces of text are marked for replacement. The usefulness of preserving document structure also makes the broader question important. The more of the original report that remains, the more context a reader has for understanding it. Some of that context can matter to identity even after the most recognizable names disappear.
The legal motivations the authors give
The paper discusses the issue in the European and German legal settings. In its account, the General Data Protection Regulation restricts subsequent processing of personal data through the purposes for which those data were collected. A business may need a record to carry out its original purpose, while the use of that same record as training material falls outside the purposes the authors say are usually permitted. They also describe the European rules on the movement of non-personal data and the significance of a record becoming anonymous for restrictions tied to personal data. This supplies the motivation for transforming documents before trying to use them for additional purposes.
Customer contracts provide one example of a practical tension. The authors discuss circumstances in which personal data cease to be needed for the purpose for which they were collected, while retention requirements can still apply to the underlying record. Tax-related retention periods are their example. Anonymizing records after the end of a contract is presented as a possible way to preserve information that still needs to be kept while addressing the presence of personal data. The number of documents that could require this treatment motivates automation.
The paper also discusses the publication of German judgments in the public interest. It presents publication as a responsibility of the courts and explains the need to protect the people identifiable in the judgments that are made public. According to the authors, this work is mostly done manually, which limits how much can be published. The example explains why removing sensitive text can be valuable beyond an internal business workflow. The common problem is that the record should still communicate its substantive contents once references to identifiable people have been handled. The experiments themselves use financial documents, while the court example explains the wider motivation for studying the task.
How earlier systems found identifying information
In the authors’ account, early work on automated de-identification concentrated on medical records. The Scrub system used several forms of pattern matching to find details such as names and telephone numbers. That approach exploits the fact that some identifying strings have visible regularities. A telephone number may have a recognizable written form, and a matching rule can act on that form directly. The available patterns shape what the system can detect.
The paper describes the i2b2 clinical de-identification challenge in 2006 as a setting in which several approaches could be studied on shared material. Some systems used named entity recognition, treating identifiers as spans to be found in prose. Others used hand-built rules. A hybrid system combined dictionaries, regular expressions, and trained classifiers. This history is directly relevant to the authors’ own design because different kinds of sensitive material offer different evidence. Recognizing an address-like string and deciding whether an ordinary-looking word is a person’s name are related editing tasks with different detection requirements.
The authors place their work within that tradition and shift the focus to financial records. They describe their contribution as a large evaluation of anonymization techniques on that kind of document. Their framing also brings a document-level question into an area frequently studied through sentences. A sentence can provide the immediate evidence that a mention is sensitive. A financial report can provide repeated evidence across passages, including a clear occurrence of a name that helps resolve a later short or ambiguous occurrence. The system makes use of both kinds of evidence, at different stages.
Why the task is harder than matching a list of names
A sensitive word can look like an ordinary word. The paper illustrates this with Vogel, which can refer to a person in a business sentence and to a bird in a proverb. The name reading is supported by surrounding words, such as a form of address and a description of someone’s position. The ordinary reading is supported by what the bird is doing in the proverb. A list that assigns the same status to every occurrence of the spelling loses these differences.
The same issue arises from the vocabulary of the documents. A list of known words may have broad coverage of everyday German and still lack a particular company or person’s name. These less familiar strings are precisely the kind of material that an anonymization system needs to handle. The paper’s approach represents a name through the characters or pieces that make up the word and through what appears around it. It can then ask whether the string is functioning as a name in a particular passage.
For anonymization, the cost of an error also depends on its direction. An extra deletion removes something a reader might have used. A missed name leaves information in the copy that was supposed to suppress it. The authors give priority to avoiding the second error. That choice affects both the consistency rule and the way the experiments count mistakes. A name removed under the wrong category can still be hidden, while a correctly spelled and accurately located name does no good if the system decides to leave it visible.
The method, step by step
From a file to decisions about words
The method treats the document as a sequence of tokens, the units assigned labels by the system. A token can be a word or part of the written material handled separately by tokenization, the process of dividing text into the units that will be processed. A person’s or organization’s name can cover several tokens. The editing problem is to decide which of those units should remain as written, which should be hidden, and, when a type is shown in the result, which label should replace them.
The first decisions use a numerical representation of each token in its sentence. A classifier reads those representations and assigns labels. The document-level step then uses repeated words to carry a sensitive label across occurrences. Rules handle regularly formatted details, and the resulting labels tell the application which text to replace or display as masked. In the paper’s workflow illustration, the prose around a name, place, date, and email address survives while the identified details are replaced with short type markers.
How a document becomes a redacted copy
The steps in order.
The label 0 indicates text that can be left in place. The learned classifier covers ORG for organizations, PER for people, and LOC for places. Its other sensitive labels are PROD for products, SEG for information about the industry in which a company operates, and OTH for other sensitive details. Including 0, these make up the 7 output categories of the learned part. A single token can be labeled because it forms part of a longer name. The application’s broader label inventory includes URL, TEL, DATE, NUM, and EMAIL for details such as web addresses and telephone numbers.
These labels have two functions. During training, they tell the classifier which decisions experts made about the text. During editing, a sensitive label identifies a piece of text to change and supplies a category the application can display in its place. The category matters for the readability of the result. A reader may be able to follow a sentence more easily if they can see that a place name was removed after a reference to a person. The benchmark described later asks a narrower question about whether the relevant tokens were hidden at all.
How a token acquires a representation of its context
Word embeddings are vectors, or ordered lists of numbers, used to represent words computationally. A global embedding assigns a word a reusable vector from a vocabulary. It is straightforward to obtain that vector from a stored list. The paper illustrates what this kind of representation tries to capture through semantic relatedness. A word about finance should be closer in the representation to one about banking than to one about an apple. The comparison concerns the word in the vocabulary as a whole.
In a contextual representation, the vector belongs to an occurrence of the word. A neural encoder reads its sentence and produces a representation influenced by that sentence. The numbers for Vogel in the example about a business executive can therefore differ from the numbers for the same spelling in the proverb. The classifier gets a potential source of evidence for distinguishing a surname from a common noun even when it processes only the vector at that position. The usefulness of this design depends on how much of the relevant context the encoder captures and how readily the classifier can extract it.
The authors distinguish this choice from a system that starts with global vectors and then applies its own context-sensitive classifier to the whole sentence. Such a classifier could in principle use surrounding words to disambiguate a token, as the paper acknowledges. Their rationale for contextual representations also concerns the input vocabulary. A stored word vector depends on an entry being available for the whole word. An encoder based on characters or smaller pieces can produce a vector for an unfamiliar spelling from material it can already process. Generating a representation in this way gives the classifier an input for a rare name. The label still depends on the evidence found in that input.
Obtaining these representations takes work per sentence. Looking up a stored vector would involve retrieving an existing entry. With the authors’ encoders, the surrounding text has to pass through a trained network before the token classifier can act. This makes the numerical representation both a source of useful context and a major part of the application’s processing cost. The authors vary the encoder’s size partly because its cost is incurred throughout each document.
How the recurrent and attention-based encoders read context
The Flair representations used in the paper come from character-based recurrent neural networks. A recurrent network carries an internal state as it moves through a sequence. During language training, it uses the characters it has encountered to predict the next character in its direction of travel. Success at that task can depend on the spelling under way and on information from other words. The state can therefore carry evidence about the word’s surroundings along with evidence about the characters that make it up.
The setup runs across each sentence in both directions. One direction builds up evidence as it moves through the characters in their written order. The other builds up evidence from the opposite side. The encoder takes the relevant internal states at the token’s boundaries to assemble the token vector. In broad terms, the representation allows the classifier to use clues before and after a name. It also gives the system a numerical input for an unfamiliar full word through its character sequence.
The paper compares the general German Flair representation, flairDE, with Flair representations trained on financial publications. The financial versions differ in vector size. A larger vector gives the encoder more capacity in its output, while a smaller one reduces the amount of computation involved in representing a document. Both the kind of text seen before task training and the size of the representation are therefore choices the authors can vary.
The other encoder in the experiments is BERT, which uses the Transformer and attention architecture. The paper describes self-attention as a way of considering relationships among the tokens in a sequence. In the pretraining task it describes, some tokens are masked and the surrounding text supplies clues for reconstructing them. The encoder learns from seeing context on both sides of a masked position. The authors point to that access to relationships across a sequence as an architectural difference from carrying information through successive recurrent states. They also note BERT’s maximum sequence length of 512, a constraint on the context available within an input sequence.
The BERT system used in the experiments starts from general German pretraining and undergoes fine-tuning on the financial corpus, in the sense of continuing its language training on that material. It supplies embeddings of dimension 3072. The experiment uses those embeddings as input to a separate entity classifier. The masking in BERT’s language training is distinct from the masking a user sees in the application. One creates a learning problem by hiding text from the encoder during training. The other hides detected sensitive information in a document being reviewed.
How the classifier turns a representation into a label
The paper tests several ways to use the resulting vectors. The simplest is a multilayer perceptron, abbreviated MLP. This is a fully connected network that takes the vector for one token, maps it through a hidden layer, and produces scores for the output categories. The available context enters with the vector. If the encoder has captured evidence that a word is being used as a surname, the MLP can learn to act on that evidence. The authors include this classifier because it is straightforward to use and its decisions have a simpler path from the representation to the output.
The recurrent classifier, abbreviated RNN in the results, reads the vectors as a sequence. It uses a bidirectional long short-term memory network, or BiLSTM, to carry information in both directions through that sequence. The inputs here are already contextual word vectors. The additional recurrence gives the entity classifier a way to learn which surrounding evidence matters specifically for recognizing sensitive text. Its outputs from the two directions are joined and passed to a final layer that produces probabilities for the labels. The recurrence in a Flair encoder and the recurrence in this classifier do different jobs. Flair learns to represent language from characters. The classifier learns from examples of the decisions the experts made about financial text.
The RNN with a conditional random field, or CRF, adds a way to account for dependencies among the output labels themselves. The basic recurrent classifier gathers evidence across the sentence but produces a decision at each position from the resulting representation. The CRF introduces a learned relationship between labels at neighboring positions. This can matter for a multiword name because the label of an adjacent word may be relevant to interpreting a particular part of it. The CRF operates within the sequence on which the classifier is making predictions. The later consistency rule has a different scope and can affect separated occurrences across a document.
The authors train against the experts’ annotated labels and describe the training objective as cross-entropy. For an individual token with a gold label, the usual probability-based expression for its contribution to this objective is
ℓᵢ = −log pᵢ(yᵢ)
Here i identifies the token position and ℓᵢ denotes its loss. The label yᵢ is the expert’s annotation for that position. The notation pᵢ(yᵢ) means the probability the classifier assigns to that label. The function log is the logarithm and the minus sign makes the loss larger when the probability of the annotated label is lower. The equality states the relationship between the token loss and the probability assigned to the gold label. This describes the token classification objective. The paper describes the CRF by its role in learning dependencies between labels in a sequence.
For the classifiers that choose a label by comparing probabilities at a token position, the inference decision can be written as
ŷᵢ = argmax_{c ∈ C} pᵢ(c)
Here ŷᵢ is the predicted label at position i. The symbol c denotes a candidate label, C is the set of candidate labels, and c ∈ C means that the candidate belongs to that set. The value pᵢ(c) is the probability assigned to the candidate at the position. The operation argmax returns the label associated with the largest probability. In the simplest case the winning label is 0, and the token is left in place unless a later rule marks it for removal.
Where language training and annotation enter
The financial language corpus comes from the Bundesanzeiger, which the authors abbreviate as BANZ. It consists of 19,000 German financial documents and contains 200 million words. The research team uses that material to train representations of financial language. For comparison, the general German Flair encoder was pretrained on a corpus of German sentences containing 500 million words. The sizes refer to language material used for learning representations. The decision about whether a particular token is a person, organization, or place is learned from a separate annotated collection.
Using financial publications for language training serves several purposes in the paper. It exposes the encoder to the kind of writing it will receive during anonymization. It lets the authors train representations of different sizes. They also identify licensing conditions on general resources as a reason to consider another training source for commercial uses. The comparison consequently addresses a practical choice between using an existing general representation and building one suited to the documents and operating constraints of the application.
The financial recurrent encoders are BANZ1024, BANZ2048, and BANZ4096. The numbers in those names identify vector dimensions. The authors train them for 100 epochs using the Flair package’s default settings, with an epoch being a pass through the training material. For BERT, they continue training the existing general German encoder using the same financial corpus. This produces a financial adaptation of an already pretrained system, while the BANZ recurrent encoders are described as trained on the financial collection. Both approaches expose the representations to the target domain through language training.
The supervised stage uses 407 published German financial documents annotated by domain experts. The authors allocate 305 documents to training and 102 to validation. Training supplies examples from which the classifiers learn how to assign sensitive labels. Validation provides a separate collection during development. A further set of thoroughly annotated financial documents is reserved for final evaluation. This organization distinguishes the material used to acquire a general representation of financial text from the examples used to learn the editing decisions and from the material used to measure those decisions.
The recurrent classifiers are trained using the Flair framework for 100 epochs with its default settings. The paper describes the recurrent classifier as a single bidirectional LSTM layer with a hidden representation of 256 dimensions. For the MLP, the reported hidden layer sizes are 500 units for input dimension 1024, 500 for input dimension 2048, and 1000 for input dimension 4096. The MLP is trained for 100 epochs with batches of 100 tokens. The optimizer is Adadelta, with a learning rate of 0.1 and weight decay of 1e–5. The learning rate governs the scale of the optimizer’s updates, and weight decay constrains the learned weights during training.
What happens when the same text appears again
A token’s context can be clear in one sentence and sparse in another. In the paper’s illustration, a person is referred to with a title and a surname in one passage and with a shorter form in another. The shorter context may contain less evidence for a confident prediction. Even so, the shorter mention can reveal the information the system removed elsewhere. The authors use the whole document to address that kind of inconsistency after the initial labeling.
The rule looks for a token classified as a named entity anywhere in the document and marks other occurrences of the same token with the corresponding sensitive label, including positions originally classified as 0. Thus a confident occurrence can have consequences beyond its sentence. The rule is designed to favor recall. Removing a repeated name across the document can be more important for the authors’ objective than leaving every benign occurrence of the same spelling visible.
The unit of the rule is the repeated token. This makes it possible for a single recognized occurrence to affect several passages, while the result depends on what the initial classifier found. If every occurrence escaped detection, the rule has no sensitive prediction to propagate. Applying the rule to a spelling with several uses can also extend a sensitive label to an ordinary word. The benchmark measures how those tendencies balance on the financial documents through the change in precision and recall.
The application uses regular expressions for patterned forms. A regular expression specifies a pattern in text that a program can search for, such as a characteristic arrangement of letters, punctuation, or digits. The authors describe rules for items including dates, numbers, web and email addresses, and telephone numbers. Users can choose whether to include categories such as numbers and dates. This part of the method relies on the visible form of the text, while the classifier supplies predictions for categories where how a word functions in its sentence is frequently decisive.
How the result reaches the user
The web interface accepts text documents and displays the result alongside the controls used to configure processing. Sensitive text can be highlighted by category, so a user can distinguish a detected person from a company or place. A masking option blacks out the passages selected as sensitive in the display. The document can also be processed for download with generic markers such as PER, ORG, and LOC in place of the identified text. These views support different parts of the same task, from examining what was detected to obtaining an edited file.
The paper describes parsing supported files so text can be replaced within the original document structure. For a word-processing file, the goal is to retain features such as fonts, text size, and layout as the wording is changed. The authors also describe handling spreadsheet and PDF files and using optical character recognition to obtain text from scanned PDFs. That step extracts text from a scan so the tagging pipeline has text to work with. The paper describes these capabilities as part of the application, while its accuracy comparisons are about the tagging decisions on the evaluation text.
For a collection of records, the authors provide an internal REST API and Python package. An authorized employee can use the interface to process a corpus and return the edited copies for further work. The distinction between this path and the web interface is primarily one of use. The web interface gives a person a view of an individual document and the identified passages. The programmatic interface allows the transformation to become part of processing a collection. The authors make the source material for language training available through the Bundesanzeiger and report that the annotated classifier-training data and the application code are unavailable publicly.
Experiments and results
What the evaluation counts as a success
The final financial evaluation set contains 45 documents with a total of 189k tokens. The paper reports 17k tokens, or 9.1% of the total, in the person, organization, and location categories. These counts concern tokens in the evaluation documents, so a name composed of several tokens contributes several opportunities for correct detection. A name that appears repeatedly also contributes observations at its different positions. This is the set on which the authors compare performance before and after document-wide consistency processing.
The evaluation recodes predictions and annotations into a binary decision. The label 1 represents a token to remove in the categories under evaluation. The label 0 represents a token to keep. A token correctly identified as sensitive counts as a success if it is selected for removal, even if a person was labeled as an organization. A sensitive token left visible counts as a miss. An ordinary token selected for removal counts against precision. The setup reflects the concern that hiding a sensitive detail under an imperfect type marker can still protect the text of that detail.
Precision describes the share of flagged tokens that agree with the positive annotations. Recall describes the share of positively annotated tokens that the system flags. F1 combines precision and recall in a single score that depends on both. A very cautious system can have strong precision because the tokens it does flag are usually sensitive, while having weak recall because many sensitive tokens go unflagged. Conversely, propagating a label to more positions can catch more of the intended targets while introducing extra removals. Reporting the measures together makes it possible to see which behavior drove a result.
The annotations for products, industry segments, and other sensitive details were insufficiently reliable for the reported evaluation. The consistency result in the paper’s table is for people, organizations, and places. It isolates the effect of spreading labels within a document for those categories. The optional rules for dates, numbers, and other patterned formats are part of the application, but the precision, recall, and F1 in this comparison quantify the selected group of names.
The comparison systems
The authors pair different encoders with the MLP, the recurrent classifier, and the recurrent classifier with a CRF. This lets them hold the encoder constant while changing the classifier, or hold the classifier constant while changing how the input was represented. In each case the relevant financial classifiers learn from the experts’ annotated financial documents. Comparisons across these trained variants help locate the source of differences that would be hard to interpret from a comparison of complete systems alone.
The paper also applies flairNER, an existing pretrained German recognizer distributed through Flair. It uses the general German Flair representation and a recurrent classifier with a CRF trained on CoNLL-2003 German named entity data. It had seen neither the BANZ corpus nor the annotated financial documents. This is a baseline for what an existing recognizer can do when applied to the financial task. It is different from a financial classifier that uses flairDE. The latter also starts from a general representation, but its entity decisions are learned from the financial annotations.
The distinction between the general encoder and the general recognizer is consequential. General language pretraining can provide useful information about German words and context, while financial annotation can still teach a classifier to make decisions appropriate to financial prose. The comparison with flairNER changes the task training as well as the resulting system’s exposure to the target data. Comparisons of the financially trained classifiers using different encoders address the more specific question of which representation works well for the task.
Financial documents before the consistency check
Before post-processing, the highest reported F1 on the financial evaluation set was 0.972 for the recurrent classifier with a CRF using BANZ4096. Its recall was 0.973 and its precision was 0.971. The plain recurrent classifier with the same encoder reached F1 of 0.970. Its precision was 0.972, and its recall was 0.969. The MLP with that representation reached precision of 0.986 and recall of 0.765. Its high precision describes a reliable set of positive predictions, while its lower recall describes the sensitive tokens that set leaves out.
Classifiers using BANZ4096 on the financial evaluation set before post-processing
The recurrent classifiers achieve higher F1 than the MLP, with the CRF variant leading.
The numbers
| System or setting | F1 |
|---|---|
| MLP | 0.862 |
| Recurrent classifier | 0.970 |
| Recurrent classifier with CRF (this paper) | 0.972 |
The choice of representation was particularly consequential for the MLP. With flairDE, it recorded a financial recall of 0.933 and F1 of 0.950 before post-processing. With BANZ1024, it recorded recall of 0.485 and F1 of 0.651. Its precision with the smaller financial representation was 0.989, the highest financial precision in that column of the table. Taken together, these scores show that a classifier can appear strong by the precision measure while leaving a substantial portion of annotated names visible. Moving to a recurrent classifier with the same smaller representation brings the task-specific sequence into the decision and yields a different balance.
The BERT representation also worked differently depending on the classifier reading it. Before post-processing on the financial documents, the MLP with BERT scored 0.756 F1, while the plain recurrent classifier reached 0.957 F1 and the recurrent classifier with a CRF reached 0.952 F1. That comparison evaluates BERT as a source of vectors. It measures how well the downstream classifiers used the vectors to find names, with the strongest results for this particular encoder coming from the plain recurrent classifier.
Financial documents after the consistency check
With document-wide processing enabled, the recurrent classifier with a CRF and flairDE achieved the highest reported recall, 0.990. Its precision was 0.903 and its F1 was 0.945. The strongest F1 after the check was 0.949, achieved by the plain recurrent classifier using BANZ4096, with precision of 0.915 and recall of 0.986. The results identify different leading configurations depending on whether recall or F1 is the deciding measure. The system that misses the fewest annotated tokens accepts additional removals to achieve that coverage.
Recall on the financial evaluation set after document-wide post-processing
The recurrent classifier with a CRF and the general German Flair representation achieves the highest recall.
The numbers
| System or setting | recall |
|---|---|
| Pretrained flairNER baseline | 0.897 |
| Recurrent classifier with BANZ4096 | 0.986 |
| Recurrent classifier with CRF and BANZ4096 | 0.987 |
| Recurrent classifier with flairDE | 0.988 |
| Recurrent classifier with CRF and flairDE (this paper) | 0.990 |
The paper describes its headline performance as anonymizing 99% of sensitive entities. The underlying result is the reported recall on tokens from the three evaluated name categories. The precision associated with that recall records the effect of also flagging tokens that the annotations leave outside those categories. For an application where a visible name is especially costly, greater coverage is valuable. For a reader of the edited report, unnecessary deletions can still matter because they remove words that help a passage make sense.
There is an inconsistency in how the paper reports the general recognizer baseline on the financial data. Its table gives flairNER recall of 0.779 before post-processing and 0.897 afterward. The results narrative instead gives 84% and 93% for the corresponding before and after comparison. The chart uses the tabulated value, which appears alongside the other configurations under the same stated metric. Both accounts describe an increase after the consistency step, but the paper gives different magnitudes for this baseline.
The authors also report a runtime benefit from smaller financial encoders. They measured inference in seconds per document for a 10-page document and describe runtime reductions of over 50% in their comparison with the general representation. Their runtime analysis attributes most of the processing time to producing the contextual embeddings. Changing the classifier itself made comparatively little difference to runtime in that analysis. The size of the representation is therefore especially relevant when the proposed use is processing a corpus, even when differences in tagging scores among recurrent configurations are small.
Performance away from financial documents
The additional evaluation uses the GermEval 2014 named entity recognition corpus. The paper describes it as 29k sentences with approximately 590k tokens, of which 8.4% are named entities. The sentences come from different sources and are evaluated without the document-wide check. Carrying a sensitive label from one occurrence to another is motivated by their presence in the same coherent document, so the authors omit it for a collection structured around individual sentences. The GermEval results measure transfer of the trained tagging systems under that condition.
Recurrent classifiers with a CRF on GermEval before post-processing
The general German Flair representation gives the strongest F1 in this comparison.
The numbers
| System or setting | F1 |
|---|---|
| BANZ1024 | 0.711 |
| BANZ2048 | 0.713 |
| BANZ4096 | 0.731 |
| BERT | 0.653 |
| flairDE (this paper) | 0.832 |
The plain recurrent classifier with flairDE reached GermEval F1 of 0.828 and recall of 0.848. The CRF variant with that encoder reached recall of 0.840 and precision of 0.824. The flairNER baseline recorded F1 of 0.817, with precision of 0.889 and recall of 0.755. Those results again illustrate that the highest precision, highest recall, and highest F1 can belong to different systems. They also show that keeping a general representation can support transfer even when the classifier has been trained on financial annotations.
The general German representation has a clearer advantage on GermEval than it does among recurrent classifiers on the financial evaluation set. The authors interpret this as consistent with the variety of sources in GermEval. The two evaluations answer different questions. The financial set measures detection where the target text is drawn from the application domain and repeated mentions can be compared within documents. GermEval measures sentence-level recognition in more varied text. The latter gives evidence about transfer of the classifier and encoder, while leaving transfer of the full anonymization procedure unmeasured.
What the ablations show
Adding document context after the first prediction
The cleanest comparison is the evaluation of the same configuration before and after label propagation. With BANZ4096 and the recurrent classifier with a CRF, financial recall rises from 0.973 to 0.987, while precision moves from 0.971 to 0.910. F1 moves from 0.972 to 0.947. This is what the authors’ preference for recall looks like when translated into the measured behavior of the system. The added rule makes more of the annotated sensitive tokens eligible for replacement. It also makes more replacements that the annotations do not call for, and F1 reflects both effects.
Label propagation has a different effect when the first classifier is more conservative. With the MLP and BANZ1024, financial recall rises from 0.485 to 0.682, while precision changes from 0.989 to 0.960. F1 rises from 0.651 to 0.797. The same operation can therefore raise F1 for an initial classifier formed around a relatively small set of confident positive decisions. It still leaves this configuration with lower recall than the recurrent classifiers. Propagating correct decisions is especially useful for repeated tokens. It cannot supply a positive decision for a spelling the first classifier never identifies.
Gains and losses arise from the same assumption about repetition. Imagine the surname in the paper’s example appearing in a fuller reference and then in a shortened one. Treating the repeated surname as sensitive protects the shorter mention when its immediate context provides weaker evidence. A repeated spelling that also has an ordinary meaning can be hidden in that ordinary use once it has received a sensitive label elsewhere. The measured precision and recall capture the combined effect of these decisions over the evaluated texts. The paper does not break that effect down by whether the propagated label came from a correct prediction or whether the spelling changed its meaning between occurrences.
This comparison also separates the consistency rule from the regular expressions. The positive categories used to score propagation are the names of people, organizations, and places. A calendar format or other patterned string can be detected by a separate rule, but that capability does not explain the changes shown in the before and after columns for those names. Their differences arise from adding document-level information to the output of the trained recognizer.
Adding sequence processing after contextual encoding
Holding the embedding fixed changes the question from what the encoder knows about language to how a classifier uses that information. On the financial documents before post-processing, the MLP with BANZ1024 has recall of 0.485 and F1 of 0.651. The recurrent classifier with the same representation has recall of 0.948 and F1 of 0.953. The underlying input vectors are from the same encoder. The recurrent classifier can read their sequence and learn how neighboring representations bear on the tagging decision, while the MLP has to extract its evidence from the vector for the token it is labeling.
The comparison with flairDE shows why the gain should be understood together with the representation. On the financial evaluation set before propagation, the MLP using flairDE already achieves recall of 0.933 and F1 of 0.950. The recurrent classifier with that encoder reaches recall of 0.968 and F1 of 0.967. This is a smaller separation than with BANZ1024. The recurrent classifier offers a way to use more of the sequence for the task, while the extent of its advantage depends on how informative the original contextual vectors are for a classifier working at a single position.
Adding the CRF tests a further use of sequence information. A recurrent classifier can make use of the surrounding input, while a CRF can also learn that the labels at nearby positions are related. With BANZ4096 on the financial set before post-processing, moving from the plain recurrent classifier to the CRF variant raises recall from 0.969 to 0.973 and changes F1 from 0.970 to 0.972. With BERT embeddings, the plain recurrent classifier achieves 0.957 F1 before post-processing and the CRF variant achieves 0.952. The results support a benefit in some configurations and show its dependence on the representation and the metric.
There are consequently several places where context can help a decision. The encoder represents a token using its sentence. The recurrent classifier learns how to use sequences of those representations for sensitive labeling. The CRF accounts for nearby output labels. The document rule uses another occurrence of the same text, possibly far away. Each comparison changes a different part of the reasoning. The largest measured differences between the MLP and recurrent classifiers indicate the importance of how the task classifier reads the sequence, while the effect of propagation shows the separate value of looking beyond the sequence used for the initial prediction.
Changing the training domain and the size of the representation
The recurrent architecture makes the comparison among BANZ sizes easier to interpret because it is used across representations trained on the same financial language source. Before post-processing on financial documents, plain recurrent recall is 0.948 with BANZ1024, 0.966 with BANZ2048, and 0.969 with BANZ4096. The larger representation gives the strongest recall in this comparison. The authors emphasize that a smaller representation can shorten processing, and discuss the move from BANZ4096 to BANZ2048 as a possible trade between recall and inference time. The figures support a choice among sizes under the conditions of this particular experiment.
The source of the pretraining text is harder to vary in isolation. The general German Flair encoder and the financial encoders were trained on different corpora, with different amounts of text and different available representations. The financial versions are somewhat stronger for some recurrent configurations on the target documents. After propagation, the highest recall belongs to the CRF using the general German Flair representation. In the MLP comparison, the general representation also supplies the highest financial recall before the rule is applied. Financial pretraining is a useful option in this study, and the size and direction of its advantage depend on what uses the representation and which stage of the system is being scored.
The contrast with GermEval illustrates the cost of interpreting specialization through a single test. The financial encoders were built to supply useful representations for the language of financial documents. Their target-domain performance can be good even if the features learned from that text are less useful for sentences collected across different sources. In GermEval the general German representation consistently has stronger results than the BANZ alternatives for the recurrent classifiers in the relevant comparisons. That is evidence of a difference in fit between the evaluation domains. The study does not isolate particular financial expressions or grammatical patterns as the cause.
The BERT comparison is similarly specific. BERT is exposed to the financial corpus and supplies vectors to the same family of downstream classifiers. Under this use, some recurrent Flair configurations achieve higher financial F1. The authors’ broader interest in attention-based entity recognition remains separate from the measured comparison because it would involve training the Transformer itself to make the tagging decisions. The study evaluates whether its contextual vectors help an external classifier, a test that leaves room for a different result from a differently trained system.
Limitations
Limits stated by the authors
Annotation quality is a constraint the authors single out. The classifier learns from examples of which tokens the experts marked, so errors in the examples can become part of the learned behavior. Differences in judgment between annotators can also matter. The discussion points to identifying suspicious training examples as future work. In the reported experiment, the authors restrict the scored positive class to people, organizations, and places because the evidence available for products, industry segments, and other sensitive information is less reliable. The definition of the benchmark follows what could be evaluated with the annotations they had.
The paper also identifies limits in the architectures it studied. BERT has the stated input length limit of 512 and in this study provides representations to a separate classifier. The authors discuss future work in which entities would be included directly during pretraining. They cite an earlier approach that treats words and entities as separate inputs when learning through masking and attention. They also propose investigating an attention-based recognizer trained as a complete entity tagging system. Those possibilities remain separate from the experiments with a vector-extracting BERT encoder.
The authors discuss court documents and healthcare records as possible applications. They expect some named entity patterns to carry over, and they outline additional language training and supervised adaptation when appropriate material is available. They also anticipate that a new domain may need its own post-processing. The test outside finance is GermEval. Its sentences offer a check on part of the system’s portability, while the proposed uses in courts and healthcare remain examples of where the method could be evaluated.
Another open question in the paper is the usefulness of anonymized documents for training other systems. The authors motivate processing a collection so it can be used for development and analysis. Preserving prose and layout is part of that design. They leave the comparison of downstream learning from anonymized and original text to future work. A reader can see how replacing a name with a generic category might preserve parts of a sentence’s meaning, while the measured effects on later training remain unresolved.
The authors also report an access limit on reproduction. The financial material used to train the language representations is available through the Bundesanzeiger. The annotated data used to train the classifiers and the code are unavailable publicly. This leaves the corpus source and the reported setup available for comparison, while a direct recreation of the authors’ supervised training and judgments about particular tokens would require material beyond the public resources they describe.
Limits of the measurement
The unit of measurement is a token associated with one of the evaluated name categories. A single occurrence of a name may contain several tokens, and a document can repeat the same name. Token recall consequently answers a question about the coverage of sensitive text at individual positions. It leaves open how many entire names are fully hidden and how many evaluated documents retain at least one identifying word. A remaining fragment might be enough to recognize a name in context. The paper reports no rate of fully cleared documents, so the headline recall should be read at the level at which it was measured.
Collapsing the labels into a binary decision serves the authors’ aim of suppressing sensitive strings. It also conceals some errors that matter to the edited document. A location replaced by a marker for a person can count as successful removal. A reader who relies on that marker to interpret the sentence receives different information about the original. Correct span boundaries matter as well. Covering most of a multiword name can produce several correct token decisions while leaving a meaningful part visible. The reported metrics give a quantified view of detection, with category fidelity and complete-span removal left unresolved.
The evaluation likewise leaves open whether a reader can infer an identity from what remains. The paper itself points to industry information as an additional kind of identifying detail. In a report, a person or organization can be described by surviving context. The classification experiment asks whether certain annotated details have been selected for replacement, and it does not test whether anyone could link a processed passage back to its subject. The legal discussion explains why actual anonymization matters, while the benchmark measures a component of the work needed to reach it.
The regular-expression branch extends the application’s coverage to recognizable formats. The reported metrics for the financial names supply no separate precision or recall for those rules. A reader therefore has evidence that the tool applies them, but no measured rate for how reliably it catches the relevant formats in the documents. The same distinction applies to scanned documents and layout. The paper describes optical character recognition and preservation of formatting for supported files. The main experiments do not quantify how errors introduced by scanning affect name detection or how consistently the downloadable copy retains its original layout.
Limits of the comparisons
Several conditions change between the financial evaluation and GermEval. The domains differ, the organization of the text differs, and the authors omit the document rule for GermEval. Numerical comparisons across the two settings reflect these conditions together. The controlled comparison for propagation is within the financial evaluation. The GermEval comparison is informative about how the trained classifiers and representations transfer to another collection of sentences, but it cannot establish what the full document workflow would achieve on annotated nonfinancial records.
The financial corpus comparison similarly combines several properties. General and specialist pretraining use different sources and amounts of language material, and the encoder configurations can differ in size. A particular financial representation’s advantage is evidence about using that representation in the tested workflow. It provides weaker evidence about what would happen if corpus domain alone changed under otherwise identical training. The paper’s result tables describe specific configurations, with uncertainty about how much of a small separation would persist under a new sample or another training run.
Finally, the document-level rule encodes a preference about ambiguous repetition. A token identified as sensitive can propagate a useful decision or a mistaken one. The paper describes the treatment of repeated tokens that were initially marked as ordinary, while leaving details such as conflicts between different sensitive labels under-specified. This matters more when the goal includes meaningful category markers or when a spelling has several roles in the same document. The observed precision and recall summarize how well this policy worked on the financial set. Its effect in another collection would depend on the recurrence of names and the frequency of ambiguous repeated forms.
What came after
PII-Bench: Evaluating Query-Aware Privacy Protection Systems (2026) cites the financial anonymization study and frames privacy protection around the query a system receives. The titles and tasks point to different units of evaluation. Biesner and colleagues process a document and compare the words selected for removal with expert annotations. The later work explicitly puts the query into the framing of the evaluation. In a query-aware setting, the relevant question is how privacy protection is evaluated when a request helps determine which information a system will use or reveal.
The citation connects a document-editing approach to a later line of evaluation centered on requests for information. The earlier study supplies a concrete account of what goes into a document-level decision, including the use of sentence context, the propagation of labels across repeated text, and the tradeoff between finding more identifiers and suppressing ordinary words. The citation establishes that relationship at the level of prior work. The later work’s specific use of the German financial corpus, classifiers, or consistency rule is unspecified.
Cite
Cite as David Biesner, Rajkumar Ramamurthy, Robin Stenzel, Max Lübbering, Lars Hillebrand, Anna Ladi, Maren Pielka, Rüdiger Loitz, Christian Bauckhage and Rafet Sifa. 2021. Anonymization of German financial documents using neural network-based language models with contextual word representations. International Journal of Data Science and Analytics.
@article{biesner2021anonymization,
title = {{Anonymization of German financial documents using neural network-based language models with contextual word representations}},
author = {David Biesner, Rajkumar Ramamurthy, Robin Stenzel, Max Lübbering, Lars Hillebrand, Anna Ladi, Maren Pielka, Rüdiger Loitz, Christian Bauckhage and Rafet Sifa},
journal = {International Journal of Data Science and Analytics},
year = {2021},
doi = {10.1007/s41060-021-00285-x},
url = {https://doi.org/10.1007/s41060-021-00285-x}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/biesner-2021-anonymization-german-financial-documents-neural/