LLMs are generally suboptimal for NER. If you want zero shot, use GLiNER. If you want to train a model, fine-tune a BERT family model or T5. Answer from barrbaar on reddit.com
🌐
Medium
medium.com › @grisanti.isidoro › named-entity-recognition-with-llms-extract-conversation-metadata-94d5536178f2
Named Entity Recognition with LLMs — Extract Conversation Metadata | by Isidoro Grisanti | Medium
October 20, 2023 - In this article it was provided a comprehensive overview of how to use Large Language Models (LLMs) in order to solve NLP tasks such as Named Entity Recognition.
🌐
arXiv
arxiv.org › abs › 2304.10428
[2304.10428] GPT-NER: Named Entity Recognition via Large Language Models
October 7, 2023 - GPT-NER bridges the gap by transforming the sequence labeling task to a generation task that can be easily adapted by LLMs e.g., the task of finding location entities in the input text "Columbus is a city" is transformed to generate the text sequence "@@Columbus## is a city", where special tokens @@## marks the entity to extract.
🌐
AWS
aws.amazon.com › blogs › machine-learning › use-zero-shot-large-language-models-on-amazon-bedrock-for-custom-named-entity-recognition
Use zero-shot large language models on Amazon Bedrock for custom named entity recognition | Artificial Intelligence
June 18, 2024 - In this solution, we implement zero-shot NER with LLMs using the following key services: Amazon Textract – Extracts textual information from the input document. Amazon Comprehend (optional) – Identifies predefined entities such as names of people, dates, and numeric values.
🌐
Reddit
reddit.com › r/languagetechnology › current advice for ner using llms?
r/LanguageTechnology on Reddit: Current advice for NER using LLMs?
October 18, 2024 -

I am interested in extracting certain entities from scientific publications. Extracting certain types of entities requires some contextual understanding of the method, which is something that LLMs would excel at. However, even using larger models like Llama3.1-70B on Groq still leads to slow inference overall. For example, I have used the Llama3.1-70B and the Llama3.2-11B models on Groq for NER. To account for errors in logic, I have had the models read the papers one page at a time, and used chain of thought and self-consistency prompting to improve performance. They do well, but total inference time can take several minutes. This can make the use of GPTs prohibitive since I hope to extract entities from several hundreds of publications. Does anyone have any advice for methods that would be faster, and also less error-prone, so that methods like self-consistency are not necessary?

Other issues that I have realized with the Groq models:

The Groq models have context sizes of only 8K tokens, which can make summarization of publications difficult. For this reason, I am looking at other options. My hardware is not the best, so using the 70B parameter model is difficult.

Also, while tools like SpaCy are great for some entity types of NER as mentioned in this list here, I'm aware that my entity types are not within this list.

If anyone has any recommendations for LLM models on Huggingface or otherwise for NER, or any other recommendations for tools that can extract specific types of entities, I would greatly appreciate it!

UPDATE:

I have reformatted my prompting approach using the GPT+Groq and the execution time is much faster. I am still comparing against other models, but precision, recall, F1, and execution time is much better for the GPT+Groq. The GLiNE models also do well, but take about 8x longer to execute. Also, even for the domain specific GLiNE models, they tend to consistently miss certain entities, which unfortunately tells me those entities may not have been in the training data. Models with larger corpus of training data and the free plan on Groq so far seems to be the best method overall.

As I said, I am still testing this across multiple models and publications. But this is my experience so far. Data to follow.

🌐
Universal-ner
universal-ner.github.io
UniversalNER
@article{zhou2023universalner, title={UniversalNER: Targeted Distillation from Large Language Models for Open Named Entity Recognition}, author={Wenxuan Zhou and Sheng Zhang and Yu Gu and Muhao Chen and Hoifung Poon}, year={2023}, eprint={2308.03279}, archivePrefix={arXiv}, primaryClass={cs.CL} }
🌐
arXiv
arxiv.org › html › 2402.09282v3
Distilling Large Language Models into Tiny Models for Named Entity Recognition Corresponding author : Yining Huang email: [email protected]
September 17, 2025 - Our research builds upon these foundations, aiming to further leverage the capabilities of LLMs to enhance NER model training and performance, particularly through the integration of Chain of Thought prompting and knowledge distillation techniques. This research delineates a three-phase exploration into augmenting Named Entity Recognition (NER) performance by integrating Large Language Models (LLMs), specifically GPT-4, for data annotation, and subsequently training a BERT model with these annotations.
🌐
GitHub
github.com › explosion › spacy-llm
GitHub - explosion/spacy-llm: 🦙 Integrating LLMs into structured NLP pipelines
With only a few (and sometimes no) examples, an LLM can be prompted to perform custom NLP tasks such as text categorization, named entity recognition, coreference resolution, information extraction and more.
Starred by 1.4K users
Forked by 106 users
Languages   Python 96.7% | Jinja 3.3%
Top answer
1 of 2
2

