benfred

implicit is a fast collaborative filtering library for implicit feedback datasets (Python), providing ALS, BPR, logistic matrix factorization, and item-nearest-neighbour models with multi-threaded CPU training and optional GPU acceleration.

v0.7.3
Published at
May 8, 2026
3,830
Stars
4,030
Download
Synced at
8d ago

Latest release

v0.7.3May 8, 2026, 06:36 PM
Downloads slow? Switch the source anytime above

README

Project Overview

implicit is a collaborative filtering recommendation library focused on implicit feedback data such as clicks, purchases, and plays. It implements multi-threaded training with Cython and OpenMP, fitting models efficiently across all CPU cores. It provides four mainstream algorithms: implicit ALS, Bayesian Personalized Ranking (BPR), logistic matrix factorization, and item-item nearest neighbour models using Cosine, TFIDF, or BM25 distances. ALS and BPR ship custom CUDA kernels, and Annoy, NMSLIB, or Faiss can accelerate serving recommendations.

Train industrial recommendation models straight from behaviour logs, no ratings required.

Item Value
Platform Linux, macOS, Windows
Language Python (Cython/CUDA kernels)
License MIT
Algorithms ALS, BPR, logistic matrix factorization, item-item KNN

Key Features

  • Implicit ALS: alternating least squares tuned for implicit feedback with multi-threaded training
  • BPR: Bayesian Personalized Ranking for ranking scenarios
  • Logistic matrix factorization: a probabilistic factorization of interactions
  • Item-item KNN: models using Cosine, TFIDF, or BM25 distances
  • GPU training: custom CUDA kernels for ALS and BPR
  • ANN acceleration: integrates Annoy, NMSLIB, and Faiss to speed up recommendations
  • Similar lookups: one call returns similar items or similar users

Target Audience

  • Backend engineers building recommender systems
  • Algorithm engineers handling implicit behaviour data
  • Researchers studying recommendation algorithms
  • Competitors working on recommendation challenges

Quick Start

  1. Install:
pip install implicit
  1. Train an ALS model and recommend:
import implicit

model = implicit.als.AlternatingLeastSquares(factors=50)
model.fit(user_item_data)
recommendations = model.recommend(userid, user_item_data[userid])
  1. Find related items:
related = model.similar_items(itemid)

Core Advantages

  • Fast training: Cython plus OpenMP saturates all cores, far beyond pure NumPy
  • Optional GPU: mainstream algorithms ship CUDA kernels, fitting large datasets in seconds
  • Implicit-feedback focus: interfaces and algorithms designed around clicks and purchases

System Requirements

Item Requirement
OS Linux, macOS, Windows
Runtime Python 3.9+, SciPy 0.16+
GPU Optional; needs CUDA Toolkit 13 and rmm-cu13

Notes

  • Input format: models take sparse matrices; build the user-item confidence matrix first
  • BLAS threads: on OpenBLAS set OPENBLAS_NUM_THREADS=1; disabling its internal threading actually speeds this library up
  • GPU setup: GPU support requires CUDA 13 and the rmm dependency; the CPU build has no such requirement

Release history

Sort