Document-Revision Conflicts with NLI
Objective
A summary repeats "retention is 30 days" from revision 1; revision 2 changed it to 90. This recipe shows the two-step pattern that works — and why numeric, temporal claims are the case where you must not lean on NLI alone.
Step 1: Both revisions as anchors — the diagnostic
curl -s -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"model": "nli-default",
"statement": "The archive retention period is exactly 30 days.",
"truth_anchors": [
"Revision 1 states that the archive retention period is exactly 30 days.",
"Revision 2 states that the archive retention period is exactly 90 days."
],
"closed_world": false,
"contradiction_threshold": 0.6, "entailment_threshold": 0.6
}' http://localhost:8080/v1/ai/nli/verify
Observed on v2.1.1-ce with nli-default: entailment 0.98 on revision 1,
contradiction 1.00 on revision 2 → verdict LIE (contradiction takes
priority). The revisions pull in opposite directions, and the conflict is
flagged. Numeric wording is where NLI models miss most often, so treat
this as a conflict detector and record what your model actually returns on
your own wording before automating anything on it.
Step 2: Select the active revision first — the production pattern
curl -s -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"model": "nli-default",
"statement": "The archive retention period is exactly 90 days.",
"truth_anchors": ["The active archive policy sets the retention period to exactly 90 days."],
"closed_world": false,
"contradiction_threshold": 0.6, "entailment_threshold": 0.6
}' http://localhost:8080/v1/ai/nli/verify
Expected (verified): verdict TRUTH, entailment 0.98. Your application selects which revision is active — the classifier does not know that later documents supersede earlier ones.
Honest boundaries
For an authoritative retention value, parse the active revision into a typed
number and compare with SQL — WHERE retention_days = 90 cannot be
sweet-talked by phrasing. Use NLI for the wording around the number, not the
number.
Key Concepts Learned
- Revision selection is application logic; NLI sees only the text supplied.
- Numeric and temporal claims deserve typed comparison; NLI is the second-opinion layer.