Skip to content

Which AI Technique Solves My Problem?

Updated October 25, 2026Tested on SynapCores 2.3.2

The questionWhich AI technique solves my problem?

Short answer

Pick by the job. Use an LLM to write or explain text. Use vector search to find content about the same topic. Use an NLI (natural language inference) model to check whether a passage supports or contradicts a claim. Use a traditional ML model to predict a number or category from labelled history. Use a graph to follow relationships, and plain SQL for exact rules. Most real systems chain them. The common mistake is asking one technique to do another's job, such as treating high similarity as proof.

The situation: you have a job for "AI": remember a customer, answer from your help articles, flag risky transactions, check that an answer matches the policy. The default today is to prompt an LLM for all of it. Sometimes that's right. Often a smaller, cheaper tool does the job better and gives the same answer every time.

We build SynapCores. The guidance here applies whichever stack you use. Already know your problem? Jump to the twelve guides.

Pick by the job: the decision table

You need to… Use Why it fits Watch out for
Write, summarise or explain an answer LLM Flexible language generation Makes things up; output varies run to run; cost per call
Find content about the same topic Vector search Embedding similarity captures meaning, not keywords Similar ≠ correct. A contradiction can be very similar
Check whether a passage supports a claim NLI Labels entailment / contradiction / neutral for a pair of texts Judges only the passage given; weak on numbers, dates, scope; unrelated pairs can score as "contradiction"
Predict a number or category Traditional ML Learns from labelled history; cheap, repeatable Needs representative labels; drifts; needs monitoring
Enforce exact conditions SQL / rules Deterministic, auditable Someone has to write the logic
Follow relationships (who is linked to whom) Graph Multi-hop paths are natural to express Modelling effort

Find your problem

Each guide starts from the problem and explains the technique inside it. Guides that aren't published yet are marked Coming soon.

Find things (vector search, plus SQL filters and graph)

Write and answer (LLM, grounded in your data)

  • How to ask your database questions in plain EnglishComing soon
  • How to build a support chatbot that only answers from your help articles (with sources)Coming soon

Remember (agent memory: vectors to recall, NLI to check each write)

Check claims (NLI, with a similarity floor and exact rules)

Predict and flag (traditional ML in the database)

New to the category? What Is an AI-Native Database? explains why these can run in one engine.

Four questions to ask

  1. Is the output free text? Then an LLM is probably in the loop. Decide what checks its output.
  2. Is the output a fixed label or a number, and do you have labelled history? Train a classifier or regressor. It will be cheaper and more consistent than prompting an LLM.
  3. Do you need to find things, or to judge things? Finding is retrieval (vectors, keywords, SQL filters). Judging whether a claim holds against a source is NLI, an LLM judge or a human.
  4. Can it be written as a rule? "Refund amount ≤ order total" is SQL, not AI. Use AI for what you can't write as a rule.

How they fit together

text
 question
    │
    ▼
 SQL filters + access control ── tenant, product, date, permissions
    │
    ▼
 retrieval ── vector similarity (+ keyword, + graph)      "what's on topic?"
    │
    ▼
 LLM ── drafts an answer from the retrieved passages        "write it"
    │
    ▼
 NLI ── each sentence vs its on-topic passages             "is it supported?"
    │
    ▼
 SQL / rules ── exact checks on numbers, dates, limits      "is it allowed?"
    │
    ▼
 ship / review / block, logged

A classifier usually sits beside this pipeline rather than in it: scoring churn risk, routing tickets, or flagging anomalous transactions that a person or an agent then explains.

Same text, four different signals

Here's what the techniques actually return on the same pairs of sentences. The numbers come from our recipes, run on SynapCores 2.3.1 and re-run on 2.3.2-ce (same values), with the default 384-dim embedding model and the nli-default NLI model (DeBERTa-v3-small).

