lantern  by lanterndata

PostgreSQL extension for vector storage and AI app development

created 2 years ago
862 stars

Top 42.5% on sourcepulse

GitHubView on GitHub
Project Summary

Lantern is an open-source PostgreSQL extension designed to store vector data, generate embeddings, and perform efficient vector searches, targeting developers building AI applications. It offers a lantern_hnsw index type that significantly speeds up vector search queries by leveraging a state-of-the-art HNSW implementation.

How It Works

Lantern integrates a single-header, C++ HNSW implementation (usearch) directly into PostgreSQL. This allows for efficient in-database vector indexing and searching, bypassing the need for external vector databases. The extension provides custom operators (<->, <=>, <+>) and operator classes for various distance metrics (L2 squared, cosine, Hamming), enabling flexible vector comparisons.

Quick Start & Requirements

  • Docker: docker run --pull=always --rm -p 5432:5432 -e "POSTGRES_USER=$USER" -e "POSTGRES_PASSWORD=postgres" -v ./lantern_data:/var/lib/postgresql/data lanterndata/lantern:latest-pg15
  • Homebrew: brew tap lanterndata/lantern && brew install lantern && lantern_install
  • Prerequisites: CMake >= 3.3, GCC/G++ >= 11 (or 12 for native), PostgreSQL 11-16 with development packages.
  • Resources: Official documentation and Replit integration are available.

Highlighted Details

  • Matches or outperforms pgvector and pg_embedding (Neon) in index creation time, SELECT throughput, and latency.
  • Supports embedding generation using CLIP, Hugging Face, and custom models.
  • Interoperable with pgvector's data types for seamless migration.
  • Allows parallel index creation and index graph generation outside the database server.

Maintenance & Community

  • Community contributions are welcomed via GitHub issues and PRs.
  • Support is available via email at support@lantern.dev.

Licensing & Compatibility

  • The extension is released under the Apache 2.0 license, permitting commercial use and integration with closed-source applications.

Limitations & Caveats

  • The extension must be explicitly enabled (CREATE EXTENSION lantern;) for each PostgreSQL database.
  • Future roadmap includes support for 1-byte and 2-byte vector elements and up to 8000 dimensions.
Health Check
Last commit

7 months ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
20 stars in the last 90 days

Explore Similar Projects

Starred by Jared Palmer Jared Palmer(Ex-VP of AI at Vercel; Founder of Turborepo; Author of Formik, TSDX).

pgvector-node by pgvector

0.8%
399
Node.js library for pgvector support
created 4 years ago
updated 2 weeks ago
Feedback? Help us improve.