Skip to main content

GitHub - yichuan-w/LEANN: RAG on Everything with LEANN. Enjoy 97% storage savings while running a fast, accurate, and 100% private RAG application on your personal device.

·1106 words·6 mins
GitHub Python Open Source
Articoli Interessanti - This article is part of a series.
Part : This Article
Part : Everything as Code: How We Manage Our Company In One Monorepo At Kasava, we've embraced the concept of "everything as code" to streamline our operations and ensure consistency across our projects. This approach allows us to manage our entire company within a single monorepo, providing a unified source of truth for all our configurations, infrastructure, and applications. **Why a Monorepo?** A monorepo offers several advantages: 1. **Unified Configuration**: All our settings, from development environments to production, are stored in one place. This makes it easier to maintain consistency and reduces the risk of configuration drift. 2. **Simplified Dependency Management**: With all our code in one repository, managing dependencies becomes more straightforward. We can easily track which versions of libraries and tools are being used across different projects. 3. **Enhanced Collaboration**: A single repository fosters better collaboration among team members. Everyone has access to the same codebase, making it easier to share knowledge and work together on projects. 4. **Consistent Build and Deployment Processes**: By standardizing our build and deployment processes, we ensure that all our applications follow the same best practices. This leads to more reliable and predictable deployments. **Our Monorepo Structure** Our monorepo is organized into several key directories: - **/config**: Contains all configuration files for various environments, including development, staging, and production. - **/infrastructure**: Houses the infrastructure as code (IaC) scripts for provisioning and managing our cloud resources. - **/apps**: Includes all our applications, both internal tools and customer-facing products. - **/lib**: Stores reusable libraries and modules that can be shared across different projects. - **/scripts**: Contains utility scripts for automating various tasks, such as data migrations and backups. **Tools and Technologies** To manage our monorepo effectively, we use a combination of tools and technologies: - **Version Control**: Git is our primary version control system, and we use GitHub for hosting our repositories. - **Continuous Integration/Continuous Deployment (CI/CD)**: We employ Jenkins for automating our build, test, and deployment processes. - **Infrastructure as Code (IaC)**: Terraform is our tool of choice for managing cloud infrastructure. - **Configuration Management**: Ansible is used for configuring and managing our servers and applications. - **Monitoring and Logging**: We use Prometheus and Grafana for monitoring,
LEANN MCP Integration
#### Source

Type: GitHub Repository Original Link: https://github.com/yichuan-w/LEANN?tab=readme-ov-file Publication Date: 2026-01-06


Summary
#

Introduction
#

Imagine being a researcher who needs to analyze thousands of different types of documents, including scientific articles, emails, and corporate reports. Every time you search for specific information, you find yourself navigating through disorganized files and wasting precious hours. Now, imagine having a system that can index and search through millions of documents quickly and accurately, all on your laptop, without ever sending your data to a remote server. This is exactly what LEANN offers, an open-source project that revolutionizes the way we manage and retrieve information.

LEANN is an innovative vector database that transforms your laptop into a powerful Retrieval-Augmented Generation (RAG) system. Thanks to advanced indexing and semantic search techniques, LEANN allows you to find exactly what you need in just a few seconds, saving up to 97% of storage space compared to traditional methods. It’s not just a tool for developers, but a practical solution for anyone who needs to manage large amounts of data efficiently and securely.

What It Does
#

LEANN is a vector database focused on managing and searching information locally and privately. In practice, LEANN allows you to index and search through millions of documents directly on your device, without the need to send data to remote servers. This is particularly useful for those working with sensitive data or who want to maintain complete control over their information.

One of the main features of LEANN is its ability to save storage space. Thanks to techniques such as graph-based selective recomputation and high-degree preserving pruning, LEANN calculates embeddings only when necessary, avoiding the need to store all vectors. This not only reduces space usage but also makes the system faster and more responsive.

LEANN is compatible with various indexing backends, such as HNSW (Hierarchical Navigable Small World), and supports semantic search, allowing you to find information in a more intuitive and accurate way compared to keyword-based search methods. Additionally, LEANN is designed to be easy to integrate into existing projects, offering a simple and intuitive interface for developers and end users.

Why It’s Amazing
#

The “wow” factor of LEANN lies in its ability to offer a powerful and private semantic search system directly on your device. It’s not just a simple keyword-based search tool, but a system that understands the context and meaning of the information you are looking for.

Dynamic and contextual: LEANN uses advanced indexing techniques that allow it to calculate embeddings only when necessary. This means the system is always up-to-date and ready to answer your questions accurately. For example, if you are looking for information about a specific project, LEANN can return results that take into account the context in which you are working, making the search more relevant and useful.

Real-time reasoning: Thanks to its ability to calculate embeddings in real-time, LEANN can answer complex questions quickly and accurately. Imagine needing to analyze a large dataset of emails to find a fraudulent transaction. With LEANN, you can ask “Which emails contain suspicious transactions?” and get immediate results, without having to wait for the system to process all the data.

Total privacy: One of the biggest advantages of LEANN is its emphasis on privacy. All your data remains on your device, never being sent to remote servers. This is particularly important for those working with sensitive information or who want to maintain complete control over their data. As one of the developers said, “Hi, I am your system. Service X is offline, but I can still help you find the information you need.”

