Skip to content

From SQL into a model

New knowledge insert (SQL → LLM) turns the rows of a query into facts a model can recall. A fact is a triple: entity — relation — value. Acme — headquarters — Zagreb.

1. SQL query

Pick the connection and database, write the query, Run query. The result is shown so you can confirm you selected what you meant to.

If the result is truncated, NabuSQL says so — only the fetched rows are inserted.

2. Mapping

Tell the wizard which column is which:

FieldMeaning
Entity (column)The column holding the subject, e.g. company name
RelationEither a fixed value for every row (e.g. headquarters) or taken from a column
Value (column)The column holding the fact itself

A preview of the first rows shows the triples that will be produced.

3. Write mode

This is the decision that matters.

Facts are stored alongside the model and retrieved when queried. Recall is 100% accurate, and the model's existing knowledge is not altered. The trade-off: it works inside NabuSQL, because the retrieval is done by NabuSQL.

This is the right choice for essentially every real use.

Write into weights (COMPOSE) — experimental

Facts are written into the model's own parameters, with an ALPHA setting controlling write strength.

Interference is a property of the technique, not a bug

Writing several facts that share the same relation causes them to interfere with each other. Some will not be recalled, and the model's pre-existing knowledge can degrade. NabuSQL warns about this when you select the mode with more than a few rows.

For anything beyond a handful of facts, use Reliable recall (KNN).

Also set the patch name and confirm the model.

4. Insert and verify

The insert runs, then Verify checks each fact by asking the model and classifying the answer:

ResultMeaning
recalledThe model returns the fact
weak (top-3)The fact is in the top three answers, not first
not recalledThe model does not produce it

With COMPOSE, Retry failed with higher ALPHA re-attempts the facts that did not stick. Verification exists precisely because COMPOSE has no guarantee — with KNN, recall is exact.

Sending a result straight from the grid

The data grid right-click menu has Send to LLM as knowledge, which opens the wizard with that result already loaded.

A realistic use

A product catalogue in MySQL, and a local model that should answer questions about it:

  1. SELECT name, category FROM products in step 1.
  2. Entity = name, relation = fixed category, value = category in step 2.
  3. Reliable recall (KNN) in step 3.
  4. Insert and verify.

Then query it from the LQL console, or export the patch as a Knowledge Card for LM Studio.