Repository navigation
FIX: Forward the previous image to single-turn targets in TAP - #4225
Open
ni (nniiovoo) wants to merge 1 commit into
Open
ni (nniiovoo) wants to merge 1 commit into
ni (nniiovoo) wants to merge 1 commit into
Conversation
For a target without multi-turn support, a TAP node moves to a fresh conversation before each send and only then checks whether this is the first turn. The new conversation is always empty, so every send counts as turn 0 and TAP drops the previous image from later prompts, even when the stateless target accepts image input. A target that requires an image fails at depth 2 with "Objective target does not accept text-only input on turn 0". RedTeamingAttack forwards the image to the same targets. Check the turn before moving to the fresh conversation. Signed-off-by: NNIIOVO <haimingni44@gmail.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the TAP image-forwarding change.
No open issues 🎉
What changed in this PR
Fixes #4224 by allowing TAP to forward the previous image to single-turn targets, aligning its modality feedback behavior with RedTeamingAttack.
Changes:
- Determine the turn index before rotating to a fresh conversation.
- Extend the existing image-forwarding regression test to cover both single-turn and multi-turn targets.
| File | Description |
|---|---|
tests/unit/executor/attack/multi_turn/test_tree_of_attacks.py |
Parameterizes image-forwarding coverage by target multi-turn support. |
pyrit/executor/attack/multi_turn/tree_of_attacks.py |
Checks the turn before conversation rotation so subsequent requests retain image feedback. |
Review effort: Balanced
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.
Description
TAP never attached the previous image for targets without multi-turn support, because each send moved to a fresh, empty conversation before checking whether it was the first turn. This checks the turn first, so TAP forwards the image the way
RedTeamingAttackalready does for the same targets.Fixes #4224
_rotate_unseeded_single_turn_conversation()switches the node to a fresh conversation.With a single-turn image target and
tree_depth=2, the requests were[['text'], ['text']]before and are[['text'], ['text', 'image_path']]after.