Named Entity Recognition Best Practices That Improve Accuracy
Named entity recognition works best when the entity set is defined first, the labels are consistent, and quality is measured on a fixed test set.
On this page
Short answer
Named entity recognition is the task of finding and labelling names in text, such as people, companies, places, dates and product names. Best practice is to define the entity set first, label a consistent sample, and measure precision and recall on a fixed test set before shipping. Most accuracy problems come from vague labels and messy training data, not from the model choice.
What is named entity recognition?
Named entity recognition, often shortened to NER, is the task of finding names in text and labelling what kind of thing each name is. A system reads a sentence and marks spans such as a person, a company, a city, a date or a product, so downstream software can use those names as structured data.
NER sits at the start of many text pipelines. A support tool uses it to pull order numbers and product names from tickets. A document tool uses it to pull parties and dates from contracts. A search tool uses it to match queries to the right records. When NER is wrong, every step after it inherits the error.
The work is mostly data work. Models are easy to find; the hard part is deciding exactly what counts as an entity in your text and labelling examples the same way every time. That is why NLP development projects spend more time on annotation than on model tuning.
Define the entity set before you label anything
Define the entity set before anyone labels a single sentence. Write down each entity type, what it covers, and what it does not cover, with two or three examples of each. If the team cannot agree whether a brand name inside a product name is one entity or two, the labels will drift and the model will learn the drift.
Keep the set small at first. Five to eight types that matter for the product beat twenty types that nobody can tell apart. You can add types later once the first set is stable. A type that appears only a handful of times in your text is not worth a label; fold it into a broader type or drop it.
Write the rules down as a short guide with edge cases. Include the awkward cases: job titles that look like names, company names that are also common words, and dates written in more than one format. The guide is what keeps two annotators labelling the same way.
How do you build a good annotation set?
A good annotation set is a sample of your real text, labelled twice and checked. Start with a few hundred documents from the same source the system will read in production, not from a public dataset in a different style. Public data helps you start, but it does not teach the model your documents.
| Practice | What it does | What it prevents |
|---|---|---|
| Label real production text | Matches the model to your documents | Good scores, poor live results |
| Double-label a sample | Shows where annotators disagree | Hidden label noise |
| Keep a fixed test set | Measures change fairly | Scores that move for no reason |
| Review low-agreement cases | Fixes the guide, not the labels | Repeated errors on the same cases |
| Track label counts | Spots rare types early | A type the model never learns |
Measure agreement between annotators on a shared sample before you scale up labelling. If two people agree on fewer than nine in ten entities, fix the guide first. More labelled data with the same disagreement only teaches the model to be confused faster.
Rules, statistical models or LLMs: which fits?
The right approach depends on how regular your text is. Fixed patterns such as order numbers, invoice codes and dates in a known format are best handled by rules, because a rule is exact and easy to explain. A statistical model fits free text where the same entity appears in many forms.
Large language models fit cases where the entity rules depend on meaning rather than form, such as telling a product name from a company name in a review. They cost more per document and are slower, so use them where the cheaper options fail, not as the default for every document.
Most production systems mix approaches: rules for the fixed patterns, a model for the rest, and a validation step that checks the result against known lists. Start with the simplest approach that clears your accuracy bar, and add complexity only when the test set shows it is needed.
How do you measure NER quality?
Measure NER quality with precision and recall on a fixed test set, not on the data you trained on. Precision is the share of entities the system found that are correct. Recall is the share of real entities in the text that the system found. Report both, because a system can look good on one and fail on the other.
Measure per entity type, not just overall. A system can score well overall while missing one rare type entirely, and that rare type may be the one the product depends on. Track the F1 score per type, which combines precision and recall into one number, and watch the weakest type first.
Keep the test set fixed and hidden from training. Every time the guide, the data or the model changes, run the same test set and compare. If the test set changes with each experiment, you cannot tell whether a change helped or the test simply got easier.
How do you handle ambiguous names?
Ambiguous names are the main source of NER errors. The same string can be a person, a company or a place depending on context, and a model that guesses from the string alone will get these wrong. Context is the fix: the words around the name usually say which one it is.
Give the model enough context to decide. A model that reads one sentence at a time will struggle with names that only make sense in the wider document. Feeding the surrounding paragraph, or the document type, often fixes more errors than a bigger model does.
For names that stay ambiguous even with context, use a known list. A list of your customers, products and locations lets the system check a candidate name against what exists, and a match against the list is stronger evidence than the text alone. Document tools that pull names from contracts often pair NER with document AI for exactly this reason.
Example (hypothetical): a support team that tags tickets by product
Example (hypothetical): a support team receives 400 tickets a week and wants each one tagged with the product it mentions, so tickets route to the right team. Today a person reads each ticket and adds the tag by hand, which takes about 2 minutes per ticket, or 400 x 2 = 800 minutes, about 13 hours a week.
The team defines five entity types, labels 300 real tickets with two annotators, and keeps 100 tickets as a fixed test set. The first model tags 320 of the 400 tickets correctly, misses 50 product mentions, and adds 30 wrong tags. Precision is 320 out of 350 tags, about 91%, and recall is 320 out of 370 real mentions, about 86%.
The review shows most misses are product names written as abbreviations, so the team adds the abbreviations to the guide and labels 100 more tickets.
The next run tags 350 correctly, misses 20 and adds 15 wrong tags. Precision rises to 350 out of 365, about 96%, and recall to 350 out of 370, about 95%. The team ships the tagger with a human check on the tickets it flags as uncertain, and the manual tagging time falls to about 2 hours a week.
What are the common mistakes?
The most common NER mistakes are vague labels, testing on training data, and ignoring the long tail of rare entity types.
- Labelling before defining the set. Annotators guess, labels drift, and the model learns the drift.
- Testing on training data. Scores look perfect and production results do not, because the test was not a real test.
- Measuring only overall accuracy. A weak type hides inside a good average until a customer finds it.
- Ignoring rare types. A type with ten examples in training will be missed; gather more or drop the type.
- Starting with the biggest model. Rules and small models clear the bar for most fixed patterns at a fraction of the cost.
- No plan for new names. Products and companies change; without a review cycle, accuracy slides silently.
Keep the loop tight: label a little, measure on a fixed set, fix the guide, and repeat. Annotation quality beats model size, and a fixed test set is what makes the loop honest. If labelling is the bottleneck, data annotation services can supply the labelled sample under your guide.
Key takeaways
- Define the entity set and write the guide before labelling.
- Label real production text, double-label a sample, and keep a fixed test set.
- Rules fit fixed patterns; models fit free text; LLMs fit meaning-dependent cases.
- Report precision and recall per entity type, not just overall.
- Context and known lists fix most ambiguous names.
- Review the weakest entity type first, and re-measure after every change.
Frequently asked questions
What is named entity recognition used for?
It is used to pull structured names out of text, such as people, companies, places, dates and products, so software can route tickets, fill databases, search documents and link records together.
How much labelled data does NER need?
A few hundred well-labelled documents are often enough to start, if they match the text the system will read in production. Quality and consistency matter more than volume, and rare entity types need their own extra examples.
What is the difference between precision and recall in NER?
Precision is the share of entities the system found that are correct. Recall is the share of real entities in the text that it found. A system can have high precision and low recall, or the reverse, so both should be reported.
Can rules replace a model for NER?
For fixed patterns such as order numbers, codes and dates in a known format, rules are exact and cheap. For names in free text, where the same entity appears in many forms, a model is usually needed.
How do you handle new entity names after launch?
Keep a review cycle: sample live output, label the misses, and add them to the training set on a schedule. Without this, accuracy falls as products, people and company names change.
Should I use an LLM for named entity recognition?
Use one when the entity rules depend on meaning rather than form, such as telling a product name from a company name in a review. For simpler cases, a smaller model or rules will be faster and cheaper.