Lemmatization in NLP: Meaning, Examples & Stemming vs Lemmatization

Key Insights
- Lemmatization in NLP converts inflected words into their dictionary base forms, known as lemmas, using lexical resources, linguistic rules and, where supported, grammatical context.
- Unlike stemming, which typically reduces words through suffix-based rules, lemmatization aims to produce meaningful dictionary forms. The appropriate technique depends on the task and the level of linguistic precision required.
- Morphology and part-of-speech (POS) tagging help lemmatizers identify the correct base form, particularly when a word’s grammatical role affects its meaning.
- Python libraries such as NLTK and spaCy offer practical lemmatization tools, but their outputs depend on POS information, lexical resources and configuration.
- Lemmatization can support text classification, information retrieval and linguistic analysis, but it does not automatically improve every NLP pipeline.
- Modern language models often use subword tokenisation and may not require a separate lemmatization step. Preprocessing choices should be evaluated against the specific task.
Lemmatization is a natural language processing (NLP) technique that converts a word into its dictionary base form, called a lemma. For example, running can become run. By grouping related word forms, lemmatization in NLP can help systems analyse text consistently.
Imagine you are building a search system that needs to recognise connect, connecting, and connected as related forms of the same word. Should the system treat them as three separate terms, or bring them together?
This is one of the problems lemmatization helps address. However, lemmatization differs from stemming, which typically removes word endings using simpler rules. This article explains what lemmatization means, how morphology and part-of-speech (POS) tagging influence its results, and how to implement it in Python using NLTK and spaCy.
Your roadmap to becoming a Generative AI Engineer
See what you already know, what to learn next and how long the switch to a GenAI engineering role takes. Tap any step for what to study and build.
What's inside8 stages ยท 30 steps to job-ready
- Python & engineering foundations
- ML & deep learning essentials
- How LLMs work
- Prompting & building LLM apps
- RAG & model customisation
- Agents & tool use
- Production, evaluation & safety
- Portfolio & job readiness
Python & engineering foundations
What to study
- Core Python: data types, functions, classes, modules
- Virtual environments and package management (pip, uv)
- Writing clean, testable scripts
What to build
A command-line script that reads a CSV, cleans it and writes a summary report.
What to study
- SQL joins, aggregations and window functions
- pandas for cleaning and reshaping data
- Working with text data at scale
What to build
A notebook that cleans a messy text dataset and prepares it for a model.
What to study
- Git branching and pull requests
- How REST APIs work: HTTP methods, status codes, auth headers
- Reading and writing JSON
What to build
Call a public API from Python, handle errors and save the results as JSON.
What to study
- Vectors, matrices and dot products
- Probability and distributions
- Gradients and optimisation, intuitively
What to build
Implement cosine similarity and gradient descent from scratch in NumPy.
ML & deep learning essentials
What to study
- Supervised vs unsupervised learning
- Train/test splits, overfitting and evaluation metrics
- scikit-learn workflows
What to build
Train and evaluate a text classifier with scikit-learn.
What to study
- Tokenisation and text preprocessing
- Word embeddings and semantic similarity
- Sequence models (RNN, LSTM) and why transformers replaced them
What to build
Build a semantic search over 500 short texts using sentence embeddings.
What to study
- Layers, activations, loss functions and backpropagation
- Training loops, batching and GPUs
- PyTorch tensors and autograd
What to build
Train a fully connected network on a small dataset and plot its learning curve.
How LLMs work
What to study
- Self-attention and multi-head attention
- Encoder, decoder and encoder-decoder models
- Positional encoding and why scale matters
What to build
Walk through a minimal transformer implementation and explain each block in a short write-up.
What to study
- The Transformers library, model hub and datasets
- Running open-weights models locally
- Fine-tuning a pre-trained model for a task
What to build
Fine-tune a small pre-trained transformer for sentiment or topic classification.
What to study
- Closed vs open-weights model families
- Tokens, context windows, temperature and sampling
- Comparing models on cost, latency and quality
What to build
A comparison table of three models answering the same 20 prompts, with cost and latency.
What to study
- Quantisation, pruning and distillation
- When a small model beats a large one
- On-device and low-cost inference
What to build
Quantise an open model and compare its speed and quality against the original.
Prompting & building LLM apps
What to study
- System prompts, few-shot examples and chain-of-thought
- Prompt test sets and versioning
- Reducing hallucinations through prompt design
What to build
A prompt library with a 30-example test set and before/after scores.
What to study
- Calling LLM APIs: streaming, rate limits, keys
- Serving with FastAPI and simple UIs with Streamlit
- Caching and cost control
What to build
A small chat app with streaming responses, deployed for others to try.
What to study
- JSON schema outputs and validation
- Function / tool calling
- Retries and graceful failure
What to build
An invoice or resume parser that returns validated JSON.
What to study
- Chains, prompts and output parsers
- Document loaders and retrievers
- When a framework helps and when it gets in the way
What to build
Rebuild your chat app with LangChain and compare the code with your plain-API version.
RAG & model customisation
What to study
- Embedding models and similarity search
- Vector databases (e.g. pgvector, Pinecone, Weaviate)
- Chunking strategies and metadata filters
What to build
Index a document set in a vector database and query it with filters.
What to study
- Supervised fine-tuning vs prompting vs RAG
- LoRA and other parameter-efficient methods
- Preparing instruction datasets
What to build
LoRA fine-tune an open-weights model on a narrow task and compare it with prompting alone.
What to study
- Vision transformers and CLIP-style models
- Image captioning and visual question answering
- Combining text and image retrieval
What to build
An image search app that finds photos from a text description.
What to study
- The RAG pipeline end to end
- Re-ranking, hybrid search and citations
- Measuring retrieval quality
What to build
A document Q&A assistant that cites its sources, with a retrieval-quality report.
What to study
- Instruction tuning and reward models
- RLHF and DPO, conceptually and with TRL
- Where alignment fits in real products
What to build
Train a small reward model and run a preference-tuning loop on a toy task.
Agents & tool use
What to study
- ReAct, planning and reflection patterns
- Single-agent vs multi-agent setups
- Memory: short-term, long-term and retrieval
What to build
A research agent that searches, reads and summarises sources on a topic.
What to study
- Model Context Protocol (MCP) servers and clients
- Connecting agents to databases, CRMs and internal APIs
- Permissions and audit trails for tool calls
What to build
An MCP server that exposes two tools from a real API, used by your agent.
What to study
- Graphs, state and checkpoints
- Human-in-the-loop approvals
- Error handling in multi-step workflows
What to build
Rebuild your research agent as a LangGraph workflow with an approval step.
Production, evaluation & safety
What to study
- Docker images for AI apps
- CI/CD basics
- Secrets and environment configuration
What to build
Containerise your RAG assistant and deploy it with a CI pipeline.
What to study
- Building evaluation datasets
- LLM-as-judge and its limits
- Regression testing prompts and models
What to build
An eval harness that scores your assistant on 50 cases and runs on every change.
What to study
- Tracing LLM calls
- Tracking token cost and latency
- Dashboards and alerting
What to build
Add tracing and a cost dashboard to your deployed app.
What to study
- Managed model platforms on AWS, GCP and Azure
- Serverless deployment and autoscaling
- Data privacy and region choices
What to build
Deploy your app on one cloud using a managed model endpoint.
What to study
- Hallucination, bias and privacy risks
- Prompt injection and defences
- PII handling and content filtering
What to build
Add input and output guardrails to your assistant and document the risks you tested.
Portfolio & job readiness
What to study
- GenAI system design questions
- Explaining trade-offs: RAG vs fine-tuning, cost vs quality
- Coding rounds in Python
What to build
Mock-interview notes for three GenAI system design questions.
What to study
- Choosing a domain problem (healthcare, fintech, edtech)
- Writing clear READMEs and architecture notes
- Recording a short demo
What to build
A client-ready AI agent for one domain, with a public demo and write-up.
Fine-tuned text classifier
Adapting a pre-trained transformer to a real task.
Fine-tune a small pre-trained transformer on a labelled dataset, evaluate it properly and compare it with a classic ML baseline.
Structured data extractor
Turning messy documents into clean JSON.
Use an LLM API with schema-validated outputs to extract fields from invoices or resumes, with a prompt test set to track accuracy.
Document Q&A assistant
Retrieval-augmented answers with citations.
Index a document collection in a vector database and build an assistant that answers questions with cited sources and a retrieval-quality report.
LoRA fine-tune of an open model
Customising a model when prompting isn't enough.
Fine-tune an open-weights model with LoRA on a narrow task and document when it beats prompting and RAG, and when it doesn't.
Reward model & preference tuning
Teaching a model what good looks like.
Train a small reward model on preference data and run a preference-tuning loop, with a write-up of what changed.
Multimodal image search
Finding images from plain-language descriptions.
Embed images and text in a shared space and build a search app that retrieves photos from a description.
Tool-using research agent
An agent that plans, acts and asks for approval.
Build a LangGraph agent that searches, reads and summarises sources, calls tools through an MCP server and pauses for human approval.
Deployed GenAI service
From notebook to a monitored production API.
Containerise an LLM app, deploy it on a cloud platform with CI/CD, and add tracing plus a cost and latency dashboard.
Eval harness with guardrails
Proving your AI app works, and stays safe.
Create a 50-case evaluation set, automate scoring on every change, and add input and output guardrails against prompt injection and PII leaks.
Domain AI agent capstone
A client-ready agent for a real industry problem.
Pick a domain such as healthcare, fintech or edtech and ship an agent that combines retrieval, tools, evals and guardrails, with a public demo and write-up.
GenAI glossary 17 terms
Tap a term to see what it means. You will hear these in every GenAI interview.
- LLM
- Large language model: a neural network trained on huge amounts of text to predict and generate language.
- Transformer
- The neural network architecture behind modern LLMs, built around the attention mechanism.
- Token
- A chunk of text (often part of a word) that a model reads and writes. Pricing and limits are counted in tokens.
- Context window
- The maximum number of tokens a model can consider at once, including your prompt and its answer.
- Prompt engineering
- Designing instructions and examples so a model reliably produces the output you need.
- Embeddings
- Numeric vectors that capture meaning, so similar texts end up close together.
- Vector database
- A database built to store embeddings and find the most similar ones quickly.
- RAG
- Retrieval-augmented generation: fetching relevant documents and giving them to the model so answers are grounded.
- Fine-tuning
- Further training a pre-trained model on your own data to specialise it.
- LoRA
- Low-rank adaptation: a parameter-efficient fine-tuning method that trains small add-on weights instead of the whole model.
- Agent
- An LLM system that plans steps, calls tools and acts towards a goal, often over several turns.
- Tool calling
- Letting a model call functions or APIs, such as search or a database query, with structured arguments.
- MCP
- Model Context Protocol: an open standard for connecting AI applications to tools and data sources.
- Evals
- Systematic tests that measure how well an AI system performs on representative cases.
- Guardrails
- Checks on inputs and outputs that keep an AI system safe, on-topic and compliant.
- Hallucination
- When a model states something false or unsupported with confidence.
- Prompt injection
- An attack where malicious text tricks a model into ignoring its instructions.
Close your gaps with a structured programme
The Certificate Programme in Generative AI from CEP, IIT Delhi covers transformers, fine-tuning, RAG, agents and responsible AI through live weekend classes and hands-on projects.
What is Lemmatization in NLP?
Lemmatization maps an inflected word to its canonical dictionary form using vocabulary resources, linguistic rules and, depending on the implementation, grammatical information.
Lemma meaning with examples
A lemma is the dictionary form used to represent a word and its grammatical variants. For example:
- Cars โ car
- Running โ run
- Better โ good, when used as a comparative adjective
These lemmatization examples show why the process involves more than removing suffixes. The word better cannot reliably become good through simple suffix stripping; a lexical resource must recognise the relationship.
Hereโs something to notice: if you remove the ending from better, you will not arrive at good. Yet good is the appropriate lemma when better is used as a comparative adjective. This is why lemmatization needs linguistic knowledge, not just a rule for cutting off suffixes.
Why Lemmatization matters?
Lemmatization can reduce vocabulary variation by grouping forms such as walk, walks and walked. This may help text classification, information retrieval and text analysis by making related forms easier to match.
However, it is not necessary for every NLP pipeline. Whether it helps depends on the task, model and preprocessing strategy.
Finding a lemma requires more than shortening a word. The next section explains the linguistic information and resources that support this process.

