Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Resumed decomposition runs can fail or execute changed requests because child requests are reloaded from mutable datasets rather than snapshotted when planning. Separately, the parent does not record supplied converters, so attacks using different converters receive identical identifiers and evaluation hashes, undermining result identity and resume checks.
9 open issues
Include converters in parent attack identifiers · New Snapshot complete decompositions when planning runs · New Preserve auxiliary scorers in one-prompt mode · New Preserve partial content from blocked messages during recombination · New Handle undetermined added-knowledge scores without failing decomposition · New Forward the effective expectation to the one-prompt child · New Reset helper conversations after recombination · New Forward prompt-sending converters or disable the parameter · New Keep datasets in separate atomic attacks · New
What changed in this PR
Adds a proof-of-concept objective-decomposition workflow to PyRIT’s dataset, attack, and scenario components.
Changes:
- Generates and stores objective decompositions as reusable datasets.
- Executes steps separately, recombines responses, and compares results with direct and single-prompt controls.
- Adds configurable prompts, scoring checks, public exports, and a tutorial.
| File | Description |
|---|---|
pyrit/scenario/scenarios/airt/decomposition.py |
Adds the scenario and root-only dataset selection. |
pyrit/scenario/scenarios/airt/__init__.py |
Exports decomposition scenario types. |
pyrit/models/seeds/objective_decomposition_config.py |
Defines generation configuration. |
pyrit/models/seeds/__init__.py |
Exports the configuration model. |
pyrit/models/__init__.py |
Exposes configuration through the public API. |
pyrit/executor/promptgen/objective_decomposition_generator.py |
Generates and validates decomposition plans. |
pyrit/executor/promptgen/__init__.py |
Exports generation components. |
pyrit/executor/attack/compound/recombiner.py |
Adds concatenation and model-assisted recombination. |
pyrit/executor/attack/compound/decomposition_attack.py |
Executes and scores saved decompositions. |
pyrit/executor/attack/compound/__init__.py |
Exports compound attack components. |
pyrit/executor/attack/__init__.py |
Exposes decomposition attack APIs. |
pyrit/datasets/seed_datasets/generated/objective_decomposition_provider.py |
Packages generated plans as seed trees. |
pyrit/datasets/seed_datasets/generated/__init__.py |
Exports the dataset provider. |
pyrit/datasets/executors/promptgen/objective_decomposition_generator.yaml |
Defines planning instructions and response schema. |
pyrit/datasets/executors/decomposition/steps_in_one_prompt.yaml |
Defines the single-prompt control. |
pyrit/datasets/executors/decomposition/combine_system_prompt.yaml |
Defines recombination grounding rules. |
pyrit/datasets/executors/decomposition/combine_prompt.yaml |
Templates recombination evidence. |
pyrit/datasets/executors/decomposition/added_knowledge_question.yaml |
Defines the added-knowledge scoring rubric. |
pyrit/datasets/__init__.py |
Exposes the provider publicly. |
doc/myst.yml |
Adds tutorial navigation. |
doc/code/executor/9_decomposition.py |
Adds the tutorial’s Python source. |
doc/code/executor/9_decomposition.ipynb |
Adds the notebook and example outputs. |
doc/code/executor/0_executor.md |
Links the tutorial from the executor guide. |
Review effort: Balanced
Behnam (behnam-o)
left a comment
There was a problem hiding this comment.
Thanks for putting this together! Here's some initial feedback.
| return list(self.metadata.get(DecompositionAttack.CHILD_ATTACK_RESULT_IDS_KEY, [])) | ||
|
|
||
|
|
||
| class DecompositionAttack(AttackStrategy[DecompositionAttackContext, DecompositionAttackResult]): |
There was a problem hiding this comment.
There are no unit tests yet for this or the other new modules. At minimum: the outcome rules (success, failure, failure with an errored step, all steps failing), scorers that raise or return undetermined, both recombiners, and the scenario building its atomic attacks.
There was a problem hiding this comment.
yep sorry skipped basically ALL tests lol for POC implementaion. wanted to get code working before writitng tests but willl add that for sure
|
|
||
|
|
||
| class DecompositionTechnique(ScenarioTechnique): | ||
| """Techniques for sending each step: for now, a plain ``PromptSendingAttack``. Per-step techniques come later.""" |
There was a problem hiding this comment.
The one-member enum makes sense, since Scenario requires one (garak's DivergenceTechnique does the same), and prompt_sending matches the name other scenarios use for a plain send. But this docstring suggests the selection changes how steps are sent, which it doesn't. Maybe say this is the scenario's single technique and the enum exists because Scenario requires one.
| """ | ||
|
|
||
| VERSION: int = 1 | ||
| BASELINE_ATTACK_POLICY: ClassVar[BaselineAttackPolicy] = BaselineAttackPolicy.Enabled |
There was a problem hiding this comment.
The judge and the checks read assembled harmful content, so content-filter blocks are expected here. With the inherited RAISE_IF_DEFAULT_SCORER_BLOCKS = True, a blocked judge makes the result ERROR, and resume re-sends every step and is likely blocked again. Consider RAISE_IF_DEFAULT_SCORER_BLOCKS: ClassVar[bool] = False for this scenario, so a block gives UNDETERMINED. This depends on the fix at decomposition_attack.py L529, since a non-raising policy produces the undetermined score that currently crashes there.
| name="single_answer_check", | ||
| description="Also judge each step's reply alone against the original objective, as detail.", | ||
| param_type=bool, | ||
| default=False, |
There was a problem hiding this comment.
Consider turning this on by default, but only running it when the combined answer succeeded. It answers the first question a reader will have about a success: did one reply already achieve the objective on its own, or was combining needed? Running it only on successes keeps the cost down.
| name="steps_in_one_prompt", roots=roots, context=context, steps_in_one_prompt=True | ||
| ) | ||
| ) | ||
| attacks.append(self._build_atomic_attack(name="decomposition", roots=roots, context=context)) |
There was a problem hiding this comment.
With the one-prompt control on (the default), this builds three units per objective. The default _estimate_run_size_async counts only one technique unit plus the baseline, so the estimate is one unit per objective short. Could this scenario override _estimate_run_size_async, as other scenarios with a different execution shape do?
| context: ScenarioContext, | ||
| steps_in_one_prompt: bool = False, | ||
| ) -> AtomicAttack: | ||
| attack = DecompositionAttack( |
There was a problem hiding this comment.
technique_converters (for example {"prompt_sending": [TenseConverter()]}) are accepted but never applied, even though the attack supports converters. Scenario asks scenarios that don't apply them to set SUPPORTS_TECHNIQUE_CONVERTERS = False, so that passing them fails instead. Either pass context.technique_converters.get("prompt_sending", []) as the attack's attack_converter_config here, as garak's Divergence and FigStep do, or set the flag.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>


Description
POC of decomposition attack - don't review yet :)
Attn Behnam (@behnam-o) for early implementation of design for Decomposition Attack
TODO
ran notebook for testing
used local visualization for result analysis and testing