Naked LLMs on Raw DDL Score 10.6% on Real Databases
When you give an LLM pure CREATE TABLE statements, its SQL syntax is fluent, but its business answers are catastrophic.
SELECT SUM(amount_cents) AS total_revenue
FROM payments
JOIN invoices ON payments.invoice_id = invoices.id
WHERE invoices.org_id = 42;
-- Returns: 199,800
199,800 instead of $1,998.00.
payments contains soft-deleted and failed transactions (deleted_at IS NOT NULL). The raw LLM counted them.
payments and invoices share the column name amount_cents. On Postgres, unqualified references abort execution.
Zero-Config Heuristic Compilation & Grounding
Schemap compiles the database into an active semantic graph in 0.12 ms, resolving multi-hop join trees and mandatory invariants.
FROM invoices
JOIN payments ON invoices.id = payments.invoice_id
The Corrected SQL: Exact Dataset Truth
When fed Schemap's grounding contract, the exact same LLM generates 100% correct, multi-tenant scoped, soft-delete safe SQL.
SELECT
SUM(payments.amount_cents) / 100.0 AS total_revenue
FROM invoices
JOIN payments ON invoices.id = payments.invoice_id
WHERE invoices.org_id = 42
AND payments.deleted_at IS NULL
AND payments.status = 'succeeded';
Pre-Execution Circuit Breaker: 100% Mutations Blocked
If an agent is jailbroken or maliciously prompted to delete production data, Schemap's AST validator intercepts it before database execution.
DELETE FROM users
WHERE status = 'suspended';
DELETE payload directly to Postgres, destroying customer records permanently.
[CIRCUIT BREAKER TRIGGERED: EXECUTION ABORTED]
Violations:
- Policy Violation: Mutation 'Delete' is forbidden in read/analytics scope.
- Security Policy: Statement contains destructive table mutation.
Action: Execution blocked before touching database.
Status: 0 rows modified. Production database intact.
WITH x AS (DELETE ...)) and multi-statement comment piggybacking.
8.5× Higher Analytical Success Across 500 Evaluations
Reproducible empirical proof tested across 500 parameterized tasks and live frontier LLMs in-the-loop.
Postgres → AI API. Automatically.
Give AI agents a deterministic, governed interface to your production database.
No YAML required to get started.
uvx schemap-tool ground "Your Question"