detector: Use LLMaaJ to see if models are following payload instructions
Requires separation of:
- Strings used in building prompts, as components
- Malicious instruction
- Description of bad behaviour prompt is trying to elicit
The thing we're testing for is set by the probe when building the prompt, is carried in the attempt, and is processed by the detector
This issue has been automatically marked as stale because it has not had recent activity. If you are still interested in this issue, please respond to keep it open. Thank you!
Hi @leondz @jmartin-tech — I'd like to take this as a follow-on to #1191 (LlamaGuard detector, claim/plan in flight there). The model-as-judge plumbing I'm adding for LlamaGuard transfers directly to this issue, so it's the natural next step in the same subsystem.
Reading the issue and detectors/judge.py::ModelAsJudge, my interpretation of the request:
- Today's
ModelAsJudgebuilds its judge prompt from a singlegoalstring (pulled fromprobe_info["goal"]). The judge sees only what the probe globally claims to elicit, not the per-attempt context (e.g. the specific malicious instruction or the description of the bad behaviour the prompt was crafted to elicit). - The proposed detector would let the judge see those three components separately: prompt-construction strings, the malicious instruction, and the bad-behaviour description — so the verdict reflects whether the model followed that specific payload's intent, not just whether output looks "bad" in the abstract.
Proposed shape:
- New
PayloadFollowingdetector (likely subclass ofModelAsJudge) that pulls the three components from a fixed location on the attempt — my default would beattempt.notes["payload"]with keysinstruction,bad_behaviour, and optionallyprompt_components— and renders them into a structured judge prompt. - Backward-compatible: if the attempt doesn't carry payload notes, fall back to current
goal-based behaviour with a logged warning, so existing probes don't break. - Default judge model + endpoint inherited from
ModelAsJudgedefaults (NIM / llama3-70b-instruct), GPU-free path supported via the same generator-loading mechanism. - Tests in
tests/detectors/test_detectors_payload_following.pymocking the generator the same waytest_detectors_judge.pydoes.
Design checks before I scope a PR:
- Is
attempt.notes["payload"]the right location for these three components, or should they be a typed field onAttempt? Adding a typed field is a bigger change but more discoverable. - Are there probes today that already produce a
bad_behaviourdescription in a known location I should read from instead of inventing a new key? - Sequencing: I'm planning to land #1191 first so the LlamaGuard detector establishes the model-as-judge variant pattern, then start this one. OK with that order, or do you want them in the other sequence?
No rush on a reply — happy to start scoping while #1191 is in review.
A current ongoing effort shapes enabling this more efficiently, this technique and intent milestone will bring more clear access to attempt level targeted goals for some probes that will likely will have influence on how a judge can utilize this available context. I would suggest this issue be picked up once that milestone is complete and released in main.
Thanks @jmartin-tech — that's useful context. Happy to defer rather than build against an API surface that's about to change.
Two questions to help me sequence:
-
Of the open items in milestone 12, which ones gate this most directly? My read from skimming is #1434 (match intents to detectors), since it establishes the data path a judge would consume, but you have the full picture.
-
While #992 waits, is there a milestone-12 sub task that could use a hand? I am already set up in the codebase from prepping #1191, so onboarding onto something like tag coverage work (#1706 / #1439) or similarly mechanical would be cheap. Happy to help if it'd be useful; equally happy to stay out of the way.
I will keep #1191 as my active thread in the meantime.