NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Nested Named Entity Recognition via Second-best Sequence Learning and Decoding

Takashi Shibuya, Eduard H. Hovy

TL;DR

This paper introduces a clever way to identify "nested" named entities—like a protein name hidden inside a larger chemical compound name—by treating the inner entity as the "second-best" sequence path within the outer one. By extending standard Conditional Random Fields (CRFs) with a recursive decoding strategy and a novel objective function, the authors achieve state-of-the-art results without the need for complex hypergraphs or extra hyperparameters.

What Problem Does This Paper Address?

In standard Named Entity Recognition (NER), we assume entities are "flat." For example, in the phrase "University of Pittsburgh," the whole span is an Organization. But language is often like a Russian nesting doll. In the biomedical domain, you might see "Ca2+ -dependent PKC isoforms." Here, "PKC isoforms" is a protein nested inside a larger protein mention.

Standard sequence labeling (assigning one tag per word) fails here because a single word can't belong to two different entities of the same type simultaneously. Previous solutions to this "Nested NER" problem usually involved:

  1. Exhaustive search: Checking every possible sub-span (computationally expensive).
  2. Hypergraphs: Complex structures that require custom algorithms.
  3. Layered models: Stacking multiple flat NER models (often requiring many hyperparameters).

The authors aim for a middle ground: a method that is as simple and efficient as a standard flat NER model but capable of digging into nested structures.

Methods

The core innovation is the Second-best Sequence Decoding algorithm.

  1. Multiple CRFs: Instead of one giant model, they use a separate CRF for each entity type (e.g., one for Proteins, one for Organizations). This allows the same span to have multiple labels if needed.
  2. Outside-to-Inside Decoding: The model first runs a standard Viterbi decode on the whole sentence to find the "outermost" entities (the 1st level).
  3. The Second-Best Trick: Once an entity is found (say, from index 5 to 10), the model looks inside that specific span. Since the "best" path for that span is already known to be the outer entity, the model searches for the second-best path. If that second-best path contains a valid entity, it’s extracted as a nested mention (the 2nd level). This process repeats recursively.
  4. Novel Training Objective: You can't just use standard training if you want the model to "hide" inner entities in the second-best path. The authors designed a loss function that maximizes the log-likelihood of the entire "collection" of gold tags across all nesting levels. This forces the model to rank the outermost entity first and the inner nested entity second within that span.

Datasets

The authors evaluated their model on three standard benchmarks for nested NER:

  • ACE-2004 & ACE-2005: General domain datasets (news, weblogs) containing various entity types like Person, Organization, and GPE.
  • GENIA: A biomedical dataset where nesting is extremely common (e.g., DNA, RNA, and Protein mentions).

Key Insights and Ideas

  • Hyperparameter-Free: Unlike many nested NER models that require tuning thresholds for "mention confidence" or "max nesting depth," this method has zero additional hyperparameters beyond a standard CRF.
  • Efficiency through Reuse: The model calculates the emission scores for the words only once. The recursive decoding just re-uses these scores on smaller and smaller spans, making it much faster than exhaustive span-based models.
  • The Power of Constraints: By setting "illegal" transitions (like moving from an 'Outside' tag to an 'Inside' tag without a 'Begin' tag) to negative infinity, they ensure that the second-best path is always a valid, logically consistent entity sequence.

Key Results

The model achieved impressive performance, setting new state-of-the-art (SOTA) marks at the time of publication:

  • F1-Scores: 85.82% on ACE-2004, 84.34% on ACE-2005, and 77.36% on GENIA.
  • Recall Boost: The method was particularly good at finding mentions that other models missed, showing a significant jump in recall (up to 3.1% on ACE-2005).
  • Speed: While recursive, the model is only about 38% slower than a standard "flat" CRF. It processed roughly 3,700 tokens per second on a standard CPU, making it highly practical for real-world applications.

Limitations and Future Work

  • Crossing Entities: The model is strictly "nested." It cannot handle "crossing" entities where two mentions overlap but neither is fully contained within the other (e.g., "[A B] C" and "A [B C]"). However, the authors note that such cases are extremely rare in standard datasets.
  • Pronominal Mentions: The error analysis showed the model struggles with pronouns (e.g., "They" referring to "tanks"). This is a coreference resolution problem that simple NER models aren't designed to solve.
  • Future Directions: The authors suggest integrating this decoding logic with more advanced encoders (like BERT or Flair) and exploring joint modeling with entity linking to better handle context.

Summary updated

BibTeX
@article{shibuya2020nested,
  author = {Takashi Shibuya and Eduard H. Hovy},
  title = {{Nested Named Entity Recognition via Second-best Sequence Learning and Decoding}},
  journal = {Trans. Assoc. Comput. Linguistics},
  year = {2020},
  doi = {10.1162/tacl\_a\_00334},
}
Figure