Mubit + Neon AI Gateway: an agent that cuts its own frontier-model tokens by 73%
Mubit, a proxy placed in front of Neon AI Gateway, records an agent's model calls, groups recurring calls into tasks, and fine-tunes a small open-weight model once a task has at least 25 good replies. The tuned model must pass a held-out exam, then moves through shadow, canary and promotion stages, and is demoted if sampled quality drops. It also stores verified lessons tied to schema versions. On 20 CL-bench questions run against a Postgres analyst agent, gpt-5.5 input tokens fell 73% (21.7k to 5.9k per question) and latency fell 40% with roughly equal accuracy. SQL generation stayed on the frontier model because the small model matched only 8-10% of the time, and lessons doubled correct runs after a schema change. The template runs on Neon Functions with an outbox-style lesson queue and uses Neon branches to test before and after a migration.
Related posts
- Open-weight models are fast on Neon AI Gateway. Here's why
Neon mediumAdept
Neon AI Gateway serves open-weight models through Databricks Foundation Model APIs, so it gets that stack's inference optimizations: continuous batching with PagedAttention-style KV-cache paging and overlapped prefill/decode, a TensorRT-LLM backend with fused and GroupGEMM kernels for MoE, tensor parallelism, FP8 quantization, and per-GPU tuning. Prompt caching matters most for agent loops that resend a stable system prompt and tool schema. On gpt-oss in a production batch pipeline it raised per-replica input-token throughput 2.5× and cut P50 latency 3× at a ~30% hit rate. FP8 on H100 gave about 2.2× throughput over FP16. To benefit, keep prompt prefixes stable and point an OpenAI-compatible SDK at the gateway.
- How Shopify turns open models into task experts
Shopify Engineering hardMasterShopify's Sidekick keeps a frontier model for merchant conversation and planning but offloads token-heavy subagent work, such as GraphQL query generation, to open models it post-trains and self-hosts. Each model is built through a loop: a rubric and an LLM judge tuned with GEPA/ACE to match human agreement, an optimized frontier agent as the baseline, open-model selection, early inference benchmarking with AIPerf, nightly self-healing that converts failed conversations into training data via critic hints, and post-training with Megatron Bridge. For GraphQL, Nemotron 3.5 Lightning went from 37.7 to 74.5 on the judge after six loops and about 61,000 healed examples, beating the frontier model's 73. It also cut median latency from 6.50s to 0.87s and serving cost by about 90%, and Blackwell GPUs made both training and serving cheaper.
- Neon for Agent Platforms: A Companion Skill for the AI Agent Program
Neon mediumAdept
neon-for-agent-platforms is an open-source companion Agent Skill and set of TypeScript scripts for running fleets of Neon Postgres databases on agent platforms. It covers a dual-org model that separates sponsored free-tier and paid customers, with one project per tenant transferred to the paid org on upgrade. It also covers copy-on-write dev and preview branches with shorter suspend timeouts to keep costs predictable, branch-based compound checkpoints, and the consumption API for per-customer cost attribution. Both skills install via npx, and the scripts can also be run directly against a Neon API key and org ID.
- Sidekick's continual learning loop
Shopify Engineering hardMasterShopify's Sidekick GraphQL agent improves daily through a continual learning loop that turns production failures into model weight updates, beating frontier-model quality while cutting estimated serving costs from about $27M to $1M per year (96%). The loop starts with a rubric validated by inter-annotator agreement (Cohen's kappa) and an LLM judge calibrated with DSPy using GEPA and ACE, then backtested against past A/B tests and degradation tests. An autoresearch agent tunes prompts, tools and harness code against the judge. Hard negatives from production are then repaired by a panel of frontier critics via hinting and replay, and the repaired trajectories train a smaller model through chain-of-thought SFT followed by GRPO with the judge as reward. Gist-token compression shrinks the ~6,000-token system prompt to ~1,500 tokens, cutting end-to-end latency about 38% and GPU needs about 14%.
- 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.