Optimizing Bi-Encoder for Named Entity Recognition via Contrastive Learning

Sheng Zhang, Hao Cheng, Jianfeng Gao, Hoifung Poon
8/30/2022
cs.CLcs.AI
contrastive-ssl

Official code: microsoft/binder (94 stars, Python, MIT, last commit 2026-09-10).

Abstract

We present a bi-encoder framework for named entity recognition (NER), which applies contrastive learning to map candidate text spans and entity types into the same vector representation space. Prior work predominantly approaches NER as sequence labeling or span classification.

Show full abstract

We instead frame NER as a representation learning problem that maximizes the similarity between the vector representations of an entity mention and its type. This makes it easy to handle nested and flat NER alike, and can better leverage noisy self-supervision signals. A major challenge to this bi-encoder formulation for NER lies in separating non-entity spans from entity mentions. Instead of explicitly labeling all non-entity spans as the same class $\texttt{Outside}$ ($\texttt{O}$) as in most prior methods, we introduce a novel dynamic thresholding loss. Experiments show that our method performs well in both supervised and distantly supervised settings, for nested and flat NER alike, establishing new state of the art across standard datasets in the general domain (e.g., ACE2004, ACE2005) and high-value verticals such as biomedicine (e.g., GENIA, NCBI, BC5CDR, JNLPBA). We release the code at github.com/microsoft/binder.

View on arXivView PDF

Code Implementations(1)

microsoft/binderOfficial100%
MIT
9423Python, PerlNov 11, 20222 months agoMIT

Similar Papers

Cite this paper

@article{zhang2022optimizing,
  title  = {Optimizing Bi-Encoder for Named Entity Recognition via Contrastive Learning},
  author = {Sheng Zhang and Hao Cheng and Jianfeng Gao and Hoifung Poon},
  year   = {2022},
  eprint = {2208.14565},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2208.14565}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2208.14565.svg)](https://codeofpaper.com/paper/2208.14565)

Discussion