LEANN  by yichuan-w

RAG on Everything with 97% storage savings

Created 2 months ago
1,811 stars

Top 23.9% on SourcePulse

GitHubView on GitHub
Project Summary

LEANN is a novel vector database designed for personal AI applications, enabling users to build private, efficient Retrieval-Augmented Generation (RAG) systems on their local devices. It targets individuals and developers seeking to leverage their personal data (emails, documents, browsing history) for AI tasks without cloud reliance or significant storage overhead, offering up to 97% storage savings.

How It Works

LEANN employs a graph-based selective recomputation strategy, drastically reducing storage needs by not storing all embeddings. Instead, it stores a pruned graph structure and computes embeddings on-demand during search. This approach, combined with high-degree preserving pruning and CSR format for graph storage, minimizes memory and disk footprint while maintaining accuracy.

Quick Start & Requirements

  • Installation: Clone the repository (git clone https://github.com/yichuan-w/LEANN.git), activate a virtual environment (uv venv, source .venv/bin/activate), and install LEANN (uv pip install leann).
  • Prerequisites: uv package manager. Building from source requires llvm, libomp, boost, protobuf, zeromq, pkgconf on macOS, or libomp-dev, libboost-all-dev, protobuf-compiler, libabsl-dev, libmkl-full-dev, libaio-dev, libzmq3-dev on Linux.
  • LLM Setup: OpenAI API key (environment variable OPENAI_API_KEY) or Ollama for local LLM execution.
  • Resources: Minimal hardware requirements for local execution, with specific examples for macOS email access requiring full disk access permissions.
  • Links: Demo Notebook, Configuration Guide, Claude Code Integration.

Highlighted Details

  • Achieves up to 97% storage savings compared to traditional vector databases (e.g., 6GB for 60M documents vs. 201GB).
  • Supports RAG on diverse personal data sources: documents (PDF, TXT, MD), Apple Mail, Chrome History, WeChat.
  • Offers flexible LLM integration (OpenAI, HuggingFace, Ollama) and embedding model choices.
  • Provides a powerful CLI for building, searching, and interactive chat with indexes.

Maintenance & Community

  • Core contributors: Yichuan Wang, Zhifei Li.
  • Developed at Berkeley Sky Computing Lab.
  • Open to contributions via issues and PRs.
  • Roadmap, FAQ.

Licensing & Compatibility

  • MIT License.
  • Permissive license suitable for commercial use and closed-source linking.

Limitations & Caveats

  • Browser history RAG currently supports macOS Chrome profiles; Windows support is pending.
  • WeChat RAG requires a separate WeChat exporter tool and may have installation troubleshooting steps.
  • Claude Code integration requires global installation of the leann CLI.
Health Check
Last Commit

2 days ago

Responsiveness

Inactive

Pull Requests (30d)
34
Issues (30d)
30
Star History
1,811 stars in the last 30 days

Explore Similar Projects

Starred by Carol Willing Carol Willing(Core Contributor to CPython, Jupyter), Luis Capelo Luis Capelo(Cofounder of Lightning AI), and
10 more.

lancedb by lancedb

0.6%
7k
Embedded retrieval engine for multimodal AI
Created 2 years ago
Updated 3 days ago
Feedback? Help us improve.