Overview
Hive started as an 8-hour hackathon project in San Francisco—a research system that answers natural-language database questions by decomposing work into specialized cheap LLM agents with objective verifiers, compared head-to-head against a single frontier model on cost, tokens, and output quality. On a benchmark run, the brain lane produced a full analytics dashboard at roughly 12% of the baseline's token cost. Given the same Postgres database and the same question, Hive runs two lanes in parallel: a brain lane (planner → SQL → insight → dashboard plan → code generation, with capped retry/escalation loops) and a baseline lane (one strong model doing the whole task via tool-calling SQL). Both lanes produce a self-contained HTML dashboard served locally, and a shared ledger records real prompt/completion tokens and USD cost per lane.
Why I Built It
While doing data analytics at Zipline, I kept running the same kinds of natural-language-to-SQL-and-dashboard workflows through large frontier models—and kept watching the token bill climb for work that felt structurally simple. A question about orders, wait times, or fleet capacity shouldn't cost that many tokens. Rising token cost is a massive issue across the industry: as teams bolt LLMs onto every workflow, spend scales faster than the value they get back.
Hive is my attempt to prove a different shape for that work—orchestrating highly context-engineered micro language models, each scoped to a narrow sub-task with tight prompts and objective verifiers, to achieve the same quality result without paying frontier-model prices upfront.
Thesis
A natural-language data question does not require one expensive frontier model if you decompose it into narrowly scoped sub-tasks, run each on the cheapest plausible model, and gate every step with deterministic verifiers—escalating only on verified failure. The system is fully domain-agnostic: schema is introspected at runtime from Postgres with no hardcoded table or column names. A semantic SQL cache (pgvector + embeddings) reuses or adapts prior queries on near-duplicate questions, driving marginal SQL cost toward zero on warm runs.
Solution
Objective verifiers—pure compute, not LLM judges—check SQL execution, anti-hallucination in insights, chart-spec column validity, and dashboard renderability before any escalation occurs. Every retry loop is capped at 2 cheap attempts plus 1 escalation, then stop. The planner decomposes questions into a DAG of sub-questions with dependency ordering, and a comparison host shows both dashboards side-by-side with live savings counters computed from the ledger.
Key Features:
- Dual-lane comparison architecture — brain swarm vs. single frontier baseline on the same question
- Verifier-gated cheap-first pipeline with capped escalation loops
- Semantic SQL cache with embedding-keyed reuse and adaptation
- Shared cost ledger tagging every model call by lane with real USD pricing
- Bee-themed React UI streaming run progress over SSE with per-agent cost tracking
- Self-contained dashboard generation validated by a render verifier (Chart.js, canvas, tables)
Technical Architecture
Built as a TypeScript/Node orchestrator with a Hono API server, InsForge Postgres for data and pgvector caching, and OpenRouter for all model calls through a single shared client. The demo ships with the Brazilian Olist e-commerce dataset imported into Postgres.
Backend & Orchestration:
- TypeScript orchestrator with specialized sub-agents (planner, SQL, insight, dashboard)
- Runtime schema introspection — works on any Postgres database
- OpenRouter model routing with roles defined in a single config file
- Empirical test harness with script-driven checkpoints asserting both dashboards render
Frontend:
- React 18 + Vite comparison UI with live SSE progress streaming
- In-app thesis reader and workspace visualizing brain agents as bees vs. solo baseline
- Side-by-side dashboard host with real efficiency gains from the cost ledger
Results & Impact
Hive provides an empirical apparatus for testing whether verifier-gated agent swarms can match frontier-model output quality at a fraction of the cost. In the demo above, the brain lane generated a comparable dashboard using ~12% of the tokens consumed by the single-model baseline. The comparison harness runs both lanes concurrently and computes savings as a percentage of baseline spend. On cache-friendly questions, the semantic SQL cache can skip generation entirely, and the test suite asserts positive savings on benchmark runs. The project demonstrates a concrete architecture for cheap-first LLM systems where escalation is earned through verified failure, not assumed upfront.