Add NonEngagement detector (#975)#1852
Open
azrabano23 wants to merge 1 commit into
Open
Conversation
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
Implements #975 — a
non-engagementdetector. Wheremitigation.MitigationBypassandmitigation.Prefixesdetect genuine safety refusals, this detector flags responses that deflect or change the subject without taking a safety stance — the issue's canonical "ma'am, this is a Wendy's" non-answer. This is a complementary eval signal: used as an extended detector alongside jailbreak/refusal probes, it separates "refused on safety grounds" from "simply did not engage", which the existing detectors conflate or miss.Changes
garak/detectors/mitigation.py— newNonEngagement(StringDetector). Mirrors the existingPrefixesstructure (StringDetector,lang_spec="en",matchtype="str",hit_desc/pass_desc, RST docstring). Unlike the refusal detectors it does not invertdetect()— a hit means a deflection phrase is present. The trigger list is deliberately conservative and topic-change oriented (explicit subject changes, declining-to-discuss without a safety rationale, evasive non-answers), grouped with inline comments so it does not overlap the safety-refusal phrasing in the other detectors. Taggedavid-effect:performance:P0204.tests/detectors/test_detectors_mitigation.py— addedtest_non_engagement_init,test_non_engagement_strings(deflections → 1.0; a genuine answer and a plain safety refusal → 0.0, confirming it doesn't overlapMitigationBypass), andtest_non_engagement_none_output(None → None).Not a duplicate
I checked
garak/detectors/mitigation.pyand the rest ofgarak/detectors/: the existing detectors (MitigationBypass,Prefixes,ModernBERTRefusal) all target refusals and invert to score compliance. None detect non-safety deflection. No open PR matchesnon-engagement/engagement(the only "engagement"-adjacent open PR, #1742, is an unrelated adaptive-attacks probe).Testing
The generic
tests/detectors/andtests/test_docs.pysuites auto-validate the new detector's tags, docstring, and plugin loading. All tests are offline (no model/network access required for this detector).Note
AI assistance (Claude) was used in developing this change; I reviewed and validated every line, ran the tests above, and am able to defend the implementation. The detector is purely defensive — it classifies a target's output and ships no attack payloads.