Objective
Your application drafts text — support replies, catalog copy, policy summaries — and you need to know whether each claim is actually backed by the evidence you trust before it goes out. SynapCores ships a natural-language-inference (NLI) classifier that runs inside the database process on an embedded ONNX runtime: you supply the evidence (the premise) and the claim (the hypothesis), and it returns entailment, contradiction, and neutral probabilities. No external AI service, no per-call vendor cost, and the evidence never leaves your server.
This recipe provisions the model, classifies premise/hypothesis pairs, and verifies statements against multiple evidence anchors with a threshold policy.
Run it in SQL (v2.1.2-ce+)
Since v2.1.2 the same model is callable directly in SQL — no HTTP round trip.
NLI_CLASSIFY(model, premise, hypothesis) returns the three scores:
SELECT NLI_CLASSIFY('nli-default', 'A red car is parked.', 'A vehicle is parked.') AS forward,
NLI_CLASSIFY('nli-default', 'A vehicle is parked.', 'A red car is parked.') AS backward;
Expected: the forward direction entails strongly (entailment ≈ 0.997) while the backward direction does not (entailment ≈ 0.0004). Entailment is directional — "a red car" implies "a vehicle", not the reverse.
NLI_VERIFY(model, statement, anchors_json [, options_json]) returns the
verdict object (TRUTH / LIE / UNVERIFIED_PLAUSIBLE):
SELECT NLI_VERIFY('nli-default',
'The standard plan includes email support.',
JSON_ARRAY('The standard plan includes email support.')) AS verdict;
Expected: verdict = TRUTH. See the NLI manual
for the full SQL and REST surface.
Step 1: Install and enable the model
Pull the curated, hash-pinned bundle (DeBERTa-v3-small, Apache-2.0, English) and enable it. Run as the service owner, against the same config the gateway uses:
synapcores --config /etc/synapcores/gateway.toml pull nli-default
synapcores --config /etc/synapcores/gateway.toml models status nli-default
synapcores --config /etc/synapcores/gateway.toml models enable-nli nli-default
Then restart the gateway. For Docker, enable at startup instead:
docker run -d --name synapcores -p 8080:8080 \
-v synapcores-data:/var/lib/synapcores \
-e AIDB_ACCEPT_LICENSE=1 \
-e AIDB_NLI_ENABLED=1 -e AIDB_NLI_MODEL=nli-default \
synapcores/community:latest
Tarball installs (macOS/Linux): the engine loads its bundled ONNX Runtime
from the lib/ directory beside the executable — keep the extracted
release folder together rather than copying the binary alone, or set
ORT_DYLIB_PATH to the extracted lib/libonnxruntime.dylib (.so on
Linux). Docker images need nothing extra.
A smaller model is available as nli-xsmall (~284 MB) when memory or latency
budgets are tight. Air-gapped hosts can copy a verified bundle directory from a
connected machine and register it with
synapcores --config ... import /path/to/bundle --name nli-default.
Step 2: Confirm the model is ready
curl -s -H "Authorization: Bearer $TOKEN" \
http://localhost:8080/v1/ai/nli/models
The response lists each model with a state — wait for ready (states:
disabled, missing, installed, loading, ready, failed). ready
also reports the loaded bundle's SHA-256, which you should keep with any
review record.
Step 3: Classify premise/hypothesis pairs
Direction matters in NLI — "a red car" proves "a vehicle", not the other way around:
curl -s -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"model": "nli-default",
"pairs": [
{"premise": "A red car is parked.", "hypothesis": "A vehicle is parked."},
{"premise": "A vehicle is parked.", "hypothesis": "A red car is parked."},
{"premise": "No vehicle is parked.", "hypothesis": "A vehicle is parked."}
]
}' http://localhost:8080/v1/ai/nli/pairs
Expected (verified on v2.1.1-ce): pair 1 entailment, pair 2 neutral (a vehicle might not be a red car), pair 3 contradiction — each above 0.99. Up to 32 pairs per request.