How does Lemmatization Work?
A lemmatization algorithm uses linguistic rules, vocabulary resources and sometimes grammatical information to identify a suitable base form. The exact process varies across tools and languages.

Morphology and word forms
Morphology in NLP examines how words change form and how they are constructed. Inflection changes a word to express grammatical information without creating a separate dictionary entry. For example, walks, walked and walking can share the lemma walk.
Word formation can create a different word with a related meaning. For instance, teach and teacher are related, but they do not share the same lemma. A lemmatizer must distinguish these relationships rather than treating every shared word fragment as equivalent.
The role of part-of-speech tagging
POS tagging in NLP identifies a word’s grammatical role, such as noun, verb or adjective. This matters because the same surface form can have different lemmas depending on how it is used.
Consider meeting. As a noun, it may remain meeting. As a verb, it can map to meet. A lemmatizer that uses grammatical context can make a more appropriate choice.
Quick check: What should meeting become?
- In โThe meeting starts at noon,โ it is a noun, so it may remain meeting.
- In โWe are meeting tomorrow,โ it functions as a verb, so it can map to meet.
The word has not changed its spelling, but its grammatical role has changed. That is why context matters.
Dictionaries, lexical resources, and rules
Dictionary-based lemmatization uses stored vocabulary information to identify base forms. Resources such as WordNet contain lexical relationships and irregular forms that simple suffix rules may miss.
Rule-based systems apply morphological patterns, often alongside POS tags. Lookup-based systems consult stored mappings. Some tools combine these approaches, and their results depend on the language resources and configuration available.
These mechanisms explain why lemmatization can produce meaningful dictionary forms, while stemming follows a different, usually simpler process.
Stemming vs Lemmatization: What is the Difference?
Stemming typically strips or transforms word endings using heuristic rules. Lemmatization aims to return a recognised dictionary form using lexical and, where supported, grammatical information.
| Aspect | Stemming | Lemmatization |
|---|---|---|
| Method | Applies word-reduction rules | Uses lexical resources, rules and sometimes POS |
| Output | May not be a valid word | A recognised lemma where supported |
| Context | Usually ignores grammatical role | May use POS and morphology |
| Speed | Generally faster | Often more computationally involved |
| Example | studies โ studi with Porter stemming | studies โ study |
| Typical use | Lightweight indexing and retrieval | Tasks where meaningful base forms matter |
Examples of stemming and lemmatization
| Word | Porter stemming example | Lemmatization example |
|---|---|---|
| studies | studi | study |
| cars | car | car |
| running | run | run, when identified as a verb |
| better | better | good, when identified as an adjective |
Outputs can vary with the stemming algorithm, POS information and lexical resource. The table illustrates typical results rather than a universal mapping for every tool.
Think about your use case: If you are building a lightweight search index and mainly want to group similar word forms, stemming may be sufficient. If you are analysing sentence meaning or need readable base forms, lemmatization may be more appropriate. The best choice depends on what your system needs to preserve.
What is the Porter Stemmer in NLP?
The Porter stemmer is a widely used English stemming algorithm that applies a series of suffix-stripping rules. It reduces related word forms to stems, which may not be valid dictionary words.
For example, the NLTK Porter stemmer can reduce studies to studi. This can be useful in lightweight text preprocessing when grouping word variants matters more than producing linguistically meaningful base forms. Unlike lemmatization, the Porter stemmer does not aim to identify a dictionary lemma.
The Porter stemmer illustrates how stemming works. Now, letโs see how lemmatization works in Python and how the output changes depending on the tool and grammatical information provided.
How to Perform Lemmatization in Python Using NLTK and spaCy
NLTK provides the WordNetLemmatizer, while spaCy supports pipeline-based lemmatization using lookup tables or rules. The appropriate method depends on your applicati
Lemmatization using NLTK
The following NLTK lemmatization example specifies the POS for each word. The WordNetLemmatizer defaults to noun processing (pos=”n”) when no POS is supplied.
import nltk
nltk.download("wordnet")
from nltk.stem import WordNetLemmatizer
lemmatizer = WordNetLemmatizer()
print(lemmatizer.lemmatize("cars"))
print(lemmatizer.lemmatize("running", pos="v"))
print(lemmatizer.lemmatize("better", pos="a"))
Expected output:
car
run
good
The POS values used here are n for noun, v for verb and a for adjective. Without the appropriate POS, a word may remain unchanged or produce a different result. NLTK returns the input unchanged when it cannot find a suitable lemma for the specified POS.
Try changing the input: Run lemmatizer.lemmatize(“running”) without specifying a POS, and then compare it with lemmatizer.lemmatize(“running”, pos=”v”). Why does the second call return run? The difference illustrates why the default POS setting matters.
Lemmatization using spaCy
spaCy’s rule-based lemmatizer relies on grammatical annotations supplied by earlier pipeline components. Install spaCy and download its English model before running this example:
pip install spacy
python -m spacy download en_core_web_sm
import spacy
nlp = spacy.load("en_core_web_sm")
doc = nlp(“I was reading the paper.”)
print([token.lemma_ for token in doc])
Expected output:
[‘I’, ‘be’, ‘read’, ‘the’, ‘paper’, ‘.’]
The pipeline identifies grammatical information and assigns lemmas to tokens. Notice that spaCy returns be for was and read for reading. If you use a different language model or lemmatizer configuration, check the output rather than assuming every pipeline will behave identically.
spaCy also supports lookup-based approaches, so the exact setup depends on the selected language and lemmatizer mode.
When should You Use Stemming vs Lemmatization?
Choose based on your task rather than assuming one technique is always better.
Before deciding, ask yourself three questions: Do you need valid dictionary forms? Does grammatical context matter to your task? Have you tested whether normalising the words improves your results? Your answers can help determine whether stemming, lemmatization, or neither is appropriate.
When stemming is appropriate
- Search indexing or retrieval where aggressive word reduction is acceptable.
- Lightweight preprocessing where speed and simplicity are priorities.
- Tasks where producing a valid dictionary form is less important than grouping word variants.
When lemmatization is appropriate
- Text analysis where meaningful word forms improve interpretability.
- Text classification that benefits from consistent treatment of inflected forms.
- Information retrieval where matching grammatical variants may help.
- Tasks that need irregular forms or grammatical distinctions to be handled appropriately.
Always evaluate the effect on your actual dataset. Normalising words can help in some cases but can also remove distinctions that matter.
Is Lemmatization Still Relevant in the LLM Era?
Lemmatization remains useful in selected NLP workflows, but modern language-model applications do not automatically need a separate lemmatization step.
It is tempting to assume that more preprocessing automatically leads to better results. But consider this: if a model needs grammatical information to interpret a sentence, could converting every word to its lemma remove something useful? This is why preprocessing decisions should be tested against the task rather than applied by default.
Where Lemmatization can still help
It may help search and retrieval systems, structured linguistic analysis, and traditional machine-learning pipelines where consistent vocabulary forms are useful. For example, a retrieval system may benefit from matching different inflections of a query term.
When it may be unnecessary
Transformer models commonly use subword tokenisation, which splits text into units between whole words and individual characters. These models can process many word variants without requiring every word to be converted into a lemma first.
Preprocessing can also remove grammatical or semantic information that a task needs. Therefore, lemmatization should be tested against the actual objective rather than assumed to improve model accuracy.
Conclusion
Lemmatization helps NLP systems convert words into meaningful dictionary forms using lexical resources, morphology and, where supported, part-of-speech tagging. Unlike stemming, which reduces words through suffix-based rules, lemmatization aims to preserve linguistic meaning while identifying the appropriate base form. Although modern NLP and LLM pipelines do not always require a separate lemmatization step, it remains useful for selected applications such as text classification, information retrieval and linguistic analysis.
To explore these concepts further, the Generative AI programme by IIT Delhi, delivered through Varsity by InterviewBit, covers NLP foundations alongside broader generative AI concepts. These topics help learners connect linguistic processing techniques with the development of modern AI systems.
Frequently Asked Questions
Does lemmatization change the meaning of a sentence?
Lemmatization aims to identify a word’s base form, but incorrect POS tagging or ambiguity can produce an unsuitable result. Always check whether the normalised form preserves distinctions relevant to your task.
Can lemmatization handle irregular verbs?
Yes, when the relevant lexical resource or rules support the irregular form. For example, went can map to go when it is correctly identified as a verb.
Why does NLTK sometimes leave a word unchanged?
WordNetLemmatizer defaults to noun processing and returns the input unchanged when it cannot find a suitable lemma for the specified POS. Supplying the correct POS can change the result.
Does lemmatization work for languages other than English?
Support depends on the library, language model and available lexical resources. Languages with complex morphological systems may require language-specific tools and rules.
Can two different words have the same lemma?
Yes. Inflected forms such as write, writes and wrote can map to write when their grammatical roles are identified appropriately.
Is lemmatization supervised or unsupervised?
Lemmatization is a linguistic processing task, not one fixed learning paradigm. Implementations may use dictionaries, rules, statistical methods or trained components.
What is the difference between a lemma and a root word?
A lemma is a word’s canonical dictionary form. A root is the core morpheme from which a word is formed. The concepts are related but are not interchangeable.
Can lemmatization improve search results?
It can help match inflected forms, but its impact depends on the language, query patterns, indexing strategy and evaluation results. It should be tested against the retrieval task.
Does spaCy require POS tagging for lemmatization?
spaCy’s rule-based lemmatizer requires prior POS annotations. Lookup-based lemmatization works differently, so the requirements depend on the selected pipeline and configuration.
Should I lemmatize text before passing it to an LLM?
Not necessarily. Lemmatization may help structured analysis or retrieval, but it can also remove grammatical information a language model needs. Choose preprocessing based on the task and evaluate the results.





