Lakebase Search: the retrieval primitive for agents on Neon
Lakebase Search adds vector and BM25 search to Lakebase Postgres through two extensions, lakebase_vector and lakebase_text, so agents can query operational data without a separate search system. lakebase_vector keeps its durable index in object storage, caches hot pages in NVMe and RAM, and combines hierarchical IVF with RaBitQ quantization. That design lets compute scale to zero and reconnect without rebuilding the index, and it stays compatible with pgvector types, operators and query syntax. lakebase_text adds a BM25 index over standard tsvector with top-K pushdown, and TypeScript Neon Functions, Object Storage triggers and AI Gateway embeddings round out an ingest-to-hybrid-search pipeline that agents can call in a search-evaluate-retry loop.
Related posts
- Lakebase Search: vector and BM25 on Neon
Neon mediumAdept
Neon's Lakebase Search adds two Postgres extensions, lakebase_vector (IVF partitioning plus RaBitQ quantization, pgvector-compatible) and lakebase_text (a BM25-native index with Block-Max WAND top-K pushdown), designed for Neon's separated compute and object-storage tiers. HNSW's dependent random reads serialize into tens-of-millisecond round trips on object storage, so the new indexes map clusters and postings to contiguous blocks fetched in parallel. RaBitQ's ~32x compression fits a 100M-vector index in under 10GB versus ~300GB for HNSW, with builds 50–100x faster, and indexes persist on object storage so scale-to-zero and copy-on-write branching work without rebuilds. Hybrid search runs as plain SQL in one transaction, and lakebase_ann_prewarm() is available to avoid cold-cache latency.
- Neon Docs search is now built on Neon
Neon mediumAdept
Neon's docs search now runs entirely on its own stack: Lakebase Postgres with the lakebase_vector (pgvector-compatible ANN) and lakebase_text (BM25) extensions, a Hono API on Neon Functions, and Neon AI Gateway for embeddings and reranking. Pages are ingested as markdown via a GitHub Action, chunked by heading, embedded and stored with tsvectors in one table. To fit search-as-you-type latency budgets, full hybrid results (ANN plus BM25 merged with reciprocal rank fusion, then an LLM rerank) are precomputed for common queries and cached, while unseen queries fall back to BM25 only. Cache hits take 1.9 ms and BM25 misses 8.6 ms at p50 on the server, and top-5 hit rate rose from 80% to 94% on 171 real queries.
- CommSync Runs Text, Vector, and Hybrid Search on Postgres with Lakebase Search
Neon mediumAdept
CommSync, a unified SMS/email inbox, runs keyword, semantic and hybrid search entirely in Postgres using Neon's Lakebase Search extensions. lakebase_text provides BM25 search with top-K pushdown over tsvector, and lakebase_vector is a pgvector-compatible drop-in with an ANN index. Warm inbox search went from about 19.5s with cold-start GIN to about 18.6ms. The cmd+k palette fuses lexical and semantic results with weighted RRF (k=60, lexical 1.0, semantic 0.8) in two tiers: a 110ms lexical pass per keystroke and a debounced 420ms hybrid pass. Agent RAG uses exact nearest-neighbor on small per-org knowledge bases, with tenancy and permissions expressed as plain WHERE clauses.
- Training 100x Cheaper Retrieval models Neon and Castform
Neon easyNovice
Castform uses data stored in Neon Postgres, exposed through Lakebase Search's BM25 and vector functions, to RL post-train a 4B open-source model for agentic retrieval. The post claims the model matches GPT-5.6 Sol's accuracy at about 100x lower cost; a frontier multi-turn search request takes over 10s and costs around $0.03. The pipeline generates synthetic question/answer tasks from the existing corpus. Training uses a hybrid search tool with RRF merging and a reward function that scores retrieval, citation and answer correctness. Neon's autoscaling absorbs the bursty search load from parallel rollouts, and branching is positioned as a way to give stateful agents isolated environments.
- Building a RAG application with Llama 3.1 and pgvector
Neon mediumAdept
A small RAG pipeline built on Neon Postgres with pgvector as the vector store, OctoAI's gte-large embedding model producing 1024-dimensional vectors, and Llama 3.1 405B generating answers. The walkthrough enables the vector extension, creates a table with a VECTOR(1024) column, and embeds and inserts a CSV of fake quotes from Python via psycopg2. At query time it embeds the user input, retrieves the two nearest quotes with a cosine-distance ORDER BY ... LIMIT 2 query, and injects them into the system prompt. Embedding dimension directly drives storage cost, e.g. 1024 for gte-large versus up to 3072 for OpenAI's model.