from Hacker News

Show HN: Lantern – a PostgreSQL vector database for building AI applications

by ngalstyan4 on 9/13/23, 5:41 PM with 43 comments

We are excited to share Lantern! Lantern is a PostgreSQL vector database extension for building AI applications. Install and use our extension here: https://github.com/lanterndata/lantern

We have the most complete feature set of all the PostgreSQL vector database extensions. Our database is built on top of usearch — a state of the art implementation of HNSW, the most scalable and performant algorithm for handling vector search.

There’s three key metrics we track. CREATE INDEX time, SELECT throughput, and SELECT latency. We match or outperform pgvector and pg_embedding (Neon) on all of these metrics.

** Here’s what we support today **

- Creating an AI application end to end without leaving your database (example: https://github.com/ezra-varady/lanterndb-semantic-image-sear...)

- Embedding generation for popular use cases (CLIP model, Hugging Face models, custom model)

- Interoperability with pgvector's data type, so anyone using pgvector can switch to Lantern

- Parallel index creation capabilities -- Support for creating the index outside of the database and inside another instance allows you to create an index without interrupting database workflows.

** Here’s what’s coming soon **

- Cloud-hosted version of Lantern

- Templates and guides for building applications for different industries

- Tools for generating embeddings (support for third party model API's, more local models)

- Support for version control and A/B test embeddings

- Autotuned index type that will choose appropriate index creation parameters

- 1 byte and 2 byte vector elements, and up to 8000 dimensional vectors support

** Why we started Lantern today **

There's dozens of vector databases on the market, but no enterprise option built on top of PostgreSQL. We think it's super important to build on top of PostgreSQL

- Developers know how to use PostgreSQL.

- Companies already store their data on PostgreSQL.

- Standalone vector databases have to rebuild all of what PostgreSQL has built for the past 30-years, including all of the optimizations on how to best store and access data.

We are open source and excited to have community contributors! Looking forward to hearing your feedback!

  • by bryan0 on 9/13/23, 10:56 PM

    > Switch from pgvector, get FREE AirPods Pro.

    > Book some time here, and we will help switch you over for FREE and get you a pair of FREE AirPods Pro

    This just comes off as sketchy to me. If the tech is good it will stand on its own.

  • by carlossouza on 9/13/23, 8:14 PM

    I'm using pgvector in production, mainly in a table with 500k-1M rows.

    My main use case is to return search results with pagination: page 1 from 1-50, page 2 from 51-100, page 3 from 101-150, etc. (Think LIMIT and OFFSET).

    After a lot of experimentation and help from pgvector's team, we discovered that, for this specific use case, IVFFLAT index is much faster than HNSW.

    I looked at your documentation and only saw HNSW, no IVFFLAT.

    What would be Lantern's performance for this specific use case?

    Thx!

  • by simonw on 9/13/23, 6:55 PM

    "There's three key metrics we track. CREATE INDEX time, SELECT throughput, and SELECT latency."

    There's a fourth metric that I'm really interested in: assuming it's possible, how long does it take to update the index with just one or two updated or inserted vectors?

    Is the expectation with this (and the other) tools that I'll do a full index rebuild every X minutes/hours, or do some of them support ongoing partial updates as data is inserted and updated?

    Just had a thought: maybe I could handle this case by maintaining an index of every existing vector, then tracking rows that have been created since that index itself.

    Then I could run an indexed search that returns the top X results + their distance scores, then separately do a brute-force calculation of scores just for the small number of rows that I know aren't in the index - and then combine those together.

    Would that work OK?

    Even if the index doesn't return the scores directly, if it gives me the top 20 I could re-calculate distance scores against those 20 plus the X records that have been inserted since the index was creation and return my own results based on that.

  • by ezra-varady on 9/13/23, 9:36 PM

    Hey everyone for those interested I built an updated version of the lanterndb semantic search application that should be a bit nicer. An instance is running at

    http://170.187.170.169/

    And code can be found at

    https://github.com/ezra-varady/react-semantic-search

  • by fakedang on 9/13/23, 6:40 PM

    This might be a noob question but what does Lantern have that a normal Postgres dB with pgvector does not? I think Supabase already has a Postgres as a service product with the pgvector extension too.

    Second:

    >Creating an AI application end to end without leaving your database (example: https://github.com/ezra-varady/lanterndb-semantic-image-sear...)

    What does "without leaving your database" mean in this context?

  • by ashvardanian on 9/13/23, 7:47 PM

    Epic result, and thank you for mentioning USearch! Would be happy to further optimize it for your needs!

    I also love your specialized CI! Pgvector probably doesn’t report performance changes between releases, or does it? Was it easy to implement? Do you run the whole eval on GitHub?

  • by howon92 on 9/13/23, 6:59 PM

    Congrats on the launch!!! I suggest you highlight "why lantern is better than pgvector" at the top of your page. The first thing that came to my mind after reading this was "why should I use this instead of pgvector?"
  • by mattashii on 9/13/23, 8:36 PM

    How do you do cleanup of the index during VACUUM?

    And, do you have recall-vs-qps graphs like those on https://ann-benchmarks.com/ ? Those are generally more apples-to-apples, as 100k rows isn't exactly a reputable benchmark.

  • by skeptrune on 9/21/23, 2:31 AM

    Looks like the AirPods bit was removed. Are those still on offer? :/
  • by loxias on 9/14/23, 2:52 AM

    Curious about how it scales. Plenty of solutions look good with small amounts of data, but completely fall apart past a point. Would be interesting to see the latency numbers for 1M, 10M...
  • by raoufchebri on 9/13/23, 7:37 PM

    How do you handle conflict with pgvector's hnsw if you want to install both extensions ?

    CREATE INDEX semantic_image ON image_table USING hnsw (v dist_cos_ops) WITH (M=5, ef=30, ef_construction=30, dims=512);

  • by jw903 on 9/14/23, 1:50 AM

    Impressive performance. In your experience, is there a range of vector dimension for faster search results?
  • by dalberto on 9/13/23, 9:01 PM

    Any plans to support sparse vectors?
  • by swalsh on 9/13/23, 8:50 PM

    I like how easy postgresql vector is to use, but scaling up seems to get pretty expensive when comapred to something like qdrant.
  • by justanotheratom on 9/13/23, 7:54 PM

    can I use this in Supabase?
  • by consoomer on 9/13/23, 7:35 PM

    Not going to lie.. the more I use Postgres the more I realize my entire application is Postgres. Soon you'll be doing entire CRUD endpoints and sending emails from Postgres...

    Wait, PostgREST already does...

    builds entire SaaS with Postgres