Using generative large language models like Llama 3.1 is very inefficient for a task like NER. As this answer suggests, you can use traditional techniques like SpaCy and achieve very good results. However, the problem with non-LLM methods is that they are not flexible; you're limited to a set of predefined tags. If you want a flexible, powerful and yet efficient solution, use GLiNER. It uses BERT at its core for named entity recognition. With GLiNER You can easily perform NER on your local hardware with whatever entities you want. Using less than 500M parameters.

Installation

pip install gliner

Example of GLiNER Usage

from gliner import GLiNER

# Initialize GLiNER with the base model
model = GLiNER.from_pretrained("urchade/gliner_medium-v2.1")

text = """On 25 July 1948, on the 39th anniversary of Bleriot's crossing of the English Channel,
  the Type 618 Nene-Viking flew Heathrow to Paris (Villacoublay) in the morning carrying
  letters to Bleriot's widow and son (secretary of the FAI), who met it at the airport."""

labels = ["person", "company", "location", "airplane"]

entities = model.predict_entities(text, labels, threshold=0.5)

for entity in entities:
    print(entity["text"], "=>", entity["label"])

Result

Bleriot => person
English Channel => location
Type 618 Nene-Viking => airplane
Heathrow => location
Paris => location
Villacoublay => location
Bleriot => person

There are various models with diffrent number of parameters (166M-459M), choose the one that best suits your needs.

2 of 2
1

Apart from your limitations, I wouldn't recommend using LLMs like Llamma 3.1 for such a task. NER is one of the classic tasks of NLP and there are smaller language models and tools you can incorporate to achieve your goal. You can use NLTK or SpaCy for this matter. My personal choice is SpaCy, however a gender as you defined is not a known named entity. you can see a list of named entities in this doc.

I guess what you mean by gender is the possible gender associated with the names of a PERSON mentioned in your articles. There are a few python packages that you can use to lookup genders, however, you should note that this can be very ambiguous and there should be a substantial tolerance for error. You can use gender-guesser package.

A possible solution would be like this:

import spacy
import gender_guesser.detector as gender


nlp = spacy.load("en_core_web_sm")

def extract_info(text):
    doc = nlp(text)
    gender_detector = gender.Detector()

    for ent in doc.ents:
        if ent.label_ == "PERSON":
            name = ent.text
            name_gender = gender_detector.get_gender(name)
    
    return doc.ents, name_gender

Note that en_core_web_sm is the small model available via spaCy, you can use the large model by specifying en_core_web_lg, just make sure that the model is downloaded before running your code. here's how you can download the model:

