UseToolSuite UseToolSuite

Named Entity Recognition (NER) in NLP Explained

A guide to Named Entity Recognition: how AI extracts names, locations, and organizations from text using BERT, CRFs, and transformer architectures.

Necmeddin Cunedioglu Necmeddin Cunedioglu 10 min read
Part of the Prompt Engineering for Developers: Patterns That Actually Work in 2026 series

Practice what you learn

AI Entity Extractor (NER)

Try it free →

In the world of Artificial Intelligence, making sense of human language is one of the hardest challenges in computer science. While a human can effortlessly read a news article and instantly identify the people, companies, countries, and dates mentioned, a computer sees nothing but a sequence of bytes. Teaching machines to extract structured information from unstructured text is a problem that has occupied researchers for decades — and Named Entity Recognition is one of its most important solved applications.

Named Entity Recognition (NER) is a core subfield of Natural Language Processing (NLP) that automatically identifies and classifies named entities in text into predefined categories such as persons, organizations, locations, dates, and quantities. It is the invisible engine behind search engines, customer support automation, medical record analysis, and financial document processing.

In this guide, we’ll explore what NER is, how it evolved from rule-based systems to modern transformers, the specific architectures that power today’s NER systems, practical applications across industries, and how you can run state-of-the-art NER models directly in your browser without sending data to any server.

What Is a Named Entity?

In NLP, a Named Entity is a real-world object that can be denoted with a proper name or belongs to a specific, well-defined category. NER systems read raw text, identify these entities, and classify each one into a predefined category.

Standard Entity Categories

The most widely used entity classification systems define the following categories:

Category TagFull NameExamplesDescription
PERPerson”Elon Musk”, “Marie Curie”, “Ada Lovelace”Individual human beings (real or fictional)
ORGOrganization”Apple Inc.”, “United Nations”, “NASA”Companies, agencies, institutions, teams
LOCLocation”New York”, “Mount Everest”, “Pacific Ocean”Physical locations, geographical features
GPEGeo-Political Entity”France”, “California”, “European Union”Countries, states, cities as political entities
DATEDate/Time”January 2026”, “next Tuesday”, “the 1990s”Temporal expressions, periods
MONEYMonetary Value”$50 million”, “€1,200”, “2.5 billion yen”Currency amounts
PERCENTPercentage”15%”, “three-quarters”, “0.5 percent”Percentage expressions
MISCMiscellaneous”Nobel Prize”, “World Cup”, “Christianity”Events, nationalities, religions, works of art

NER in Action: A Practical Example

Given the input sentence:

“Tim Cook flew to Tokyo on March 15 to visit the Sony headquarters. Apple’s CEO discussed a $2 billion partnership.”

A well-trained NER system produces the following structured output:

Text SpanEntity TagConfidence
Tim CookPER0.99
TokyoLOC0.98
March 15DATE0.97
SonyORG0.98
AppleORG0.97
CEOTITLE0.95
$2 billionMONEY0.96

This structured extraction transforms unstructured text into queryable, analyzable data — enabling downstream applications like knowledge graph construction, automated report generation, and compliance monitoring.

The Evolution of NER: From Rules to Transformers

NER technology has undergone three major paradigm shifts, each dramatically improving accuracy and generalization.

Era 1: Rule-Based Systems (1990s)

The earliest NER systems relied on handcrafted rules and dictionaries (gazetteers). Engineers would write patterns like:

IF word IS_CAPITALIZED AND word IN country_dictionary → tag as LOC
IF word IS_CAPITALIZED AND next_word == "Inc." → tag as ORG
IF word MATCHES date_pattern → tag as DATE

Limitations of rule-based NER:

LimitationExampleWhy It Fails
Ambiguity”Apple” (fruit vs. company)Rules cannot resolve context-dependent meaning
Novel entities”SpaceX” (new company not in dictionary)Dictionary-based systems miss all unknown entities
Language variation”NYC”, “New York City”, “the Big Apple”Requires explicit rules for every surface form
MultilingualGerman compound nouns, Chinese without spacesRules are language-specific, don’t generalize
MaintenanceAdding new entities requires manual updatesDoes not scale as language evolves

Era 2: Statistical Models — CRFs and BiLSTM (2000s-2017)

