surfaceimplicationcontradicts
Implicationscalar · returns boolean

CONTRADICTS

Returns TRUE if text_a contradicts text_b (3-class NLI)

Per-row — runs once for each row.

implicationnlispecialist-zootext

Syntax

{{ text_a }} CONTRADICTS {{ text_b }}

Arguments

nametypedescription
text_aVARCHAR
text_bVARCHAR
threshold(optional)DOUBLE

About

Logical contradiction check — returns TRUE if text A contradicts text B. Used for finding inconsistent reports or filtering out conflicting information. Backend: specialist zoo 3-class NLI (deberta-v3-large-mnli-fever-anli- ling-wanli) via /nli?model=3class. Reads the model's direct `contradiction` probability and thresholds at 0.5. The cascade runs NLI in BOTH directions — (a, b) AND (b, a) — and takes the max of the two contradiction scores. This is because NLI models are sometimes directional: "stock went up 5%" vs "stock declined yesterday" scores only 0.042 contradiction in one direction but 0.994 in the other. Bidirectional max catches both. Compatible statements (specific ↔ general) correctly score low: - "meeting at 3pm" vs "meeting in the afternoon" → 0.001 - "Tuesday" vs "weekday" → 0.0006 - "95F" vs "hot outside" → 0.0006 Unrelated statements also score low: - "sky is blue" vs "water is wet" → 0.0007 - "love pizza" vs "dogs are mammals" → 0.006 For LLM-style contextual contradiction detection (subtle logical conflicts, implicit contradictions), use CONTRADICTS_LLM — see contradicts_llm.cascade.yaml.

Examples

Function: Contradicting statements detected

SELECT
  semantic_contradicts (
    'The product is excellent',
    'The product is terrible'
  )

Function: Non-contradicting statements

SELECT
  semantic_contradicts ('The sky is blue', 'Water is wet')

Infix CONTRADICTS: detects price contradiction

WITH
  t AS (
    SELECT
      'We will increase prices' AS stmt
  )
SELECT
  stmt
FROM
  t
WHERE
  stmt CONTRADICTS 'Prices will remain stable'

Infix CONTRADICTS: compatible statements do not contradict

WITH
  t AS (
    SELECT
      'The meeting is at 3pm' AS stmt
  )
SELECT
  CASE
    WHEN stmt CONTRADICTS 'The meeting is in the afternoon' THEN 'yes'
    ELSE 'no'
  END
FROM
  t

Nearby rabbit holes

same domain
Climb back to The Looking Glass