# gensim

> Python framework for fast Vector Space Modelling

- **URL**: https://www.freshcrate.ai/projects/gensim
- **Author**: Radim Rehurek
- **Category**: Databases
- **Latest version**: `4.4.0` (2026-04-21)
- **License**: LGPL-2.1-only
- **Source**: https://github.com/RaRe-Technologies/gensim
- **Homepage**: https://radimrehurek.com/gensim/
- **Language**: Python
- **GitHub**: 16,395 stars, 4,413 forks
- **Registry**: pypi (`gensim`)
- **Tags**: `decomposition`, `indexing`, `latent`, `lsa`, `pypi`, `semantic`, `singular`, `svd`, `value`

## Description

==============================================
gensim -- Topic Modelling in Python
==============================================

|GA|_
|Wheel|_

.. |GA| image:: https://github.com/RaRe-Technologies/gensim/actions/workflows/tests.yml/badge.svg?branch=develop
.. |Wheel| image:: https://img.shields.io/pypi/wheel/gensim.svg

.. _GA: https://github.com/RaRe-Technologies/gensim/actions
.. _Downloads: https://pypi.org/project/gensim/
.. _License: https://radimrehurek.com/gensim/intro.html#licensing
.. _Wheel: https://pypi.org/project/gensim/

Gensim is a Python library for *topic modelling*, *document indexing* and *similarity retrieval* with large corpora.
Target audience is the *natural language processing* (NLP) and *information retrieval* (IR) community.

Features
---------

* All algorithms are **memory-independent** w.r.t. the corpus size (can process input larger than RAM, streamed, out-of-core)
* **Intuitive interfaces**

  * easy to plug in your own input corpus/datastream (simple streaming API)
  * easy to extend with other Vector Space algorithms (simple transformation API)

* Efficient multicore implementations of popular algorithms, such as online **Latent Semantic Analysis (LSA/LSI/SVD)**,
  **Latent Dirichlet Allocation (LDA)**, **Random Projections (RP)**, **Hierarchical Dirichlet Process (HDP)** or **word2vec deep learning**.
* **Distributed computing**: can run *Latent Semantic Analysis* and *Latent Dirichlet Allocation* on a cluster of computers.
* Extensive `documentation and Jupyter Notebook tutorials <https://github.com/RaRe-Technologies/gensim/#documentation>`_.


If this feature list left you scratching your head, you can first read more about the `Vector
Space Model <https://en.wikipedia.org/wiki/Vector_space_model>`_ and `unsupervised
document analysis <https://en.wikipedia.org/wiki/Latent_semantic_indexing>`_ on Wikipedia.

Installation
------------

This software depends on `NumPy and Scipy <https://scipy.org/install/>`_, two Python packages for scientific computing.
You must have them installed prior to installing `gensim`.

It is also recommended you install a fast BLAS library before installing NumPy. This is optional, but using an optimized BLAS such as MKL, `ATLAS <https://math-atlas.sourceforge.net/>`_ or `OpenBLAS <https://xianyi.github.io/OpenBLAS/>`_ is known to improve performance by as much as an order of magnitude. On OSX, NumPy picks up its vecLib BLAS automatically, so you don't need to do anything special.

Install the latest version of gensim::

    pip install --upgrade gensim

Or, if you have instead downloaded and unzipped the `source tar.gz <https://pypi.org/project/gensim/>`_ package::

    python setup.py install


For alternative modes of installation, see the `documentation <https://radimrehurek.com/gensim/#install>`_.

Gensim is being `continuously tested <https://radimrehurek.com/gensim/#testing>`_ under all `supported Python versions <https://github.com/RaRe-Technologies/gensim/wiki/Gensim-And-Compatibility>`_.
Support for Python 2.7 was dropped in gensim 4.0.0 – install gensim 3.8.3 if you must use Python 2.7.


How come gensim is so fast and memory efficient? Isn't it pure Python, and isn't Python slow and greedy?
--------------------------------------------------------------------------------------------------------

Many scientific algorithms can be expressed in terms of large matrix operations (see the BLAS note above). Gensim taps into these low-level BLAS libraries, by means of its dependency on NumPy. So while gensim-the-top-level-code is pure Python, it actually executes highly optimized Fortran/C under the hood, including multithreading (if your BLAS is so configured).

Memory-wise, gensim makes heavy use of Python's built-in generators and iterators for streamed data processing. Memory efficiency was one of gensim's `design goals <https://radimrehurek.com/gensim/intro.html#design-principles>`_, and is a central feature of gensim, rather than something bolted on as an afterthought.

Documentation
-------------
* `QuickStart`_
* `Tutorials`_
* `Tutorial Videos`_
* `Official Documentation and Walkthrough`_

Citing gensim
-------------

When `citing gensim in academic papers and theses <https://scholar.google.cz/citations?view_op=view_citation&hl=en&user=9vG_kV0AAAAJ&citation_for_view=9vG_kV0AAAAJ:u-x6o8ySG0sC>`_, please use this BibTeX entry::

  @inproceedings{rehurek_lrec,
        title = {{Software Framework for Topic Modelling with Large Corpora}},
        author = {Radim {\v R}eh{\r u}{\v r}ek and Petr Sojka},
        booktitle = {{Proceedings of the LREC 2010 Workshop on New
             Challenges for NLP Frameworks}},
        pages = {45--50},
        year = 2010,
        month = May,
        day = 22,
        publisher = {ELRA},
        address = {Valletta, Malta},
        language={English}
  }

----------------