Conditional Random Fields (CRFs) introduced statistical learning to NER. Instead of explicit rules, CRFs learn probabilities from labeled training data. A CRF analyzes sequences of words and calculates the most likely tag sequence based on features of surrounding words.

For example, in “Apple released a new phone,” the CRF learns statistical patterns: “When a capitalized word is followed by the verb ‘released,’ it is highly probable that the word is an organization.” This is more robust than rules because the model generalizes from training examples rather than memorizing explicit patterns.

BiLSTM-CRF (Bidirectional Long Short-Term Memory + CRF) combined deep neural networks with statistical sequence modeling:

ComponentRoleHow It Works
Word embeddingsConvert words to dense vectorsWords with similar meanings get similar vectors (“Apple” and “Microsoft” are close in vector space)
Forward LSTMProcess text left-to-rightCaptures information from preceding words
Backward LSTMProcess text right-to-leftCaptures information from following words
ConcatenationMerge both directionsCreates full contextual representation of each word
CRF layerEnforce valid tag sequencesEnsures “I-ORG” only follows “B-ORG” (BIO schema compliance)

The BIO Tagging Scheme

NER models use the BIO (Beginning, Inside, Outside) tagging scheme to handle multi-word entities:

TagMeaningExample
B-PERBeginning of a Person entityB-PER: “Tim”
I-PERInside (continuation of) a Person entityI-PER: “Cook”
B-ORGBeginning of an Organization entityB-ORG: “United”
I-ORGInside an Organization entityI-ORG: “Nations”
B-LOCBeginning of a Location entityB-LOC: “New”
I-LOCInside a Location entityI-LOC: “York”
OOutside any entity (not an entity)O: “flew”, “to”, “the”

For the sentence “Tim Cook flew to New York”:

Tim    → B-PER
Cook   → I-PER
flew   → O
to     → O
New    → B-LOC
York   → I-LOC

Era 3: Transformers — BERT and Beyond (2018-Present)

Modern NER is dominated by Transformer architectures, specifically BERT (Bidirectional Encoder Representations from Transformers), created by Google in 2018. Transformers abandoned sequential processing entirely in favor of a revolutionary mechanism called Self-Attention.

