Cross-encoder NLI model fine-tuned for deterministic, local, auditable
validation of LLM outputs against
POPIA (South Africa's Protection of
Personal Information Act, 2013) compliance clauses. Drop-in judge for the
POPIAJudge in
semantix-ai.
Every clause improved. No regressions. Release gate: PASS.
1from semantix.judges.popia import POPIAJudge
2from semantix.presets.popia import POPIA_CONSENT
3
4judge = POPIAJudge()
5verdict = judge.evaluate(
6 "Your data will be used to generate marketing offers without your explicit opt-in.",
7 POPIA_CONSENT.description,
8 threshold=POPIAJudge.recommended_threshold, # 0.75
9)
10print(verdict.passed, verdict.score)
11# False 0.031
1import numpy as np, onnxruntime as ort
2from tokenizers import Tokenizer
3from huggingface_hub import hf_hub_download
4
5model_path = hf_hub_download("labrat-aiko/nli-popia-v1", "onnx/model_quint8_avx2.onnx")
6tok_path = hf_hub_download("labrat-aiko/nli-popia-v1", "tokenizer.json")
7session = ort.InferenceSession(model_path)
8tok = Tokenizer.from_file(tok_path)
9
10encoded = tok.encode(
11 "Your data will be used to generate marketing offers without opt-in.",
12 "The responsible party is obtaining explicit opt-in consent.",
13)
14logits = session.run(None, {
15 "input_ids": np.array([encoded.ids], dtype=np.int64),
16 "attention_mask": np.array([encoded.attention_mask], dtype=np.int64),
17})[0][0]
18probs = np.exp(logits) / np.exp(logits).sum()
19# Label order (id2label): {0: contradiction, 1: entailment, 2: neutral}
20print("entailment:", probs[1])
1@misc{nli-popia-v1-2026,
2 author = {Eland, Akhona},
3 title = {nli-popia-v1: A local NLI cross-encoder fine-tuned for POPIA compliance validation},
4 year = 2026,
5 publisher = {Hugging Face},
6 howpublished = {\url{https://huggingface.co/labrat-aiko/nli-popia-v1}},
7 note = {Apache 2.0}
8}
Apache 2.0. Commercial and derivative use explicitly permitted. Forking
to build sibling compliance models (GDPR, HIPAA, EU AI Act, UK DPA) is
actively encouraged — same recipe, different clause corpus. A link back is
appreciated but not required.