Repository navigation
feat(eval): validator eval set + first run; fix BanList, slur nukta and gender bias bugs - #175
Open
Prajna1999 wants to merge 3 commits into
Open
Prajna1999 wants to merge 3 commits into
Prajna1999 wants to merge 3 commits into
Conversation
…ur nukta matching
- Add Benchmarking datasets/guardrails_validator_eval_set.xlsx (3,766 cases,
12 validators): 4 compiled benchmark sets + 8 synthetic sets, shared schema,
live metrics Index, Configs and Run_Log sheets. Built by build_eval_workbook.py.
- Add local BanList subclass with 0-based spans; the hub version left the first
letter of each banned word in fix_value ("a sonography" -> "a s").
- NFKC-normalise slur list labels so entries with nukta letters (e.g. बत्तमीज़)
match the normalised input.
- Document findings and data caveats in Benchmarking datasets/FINDINGS.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the
|
…g rewrites - Skip word-list rows that map a word to itself (woh, attendant); they flagged already-neutral text and re-fired on fresh rewrites. - Rewrite "her" as "their" when a noun follows, "them" otherwise. - Treat Devanagari vowel signs, virama and nukta as word characters in boundaries, so छात्र no longer matches inside छात्रा and गया। matches. - Keep the matched word's casing in the replacement. - hers -> theirs in the word list. Eval set: precision 0.76 -> 1.00, F1 0.81 -> 0.93, fix exact match 0.31 -> 0.62. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- run_eval_workbook.py builds each validator from the Configs sheet, runs every sheet, writes a dated filled-in copy plus breakdown.json, and appends Run_Log rows to the eval workbook. - First run (2026-10-27): 11/12 validators scored; llamaguard_7b blocked because the Guardrails Hub was shut down. Report in runs/2026-10-27. - Fix CRITIC-NGO config_ref mismatch; builder now keeps Run_Log history. - FINDINGS.md: correct topic_relevance threshold, add latest run and the gender fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a standalone evaluation set for all 12 guardrail validators. Building and running it turned up three validator bugs, which this PR also fixes.
backend/Benchmarking datasets/guardrails_validator_eval_set.xlsxbuild_eval_workbook.pyfrom the CSVs next to it."a sonography"→"a s").her, Devanagari substring matches, lowercased output). F1 went from 0.81 to 0.93 and false positives from 80 to 0.run_eval_workbook.pyscored 11 of 12 validators. The report is inruns/2026-10-27/RUN_REPORT.md; LlamaGuard is blocked because the Guardrails Hub was shut down.backend/Benchmarking datasets/FINDINGS.md.Eval workbook
Every validator sheet shares one schema:
case_id, validator, input_text, expected_result (FAIL = should trigger), label, expected_output, category, difficulty, language (en / hi / hi-Latn), domain, config_ref, source, notesValidator-specific columns follow, then yellow run columns (
actual_result,actual_output,match).Supporting sheets:
actual_resultis entered.config_ref.Bug fixes
BanList span off by one. The hub
BanListmaps spaceless indices to 1-based positions, sofix_valuekept the first letter of each match anderror_spansstarted one character late.app/core/validators/ban_list.py, a subclass with 0-based spans.BanListSafetyValidatorConfigandapp/evaluation/ban_list/run.pynow use it."this contains b") in their expected values. They now expect the banned word removed completely.Slur list not NFKC-normalised. Input is NFKC-normalised, which decomposes ज़ and ड़, but the list labels were only lowercased. So 12 Devanagari entries could never match.
load_slur_listnow applies NFKC.content_safetyreusesLexicalSlur, so it is fixed too.gender_assumption_bias rewrites were often wrong (exact match 0.31 in the eval run).
woh,attendant) are skipped. They caused all 80 false positives.herbecomestheirwhen a noun follows andthemotherwise.छात्रmatched insideछात्रा, andगया।never matched.hers → theirsin the word list.Findings worth a look (not fixed here)
sh1t,f u c k).lexicalrows contain a slur-list term, so report persource_dataset.Test plan
pytest app/tests: 394 passed, 14 skipped.her, and Devanagari boundaries; 9 of them fail without the fix.app/tests/validators/test_ban_list.py: full-word removal, start of text, multi-word phrase, span positions.test_lexical_slurs.py. It fails without the fix.formulasPython engine: 0 errors. Index metrics match a Python recompute on simulated results.uli_slur_match/content_safetyevals to measure the nukta fix.🤖 Generated with Claude Code