---
title: "Learning to Rank Context for Named Entity Recognition Using a"
description: "Amalvy and colleagues train a sentence re-ranker on synthetic examples so a named entity recognizer can use clues from across a novel."
canonical: "https://research.elamur.ai/free/en/papers/amalvy-2023-learning-rank-context-named-entity/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/amalvy-2023-learning-rank-context-named-entity/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2023](https://md.research.elamur.ai/free/en/papers/2023/) / Learning to Rank Context for Named Entity Recognition Using a Synthetic Dataset

# Learning to Rank Context for Named Entity Recognition Using a Synthetic Dataset

Paper · 2023 · Arthur Amalvy, Vincent Labatut and Richard Dufour

**Authors:** Arthur Amalvy, Vincent Labatut and [Richard Dufour](https://md.research.elamur.ai/free/en/authors/richard-dufour/) · **Year:** 2023 · **Venue:** Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

[Cited by **7** papers in our library of the 163,136 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/amalvy-2023-learning-rank-context-named-entity/cited-by/) · Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/2023.emnlp-main.642/)
- [PDF](https://aclanthology.org/2023.emnlp-main.642.pdf)
- [DOI 10.18653/v1/2023.emnlp-main.642](https://doi.org/10.18653/v1/2023.emnlp-main.642)

## Summary

A name in a novel can be hard to classify from the sentence where it appears. The surrounding words may leave open whether it refers to a person, a place, or an organization, while a passage much later in the book makes its role clear. [Named entity recognition](https://md.research.elamur.ai/free/en/concepts/named-entity-recognition/) is the task of finding such mentions and assigning them a type. Amalvy and colleagues ask how a recognizer working on a short stretch of text can find useful evidence in a document too long to process in one pass. Their approach searches the book for candidate sentences, learns to rank them for their usefulness to the recognition task, and gives the recognizer a small selection alongside the sentence it must label.

The obstacle is supervision. The authors have literary sentences with entity labels, but those labels do not say which other sentences would help a recognizer. They use the instruction-following system Alpaca to create examples of that relationship. A generated sentence might describe an entity by name, depict a person doing something, or show a character traveling to a named place. For negative examples, the authors pair a target sentence with a randomly drawn sentence from another book or with a generated clue intended for a different target. A BERT reranker learns from those pairs. At evaluation time it scores actual sentences from the novels, and a separate BERT recognizer labels the target sentence with the selected context in view.

The experiments evaluate recognition on the opening chapters of 40 English novels and allow the search to reach into the rest of each book. The strongest reported configuration in the authors’ selection experiment keeps 3 context sentences. It improves on recognition with no added context by around 1 F1 point, generally performs better than simple retrieval rules, and has a slight edge over supervised rerankers trained on human-annotated passage retrieval data. The difference varies by novel. For The Black Company, the learned reranker improves on the no-retrieval baseline by 8.1 F1 points in the comparison that adds a single context sentence.

The search range matters particularly to the learned reranker. Restricting its candidates to the opening chapter lowers recognition performance substantially compared with searching the whole novel. The ranking still treats each candidate independently, so several highly scored sentences can repeat the same clue or cover just one of the names in the target. The experiments establish that generated training examples can help a ranker choose real literary evidence. They leave open how best to choose a set of sentences whose clues complement one another.

## Deep dive: Learning to Rank Context for Named Entity Recognition Using a Synthetic Dataset

Amalvy and colleagues train a sentence re-ranker on synthetic examples so a named entity recognizer can use clues from across a novel. · about 32 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### A local prediction can depend on distant evidence

A recognizer has to determine where a mention begins and ends and which class belongs to it. A sentence can supply ample evidence for both decisions. A person may speak or act, a place may be the destination of a journey, and an organization may be described through its responsibilities. In a novel, the evidence may be distributed across scenes. A name can be introduced with a useful description and later appear in a sentence that assumes the reader already knows what it refers to. The later sentence is still a complete input to the recognition task, even though it supplies less information than a reader of the book would have.

The work builds on an earlier study by the authors that examined the contribution of local and book-level context to literary recognition. That study found a performance cost when the recognizer lacked document-level evidence. The new paper shifts the question from whether such evidence matters to how to find it. Once every sentence in a long document is a potential clue, a retrieval system must decide which small subset is worth including with the current sentence.

The obstacle to treating the whole book as input comes from the attention mechanism in a standard [Transformer](https://md.research.elamur.ai/free/en/concepts/transformer/). As the input grows, the cost of attention grows quadratically with its length. The paper notes that pretrained systems such as BERT and LUKE can be highly accurate at recognizing entities while still facing this constraint. The issue is therefore one of access to evidence. A recognizer may have the capacity to interpret a revealing description, yet encounter a target sentence in a window that excludes the description. [BERT](https://md.research.elamur.ai/free/en/papers/devlin-2019-bert-pre-training-deep-bidirectional/) and [LUKE](https://md.research.elamur.ai/free/en/papers/yamada-2020-luke-deep-contextualized-entity-representations/)

One response is to change the architecture so that attention has subquadratic complexity. The paper points to work on efficient Transformers and to a benchmark that treats long sequences as a continuing challenge. The retrieval approach changes what goes into the recognizer. It searches the longer document in sentence-sized units and assembles a shorter input from the sentences judged useful. A passage can enter that input even if it lies far away in the original book. The search range and the recognizer’s input length become separate design choices. [Efficient Transformers](https://md.research.elamur.ai/free/en/papers/tay-2020-efficient-transformers-survey/) and [Long Range Arena](https://md.research.elamur.ai/free/en/papers/tay-2020-long-range-arena-benchmark-efficient/)

#### Where to look for a clue

The literature the authors discuss distinguishes external sources from the document itself. Earlier recognition studies had used external context retrieval. A document-level search is possible even when those resources are unavailable, provided the document contains relevant evidence. That condition matters for a novel, since descriptions and uses of its names may be spread across the book. The paper treats the book as the source of candidate evidence and the sentence under examination as the place where a prediction is required. [Improving Named Entity Recognition by External Context Retrieving and Cooperative Learning](https://md.research.elamur.ai/free/en/papers/wang-2021-improving-named-entity-recognition-external/)

Earlier work had also combined predictions for the same sentence under different neighboring contexts by majority vote. The contexts in that study came from nearby sentences. A neighbor can be a good source of evidence because it participates in the same passage. It can also follow the same pattern of referring to a familiar character without explaining who that character is. The approach in this paper allows a candidate to come from beyond the immediate scene and makes the selected context part of a single recognition input.

The authors’ earlier study of global and local context used unsupervised retrieval rules. Such a rule can prefer sentences close to the target, sentences with similar wording, or sentences that share a noun with it. Each choice captures a plausible route to relevant evidence. Proximity helps a search stay within a passage. Word overlap helps it find references to the same subject across passages. Neither property directly expresses whether the new sentence supplies information about the type of an entity. A repeated name can occur in a sentence that simply assumes the reader already recognizes it.

This distinction makes recognition-specific supervision desirable. A human annotation that marks a span as a location answers a question about the target text. Training a retriever calls for a judgment about a pair of texts. The annotation would have to indicate whether a particular candidate helps someone or something label an entity in the target. Even a well-annotated collection of opening chapters therefore leaves the supervision problem mostly intact. The paper identifies the absence of a dataset for this retrieval task and the expense of making one by hand.

#### Re-ranking as a way to use supervision economically

In [information retrieval](https://md.research.elamur.ai/free/en/topics/information-retrieval/), it is common to use a relatively simple search method to find passages and then apply a more expensive reranker to the shortlist. The paper describes this arrangement using BM25 for initial retrieval and MonoBERT or MonoT5 for the later scoring step. The rationale transfers to novels. A rule can quickly define which sentences deserve a closer look, and a learned pairwise scorer can concentrate on deciding which of those sentences to keep. Scoring each sentence in the book with the learned method would make the second stage more expensive. [Passage Re-ranking with BERT](https://md.research.elamur.ai/free/en/papers/nogueira-2019-passage-re-ranking-bert/) and [Document Ranking with a Pretrained Sequence-to-Sequence Model](https://md.research.elamur.ai/free/en/papers/nogueira-2020-document-ranking-pretrained-sequence-sequence/)

The transfer also changes the meaning of relevance. In the book task, the query is a sentence from the text, and the intended use of a candidate is to clarify an entity in it. A passage ranker trained for general retrieval may have learned to match topics or connect passages to information needs. The authors want their scorer to learn which kinds of connections are helpful for assigning an entity type. They preserve the two-stage architecture from retrieval and change the examples that teach the second stage.

The paper draws on work showing that systems trained to follow instructions can carry out tasks expressed as text generation. It discusses both training across many tasks and [fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/) on instruction datasets. For this application, an instruction has to elicit a complete sentence with controlled content, such as a description of a named organization. The authors favor Alpaca, an instruction-tuned system based on Llama, because they want longer responses than they expect from systems such as BloomZ or mT0, which the paper describes as tending towards short outputs. [Multitask Prompted Training](https://md.research.elamur.ai/free/en/papers/sanh-2021-multitask-prompted-training-enables-zero/), [Finetuned Language Models Are Zero-Shot Learners](https://md.research.elamur.ai/free/en/papers/wei-2021-finetuned-language-models-zero-shot/), [Crosslingual Generalization through Multitask Finetuning](https://md.research.elamur.ai/free/en/papers/muennighoff-2022-crosslingual-generalization-through-multitask-finetuning/), and [LLaMA](https://md.research.elamur.ai/free/en/papers/touvron-2023-llama-open-efficient-foundation-language/)

Generation supplies a way to specify what a helpful sentence should do without asking annotators to find and assess candidate sentences throughout each book. The authors use known entity labels to decide what kind of clue to request, then treat the generated pairing as a training example. The eventual test is whether a scorer taught with invented clues will find useful evidence in ordinary narrative prose.

### The method, step by step

#### What the search returns

The method starts with a target sentence and the document that contains it. For each target sentence, the authors want to retrieve a set of other sentences from the same document. The notation below expresses the search space and the desired size of the returned set.

```
Sᵢ ⊆ Dᵢ, |Sᵢ| = k
```

Here Dᵢ is the enclosing document, treated for retrieval as a collection of sentences. The subscript i identifies the target sentence sᵢ and associates it with that document and its retrieval result. Sᵢ is the selected set of context sentences. The symbol ⊆ places the selected sentences within the document, the vertical bars give the number of members in the set, and = states that this number is the requested count k. The paper later notes that the shared-noun heuristic can return fewer sentences when the document supplies too few matches.

Each selected sentence is supposed to contribute evidence about entities in the target. The paper defines this in terms of distinguishing entity classes. The scoring stage looks at candidate sentences separately, but the recognizer ultimately sees the selected sentences together. The authors call that assembled input Ŝᵢ. The hat distinguishes the final ordered input, which includes sᵢ, from Sᵢ, the set of retrieved context alone. The authors use the order of the sentences in Dᵢ to assemble Ŝᵢ. Ranking controls admission to the input, and the original document controls the order in which the admitted sentences appear.

When the recognizer processes this input, the prediction of interest is on sᵢ. The labels for added context are discarded. A sentence elsewhere in the novel can therefore supply evidence even when no gold entity labels are available for it. The evaluation only needs gold labels for the target sentences.

From synthetic training pairs to literary entity labels The steps in order.

#### Creating paired examples from annotated prose

The synthetic collection teaches a sentence-pair task. Every record has the following form.

```
(sᵢ, sⱼ, y)
```

The parentheses enclose a training record, and the commas separate its fields. The first field, sᵢ, is the target sentence whose entities need context. The second, sⱼ, is the proposed context sentence. The subscripts i and j distinguish the roles of the two sentences. The last field, y, is the assigned relevance label for this pairing.

```
y = 1 if sⱼ is relevant to sᵢ, and y = 0 otherwise
```

Here y is the label defined for the pair, and = assigns the value associated with the condition. The label 1 identifies a positive example, and 0 identifies a negative example. Relevance is directional in this setup. The question is whether sⱼ helps with recognition in sᵢ. During construction, the authors give the label according to how the example was made.

The target sentences come from the training portion of the literary recognition collection. The authors choose an annotated entity in a target sentence and use a prompt appropriate to its class. The categories are PER for person, LOC for location, and ORG for organization. The prompts turn the class into a feature that could appear in natural text. A description can give an entity identifying properties, an action can present a named person as an actor, and a movement can present a named place as a destination. Each positive sentence must explicitly mention the target entity string.

The description pattern applies to all of the entity classes. The authors’ example for One-Eye shows the generator supplying a characterization of the named person. That sentence has the kind of information a recognizer might use to distinguish a character from a place or an institution, even if the description supplies invented details. The construction uses the entity’s annotation to request a clue to its type. It does not require the new sentence to be a historically or narratively accurate statement about the book.

For the action pattern, the authors use person mentions. In the example involving Croaker, the target passage supplies the name in dialogue, and the generated sentence places Croaker in the role of someone who whistles and walks. The generated action gives the pair a person clue without needing to explain the original exchange. For the movement pattern, the target is a location. In the example for Necropolitan Hill, the generator invents a named visitor who travels there. The presence of another named entity is part of that example. The useful relation is between the traveler and the destination, which gives the target name a location reading.

These choices reflect the authors’ observations about the kinds of sentences that can resolve ambiguity. The prompts make that judgment operational. A training pair can be constructed even if the particular target sentence has few nearby clues or the authors have yet to identify which passage in the book would help. The generator’s job is to produce an instance of the requested pattern. The subsequent BERT scorer has to learn from the finished pair what relates its sentences.

The authors generate one positive example per unique entity string across the generation data. That choice keeps often-mentioned names from accounting for a disproportionate share of positives. Counting distinct strings is also a specific design decision about what variation the set represents. A often repeated spelling receives the same generation allowance as a spelling encountered once. The generated sentence is filtered out if it omits the target string, so the retained examples preserve the explicit textual link required by the prompts. This check is about the name’s presence. It leaves the semantic quality of the description, action, or movement to the generation process.

#### Creating negatives that differ in useful ways

The first way to make a negative example is to draw a sentence at random from a different document. A sentence about another story is likely to offer little help with the names in the target. Its prose still comes from a real novel. It may include names of its own or contain no named entity at all. The paper illustrates the mismatch using a sentence involving the Italian Catherine paired with a sentence about Alice swimming. The latter can be intelligible and informative in its own scene while offering little evidence about the first sentence’s entity.

Random sampling alone gave the authors an undesirable training behavior. They report that the retriever overfit to the presence of entities in context, since their positives mention an entity and the randomly drawn contexts might contain none. The second construction gives the scorer irrelevant candidates that nonetheless have the same broad property as a positive. It takes a context generated for one positive record and puts it beside the target from another. The borrowed sentence still contains an entity. Because positive generation is organized by unique entity strings, a borrowed context is likely to mention a different name from the one whose relevance it is being judged against.

The example using Klausenburgh and Forley illustrates this difference. A description of Forley can look like the kind of clue the prompts were designed to produce. It is nonetheless a poor match for a target about getting to Klausenburgh. A scorer trained on examples like this has a reason to examine the relationship between the target and the candidate. Detecting a name or recognizing the general form of a description would be insufficient to separate that swapped negative from a positive.

The two negative sources address different properties of the training data. Cross-document sampling provides naturally occurring sentences with a variety of contents. Swapping supplies generated sentences that share the appearance of positive clues but are attached to a different target. In both cases the negative label is a consequence of construction. The procedure uses a plausible mismatch as supervision, with no separate judgment that every sampled or swapped sentence is irrelevant.

The authors make separate datasets with Alpaca-7b and Alpaca-13b. The former has 2,716 examples and the latter 2,722 examples. The authors attribute the difference in size to the filter for the target string and report that omission of that string was rare. They also observe that generation sometimes draws on information absent from the input. For Gandalf the Grey, the generator included his role as a wizard even though the sentence supplied to it did not state that. The authors suggest that pretraining may explain this. The anecdote shows how the generated clues can mix details already associated with a name and invention prompted by its class. The authors release the synthetic dataset and their code under a free license.

#### Learning to score a pair

The authors put a regression head on BERT. A regression head is an output component that produces a numerical estimate, here a relevance score between 0 and 1. The two sentences are passed to BERT as parts of a single input. In the architecture illustration, `[CLS]` appears at the start and `[SEP]` separates the target from the candidate and marks the end. The paper uses a pair about Minas Tirith to illustrate the idea. The target expresses an impression of the name’s referent, while the candidate identifies Minas Tirith as a capital. The relation between the pair is informative for a location label.

The training examples provide relevance judgments at the extremes of the output range. At inference, the score serves to order candidates for the same target sentence. A higher score makes a candidate more likely to be among the retained sentences. The selection requires a useful ordering inside the candidate pool. The paper does not specify a rule that would translate the score into the expected size of a change in recognition F1.

The reranker is trained for 3 epochs, meaning passes through the training data. The learning rate, which sets the scale of the training updates, is written as follows.

```
2 × 10⁻⁵
```

The leading 2 is the coefficient, × denotes multiplication, 10 is the base, and the superscript ⁻⁵ is the negative exponent. The same learning rate is used for the recognition component, which is fine-tuned for 2 epochs. The reranker is optimized to score pairs, while the recognizer is trained to assign labels. The recognition experiments reuse the same recognizer across retrieval conditions so that the chosen contexts can vary while the prediction component is held fixed for the comparison.

#### Turning a book into a shortlist

At test time, the candidate texts come from the actual book. The authors split its text into sentences. For each target, they run several inexpensive retrieval procedures before applying the learned scorer. BM25 contributes sentences with similar wording. The shared-noun rule, called `samenoun`, contributes sentences that contain a noun also found in the target. Nouns are identified with NLTK. The immediate predecessors and the immediate successors provide local context on both sides. This structure gives each source an opportunity to contribute candidates.

The authors give each source a quota of n sentences. Before removal of repeated candidates, the nominal size of the pool is as follows.

```
4n
```

Here n is the per-source quota. The coefficient 4 counts the sources, with preceding and following sentences given distinct quotas, and adjacency of the symbols denotes multiplication. A sentence might be found by several sources. The authors remove repeated instances before scoring, so the number of distinct candidates may be below the nominal size. The shared-noun rule can also exhaust its qualifying sentences before filling a quota.

The search evaluates the following settings for the per-source quota.

```
n ∈ {4, 8, 12, 16, 24}
```

Here n denotes the candidate quota just described, ∈ means “is a member of,” and the braces enclose the tested values, separated by commas. The quota determines how much evidence the learned scorer can examine. It is separate from k, which determines how much evidence the recognizer reads. The paper reports experiments with k from 1 to 8. Raising n can expose the ranker to more candidates while leaving the size of the final set unchanged. Raising k can put lower-ranked candidates into the recognizer’s input even if n is unchanged.

Once the shortlist is formed, BERT scores each pair consisting of the target and one candidate. The method takes the highest-scoring k candidates, puts them and the target back in document order, and passes the resulting text to the recognizer. The recognizer is pretrained BERT with a classification head, using the `bert-base-cased` checkpoint from the Transformers library. The head maps the representations to the labels used in the recognition task. Only the target sentence’s predictions contribute to the recognition result. [Transformers](https://md.research.elamur.ai/free/en/papers/wolf-2020-transformers-state-art-natural-language/)

The separation of roles is central to the experiment. The generator can use the annotated entity to create a clue during training. The retrieval scorer at test time sees the target text and a sentence from the book. It has to rank that sentence using what it learned from the pair data, with the heuristic shortlist as its starting point. The recognition system then decides how the retrieved words affect the target labels.

### Experiments and results

#### Where the labels and the candidate text come from

The English literary benchmark consists of the first chapter of 40 novels. The paper uses the collection created by Dekker and colleagues and subsequently corrected and expanded by Amalvy and colleagues. It retains the PER, LOC, and ORG classes described in the method. The authors also collect the full texts of the books, so the labeled evaluation sentences and the material available to search cover different portions of each document.

This design makes it possible to evaluate access to faraway evidence without requiring entity annotations for every page. An opening-chapter sentence supplies the target and the gold labels against which its prediction can be scored. A later sentence supplies textual evidence if a heuristic can find it and a ranking method retains it. The experiment measures recognition in the annotated chapters with book-wide retrieval available. The evidence is literary prose in both roles, but only the target role requires labels.

The authors calculate recognition F1 using the default mode of `seqeval`, a library for evaluating sequence labels. Precision reflects how many predicted entities are correct. Recall reflects how many annotated entities the recognizer recovers. F1 combines those aspects of performance, so an increase in recall and a decrease in precision can pull the result in opposite directions. The authors report means across 5 folds. Where retrieval is nondeterministic, they average 3 runs to account for variation. For example, `samenoun` randomly selects from sentences qualifying under its shared-noun criterion.

The recognition component is kept fixed across retrieval configurations in the comparison. This matters because adding context can change the recognizer’s predictions without retraining it. The comparisons test which sentences each method puts in front of that recognizer and how well the resulting input works. They also vary how many sentences are supplied, so a comparison at a given k is about the selection method under a particular context allowance.

#### What the baselines test

The no-retrieval condition sends the target sentence to the recognizer alone. It measures how well local wording already supports the labels. The `surrounding` baseline adds nearby sentences. The BM25 baseline selects candidates by its similarity score, and `samenoun` chooses sentences with a noun in common with the target. These conditions let the authors examine the value of learning a ranking beyond the value of supplying more text. They also test simple choices a system can use without a labeled retrieval collection.

The authors include two random rerankers to examine the effect of selection after pre-retrieval. One draws k sentences randomly from the pooled candidates. The other takes an equal share from each heuristic bucket. The allocation for the second strategy is expressed as follows.

```
k/4
```

Here k is the desired total number of retained sentences, / denotes division, and 4 is the number of heuristic buckets. The expression gives the intended share from each bucket. This baseline preserves a balance across candidate sources. The pooled random baseline makes its choice from the shortlist as a whole. Both give the recognizer sentences that have passed an initial heuristic filter, so their comparison with learned reranking concerns the additional value of ordering those candidates.

The supervised comparisons use MonoBERT-large and MonoT5 trained on [MS MARCO](https://md.research.elamur.ai/free/en/papers/bajaj-2016-ms-marco-human-generated/), a passage retrieval dataset with human annotations. The authors test each with BM25 alone and with the combined shortlist. The BM25-only versions retrieve 16 sentences before passing them to the supervised reranker. The `all+` versions use the same kinds of pre-retrieval sources as the synthetic-data system. This makes the combined-shortlist comparisons closer in design to the authors’ method. They compare a relevance scorer trained for passage retrieval with a relevance scorer taught through generated clues aimed at entity classification.

Changing the first-stage method matters independently of the reranker. A reranker can bring a good candidate forward only if the candidate reaches its shortlist. The BM25-only conditions therefore test a common retrieval arrangement, and the combined conditions indicate what changes when the supervised scorer can also draw from shared nouns and the immediate neighborhood.

#### Recognition gains and their conditions

In the configuration search, the authors choose the reranker trained on the Alpaca-7b data with n = 8 and k = 3. The n value is the candidate quota for each heuristic. The k value is the number of selected context sentences that go to the recognizer. The peak of the learned method in the comparison with unsupervised retrieval also occurs at k = 3. The authors say retrieval improved literary recognition by about one F1 point compared with the condition without retrieval. The number is the paper’s approximate improvement, and the experiment uses F1 on the annotated opening chapters.

The simple retrieval rules also tend to help. Their benefit depends on which rule is used and how many sentences are appended. In the authors’ comparison with no retrieval, `surrounding` and BM25 are exceptions to the general benefit when they retrieve 6 sentences or more. The neural reranker generally scores above the unsupervised alternatives over the tested settings. This pattern adds a qualification to the aggregate improvement. The recognizer can benefit from a small supply of context, and adding further candidates selected by a simple rule can erode that advantage.

In the comparison that retrieves just one sentence, the learned reranker matches or exceeds the other configurations on 50% of the novels, expressed by the authors as 20 out of 40. The statistic includes ties. It applies to the per-book experiment with k = 1, which asks how well methods pick a single addition to the target. Results vary considerably across titles. In the same comparison, the largest improvement of neural retrieval over no retrieval is 8.1 F1 points for The Black Company. That result describes one book under the single-sentence setting. The around 1 F1 point improvement concerns the overall comparison for the reranker at its peak configuration.

The supervised rerankers score above the random reranking baselines. The candidates supplied by the heuristic pool already carry some indication of potential usefulness, and learned selection adds value beyond drawing from that pool. The authors’ system has a slight lead over the other supervised methods. They present the results as close, with the point of comparison being that their ranker can match or slightly exceed systems trained on human passage judgments while using generated training pairs aimed at the literary recognition task.

The combined candidate pools generally do better than BM25-only pools in the supervised comparison. Since both MonoBERT and MonoT5 can be used with different initial retrieval procedures, the experiment makes visible the contribution of pre-retrieval. The authors interpret the pattern as evidence that relying on BM25 alone can leave useful sentences out. The alternative search rules can contribute candidates with a relation to the target that a similarity ranking might place too low.

#### Relevance scores and recognition scores answer different questions

The authors also report an F1 of 98.01 for their selected reranker on the evaluation portion of the synthetic retrieval dataset. This is the score for deciding relevance on constructed pairs. The recognition F1 on the literary benchmark evaluates predicted entity mentions and types. A system can be very good at recognizing the relationship used to build a synthetic pair while facing a harder ranking problem among authentic sentences. The high synthetic score establishes that the scorer learned the task embodied in those examples, and the downstream comparisons show whether doing so improved predictions on prose.

The paper illustrates what the pair scorer does using a sentence mentioning the Ministry of Truth. A candidate that expands on the ministry’s responsibilities scores at the upper end of the relevance scale. A sentence describing Winston heading for the stairs scores at the lower end. The first candidate explicitly discusses the institution and gives information that can support an organization reading. The second can belong to the same narrative while having little to contribute to that decision. These are individual estimates produced by the learned scorer.

Candidate relevance scores for the Ministry of Truth target in the English literary corpus The re-ranker favors the sentence explaining the ministry’s duties over a narrative action involving Winston.

**The numbers**

| System or setting | Predicted relevance |
| --- | --- |
| Winston heads for the stairs | 0.0 |
| Sentence describing the ministry’s responsibilities (this paper) | 1.0 |

The example helps explain the difference between being in the right book and being useful to the current recognition decision. A name in a candidate can matter if it connects the candidate’s information to the target. An action involving someone else may supply evidence for that person’s type in a different pair. The score is assigned with respect to the current target. The F1 comparisons show how the ranking behaves over the benchmark, where a candidate’s usefulness also depends on how the recognizer responds to the whole input.

### What the ablations show

#### Breadth of search and length of input are separate choices

The configuration sweep varies the number of candidates per heuristic and the number of sentences retained after reranking. The authors find that n = 4 is too small for good performance in their experiments. They suggest that this setting may expose the reranker to too few helpful candidates. This interpretation follows from the two-stage design. A good relevance judgment can only rescue a sentence that was retrieved in the first place. A small quota limits what a learned scorer has a chance to promote, even when its prediction for any individual pair is accurate.

Larger n values help when k is high. The best results, though, occur with k between 2 and 5. A broader search does not automatically create a need for a longer recognition input. With greater breadth, the reranker can replace weaker candidates within a compact set. With a larger final set, the recognizer receives progressively lower-ranked material as well. The experiments favor an intermediate operating point for these novels, with n = 8 and k = 3 chosen for the authors’ main configuration.

The sweep measures NER F1 after retrieval and recognition. It does not count how many of the discarded candidates were genuinely useful, because the authors lack gold contextual relevance annotations for the books. The proposed candidate-coverage explanation is therefore consistent with the performance pattern instead of a direct measurement of what the initial stage missed. An F1 curve can show that broadening the pool improved the final decision under a setting. Identifying which passages account for the improvement would require a different analysis.

#### Generator size has little effect in the tested setup

The Alpaca comparison changes the generator used for the retrieval data. Alpaca-7B has 7 billion parameters, and Alpaca-13B has 13 billion parameters. In either case, the generated sentences are filtered and turned into training pairs for a BERT reranker. The same kind of recognition experiment then measures the downstream outcome. This makes the comparison about the effect of the generator through the resulting training data.

The authors find very little influence on NER performance across the surveyed n values. The final configuration uses the training set from the smaller generator. An explanation consistent with the construction is that the prompts request kinds of clues that both versions can supply and that the reranker mainly needs to recognize the relationship between clue and target. The paper does not measure the quality of the generated prose along that dimension or isolate which properties of the two datasets the rankers learn. The result supports using either of these Alpaca variants for the setup studied. Its scope is the chosen prompts, the two related generators, and the downstream benchmark.

The high synthetic evaluation F1 and the smaller downstream gain help put this comparison in context. The generation procedure creates relatively explicit examples of the desired signal. Real books may express it less directly, and some targets may supply enough information on their own. Similar recognition outcomes under the two generators can arise even if the generated sentences differ in content. The experiment records the effect that survives training the scorer, applying it to authentic candidates, and asking the recognizer to use the result.

#### How far the retrieval system can search

The authors compare searching only the target chapter with searching the entire novel. They run this comparison for BM25, `samenoun`, and neural reranking. For the learned method, they examine n values of 4, 8, and 12. Varying the quota here helps distinguish an effect of the search range from an outcome tied to a single shortlist size.

For BM25, searching the chapter can be more beneficial when the system keeps a few matches. The chapter can contain repeated references to the entities currently involved in the narrative. When BM25 selects more than 2 sentences from that chapter, performance drops sharply. The drop is weaker when BM25 can search the whole book. The authors suggest that a chapter may contain enough good matches to supply a short list but too few to maintain the same usefulness as the requested set grows. The retrieval criterion will continue to return candidates even as the additional ones become less informative.

The shared-noun heuristic follows a similar pattern. At small k, restricting it to the chapter seems to help. The authors suggest that shared nouns within a chapter may be more likely to relate to the same entities. For k greater than 4, the full book performs better. One interpretation offered in the paper is that, when enough matches are drawn, the larger pool gives the rule a better chance of including a genuinely useful sentence. The observations indicate that the value of broadening the pool depends on both the matching rule and the number of chances it is given to find evidence.

The learned reranker behaves differently. Its recognition performance drops substantially when its initial search is restricted to the chapter. The pattern holds over the different candidate quotas tested in the context-window comparison. In this setup, the reranker is particularly effective when it has access to the larger document. Giving it a different local quota does not remove the performance gap. This supports the view that a richer candidate pool contains useful evidence that the learned scorer can select, even though a broad pool is not uniformly advantageous for the simple heuristics.

The chapter restriction operates before reranking. Both sides of the comparison still give the recognizer a short augmented input, and neither requires processing a book as a single sequence. The result is thus about access to candidates rather than direct attention over long spans. It demonstrates how a long search range can improve a local prediction through selective reading.

#### What happens to precision and recall

The paper also examines precision and recall separately for the learned method and the unsupervised alternatives. Recall generally benefits from retrieval. The stated exception is `surrounding` at k = 8. Precision can decline for any of the methods at some k values. A system given context may therefore recover more annotated entities while also making extra incorrect predictions. F1 records the combined effect of those changes.

This analysis helps interpret why an intermediate context size can work best. Supplying a clue can make a previously missed mention easier to recognize. Additional text also changes the environment in which the recognizer interprets a target sentence, and the resulting changes need not all help. The paper shows the aggregate precision and recall behavior. It does not attribute specific errors to particular words in a retrieved sentence or establish which entity classes account for the gains.

The random reranking results offer a related control. A useful pool gives every selector a starting advantage, but random choice from that pool performs below supervised selection. The combined-shortlist comparisons show that the source of candidates matters as well. Together, these experiments give evidence for both stages. The heuristic search determines what the ranker can see, and a learned ordering improves what the recognizer is asked to read.

The paper reports the observation that motivated swapping positives to make negatives, but gives no numerical breakdown of recognition performance with that component removed. Likewise, the positive clue templates are described as a design based on the authors’ observations. The numerical ablations focus on candidate counts, generator size, search range, and the choice of retrieval and reranking procedure. They do not assign a separate downstream contribution to descriptions, actions, or movements.

### Limitations

#### Limits identified by the authors

The authors’ main modeling limitation is that the reranker evaluates every candidate separately. A sentence can be scored highly because it contains a useful clue, even if another selected sentence contains the same clue. Removing duplicate candidate sentences during pre-retrieval solves the narrower problem of a heuristic finding a sentence that another heuristic already found. Different sentences can still convey redundant information. If both are retained, the recognizer pays the cost of processing a longer input for evidence it already has.

Independent scoring also leaves open how to cover several ambiguous mentions in one target. A set of strong candidates might all discuss the same person or location. Each pair can receive a sensible relevance score even though the collection leaves another mention unexplained. The ranking target is the usefulness of a single candidate to the original sentence. It does not directly represent how much new information the candidate contributes after the earlier selections.

The authors propose an iterative alternative. After selecting a sentence, the system could add it to the input used for ranking and score the remaining candidates against the expanded text. This would let a later choice depend on information already selected. It would also change the kind of input the ranker has to judge, from an original target sentence to a target accompanied by previous selections. The paper presents this as future work and does not give a measured result for the procedure.

The second stated limitation is computational. Retrieval avoids applying full attention to the entire novel as one sequence, but the authors say that its search cost still grows linearly with the number of sentences in the document. Scoring candidates has its own cost, which the shortlist controls. Keeping more sentences increases the cost of recognition by increasing the length of the recognizer’s input. A favorable comparison on F1 therefore measures the quality of the predictions under the tested settings. It supplies no timing or resource comparison that would establish the practical cost of the gain on these books.

The authors also identify a possible source of [bias](https://md.research.elamur.ai/free/en/topics/bias-fairness-safety/). Alpaca is based on Llama, and the paper refers to biases documented for Llama concerning attributes such as gender, religion, and age. These could affect the kinds of descriptions and actions generated for names. A scorer taught with those examples could learn patterns shaped by the generator’s biases. The paper describes this route by which bias might enter the retriever. Its evaluation does not measure how often that happens or what effect it has on particular groups in the literary benchmark. [On Biases in Language Generation](https://md.research.elamur.ai/free/en/papers/sheng-2019-woman-worked-as-babysitter-biases/)

#### Limits of what the experiments establish

The evaluation is on English literary text, with recognition labels in opening chapters and the rest of the book available for retrieval. This supports a claim about retrieving across those novels to recognize entities in the labeled chapters. It gives no direct measurement of performance on target sentences later in the books. A later chapter might have a different mix of established names, new names, and explicit introductions. Access to the full novel in this setup also includes sentences that follow the target. An application that reads in order and can only retrieve earlier text would have a different candidate pool.

The experiment covers person, location, and organization. The synthetic templates were chosen around those distinctions. Their general description pattern can be stated for other categories, but the experiments do not establish that the same kinds of clues improve recognition for other entity inventories, languages, or genres. The paper proposes extending synthetic retrieval supervision to other natural language tasks when the designer knows what kinds of context could help. Establishing that knowledge is part of the design problem for any such extension.

The synthetic labels are approximate judgments about what evidence should help. The presence of the name is checked, but the authors do not validate each generated sentence by measuring whether it fixes a particular prediction. A description may mention the entity and still contribute little to distinguishing its class. Conversely, negative sampling and swapping make irrelevance plausible without proving it for individual pairs. These properties matter when interpreting 98.01 F1 on the synthetic evaluation portion. It measures performance against labels produced by these construction rules. The downstream experiments supply separate evidence about whether learning those rules yields a useful ranking on real text.

The comparison with manually annotated retrieval data changes more than the way the labels were acquired. The synthetic examples target literary recognition, whereas MS MARCO supplies supervision for passage retrieval. The compared systems also include different reranking architectures. The result shows that this particular task-specific synthetic training procedure can compete with the tested passage rerankers. It leaves open how the same BERT scorer would compare if it were trained on carefully matched human judgments about clues in novels. The paper’s motivating data gap is precisely the absence of that comparison material.

The reported recognition gains are averages, and the per-book analysis shows that the average conceals substantial variation. Titles differ in how much the learned method helps. The authors describe the advantage over the supervised rerankers as slight, and the reported comparison provides no uncertainty estimates that would establish the reliability of that small edge. The more direct evidence is the pattern across baselines, shortlist configurations, and context windows. That pattern favors a learned selection stage on these books, with larger benefits in some circumstances than in others.

Finally, retrieval and recognition are evaluated as a pipeline. If the target remains difficult, several explanations are possible. The book may supply little useful evidence, the heuristic stage may fail to surface it, the reranker may rank it too low, or the recognizer may fail to use it. The chapter-versus-book comparison and the comparisons among selectors narrow some of these possibilities in aggregate. Without human relevance annotations for authentic candidate sentences, the study cannot assign each individual failure to one stage. Its strongest end-to-end claim is that the selected text improves the target labels overall in the reported literary evaluation.

### What came after

[Large Language Models for Generative Information Extraction: A Survey](https://md.research.elamur.ai/free/en/papers/xu-2023-large-language-models-generative-information/) cites Amalvy and colleagues’ study. Its topic is generative [information extraction](https://md.research.elamur.ai/free/en/concepts/information-extraction/). In the study it cites, generation is used to create training evidence for a retrieval step. The generated sentences teach a scorer what a useful clue can look like. At prediction time, the scorer ranks sentences from the original document, and a separate recognizer assigns the entity labels. The connection is an example of generation contributing to extraction through supervision.

The citation establishes a connection to the survey. It leaves open how the survey classifies the approach or whether it discusses the retrieval experiments in detail. There is no basis here to attribute an implementation, a replication, or a new experimental result to the citing work. The specific ideas that the paper leaves for subsequent experiments are to select sentences with their interactions in view and to test synthetic retrieval supervision on other tasks where useful evidence can lie beyond the immediate input.

## Cite

Cite as Arthur Amalvy, Vincent Labatut and Richard Dufour. 2023. Learning to Rank Context for Named Entity Recognition Using a Synthetic Dataset. Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/2023.emnlp-main.642](https://doi.org/10.18653/v1/2023.emnlp-main.642)

```bibtex
@inproceedings{amalvy2023learning,
  title = {{Learning to Rank Context for Named Entity Recognition Using a Synthetic Dataset}},
  author = {Arthur Amalvy, Vincent Labatut and Richard Dufour},
  booktitle = {Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-main.642},
  url = {https://doi.org/10.18653/v1/2023.emnlp-main.642}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
