KeyBERT

Minimal keyword extraction library using BERT embeddings.

Open SourceSelf HostedOffline Capable
0.0 (0)

About

KeyBERT takes a deliberately minimal approach to keyword and keyphrase extraction: it embeds a document with a BERT style model, embeds candidate n-grams from the same text, and ranks the candidates by cosine similarity to the document embedding, so the extracted phrases are the ones most semantically representative of the whole. Maarten Grootendorst's library adds two diversification strategies, Maximal Marginal Relevance and Max Sum Distance, to avoid returning near duplicate phrases. It supports embedding backends including Sentence-Transformers, Flair, spaCy, Gensim, and lightweight Model2Vec models, while the companion KeyLLM module performs keyword extraction with large language models, batching similar documents for efficiency. Useful results take a pip install and about three lines of Python, which is why data scientists reach for it when heavier NLP pipelines are overkill. Released under the MIT license.

Should you use KeyBERT?

Pick it when

Pick KeyBERT when you need a few representative keyphrases per document, for tagging articles, metadata, or quick exploration, and want results in a few lines of Python using an embedding model you already have.

Look elsewhere when

Skip it if you want themes across a whole collection rather than tags per document, where BERTopic fits, or if you cannot afford embedding inference at volume, since every candidate phrase in every document gets embedded.

Alternatives to KeyBERT

  • BERTopic

    Groups an entire corpus into labeled topics with visualizations, heavier to run, but answers what a collection is about rather than one document.

  • GLiNER

    Pulls typed entities such as people, products or places you name at runtime, better when you need structured fields rather than free keyphrases.

  • LangExtract

    LLM-based extraction with source offsets for richer structured output, but slower and costs API calls or local LLM compute per document.

  • TextBlob

    Its noun phrase chunking gives cheap keyword candidates with no embeddings, but no ranking by how well a phrase represents the document.

Reviews (0)

Leave a Review

No reviews yet. Be the first to review!

Details

Price
Free
Platform
Local/Desktop
Difficulty
Beginner (1/5)
License
MIT
Added
Apr 3, 2026

Tags