Cognitive Kernel
What it is
Section titled “What it is”The Cognitive Kernel is a small language model that runs inside the database process. Its job is to turn an intent — “show me the sales trend in Karnataka for the last three years” — into a query the engine runs, then write a plain-English answer over the result. Because it runs in-process, your schema and rows don’t leave the database to answer a question.
Every response is structured: the narrative answer, the raw data behind it, and a logic trace explaining the steps taken — so a reviewer can audit any answer rather than trust the model blindly.
flowchart LR classDef u fill:#1f2640,stroke:#9ca3af,color:#e8eaf0 classDef k fill:#1f2640,stroke:#7c5cff,color:#e8eaf0 classDef e fill:#1f2640,stroke:#00d4ff,color:#e8eaf0 classDef o fill:#1f2640,stroke:#4ade80,color:#4ade80 USR[Natural-language intent]:::u BRAIN[In-process model]:::k PLAN[Query over your tables]:::k ENG[Engine executes]:::e MMC[Structured answer<br/>narrative + data + trace]:::o USR --> BRAIN --> PLAN --> ENG --> BRAIN --> MMC
Why it matters
Section titled “Why it matters”Natural-language querying usually means shipping your schema and rows to an external model API — a data-egress and trust problem. The Cognitive Kernel runs the model inside the database process, so questions are answered without your data ever leaving, and every answer comes with the query it ran and a step-by-step logic trace you can audit.
- Data never leaves — the model runs in-process; there’s no external LLM endpoint receiving your rows.
- Auditable, not a black box — each answer ships the narrative, the raw data, and the reasoning steps, so a reviewer can check the work.
- Grounded in your schema — questions resolve to real queries over real tables, not a guess.
How you use it
Section titled “How you use it”The ask built-in is the SQL surface for natural-language queries. It returns a
table with three columns — narrative, data, and trace.
-- Ask a question in plain English.SELECT narrative, traceFROM ask('What were the top 5 SKUs by revenue in Karnataka last quarter?');Plain SQL still works too — semantic similarity over text is available as a function:
SELECT id, description, semantic_similarity(description, 'durable hiking shoes') AS simFROM productsORDER BY sim DESCLIMIT 10;For deliberately broad, exploratory questions you can opt into a larger external model that sees only anonymized aggregates — never raw rows:
SELECT *FROM ask( 'Compare our regional revenue trends to industry benchmarks and suggest where to invest.', use_bridge => TRUE);Key concepts
Section titled “Key concepts”| Concept | What it means |
|---|---|
ask(...) | The SQL surface for natural-language queries; returns narrative, data, and trace. |
| Logic trace | The auditable chain of steps taken to produce the answer, queryable as a column. |
| External bridge | An opt-in escalation to a larger model that receives only anonymized aggregates. |