python -m spacy download en_core_web_sm
Find elsewhere
🌐
ACL Anthology
aclanthology.org › 2024.emnlp-main.660.pdf pdf
NuNER: Entity Recognition Encoder Pre-training via LLM- ...
Figure 11: Comparison of NuNER with LLMs. Dashed · curves indicate in-context learning and solid curves in- dicate fine-tuning. Results tables are shown in Table 11 ... GPTs as it is not intended to be a zero-shot model. ... Table 2: NuNER vs. UniversalNER few-shot entity- level F1-score in the k ∼2k setting showing similar · performance. Dataset-wise tables can be found in Ta- ... Named Entity Recognition ...
🌐
Medium
medium.com › @nk94.nitinkumar › fine-tuning-large-language-models-for-named-entity-recognition-da97c38df742
Fine-Tuning Large Language Models For Named Entity Recognition | by Nitin Kumar | Medium
February 3, 2024 - Ensuring the start and end character indices of the detected entities is consistent with where the entities actually occur in the input string. ... # XML formatted string with NER detections llm_output_str = "My name is <PERSON>John Doe</PERSON> and I can be contacted at <PHONE_NUMBER>111-222-3334</PHONE_NUMBER>"
🌐
Graphable
graphable.ai › blog › named-entity-recognition-llm
Named Entity Recognition LLM Biomechanics / Anatomy Example
December 13, 2023 - Using a named entity recognition LLM (Large Language Model), we extract its underlying components from semi-structured data and use the resulting output to create a graph representation of the human skeletal and musculatory system, starting ...
🌐
Xinyadu
xinyadu.github.io › cs6301 › final_pre_pdfs › Group 16.pdf pdf
Project Title: Named Entity Recognition on Medical Data using Pre-Trained LLM
language processing tasks, including Named Entity Recognition (NER) in the medical domain. ●Transfer learning: BERT's transfer learning capability allows leveraging its pre-trained knowledge to fine-tune the model on · specific medical datasets, significantly improving the accuracy of NER tasks in the medical field, such as identifying diseases, ... ●Contextual understanding: BERT's bidirectional context-awareness helps in accurately identifying and disambiguating · medical entities in text, which is crucial for tasks like information extraction, question answering, and patient data analysis.
🌐
Clarifai
clarifai.com › home › do llms reign supreme in few-shot ner? part iii
Do LLMs Reign Supreme in Few-Shot NER? Part III
May 4, 2025 - GPT-NER is a method of prompting LLMs to perform NER proposed by Shuhe Wang et al. They prompt a language model to detect a class of named entities, showing a few input and output examples in the prompt, where in the output the entities are marked with special symbols (@@ marks the start and ## the end of a named entity).
🌐
Reddit
reddit.com › r/localllama › llm for entity extraction
r/LocalLLaMA on Reddit: LLM for Entity Extraction
February 25, 2024 -

I have a use case where I need to extract all the different entities in a typical email signature.

So given an email signature, extract the following:

Input:

Bob Smith, VP of Consulting, Akamai Technologies, [email protected], 222-XXX-YYYY

Output:

  • first name: Bob

  • last name: Smith

  • job title: VP of Consulting

  • company: Akamai Technologies

  • address: [email protected]

  • phone: 222-XXX-YYYY

Data format: we have tabular data (CSV) with Signature, first name, last name, company, etc.. columns.

Outside of just using few shot prompting, I'm thinking of finetuning Mistral 7b and Llama-2-7b chat to accomplish this. Any other pointers?

Are there ways outside of using LLMs that are better suited?

Note: the current solution to address this problem uses regex.

🌐
ScienceDirect
sciencedirect.com › science › article › abs › pii › S0306457324004138
A novel large-language-model-driven framework for named entity recognition - ScienceDirect
December 30, 2024 - ... We offer a range of insights ... learning. Named entity recognition (NER) stands as the foundational pillar of knowledge graphs across multiple domains....
🌐
DEV Community
dev.to › nareshnishad › day-37-named-entity-recognition-ner-with-llms-2g5p
Day 37: Named Entity Recognition (NER) with LLMs - DEV Community
November 20, 2024 - Named Entity Recognition (NER) is a crucial Natural Language Processing (NLP) task that identifies and classifies entities like names, locations, organizations, dates, and more in a given text.
🌐
Medium
billtcheng2013.medium.com › named-entity-recognition-with-spacy-and-large-language-model-6716e61913ea
Named Entity Recognition with Spacy and Large Language Model | by Xin Cheng | Medium
January 31, 2024 - Named Entity Recognition with Spacy and Large Language Model With Azure OpenAI Spacy is the Go-to NER library. With integration of Large Language Models (LLMs) into spaCy pipelines, it supports fast …
🌐
IBM
ibm.com › think › topics › named-entity-recognition
What Is Named Entity Recognition? | IBM
3 weeks ago - Named entity recognition (NER) is a component of natural language processing (NLP) that identifies predefined categories of objects in a body of text.
🌐
arXiv
arxiv.org › abs › 2403.00528
[2403.00528] Large Language Models for Simultaneous Named Entity Extraction and Spelling Correction
March 1, 2024 - Language Models (LMs) such as BERT, have been shown to perform well on the task of identifying Named Entities (NE) in text. A BERT LM is typically used as a classifier to classify individual tokens in the input text, or to classify spans of ...