Evidence passage Claim Similarity NLI says Reality
"Annual plans can be refunded in full within 30 days of purchase." "You can get a full refund on an annual plan within 30 days of buying it." 0.903 entailment 0.998 Supported ✔
"After 30 days, annual plans are refunded pro rata for the unused full months." "After that, annual plans cannot be refunded at all." 0.561 contradiction 0.999 Contradicted ✔
"Refunds are issued to the original payment method within 5 to 10 business days." "Refunds arrive within 24 hours." 0.779 entailment 0.930 Wrong claim; NLI missed it ✘
"The customer's office is in Denver." "The customer is learning to play the cello." 0.235 contradiction 0.997 Unrelated; NLI false alarm ✘

Sources: rows 1–3 from recipe 037 (Step 3), row 4 from recipe 036 (Step 3), both observed on 2.3.1 and re-run on 2.3.2-ce with the same values.

What this shows:

  • Similarity tells you topic, not truth. The contradiction in row 2 still scores 0.561. The wrong timeline in row 3 scores 0.779, higher than the contradiction.
  • NLI tells you support, within limits. It nails rows 1 and 2. It misses the number mismatch in row 3, and it calls two unrelated sentences a contradiction in row 4.
  • They fix each other's weak spots, partly. A similarity floor removes row 4 before NLI sees it. Row 3 needs neither: it needs an exact comparison of the numbers, in SQL or code.

How to Check If an AI Answer Is Actually Backed by Your Documents walks through these failures in detail.

A fair comparison

LLM Vector search NLI model Traditional ML
Output Free text Ranked items + scores entailment / contradiction / neutral scores Label or number
Same input, same output? Not guaranteed Yes Yes Yes
Needs labelled training data from you No No No (pre-trained) Yes
Typical model size Billions of parameters Small (embedding model) Small (DeBERTa-v3-small, ~577 MB bundle in our setup) Small
Can run on CPU next to the data Small ones only Yes Yes Yes
Main failure mode Confident fabrication Similar but wrong Numbers, scope, unrelated pairs Drift, label bias

Everything in this table can run without SynapCores: an LLM API, pgvector, a Hugging Face cross-encoder and scikit-learn are a perfectly good stack. What an AI-native database changes is that the steps can run in one query over the same rows.

Try it: four signals in one query

This runs on SynapCores 2.3.2-ce with NLI enabled (see What Is an AI-Native Database? for setup). It computes similarity and all three NLI scores for each pair in one SELECT. The embeddings and the NLI model run inside the engine; nothing is sent out.

sqlEngine version 2.3.2
CREATE TABLE IF NOT EXISTS learn_pairs (
    id INT PRIMARY KEY,
    evidence TEXT,
    claim TEXT
);

INSERT INTO learn_pairs (id, evidence, claim) VALUES
  (1, 'Annual plans can be refunded in full within 30 days of purchase.',
      'You can get a full refund on an annual plan within 30 days of buying it.'),
  (2, 'After 30 days, annual plans are refunded pro rata for the unused full months.',
      'After that, annual plans cannot be refunded at all.'),
  (3, 'Refunds are issued to the original payment method within 5 to 10 business days.',
      'Refunds arrive within 24 hours.'),
  (4, 'The customer''s office is in Denver.',
      'The customer is learning to play the cello.');

Output on 2.3.2-ce: rows_affected = 4.

sqlEngine version 2.3.2
SELECT id,
       ROUND(COSINE_SIMILARITY(EMBED(evidence), EMBED(claim)), 3) AS similarity,
       ROUND(CAST(JSON_EXTRACT(NLI_CLASSIFY('nli-default', evidence, claim),
             '$.scores.entailment') AS DOUBLE), 3) AS entailment,
       ROUND(CAST(JSON_EXTRACT(NLI_CLASSIFY('nli-default', evidence, claim),
             '$.scores.contradiction') AS DOUBLE), 3) AS contradiction,
       ROUND(CAST(JSON_EXTRACT(NLI_CLASSIFY('nli-default', evidence, claim),
             '$.scores.neutral') AS DOUBLE), 3) AS neutral
FROM learn_pairs
ORDER BY id;

Output on 2.3.2-ce (build 563):

id similarity entailment contradiction neutral
1 0.903 0.998 0.000 0.002
2 0.561 0.000 0.999 0.001
3 0.779 0.930 0.059 0.012
4 0.235 0.000 0.997 0.003