Efficiency without compromise: LEANN saves up to 97% of storage space compared to traditional methods. This means you can index and search through millions of documents without worrying about the available space on your device. For example, a dataset of 60 million text fragments can be indexed in just 6GB, compared to the 201GB required with traditional methods.

How to Try It
#

Trying LEANN is simple and straightforward. Here’s how you can get started:

  1. Prerequisites: Make sure you have Python 3.9 or higher installed on your system. LEANN supports Ubuntu, Arch, WSL, macOS (ARM64/Intel), and Windows. You can find detailed instructions for installing the prerequisites in the project’s README.

  2. Installation: Clone the LEANN repository from GitHub using the command git clone https://github.com/yichuan-w/LEANN.git. Once cloned, follow the instructions in the README to install the necessary dependencies.

  3. Configuration: Configure your development environment by following the instructions in the README. This includes installing packages such as boost, protobuf, abseil-cpp, libaio, zeromq, and others.

  4. Execution: Once the environment is configured, you can start using LEANN. Here is an example of how to build an index and perform a search:

from leann import LeannBuilder, LeannSearcher, LeannChat
from pathlib import Path
INDEX_PATH = str(Path("./").resolve() / "demo.leann")

# Build an index
builder = LeannBuilder(backend_name="hnsw")
builder.add_text("LEANN saves 97% storage compared to traditional vector databases.")
builder.add_text("Tung Tung Tung Sahur called—they need their banana-crocodile hybrid back")
builder.build_index(INDEX_PATH)

# Search
searcher = LeannSearcher(INDEX_PATH)
results = searcher.search("fantastical AI-generated creatures", top_k=1)

# Chat with your data
chat = LeannChat(INDEX_PATH, llm_config={"type": "hf", "model": "Qwen/Qwen3-0.6B"})
response = chat.ask("How much storage does LEANN save?", top_k=1)
  1. Documentation: For more details, consult the official documentation available in the repository. The documentation covers all aspects of the project, from advanced features to best practices for use.

Final Thoughts
#

LEANN represents a significant step forward in the field of semantic search and data management. Its ability to offer a powerful and private search system directly on the user’s device makes it an ideal solution for anyone who needs to manage large amounts of information efficiently and securely.

In the broader context of the tech ecosystem, LEANN positions itself as an innovative project that democratizes access to artificial intelligence. Its emphasis on privacy and efficiency makes it an interesting choice for developers, researchers, and end users seeking practical and secure solutions for data management.

In conclusion, LEANN is not just a technological tool, but a vision of the future where data management is simple, efficient, and completely under the user’s control. With LEANN, the potential to innovate and improve information management is limitless.


Use Cases
#

  • Private AI Stack: Integration into proprietary pipelines
  • Client Solutions: Implementation for client projects
  • Development Acceleration: Reduction of time-to-market for projects

Resources
#

Original Links #


Article recommended and selected by the Human Technology eXcellence team, processed through artificial intelligence (in this case with LLM HTX-EU-Mistral3.1Small) on 2026-01-06 09:30 Original Source: https://github.com/yichuan-w/LEANN?tab=readme-ov-file

Articoli Interessanti - This article is part of a series.
Part : This Article
Part : Everything as Code: How We Manage Our Company In One Monorepo At Kasava, we've embraced the concept of "everything as code" to streamline our operations and ensure consistency across our projects. This approach allows us to manage our entire company within a single monorepo, providing a unified source of truth for all our configurations, infrastructure, and applications. **Why a Monorepo?** A monorepo offers several advantages: 1. **Unified Configuration**: All our settings, from development environments to production, are stored in one place. This makes it easier to maintain consistency and reduces the risk of configuration drift. 2. **Simplified Dependency Management**: With all our code in one repository, managing dependencies becomes more straightforward. We can easily track which versions of libraries and tools are being used across different projects. 3. **Enhanced Collaboration**: A single repository fosters better collaboration among team members. Everyone has access to the same codebase, making it easier to share knowledge and work together on projects. 4. **Consistent Build and Deployment Processes**: By standardizing our build and deployment processes, we ensure that all our applications follow the same best practices. This leads to more reliable and predictable deployments. **Our Monorepo Structure** Our monorepo is organized into several key directories: - **/config**: Contains all configuration files for various environments, including development, staging, and production. - **/infrastructure**: Houses the infrastructure as code (IaC) scripts for provisioning and managing our cloud resources. - **/apps**: Includes all our applications, both internal tools and customer-facing products. - **/lib**: Stores reusable libraries and modules that can be shared across different projects. - **/scripts**: Contains utility scripts for automating various tasks, such as data migrations and backups. **Tools and Technologies** To manage our monorepo effectively, we use a combination of tools and technologies: - **Version Control**: Git is our primary version control system, and we use GitHub for hosting our repositories. - **Continuous Integration/Continuous Deployment (CI/CD)**: We employ Jenkins for automating our build, test, and deployment processes. - **Infrastructure as Code (IaC)**: Terraform is our tool of choice for managing cloud infrastructure. - **Configuration Management**: Ansible is used for configuring and managing our servers and applications. - **Monitoring and Logging**: We use Prometheus and Grafana for monitoring,