Live data from Hacker News

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

docs.lantern.dev

11–20 of 46 posts

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

#11

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);

Our index access method will be called lantern_hnsw if pgvector or any other provider has already taken the hnsw access method name.

btw, we did not create our own vector type and just use size-enforced real[] arrays to represent embeddings. However, you can use our index with pgvector's vector type. So, if you already have a table with pgvector's vector column type, you can start using Lantern by just creating an index on the same column.

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

#12

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

Postgres is love. Postgres is life.

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

#13
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?

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

#14
post #2

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?

Pgvector builds a vector index. Our extension, similarly, builds an index but also extends SQL in more ways. For example, - Generating embeddings to augment plain relational data - Using data from local proprietary embedding models or third-party model APIs in queries. We have more things planned like vector versioning, data retention policies and recall regression tracking. > What does "without leaving your database…

When you say "produced locally", do you mean on the client? If so, does this mean you require me to use some alternate PostgreSQL driver locally, parsing the SQL to add your one feature?

(If it is, this really feels like it should be a separate general purpose local extension mechanism into which random functions can be added, instead of something tied to this use case... maybe I want to add some locally-executed string parsing function, for example...)

(...but, the entire concept of having some functions be "locally" executed also feels really awkward/limited and will involve a ridiculous amount of work to make, at the end of the day, it only sort of work in some places in the query, so I bet you don't mean what I do when I say "locally", right?)

(But, like... doing it remotely--on the database server as part of the query plan--frankly seems kind of crazy to me, as it is going to be so slow and add a massive CPU load to what should be an I/O workload. Makes for good demos I bet, but otherwise unusable in a database context.)

(Regardless, the premise of seeing this as a feature kind of squicks me... like, it honestly gives me strong apprehensions about using your extension at all, as I can see--very clearly--the mission creep it is going cause as you deal with demands to drag more and more popular embedding models with lots of execution dependencies as part of the extension that has to be loaded into the server, as well as fielding distracting discussions about the performance of the embedding helpers...)

(...this frankly shouldn't be part of the same extension: it should be another extension that happens to return this extensions data type--or even potentially returns some more generic one, like an array of float, making it drop-in compatible with other extensions for vector indexing--and there should then almost certainly be separate such extensions for each major model you want to support.)

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

#16
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!

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

#17

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?

Thanks!

I don’t believe pgvector reports performance changes between releases.

At the moment, we run the benchmarking on Github CI, but we plan to move this to an external machine, since the results are unstable on Github machines. We’re planning to extend benchmarking across other repos and versions.

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

#18
post #3

"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 up…

> 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?

Here’s a chart for INSERT latency (sorry about the formatting): https://docs.lantern.dev/graphs/insert.png

At the moment, we underperform Neon wrt this metric, but a better implementation is coming soon that will address this.

> 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?

The HNSW algorithm updates the index after every insert. So all existing HNSW options (Lantern, pgvector, Neon, …) already support this.

With pgvector IVFFlat, you expect the performance to degrade over time, and you will need to re-index. This is because IVFflat’s index quality heavily depends on the centroids chosen at index creation time. HNSW does not have this limitation.

In both cases, you might want to do a full-index build to tune your hyperparameters.

We’re working on this in a few ways. One is automatic hyperparameter tuning. Another is supporting external index creation that would offload this to another server. Does this answer your question?

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

#20
post #14

Earlier quoted context omitted.

Pgvector builds a vector index. Our extension, similarly, builds an index but also extends SQL in more ways. For example, - Generating embeddings to augment plain relational data - Using data from local proprietary embedding models or third-party model APIs in queries. We have more things planned like vector versioning, data retention policies and recall regression tracking. > What does "without leaving your database…

When you say "produced locally", do you mean on the client? If so, does this mean you require me to use some alternate PostgreSQL driver locally, parsing the SQL to add your one feature? (If it is, this really feels like it should be a separate general purpose local extension mechanism into which random functions can be added, instead of something tied to this use case... maybe I want to add some locally-executed str…

>When you say "produced locally", do you mean on the client?

Sorry for the confusion. By “produced locally” I meant “produced on your DB server” as opposed to being an API call to a third party service such as OpenAI or HuggingFace.

(But, like... doing it remotely--on the database server as part of the query plan--frankly seems kind of crazy to me, as it is going to be so slow and add a massive CPU load to what should be an I/O workload. Makes for good demos I bet, but otherwise unusable in a database context.)

It seems like you’re worried about these workflows being on the Postgres server, which may lead to performance issues.

However, if performance becomes an issue, the functions can be executed on another server. In this approach, whether or not the functions run on the Postgres server, the end user gets access to a better developing experience as all the functions they need are available within SQL.

>...this frankly shouldn't be part of the same extension We agree. These functions are already in another repository, and not part of the same extension. The repository is here: https://github.com/lanterndata/lantern_extras

Post reply on HN