Beating GPT-5.6 Sol on retrieval with 100x cheaper open models

Aug 06, 2026 01:18 AM - 1 hour ago 1

Comparison of Castform fine-tune and frontier models by conclusion costs and mean information reward

“Most teams' champion training information is conscionable sitting successful their databases. The problem is that turning earthy information into thing usable is hard, and letting agents read, search, and mutate information cheaply astatine standard requires precocious infra. Pointing Castform astatine Neon skips both.”

Ying Hang Seah, cofounder, Castform

A "good agent" needs to beryllium beardown successful 2 areas:

  • Context: tin we supply the devices to find the correct data?
  • Model: tin the exemplary determine what to hunt for?

Neon (Lakebase Postgres) and their caller Search extensions lick the first; Castform solves the second.

In ~2022, the manufacture was going each successful connected embedding search. Every database supplier added one, and pgvector was Neon's astir downloaded extension. To supply discourse to LLMs, engineers handcrafted RAG pipelines, which successful essence, is immoderate shape of embedding similarity search.

In ~2025, agents started to summation much traction. Developers started creating multi-hop hunt workflows, decomposing large problems into smaller ones. Retrieval has shifted from the one-shot hunt systems to agentic retrieval. Instead of issuing a azygous query, models scheme and hunt aggregate times successful a loop. Every loop loop meant different telephone to the frontier model, expanding the wide costs and latency per personification request.

Comparison of a accepted RAG pipeline and an agentic hunt workflow

Concretely, a emblematic multi-turn hunt petition pinch gpt-5.6-sol takes >10s and costs ~$0.03 end-to-end, making it prohibitively slow and expensive.

Meanwhile, mini open-weights models are 100x cheaper. But, retired of the box, their capabilities lag down closed api models. RL post-training helps span this gap. On circumstantial tasks for illustration search, post-trained open-source models tin lucifer & hit frontier models while costing orders of magnitude little per request.

That is why we built Castform: to alteration developers to RL post-train models without having to woody pinch instrumentality learning & gpu internals. The goal's to make post-training arsenic approachable arsenic punctual engineering.

How does Castform usage Neon?

Castform's pipeline runs against Neon via Lakebase Search:

StageNeon + Lakebase Search
Corpus storageRaw documents unrecorded successful Postgres connected Neon
Synthetic information generationCastform training pipeline uses lakebase_text and lakebase_vector to constitute training tasks
RL TrainingEvery rollout's hunt instrumentality telephone uses Lakebase Search connected Neon
Production InferenceThe last exemplary uses the aforesaid hunt instrumentality telephone during inference

To execute RL post-training effectively, you request a task (e.g. reply a user's question), the situation for the supplier to tally successful (e.g. a hunt instrumentality for your corpus) and a reward usability (e.g. is the reply correct?).

With each 3 pieces successful place, the RL post-training is simply a loop of proceedings and error: the exemplary attempts the task fixed the tools, the reward usability scores the attempt, and the feedback awesome guides the exemplary connected really to hill-climb its measurement to optimal performance.

Yet, astir companies do not person a cleanable dataset of tasks and reward functions fresh for post-training.

Enterprises do person a ample group of proprietary data:

  • internal documentation
  • product records
  • support articles
  • customer interactions
  • wikis
  • operational databases

This information contains the knowledge an supplier needs, but turning it into an effective training dataset usually requires important information engineering and manual labeling.

That leads galore teams to disregard post-training for 1 of 2 reasons:

  • "We don't person the training data."
  • "Fine-tuning is excessively difficult and requires infrastructure we don't have."

Castform addresses both. It turns an existing corpus into training tasks, past manages the RL loop needed to thatch an open-source exemplary really to usage that information effectively.

Using Castform

With Castform, you tin move your institution knowledge guidelines into a model:

  • Document (from your data): Trains booked done Navan will beryllium paid by GitLab recreation card. Train rides must beryllium modular compartment people pinch 14 time booking lead time
  • Ground truth (inferred from your data): Train rides must beryllium modular compartment people pinch a 14 time booking lead time.
  • Question (synthetically generated): When booking a obstruction travel successful Navan, what are the rules for really early I request to reserve it and which seating level I'm expected to choose?

With the generated question-answer dataset, Castform lets you scaffold the training tally by specifying the devices the supplier has entree to and a reward function.

The reward usability specifies what you want your exemplary to get bully at. In our case, we want it to retrieve the correct chunks, mention the correct sources on pinch providing the correct last answer.

def run_tool(tool, tool_args): """Single tool: hybrid hunt complete Lakebase.""" if instrumentality == "search": query = tool_args["query"] bm25 = neon.lakebase_text(query, k) vector = neon.lakebase_vector(query, k) return rrf_merge(bm25, vector, k) def reward(trace, ground_truth): """Grade a trace against the ground-truth answer.""" reply = parse_trace(trace) retrieval = ... # did it retrieve the correct source citation = ... # did it mention the correct chunk correctness = ... # did it onshore connected the correct answer return retrieval + citation + correctness

See a broad codification illustration here.

Castform gives you afloat observability into your RL run. You tin show your reward climb pinch each step, but much importantly you tin driblet into individual tasks/prompts to watch really the exemplary performs qualitatively, allowing you to debug problems specified arsenic surgery devices aliases reward hacking.

For much specifications connected really to show your training runs, you tin cheque retired the Castform blog here. You tin besides cheque retired our example training tally here.

Average reward complete training stepsAverage reward

Why Neon 'just works'

During training, the supplier many times calls Lakebase Search until it has capable discourse to answer. Across thousands of parallel rollouts, each perchance making dozens of calls, this creates a highly bursty workload.

Neon CPU allocation and usage during a Castform training run

Neon's move compute scaling absorbs these peaks without requiring Castform to proviso for maximum capacity astir the clock. Training runs get low-latency hunt erstwhile request spikes, while compute scales down during idle periods.

This infrastructure becomes moreover much valuable arsenic agents move beyond hunt and statesman modifying data. Training stateful agents requires isolated environments that tin beryllium created and reset cheaply, preventing 1 rollout's actions from affecting different aliases rubbing production.

Neon branching tin springiness each rollout an isolated database state, while time-travel queries make it imaginable to reconstruct and inspect the authorities an supplier encountered. Combined pinch autoscaling and scale-to-zero, this creates a way toward training thousands of stateful supplier rollouts without maintaining thousands of continuously moving environments.

Castform makes it easy for immoderate developer to post-train open-source models to beryllium cheaper, faster, amended than the frontier. Post-train your first exemplary coming astatine castform.com.

More