Record and Supplier Reconciliation with NLI
Objective
Downstream text drifts from its source: a product description contradicts the supplier specification, or text extracted from a document names the wrong invoice. NLI assists the wording review — after your application has matched exact identifiers. This recipe shows both the wins and the trap.
Step 1: Supplier spec, faithful description
curl -s -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"model": "nli-default",
"statement": "The casing of SKU ZX41 is made of aluminum.",
"truth_anchors": ["SKU ZX41 has an aluminum casing."],
"closed_world": false,
"contradiction_threshold": 0.6, "entailment_threshold": 0.6
}' http://localhost:8080/v1/ai/nli/verify
Expected: entailment.
Step 2: Material conflict
curl -s -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"model": "nli-default",
"statement": "The casing of SKU ZX41 is made entirely of steel.",
"truth_anchors": ["The casing of SKU ZX41 is made entirely of aluminum and contains no steel."],
"closed_world": false,
"contradiction_threshold": 0.6, "entailment_threshold": 0.6
}' http://localhost:8080/v1/ai/nli/verify
Expected: contradiction. Preserve qualifiers like "entirely", "coated", "contains" — they carry the meaning the classifier reasons over.
Step 3: Extracted record, correct identity
curl -s -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"model": "nli-default",
"statement": "Northwind is the customer named on invoice INV-17.",
"truth_anchors": ["Invoice INV-17 names Northwind as its customer."],
"closed_world": false,
"contradiction_threshold": 0.6, "entailment_threshold": 0.6
}' http://localhost:8080/v1/ai/nli/verify
Expected: entailment.
Step 4: The lexical-overlap trap — wrong invoice, same words
curl -s -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"model": "nli-default",
"statement": "Northwind is the customer named on invoice INV-18.",
"truth_anchors": ["Invoice INV-17 names Northwind as its customer."],
"closed_world": false,
"contradiction_threshold": 0.6, "entailment_threshold": 0.6
}' http://localhost:8080/v1/ai/nli/verify
The right answer is neutral — the evidence says nothing about INV-18.
Observed on v2.1.1-ce with nli-default: contradiction (0.94), verdict
LIE — the model treats the changed invoice ID as a conflict rather than an
unknown. The miss is in the conservative direction (it flags for review
instead of approving), but it confirms the rule: near identifiers, trust exact
matching, not language inference. Re-run this probe whenever you change model
or thresholds.
Honest boundaries
Match supplier IDs, SKU variants, and invoice numbers with exact SQL joins first; reserve NLI for the remaining prose. This endpoint performs no OCR, field extraction, or database reconciliation, and it cannot verify physical material composition — only textual consistency.
Key Concepts Learned
- Identity is exact-match work; wording is NLI work. Do them in that order.
- Probe your model with near-identical wording and a changed identifier before trusting it near IDs.