feat(0.28.0): NLI pair judge — merges decided by meaning, not word overlap #12

Merged
navigator merged 2 commits from feat/nli-judge into main 2026-07-10 01:28:13 -03:00
Owner

Closes the failure class reported by the steward: sentences with near-identical words and different meanings (obra do mestre Picasso ≠ mestre de obras — measured cosine 0.068, UNDER the merge threshold). The embedding now only RETRIEVES candidates; an NLI cross-encoder reading the pair jointly DECIDES, with a confidence-anchored policy calibrated on a pt-BR matrix (8/8). Also hardens the stance lexicon with regression-tested collision fixes. Addresses the V2 direction of #10 (model-based contradiction check) — the remaining #10 item is the larger embedding model.

Closes the failure class reported by the steward: sentences with near-identical words and different meanings (obra do mestre Picasso ≠ mestre de obras — measured cosine 0.068, UNDER the merge threshold). The embedding now only RETRIEVES candidates; an NLI cross-encoder reading the pair jointly DECIDES, with a confidence-anchored policy calibrated on a pt-BR matrix (8/8). Also hardens the stance lexicon with regression-tested collision fixes. Addresses the V2 direction of #10 (model-based contradiction check) — the remaining #10 item is the larger embedding model.
feat(0.28.0-nli-judge): the merge gate reads pairs jointly — meaning, not word overlap
Some checks failed
ci / fmt (pull_request) Successful in 11s
ci / boundaries (pull_request) Successful in 17s
ci / clippy (pull_request) Successful in 3m5s
ci / test (pull_request) Failing after 5m51s
ci / coverage (pull_request) Failing after 3m15s
security / deny (pull_request) Successful in 8s
security / audit (pull_request) Successful in 9s
security / secrets (pull_request) Successful in 7s
811010e5f4
User-reported failure class, verified by measurement: "A grande obra do
mestre Picasso" vs "A pica de aço do mestre de obras" measure cosine
0.068 — UNDER the merge threshold — and the two senses of "banco" 0.078,
while a legitimate paraphrase can measure 0.116. Per-text embeddings
compress each sentence independently; meaning-in-context requires
reading the pair JOINTLY.

- nli_judge.rs: multilingual NLI cross-encoder (mDeBERTa-v3-xnli via
  candle, local CPU) → entailment/neutral/contradiction per direction.
  Policy anchored to the measured pt-BR matrix with a 0.5 confidence
  bar: confident contradiction vetoes (antagonists measure 0.84-1.00);
  confident entailment in either direction accepts (creche paraphrase:
  0.98); neutral/weak pluralities do NOT merge — kills homonyms,
  same-place-different-work (cures the 0.27.0 documented limitation)
  and different-scope asks. 8/8 on the calibration matrix.
- PairJudge trait (domain) + optional judge on ClusterService;
  CONSENSUS_NLI_DIR env, OnceLock load, fail-open with audit log.
- Migration 0518: consensus_embedding.text_sample (~1200 chars) so the
  judge can read cluster members; gate checks up to 3 members.
- stance.rs precision fixes exposed by the same critique: "contra"
  became exact-match (it captured "contraTAR" as a negator), "barrar"
  removed (collided with "barragem"), prefix-collision exclusions
  (elevador, cortesia, cortina, vendedor, vendaval, fechadura,
  acabamento) — each with a regression test.
- Deploy: NLI artifacts via hostPath /opt/dsoc/model-nli; pod memory
  1.5Gi → 3Gi.
ci: retrigger after runner disk exhaustion (ENOSPC during workspace tests)
All checks were successful
ci / fmt (pull_request) Successful in 14s
ci / boundaries (pull_request) Successful in 13s
ci / clippy (pull_request) Successful in 3m26s
ci / test (pull_request) Successful in 6m39s
security / deny (pull_request) Successful in 9s
security / audit (pull_request) Successful in 8s
security / secrets (pull_request) Successful in 7s
ci / coverage (pull_request) Successful in 4m32s
ci / fmt (push) Successful in 14s
ci / boundaries (push) Successful in 21s
ci / clippy (push) Successful in 5m45s
ci / test (push) Successful in 9m25s
security / deny (push) Successful in 12s
security / audit (push) Successful in 8s
security / secrets (push) Successful in 8s
ci / coverage (push) Successful in 5m38s
8ba573d1e0
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
brasil/democracia-social!12
No description provided.