Gensim is open source software released under the `GNU LGPLv2.1 license <https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.h

## Recent releases

| Version | Date | Urgency | Changes |
| --- | --- | --- | --- |
| `4.4.0` | 2026-04-21 | Low | Imported from PyPI (4.4.0) |
| `4.3.2` | 2023-08-24 | Low | Changes =======  ## 4.3.2, 2023-08-23  ### :red_circle: Bug fixes  * Fix incorrect conversion of cosine distance to cosine similarity (__[monash849](https://github.com/monash849)__, [#3441](https://github.com/RaRe-Technologies/gensim/pull/3441))  ### :books: Tutorial and doc improvements  * Fix inconsistent documentation for LdaSeqModel #3474 (__[rsokolewicz](https://github.com/rsokolewicz)__, [#3475](https://github.com/RaRe-Technologies/gensim/pull/3475)) * Update the licence link t |
| `4.3.0` | 2022-12-21 | Low | ## What's Changed  * Allow overriding the Cython version requirement by @pabs3 in https://github.com/RaRe-Technologies/gensim/pull/3323 * Update Python module MANIFEST by @pabs3 in https://github.com/RaRe-Technologies/gensim/pull/3343 * Clean up references to `Morfessor`, `tox` and `gensim.models.wrappers` by @pabs3 in https://github.com/RaRe-Technologies/gensim/pull/3345 * Disable the Gensim 3=>4 warning in docs by @piskvorky in https://github.com/RaRe-Technologies/gensim/pull/3346 * pin |
| `4.2.0` | 2022-05-01 | Low | A number of incremental improvements, optimizations and bugfixes: [CHANGELOG](https://github.com/RaRe-Technologies/gensim/blob/develop/CHANGELOG.md) |
| `4.1.2` | 2021-09-18 | Low | ## 4.1.2, 2021-09-17  This is a bugfix release that addresses left over compatibility issues with older versions of numpy and MacOS.  ## 4.1.1, 2021-09-14  This is a bugfix release that addresses compatibility issues with older versions of numpy.  ## 4.1.0, 2021-08-15  Gensim 4.1 brings two major new functionalities:  * [Ensemble LDA](https://radimrehurek.com/gensim/auto_examples/tutorials/run_ensemblelda.html) for robust training, selection and comparison of LDA models. * [FastSS m |
| `4.1.1` | 2021-09-14 | Low | ## 4.1.1, 2021-09-14  This is a bugfix release that addresses compatibility issues with older versions of numpy.  ## 4.1.0, 2021-08-15  Gensim 4.1 brings two major new functionalities:  * [Ensemble LDA](https://radimrehurek.com/gensim/auto_examples/tutorials/run_ensemblelda.html) for robust training, selection and comparison of LDA models. * [FastSS module](https://github.com/RaRe-Technologies/gensim/blob/develop/gensim/similarities/fastss.pyx) for super fast Levenshtein "fuzzy search" |
| `4.1.0` | 2021-08-29 | Low | ## 4.1.0, 2021-08-15  Gensim 4.1 brings two major new functionalities:  * [Ensemble LDA](https://radimrehurek.com/gensim/auto_examples/tutorials/run_ensemblelda.html) for robust training, selection and comparison of LDA models. * [FastSS module](https://github.com/RaRe-Technologies/gensim/blob/develop/gensim/similarities/fastss.pyx) for super fast Levenshtein "fuzzy search" queries. Used e.g. for ["soft term similarity"](https://github.com/RaRe-Technologies/gensim/pull/3146) calculations. |
| `4.0.1` | 2021-04-01 | Low | ## 4.0.1, 2021-04-01  Bugfix release to address issues with wheels on Windows due to Numpy binary incompatibility:  - https://github.com/RaRe-Technologies/gensim/issues/3095 - https://github.com/RaRe-Technologies/gensim/issues/3097  ## 4.0.0, 2021-03-24  **⚠️ Gensim 4.0 contains breaking API changes! See the [Migration guide](https://github.com/RaRe-Technologies/gensim/wiki/Migrating-from-Gensim-3.x-to-4) to update your existing Gensim 3.x code and models.**  Gensim 4.0 is a major rel |
| `4.0.0` | 2021-03-25 | Low | Changes =======  ## 4.0.0, 2021-03-24  **⚠️ Gensim 4.0 contains breaking API changes! See the [Migration guide](https://github.com/RaRe-Technologies/gensim/wiki/Migrating-from-Gensim-3.x-to-4) to update your existing Gensim 3.x code and models.**  Gensim 4.0 is a major release with lots of performance & robustness improvements, and a new website.  ### Main highlights  * Massively optimized popular algorithms the community has grown to love: [fastText](https://radimrehurek.com/gensim/m |
| `4.0.0.rc1` | 2021-03-22 | Low | ## 4.0.0.rc1, 2021-03-19  **⚠️ Gensim 4.0 contains breaking API changes! See the [Migration guide](https://github.com/RaRe-Technologies/gensim/wiki/Migrating-from-Gensim-3.x-to-4) to update your existing Gensim 3.x code and models.**  Gensim 4.0 is a major release with lots of performance & robustness improvements and a new website.  ### Main highlights (see also *👍 Improvements* below)  * Massively optimized popular algorithms the community has grown to love: [fastText](https://radimre |

## Citation

- HTML: https://www.freshcrate.ai/projects/gensim
- Markdown: https://www.freshcrate.ai/projects/gensim.md
- Dependencies JSON: https://www.freshcrate.ai/api/projects/gensim/deps

_Generated by freshcrate.ai. Indexes pypi releases for AI-agent ecosystem packages._
