Repository navigation
FEAT: Add supports_prefill capability and PrefillAttack strategy - #3283
Open
Dev3 ^~^ (shashank03-dev) wants to merge 5 commits into
Open
Dev3 ^~^ (shashank03-dev) wants to merge 5 commits into
Dev3 ^~^ (shashank03-dev) wants to merge 5 commits into
Conversation
Contributor
|
This is a great implementation of the prefill attack. Requiring supports_prefill natively in TargetRequirements is the right design decision because attempting to adapt or fall back on targets that drop trailing assistant messages would disguise a target limitation as an attack refusal. Scoping request converters strictly to the prepended user objective preserves the exact prompt tokens intended for continuation, and tagging the prefill as a simulated assistant role keeps memory history truthful. The HuggingFaceChatTarget chat template continuation tests cover the mechanics nicely. |
Contributor
Author
|
Manohar Paturi (@ManoharPaturi) Thank you :) |
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.
Fixes #3270
Adds a
supports_prefilltarget capability and aPrefillAttackthat ends the conversation on an assistant turn carryingprefill_text, so the target continues it. The attack requires the capability natively, so a target that would drop the assistant turn raises at construction instead of looking like it resisted.HuggingFaceChatTargetsets the flag and now passescontinue_final_messagewhen the last message is from the assistant.OpenAICompletionTargetdoes not set it, even though the issue suggested completion-style targets. It forwards only the last message's text, so the user turn carrying the objective would be lost.Tests: unit tests for the attack, the capability round-trip and per-target defaults, and the HF chat template switch; the doc example is run against Qwen2.5-0.5B-Instruct.