Lantern

Lantern

Lantern Systems, Inc. · Coding

Lantern is an open-source Postgres extension that adds HNSW vector search and embedding generation to your existing database, plus a managed cloud service for AI apps.

Interface preview of Lantern

About Lantern

What Is Lantern

Lantern runs inside PostgreSQL as an extension, so vectors sit in the same tables as the rest of your data. You add a vector column, build a lantern_hnsw index on it, and the database answers nearest neighbor queries with plain SQL. No second store, no sync job, no separate query language.

The project targets teams building semantic search, recommendations, and retrieval for AI assistants without leaving Postgres. It supports Postgres 11 through 16 and reuses pgvector's vector type, which means a pgvector table can move over with a data type that already matches.

The limits matter too. Lantern is maintained by a small team, the newest open-source release is v0.5.0 from November 2024, and the free cloud tier is small at 0.25 vCPU and 0.5 GB of RAM. It's a good fit for prototypes and mid-size catalogs, less so for teams that need a large support organization.

Getting Started

  1. Create a free Lantern Cloud project, or install the extension on your own Postgres with Docker, Homebrew, or a precompiled binary.
  2. Run CREATE EXTENSION lantern in the database you plan to use. Each database on an instance needs its own copy.
  3. Add a vector column to a table and insert rows as arrays of floats.
  4. Build an index with CREATE INDEX ... USING lantern_hnsw, picking an operator class such as cosine or L2 squared.
  5. Query with the distance operators, or switch on automatic embedding generation so Lantern fills the vector column from your text.

Product Information

A quick look at Lantern's pricing, supported platforms, and performance.

Free PlanYes
Paid Plans$0 - $704/mo
PlatformLantern Cloud (managed Postgres), self-hosted on Postgres 11-16 via Docker, Homebrew, or binaries
DeveloperLantern Systems, Inc.
CategoryCoding
Release DateJul 2023
Latest UpdatedDec 2024
Website Visits2.2K
Website Global Rank6.6M
API AvailabilityYes

Best for

The users, tasks, and scenarios where this tool fits best.

Users

  • Backend developers who already run Postgres
  • AI engineers building retrieval for chatbots
  • Small teams without a database administrator

Tasks

  • Semantic search over product catalogs, support docs, or internal wikis, where a text query should return results by meaning rather than exact words.
  • Image similarity search with CLIP embeddings, which Lantern supports as a built-in model alongside text models.
  • Recommendation features that rank items by distance to a user's embedding, computed in the same query that joins your business tables.
  • Deduplication and near-duplicate detection across large record sets, using a cosine index and a distance threshold.

Scenarios

  • Adding search to an existing Rails, Django, or Node app without introducing a new datastore.
  • Migrating off pgvector or Pinecone when you want one database to own both relational data and vectors.
  • Prototyping a RAG pipeline on the free tier before committing to a paid instance.

Key features

HNSW Index Built for Postgres

Lantern adds a lantern_hnsw index type for vector columns and speeds up ORDER BY ... LIMIT queries. The index is built on usearch, a compact HNSW implementation, and supports L2 squared, cosine, and Hamming distance through operator classes you choose at index time.

Embedding Generation in SQL

You can generate vectors without leaving the database. Lantern ships helper functions that call embedding models and write the result into a column, so a Python or Node service doesn't have to chunk text, call an API, and handle retries itself.

Automatic Embedding Columns

Managed columns keep vectors current. You point Lantern at a text column and a model, and new or changed rows get embedded in the background as an asynchronous task. That removes the usual glue code between a content table and its search index.

LLM Calls From SQL

Version 0.5.0 added llm_completion and add_completion_job, which let you run prompts against an LLM inside a query or as a background job. It's a narrow feature, useful for classification and short summaries, not a replacement for an application layer.

Serverless Indexing and Parallel Builds

Index creation is often the slow part of a vector setup. Lantern can build the index graph outside the database server or on a separate machine, so a large rebuild doesn't stall normal traffic. On the cloud, that's billed as serverless indexing from $0.50 per GB.

Index Autotuning and Quantization

Picking M, ef, and ef_construction by hand takes experiments. Lantern includes an autotune tool that suggests parameters for your data, and product quantization to shrink index size when memory is the constraint.

Pros and cons

Pros

  • Vectors live in Postgres, so joins, filters, and transactions work the same way they do for the rest of your schema.
  • pgvector's data type is supported, which keeps the migration path short if you already use it.
  • Embedding generation and managed columns cut out a separate ingestion service.
  • The cloud free tier never pauses, so a demo project can sit idle without losing its database.
  • Index builds can run outside the main server, which keeps production responsive during a rebuild.

Cons

  • The open-source release cadence is slow. v0.5.0 landed in November 2024, and the repository's last push was December 2024, so you should expect to depend on your own fork for fixes.
  • Documentation assumes you're comfortable with SQL and index tuning. Teams without a backend engineer will find the first index build confusing.
  • The free cloud instance has 0.25 vCPU and 0.5 GB of RAM, which is enough for a demo and not much more.
  • Embedding costs stack on top of the database bill, and passing your own OpenAI or Cohere key is the only way to avoid Lantern's per-token markup.

Frequently asked questions

Yes, in two senses. The extension is open source under AGPL-3.0 and free to self-host, and Lantern Cloud has a free tier with 0.25 vCPU, 0.5 GB of RAM, and no pausing. Paid cloud instances start at $44 per month and run up to $704 per month for 16 vCPU and 60 GB of RAM.