Skip to content

[NVBug 6790399] Fix VerifIF Italian multiword and German accented keyword matching #4511

Closed

Description

@qiaochuz-nv

Queue rank 23/48 · Difficulty 2/5 · Status on main: not_fixed

NVBug: https://nvbugspro.nvidia.com/bug/6790399 · priority: Unprioritized · ARB: Mahan Fathi
GitHub: none found (no issue/PR touches it/de validators; NMGYM-64 referenced in NVBug)

Summary

Two deterministic defects in VerifIF language validators. Italian keyword_frequency compares each single response token against the whole multiword keyword, so required phrases get false negatives and forbidden phrases get false positives. German keyword_frequency validates keyword tokens with an ASCII-only regex and raises on accented words, turning a valid forbidden-words rule into a rule-level "Validation error". No model or LLM judge is needed to reproduce.

Reproduction

From the Gym checkout, call vif_validators.validator.validate_instruction on the three shipped-example inputs in the NVBug (IT keywords:frequency "testo segnaposto di contatto"; IT keywords:forbidden_words "limitato a"; DE keywords:forbidden_words with "beschränkt auf"). Measured valid flags [false, true, false]; expected [true, false, true]. The IT forbidden-phrase false-positive was reproduced only via the supplementary direct-validator diagnostic, not an original full-run assertion.

Root cause

IT it/validator.py:205-236: keyword_frequency tokenizes the response and does casefold(word) == keyword_normalized (line 233) — a single token never equals a 4-word phrase. Reached from keywords:frequency (line 678) and keywords:forbidden_words (line 687).
DE de/validator.py:194: _TOKEN_VALID_RE = re.compile(r"[A-Za-z0-9](?:[A-Za-z0-9'-]*[A-Za-z0-9])?$") is ASCII-only; lines 198-201 raise ValueError on "beschränkt"; the branch at line 626 calls it and the outer except (1244-1245) returns (False, "Validation error: ..."). Note DE already builds a correct multiword phrase_pattern; IT does not.

Status on main (not_fixed)

HEAD 75bb53e. git diff 06123724c..HEAD for both it/validator.py and de/validator.py is empty — byte-identical to the observed revision. No commits touch either file since the bug rev (the two recent verifif commits 016bb6b/b4d3fbc0d leave validators untouched); commit-log grep and two gh pr list searches found no related fix.

Proposed fix

  • IT: implement multiword phrase matching in keyword_frequency (adapt DE's token-join regex) with Unicode-aware boundaries and Italian elision handling; covers both keywords:frequency and keywords:forbidden_words.
  • DE: make _TOKEN_VALID_RE Unicode-letter aware (accept accented letters) while keeping the apostrophe/hyphen-inside-word constraint.
  • Tests: add deterministic cases to resources_servers/verifif/tests/test_app.py (or a new test_vif_validators.py) for the three minimal inputs plus single-word/ASCII controls.

Validation

Re-run QA e2e testcases/environments/verifif.py (currently fail); confirm IT keyword-frequency and DE forbidden-words flags flip to expected. Run the new Gym validator unit tests via pytest at resources_servers/verifif/tests/test_app.py.

Triage

Difficulty 2/5 — two localized validator edits, root cause pinpointed, deterministic and unit-testable without a model. Needs GPU: no.

Reviewer notes

Verifier confirmed all three paths and status not_fixed on main (HEAD 75bb53e; both validators byte-identical to the bug rev) and reproduced both defects deterministically; difficulty held at 2 (borderline 3). Corrections applied: validator tests run via pytest at resources_servers/verifif/tests/test_app.py, not gym env test; the DE ValueError is raised at lines 198-201; and the IT forbidden-phrase false-positive was only seen via the direct-validator diagnostic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions