mnemiq is an open-source text-to-SQL engine developed by Agentic Fabriq (YC W26) under the Apache-2.0 license. Its core design goal is to let users tune and measure natural-language-to-SQL accuracy against their own database, rather than relying on numbers obtained from general benchmarks.
Purpose
mnemiq is used to answer natural language questions against a database. It supports Postgres, Oracle, Snowflake, Databricks, DuckDB, and SQLite. Unlike many text-to-SQL products, mnemiq emphasizes evaluation and tuning on the user's own database, because a system may perform well on a benchmark but perform poorly in a real data warehouse due to a larger schema, different naming, business definitions that exist only in people's heads, or mismatched configuration. mnemiq exposes the main parts of the pipeline as readable, modifiable, and measurable settings, rather than hiding them as internal implementation.
Main capabilities
-
Deterministic validation: mnemiq separates writing SQL from deciding to run SQL. After the model proposes a query, a deterministic layer adjudicates it before any operation touches the database. The query must be read-only, may only reference objects the caller has permission to view, must compile in the source database's own SQL dialect, and must pass EXPLAIN. If any of these fail, a rejection with a clear reason is returned, rather than a plausible-looking number.
-
Permissions up front: permissions are applied before schema retrieval, so the model never sees tables the caller does not have permission to view—naming them is useless rather than being rejected. Every answer carries tracing information: the requested SQL, the tables involved, and the augmented version behind it. If row or column policies rewrite the SQL, the answer states which tables it narrowed, while the statement actually executed (which may name the policy's own tables) is kept in the audit trail.
-
Configurable pipeline: mnemiq puts the parts that are usually hard to reach into the user's hands, including: which model writes SQL (hosted or local, one or more candidates); how much schema context to retrieve and how to rank it; how many semantic augmentations to build and whether they are human-certified; how aggressive the system's rejections are (the validator and its thresholds); and what the decider enforces, including row and column policies applied to the query tree rather than requiring the model to do so. Every setting has a cost, so they are adjustable knobs rather than defaults.
-
Layered semantic layer: when askingPreviously, mnemiq could inspect a database and build context around the schema. Tier 0 contains only tables and columns; Tier 1 adds structural information such as primary keys, foreign keys, profiling, and value distributions; Tier 2 adds LLM-proposed meanings, such as table and column descriptions, granularity, glossaries, and encoded value meanings. For production use, definitions can be reviewed and certified by designated owners, and the operator's dictionary overrides everything the model proposes. Encoded values either have evidence or are left blank, never guessed.
-
Evaluation tooling: The evaluation tooling is part of the engine, not a separate research project. It runs a question set against a configuration, scores based on the data returned rather than SQL string matching, and reports correct, refused, and wrong as three separate numbers, because a system can trade accuracy for answering less often, and a single number would hide that.
-
Grader independence: The grading itself lives in beacon, a separate Apache-2.0 repository containing the grader that decides what counts as correct and the tracker that stores all run results. Keeping the grader out of the engine is deliberate—a system should not grade its own homework, and the same grader scores mnemiq, Snowflake Cortex Analyst, and Databricks Genie in comparisons.
How to use
mnemiq can run on a clean clone without its own database and Docker. The seed step writes a small SQLite database under demo/ along with its source manifest and access policy. The first run of uv sync pulls about 230 MB of dependencies (mainly DuckDB, PyArrow, and the OpenAI client); subsequent checkouts are almost instantaneous because uv caches wheels globally.
mnemiq enrich is the only slower step: it profiles every column and does one LLM pass over the schema, taking about 30 seconds for the demo's four tables and proportionally longer for your own data. Results are cached, so you pay once per schema, not once per question.
Access is fail-closed. A role is required—pass --roles analyst, or export MNEMIQ_ROLES=analyst along with other settings. Without a role, the engine grants no permissions and defers, which is the correct behavior and also where people first mistake it for a bug. No policy, no authorization, no snapshot—no data.
Any OpenAI-compatible /v1 endpoints all work. mnemiq communicates with MNEMIQ_LLM_BASE_URL through standard OpenAI clients, so vLLM, Ollama, llama.cpp's server, LM Studio, vendor gateways, and hosted APIs all work—set the base URL, key (any non-empty string for local servers that ignore it), and model name. The engine does not assume a hosting provider, which is what "running within your own boundary" actually means: point it at a local server, and as long as every configured endpoint is verified to stay within the network, no schema, question, or guild leaves. Embeddings follow the same setup, or are configured separately via MNEMIQ_EMBED_*.
The server's context window needs to be adjusted according to the schema: some servers silently truncate long prompts. On a 1,500-column schema, the generator's prompt is about 21,000 tokens. vLLM rejects prompts exceeding --max-model-len and reports an error. Ollama does not: it keeps part of the prompt and still answers. mnemiq reads the token count reported by the server. When it looks wrong, mnemiq resends the prompt with a small amount of padding; if the count does not grow at all, it means the server maintains a fixed window, and mnemiq returns a failed answer indicating truncation, rather than a fragment-based answer.
Setting MNEMIQ_LOCAL_ONLY=1 can make verification the job of the mnemiq command rather than the user's job: if the chat, embedding, judging, or any Verity endpoint is not an IP literal within loopback, an RFC1918 range, or its IPv6 equivalent, it refuses to run. localhost and localhost.localdomain are trusted by name, and all other DNS names are rejected. MNEMIQ_PG_DSN and MNEMIQ_CONTROL_DSN are deliberately not checked.
Under MNEMIQ_LOCAL_ONLY, mnemiq never downloads DuckDB extensions, so the extensions it loads need to be pre-seeded: the stored vss and fts, and postgres or sqlite for each source type. Every command that touches a source, storage, or endpoint loads them at startup and refuses before doing anything else, naming each missing extension.
Local servers sample unless told otherwise. vLLM requests with unspecified temperature use the model's own default. Therefore mnemiq sends temperature 0 for the two calls that decide what to show the user: the judge that judges whether the result answers the question, and the selector that chooses among deep-mode candidates. This makes their rulings more consistent, but it is not a guarantee.
When to use it
mnemiq is suitable for teams that need natural language queries on their own databases and want to control, measure, and tune the entire pipeline. It is especially suitable for the following scenarios: the data warehouse schema is large or uniquely named, and general benchmarks cannot reflect actual performance; business definitions are scattered in individuals' heads and require a certified semantic layer; there are strict requirements for permissions and auditing, and it is necessary to ensure that the model does not see data it is not authorized to access; and you want to run in your own environment, using local models, to ensure that data does not leave the network.
Limitations
mnemiq does not provide accuracy numbers applicable to a user's database until the user runs it on their own database. It is an engine and evaluation tool for making that measurement. The mnemiq enrich step is slow and requires a one-time payment per schema. Context window management requires the user to adjust the server configuration according to schema size, and some servers (such as Ollama) may silently truncate prompts. MNEMIQ_LOCAL_ONLY mode requires pre-seeding DuckDB extensions and does not check DSN configuration. Local server sampling behavior may affect consistency, although mnemiq uses temperature 0 for critical calls.