325 karma · joined Aug 5, 2018 (8y ago) · 39 submissions
prev: Lantern YC W24
Find me at hn at narekg dot me
comment 1y ago · link · parent
<https://github.com/search?q=repo%3Apostgres%2Fpostgres+%22ma...>
I agree code change is simple, but I guess the task is complex for other reasons
3.
Select 1 Touches 5,583 Lines of Postgres Source Code(narekg.me ↗)
3 points · by ngalstyan4 · 1y ago · 6 comments
5.
Debugging Hetzner: Uncovering failures with powerstat, sensors, and dmidecode(ubicloud.com ↗)
345 points · by ngalstyan4 · 1y ago · 108 comments
comment 1y ago · link · parent
I am curious how you prevent private data from getting leaked to the auto-generated public docs. I imagine this problem does not exist in open source projects, but would become an issue if not everything discussed in company's private messenger should be used as context for generating docs.
comment 2y ago · link · parent
> I don’t think “get moar ram” is a good response to that particular critique.
I do not think the blog post suggested "get more ram" as a response, but happy to clarify if you could share more details!
> Indexing in Postgres is legitimately painful
Lantern is here to make the process seamless and remove most of the pain for people building LLM/AI applications. Examples:
1. We build tools to remove the guesswork of HNSW index sizing. E.g. https://lantern.dev/blog/calculator
2. We analyze typical patterns people use when building LLM apps and suggest better practices. E.g. https://lantern.dev/blog/async-embedding-tables
3. We build alerts and triggers into our cloud database that automate the discovery of many issues via heuristics.
comment 2y ago · link · parent
But at least anecdotally, it made a ton of difference.
We met <200ms latency budget with Ubicloud NVMes but had to wait seconds to get an answer from the same query with GCP persistent disks or local SSDs
comment 2y ago · link · parent
You can generate CLIP embeddings locally on the DB server via:
SELECT abstract,
introduction,
figure1,
clip_text(abstract) AS abstract_ai,
clip_text(introduction) AS introduction_ai,
clip_image(figure1) AS figure1_ai
INTO papers_augmented
FROM papers;
Then you can search for embeddings via: SELECT abstract, introduction FROM papers_augmented ORDER BY clip_text(query) <=> abstract_ai LIMIT 10;
The approach significantly decreases search latency and results in cleaner code.
As an added bonus, EXPLAIN ANALYZE can now tell percentage of time spent in embedding generation vs search.The linked library enables embedding generation for a dozen open source models and proprietary APIs (list here: <https://lantern.dev/docs/develop/generate>, and adding new ones is really easy.
comment 2y ago · link · parent
ACIDRain: Concurrency-Related Attacks on Database-Backed Web Applications: http://www.bailis.org/papers/acidrain-sigmod2017.pdf
comment 2y ago · link · parent
Then, during hashing you just need a constant immutable state, which effectively expands the hash space, without incurring the mutable state overhead of replacement strings strategy.
comment 2y ago · link · parent
PL/Rust is a more performant and more feature-rich alternative to PL/pgSQL, which is the traditional UDF scripting language for Postgres.
Building a vector index (or any index for that matter) inside Postgres is a more involved process and can not be done via the UDF interface, be it Rust, C or PL/pgSQL.
So, I think even if Lantern was written in Rust, it would not be a Trusted Language Extension under this definition.
comment 2y ago · link · parent
You are right that there are many trade-offs between HNSW and IVFFLAT.
E.g. IVFFLAT requires there be significant amount of data in the table, before the index is created, and assumes data distribution does not change with additional inserts (since it chooses centroids during the initial creation and never updates them)
We have also generally had harder time getting high recall with IVFFLAT on vectors from embedding models such as ada-002.
There are trade-offs, some of which we will explore in later blog posts.
This post is about one thing - HNSW index creation time across two systems, at a fixed 99% recall.
comment 3y ago · link · parent
We run our ci/cd benchmarks on 128dim sift vectors. We have some demos using clip embeddings (512dim) and baai/bge 768 dimensional embeddings.
Generally, smaller vectors allow higher throughput and result in smaller indexes. But the effect on performance is small. Once we merge the PR implementing vector element casts to 1 and 2 byte floats, the effect of this on throughput should be even smaller.
comment 3y ago · link · parent
You’re correct that IVFFLAT would be faster for your use case. However, IVFFLAT’s shortcoming is bad recall, which means less relevant results for your application. We believe that our HNSW implementation (or other indexes) can handle use cases like yours.
We currently handle a similar use-case by rerunning our index searches with exponentially increasing LIMITs and dropping the results which are not needed. Could you send us an email at support@lantern.dev? We can generate the numbers by this weekend, and get back to you with concrete results.
By the way – not sure if you saw in our blog post, if you’re using pgvector in production and switch to Lantern, we’ll help you every single step of the way. It’s very quick, and we’ll also send you some free AirPods Pro at the end of it!
comment 3y ago · link · parent
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
comment 3y ago · link · parent
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.
comment 3y ago · link · parent
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" mean in this context?
You can work with embeddings with just SQL. For instance, a table of academic papers can be augmented with CLIP model embeddings produced locally. This entire process - creating, storing, and querying - happens using just SQL."
SELECT abstract,
introduction,
figure1,
clip_text(abstract) AS abstract_ai,
clip_text(introduction) AS introduction_ai,
clip_image(figure1) AS figure1_ai
INTO papers_augmented
FROM papers;
SELECT
abstract,
introduction
FROM papers_augmented
ORDER BY abstract_ai <-> clip_text("The Foundation of the General Theory of Relativity")
LIMIT 10;22.
Show HN: Lantern – a PostgreSQL vector database for building AI applications(docs.lantern.dev ↗)
196 points · by ngalstyan4 · 3y ago · 43 comments
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
I have a single configured email address on which I received my welcome email on July 15 and "Server Locking" email today.
Looking into Hetzner dashboard, it seems they did not delete my instance, just turned it off and banned my IP so I cannot ssh into it. There is an option to request unblocking which I will request soon and which wants me to answer "What caused this problem?" and "How do you plan to correct this problem and prevent for the future?".
This was a development instance: running docker, postgres, SchemaSpy, some service emulators, node, vscode and accessed the services through ssh port-forwarding.
It seems there is an "Abuse" incident linked to the blocking of my IP but I only see the incident ID, no additional details.
This was a dev instance, I did not think about making it airtight. I do not rule out that someone broke into it and violated their terms (this happens with production systems and I am definitely a worse engineer than people there). If this happened, I am happy they locked it down but I wish they informed their users in these cases: I had git ssh keys and other secrets there which I proactively revoked and more information on the incident would definitely have helped choose the right course of action.
28.
Ask HN: Hetzner banned me with no explanation. What can I do?
73 points · by ngalstyan4 · 4y ago · 46 comments