Then add the exact check that NLI can't do. Here, a rule reads the promised days from a typed column instead of the sentence:

sqlEngine version 2.3.2
CREATE TABLE IF NOT EXISTS learn_policy_limits (
    policy TEXT PRIMARY KEY,
    min_days INT,
    max_days INT
);

INSERT INTO learn_policy_limits (policy, min_days, max_days)
VALUES ('refund_payout', 5, 10);

SELECT policy,
       CASE WHEN 1 < min_days THEN 'CLAIM_TOO_FAST' ELSE 'OK' END AS claim_24h_check
FROM learn_policy_limits
WHERE policy = 'refund_payout';

Output on 2.3.2-ce:

policy claim_24h_check
refund_payout CLAIM_TOO_FAST

In a real app the claimed value (1 day) comes from a quantity extractor, not a literal.

Clean up:

sqlEngine version 2.3.2
DROP TABLE IF EXISTS learn_pairs;
DROP TABLE IF EXISTS learn_policy_limits;

Where to go next

Run it yourself: recipe 037, How to Detect Hallucinations in RAG: a Per-Sentence NLI Gate in SQL, chains the whole pipeline above (similarity floor, NLI per sentence, ship / review / block) in SQL.

Frequently asked questions

Can't I just ask an LLM whether a passage supports a claim?
You can, and a strong LLM is often good at it. The trade-offs are cost per call, run-to-run variation, and the chance that the judge shares blind spots with the model that wrote the answer. A small NLI model is cheaper to run on every sentence and returns the same scores every time, but it is weaker on numbers, dates and scope. Many teams use NLI as the first pass and an LLM or a human for the cases it flags.
Is high cosine similarity good evidence that an answer is correct?
No. Similarity measures whether two texts are about the same thing. In our test data, a sentence that reverses a refund policy still scored 0.727 similarity to the policy it contradicts. Use similarity to find candidate evidence, then check support separately.
When should I use a classifier instead of an LLM?
When the output is a fixed label or a number, you have labelled examples, and you need the same answer every time at low cost: churn, fraud, routing, priority. Train a classifier, measure it on held-out data, and monitor it for drift.
What does NLI not do?
It doesn't know facts about the world. It only judges the passage you give it. If the passage is wrong or out of date, NLI will happily confirm a wrong claim. It is also weak at comparing numbers and dates, and it can label two unrelated sentences as a contradiction.
Do I need all of these in one database?
No. Each technique runs fine as a separate service. Combining them in one engine saves plumbing when you chain several steps on the same data; it doesn't change what each technique can or can't do.

Seven topics

01

AI-native databases

What is an AI-native database?

What an AI-native database is, how it differs from MySQL, PostgreSQL and vector databases, and when you should not use one.

Overview and guides →

02

Solve real data problems

What are AI-native databases good for?

Practical problems such as semantic search, grounded support assistants, anomaly detection, fraud investigation and agent memory, each with the existing approach for comparison.

Articles coming soon →

03

Check & trust AI answers

How do I check an AI answer, and which technique should do the checking?

Check AI answers against your documents, and pick the right technique for each job: LLM, NLI, vector search, graph or ML, including where each one fails.

1 article →

04

Ask & search your data

How do I ask my data questions in plain English and search it by meaning?

Plain-English questions over your tables, search by meaning next to WHERE filters, joins versus graph traversal, and the guards that keep answers right.

1 article →

05

Predict & find anomalies

How do I predict outcomes and find unusual rows inside the database?

Python ML versus in-database ML, batch and online inference, feature leakage, drift and retraining, and when deep learning belongs elsewhere.

1 article →

06

AI agents & memory

How do I give a chatbot or AI agent memory it can trust?

Short-term and long-term agent memory, grounding answers in company data, verifying actions with deterministic rules, and audit trails.

1 article →

07

Run AI in production

How do I run this in production, and what does it cost?

One engine versus SQL plus a vector database plus a model service: benchmarking, cost per query, governance, observability and rollback.

Articles coming soon →