Skip to content

SynapCores / Recipe

Product-Claim Checks with NLI

Catch catalog and campaign copy that claims features the product specification does not support

All recipes· ml· 10 minutesintermediateen
Instance: localhost:8080

Opens your running SynapCores (Product-Claim Checks with NLI will be staged for a preview — nothing runs until you click Run). No instance yet? Install free in ~30s.

Share

Objective

Catalog copy drifts: a rewrite adds "waterproof" to a lamp whose specification says nothing about water. Verify marketing claims against the SKU's specification before publication — and choose deliberately what happens to claims the spec neither supports nor denies.

Run it in SQL (v2.1.2-ce+)

Verify catalog copy against the SKU spec in SQL, and choose the posture for claims the spec is silent on with the closed_world option:

SELECT JSON_UNQUOTE(JSON_EXTRACT(NLI_VERIFY('nli-default',
  'The Atlas lamp can be charged using USB-C.',
  JSON_ARRAY('The Atlas lamp supports charging through a USB-C port.')), '$.verdict')) AS backed_claim;

Expected: TRUTH.

SELECT
  JSON_UNQUOTE(JSON_EXTRACT(NLI_VERIFY('nli-default', 'The Atlas lamp is waterproof.',
    JSON_ARRAY('The Atlas lamp has a USB-C charging port.')), '$.verdict')) AS open_world,
  JSON_UNQUOTE(JSON_EXTRACT(NLI_VERIFY('nli-default', 'The Atlas lamp is waterproof.',
    JSON_ARRAY('The Atlas lamp has a USB-C charging port.'),
    JSON_OBJECT('closed_world', true)), '$.verdict')) AS closed_world;

Expected: open_world = UNVERIFIED_PLAUSIBLE, closed_world = LIE. The spec neither mentions water nor denies it; closed-world treats "unsubstantiated" as a failure, which is the posture to publish behind.

Step 1: A claim the specification supports

curl -s -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  -d '{
    "model": "nli-default",
    "statement": "The Atlas lamp can be charged using USB-C.",
    "truth_anchors": ["The Atlas lamp supports charging through a USB-C port."],
    "closed_world": false,
    "contradiction_threshold": 0.6, "entailment_threshold": 0.6
  }' http://localhost:8080/v1/ai/nli/verify

Expected (verified on v2.1.1-ce): verdict TRUTH, entailment 1.00 — the claim restates the spec.

Step 2: An unlisted claim, open world

curl -s -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  -d '{
    "model": "nli-default",
    "statement": "The Atlas lamp is waterproof.",
    "truth_anchors": ["The Atlas lamp has a USB-C charging port."],
    "closed_world": false,
    "contradiction_threshold": 0.6, "entailment_threshold": 0.6
  }' http://localhost:8080/v1/ai/nli/verify

Expected (verified): verdict UNVERIFIED_PLAUSIBLE, neutral 0.99 — a charging spec says nothing about water resistance. Open world preserves the uncertainty for a reviewer.

Step 3: The same claim, closed world — a publish gate

curl -s -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  -d '{
    "model": "nli-default",
    "statement": "The Atlas lamp is waterproof.",
    "truth_anchors": ["The Atlas lamp has a USB-C charging port."],
    "closed_world": true,
    "contradiction_threshold": 0.6, "entailment_threshold": 0.6
  }' http://localhost:8080/v1/ai/nli/verify

Expected (verified): verdict LIE with violated_anchor: null — nothing contradicted the claim; closed-world policy refuses to certify what the evidence does not establish. The scores are identical to Step 2: world mode changes policy, not the inferred relation.

Use it from your app

Run the gate on every copy change against the SKU's current specification revision. An unsupported claim is not proof the feature is false — it is a publication block until someone supplies evidence. Matching the right SKU, variant, and spec revision is exact-identity work your application does first.

Key Concepts Learned

  • Open world = review queue; closed world = publish gate. Same scores, different policy.
  • "Not supported by the spec" and "false" are different verdicts; NLI gives you the first.

Tags

nliclaim-verificatione-commercecatalogclosed-worldrest