---
title: "Training 100x Cheaper Retrieval models Neon and Castform"
description: "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."
url: "https://swe.quest/articles/training-100x-cheaper-retrieval-models-neon-and-castform-05a64846d2e32056"
canonical: "https://neon.com/blog/how-castform-neon-beats-frontier-models-on-price-and-efficiency"
source: "Neon"
published: "2026-08-05"
difficulty: "easy"
kind: "Announcement"
reading_minutes: 5
tags: ["model-training","rag","postgres","ai-agents","search"]
---

# Training 100x Cheaper Retrieval models Neon and Castform

A post on [Neon](https://swe.quest/sources/neon.md), published 2026-08-05, 5 min read, Announcement. Original: [https://neon.com/blog/how-castform-neon-beats-frontier-models-on-price-and-efficiency](https://neon.com/blog/how-castform-neon-beats-frontier-models-on-price-and-efficiency)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Easy: no special background needed; explains what something is and why it matters

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [RAG & retrieval](https://swe.quest/tags/rag.md) (AI & ML)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [Search](https://swe.quest/tags/search.md) (Backend & APIs)

## Prerequisites

- RAG basics ([easy posts on RAG & retrieval](https://swe.quest/tags/rag.md?difficulty=easy))
- reinforcement learning fine-tuning concepts ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))

## Keywords

Neon, Castform, Lakebase Search, pgvector, BM25, reciprocal rank fusion

## Related posts

- [Bypassing inference bottlenecks: Accelerating complex AI search with Retrieve-for-Train](https://swe.quest/articles/bypassing-inference-bottlenecks-accelerating-complex-ai-search-with-retrieve-95676e43f1ce9cc3.md): Google Research · 2026-09-15 · Hard · 8 min read · Search, Model training, Inference & serving, LLMs, Recommendations & ranking
  Retrieve-for-Train replaces expensive inference-time LLM reasoning for query fan-out with a one-time offline RL stage.
- [CommSync Runs Text, Vector, and Hybrid Search on Postgres with Lakebase Search](https://swe.quest/articles/commsync-runs-text-vector-and-hybrid-search-on-postgres-with-lakebase-search-8b687b59899ef5ac.md): Neon · 2026-07-30 · Medium · 5 min read · Search, PostgreSQL, Vector search, RAG & retrieval
  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.
- [Lakebase Search: the retrieval primitive for agents on Neon](https://swe.quest/articles/lakebase-search-the-retrieval-primitive-for-agents-on-neon-08857239ea4fff67.md): Neon · 2026-09-30 · Medium · 6 min read · Vector search, PostgreSQL, Search, RAG & retrieval, AI agents
  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.
- [Neon Docs search is now built on Neon](https://swe.quest/articles/neon-docs-search-is-now-built-on-neon-6358bcc8a0cf6214.md): Neon · 2026-10-26 · Medium · 6 min read · Search, PostgreSQL, Vector search, Caching, AI agents
  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.
- [Matryoshka embeddings: faster OpenAI vector search using Adaptive Retrieval](https://swe.quest/articles/matryoshka-embeddings-faster-openai-vector-search-using-adaptive-retrieval-739d1a8595798695.md): Supabase · 2024-02-13 · Medium · 17 min read · Vector search, PostgreSQL, RAG & retrieval, Performance engineering
  OpenAI's text-embedding-3 models are trained with Matryoshka Representation Learning, so an embedding can be shortened by truncating trailing dimensions and renormalizing, which reproduces the API's \`dimensions\` output.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