How BERT processes text for NER:

  1. Tokenization — Input text is split into WordPiece tokens (subword units). “Unbreakable” becomes [“un”, “##break”, “##able”]
  2. Embedding — Each token gets a 768-dimensional vector combining token identity, position, and segment information
  3. Self-Attention (12 layers) — Each token computes attention weights to every other token in the sentence, creating a context-aware representation
  4. Token Classification Head — A linear layer on top of BERT maps each token’s contextualized embedding to entity tag probabilities

The power of self-attention for NER:

When BERT reads “Apple released a new phone,” the self-attention mechanism allows the word “Apple” to simultaneously weigh its relationship with “released,” “new,” and “phone” — all at once, not sequentially. The model understands that in this specific context, “Apple” is a corporate entity capable of releasing a technological product, not a fruit.

This deep, bidirectional contextual understanding enables modern NER to distinguish between:

  • “Washington” the person (George Washington)
  • “Washington” the state (Washington State)
  • “Washington” the city (Washington D.C.)
  • “Washington” the sports team (Washington Commanders)

All based purely on surrounding context, with near-perfect accuracy and without any manual rules.

Model Comparison for NER

ModelYearArchitectureF1 Score (CoNLL-2003)ParametersSpeed
CRF2003Statistical~88%N/AVery fast
BiLSTM-CRF2015Neural + Statistical~91%~5MFast
BERT-base2018Transformer~92.8%110MModerate
BERT-large2018Transformer~93.5%340MSlow
RoBERTa2019Transformer (optimized)~93.2%125MModerate
DeBERTa v32021Enhanced Transformer~94.6%184MModerate
Fine-tuned LLM2024+Large Language Model~95%+7B+Very slow

Real-World Applications of NER

NER is not an academic curiosity — it is a foundational technology deployed across virtually every industry that processes text at scale.

Industry Applications

IndustryApplicationHow NER Is Used
HealthcareMedical record processingExtracts drug names, dosages, symptoms, and diagnoses from doctor’s unstructured notes
FinanceRegulatory complianceIdentifies company names, financial amounts, and dates in SEC filings and contracts
LegalContract analysisExtracts parties, dates, obligations, and jurisdictions from legal documents
News/MediaAutomated taggingTags articles with people, companies, and locations for search and filtering
Customer SupportTicket routingIdentifies product names, customer names, and issue categories to route tickets to the right team
IntelligenceInformation extractionIdentifies persons of interest, organizations, and locations from large document corpora
E-commerceProduct attribute extractionIdentifies brand names, specifications, and categories from product descriptions
Search EnginesKnowledge graph constructionBuilds entity relationships from web pages to power knowledge panels and entity search

NER as a Pipeline Component

In modern NLP systems, NER is rarely used in isolation. It serves as a building block in larger information extraction pipelines:

Pipeline StepInputOutputExample
1. Text preprocessingRaw documentClean textRemove HTML, normalize whitespace
2. NERClean textEntity spans + tags”Apple” → ORG
3. Entity linkingEntity spansDisambiguated entities”Apple” → Wikidata Q312 (Apple Inc.)
4. Relation extractionEntity pairsRelationships(Tim Cook, CEO_of, Apple)
5. Knowledge graphTriplesQueryable graphNode: Apple Inc., Edge: CEO → Tim Cook

Running NER in the Browser: Privacy-First AI

Traditionally, implementing NER required sending your data to cloud APIs (Google Cloud NLP, AWS Comprehend, Azure Text Analytics). Each of these services processes your text on remote servers, creating privacy and compliance concerns — especially for sensitive data like medical records, legal documents, or personal communications.

Browser-Based NER with Transformers.js

Modern browser technology has made it possible to run BERT-level NER models entirely on the user’s device:

AspectCloud APIBrowser-Based NER
PrivacyText sent to remote serversText never leaves your device
Cost$1-5 per 1000 requestsFree (your CPU does the work)
Latency200-500ms network round trip50-200ms local processing
GDPR complianceRequires data processing agreementInherently compliant
Offline capabilityRequires internetWorks offline after model download
Model sizeServer-side (transparent)~50-100MB download (cached)

How Browser-Based NER Works

  1. Model download — A quantized BERT model (~50MB) is downloaded once and cached in the browser
  2. Tokenization — Input text is tokenized using the model’s WordPiece vocabulary
  3. Inference — The ONNX Runtime Web engine executes the model using WebAssembly
  4. Post-processing — BIO tags are decoded and merged into entity spans
  5. Display — Entities are highlighted in the user interface with color-coded categories

Try it yourself: Our AI Entity Extractor runs a fine-tuned BERT model entirely in your browser. Paste any text and see entities highlighted in real-time — your data never leaves your device.

Evaluation Metrics for NER

Understanding how NER performance is measured helps you choose the right model for your application:

MetricWhat It MeasuresFormulaWhen It Matters
PrecisionOf all entities the model predicted, how many were correct?TP / (TP + FP)When false positives are costly (e.g., automated trading)
RecallOf all real entities in the text, how many did the model find?TP / (TP + FN)When missing entities is costly (e.g., medical records)
F1 ScoreHarmonic mean of precision and recall2 × (P × R) / (P + R)Standard overall performance metric
Exact matchEntity span and tag both correctCount of exact matchesStrictest evaluation metric
Partial matchEntity partially overlappedOverlap percentageUseful for long entity names

Common NER Challenges and Solutions

ChallengeDescriptionSolution
Entity ambiguity”Paris” could be a city, a person, or a hotelUse larger context windows; fine-tune on domain data
Nested entities”Bank of New York” contains ORG + LOCUse nested NER models or span-based approaches
Rare entitiesNew company names not in training dataUse character-level features; augment training data
Cross-lingualDifferent languages, different naming conventionsUse multilingual models (mBERT, XLM-RoBERTa)
Domain specificityMedical terms vs. legal terms vs. general textFine-tune pretrained models on domain-specific data
Coreference”He”, “the company”, “it” referring to named entitiesCombine NER with coreference resolution

Further Reading


Extract entities from any text privately with our AI Entity Extractor. Analyze sentiment with our AI Sentiment Analyzer, and summarize long documents with our AI Text Summarizer — all running locally in your browser.

Necmeddin Cunedioglu
Necmeddin Cunedioglu Author
10 min read
-- views

Software developer and the creator of UseToolSuite. I write about the tools and techniques I use daily as a developer — practical guides based on real experience, not theory.