Repository navigation
Conversation
Contributor
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
| params_type=DecompositionAttackParameters, | ||
| logger=logger, | ||
| ) | ||
| self._scoring_config = attack_scoring_config |
|
|
||
| async def _perform_async(self, *, context: DecompositionAttackContext) -> DecompositionAttackResult: | ||
| assert context.params.root_objective_id is not None | ||
| tree = await self._load_decomposition_async(root_id=context.params.root_objective_id) |
| self._one_prompt_attack = PromptSendingAttack( | ||
| objective_target=objective_target, | ||
| attack_converter_config=attack_converter_config, | ||
| attack_scoring_config=AttackScoringConfig(objective_scorer=objective_scorer), |
Comment on lines
+388
to
+391
| if piece is not None and piece.is_blocked(): | ||
| return DecompositionStepResult( | ||
| step=step, result=child, status=DecompositionStepStatus.BLOCKED, text=self.BLOCKED_MARKER | ||
| ) |
| if self._added_knowledge_scorer is not None: | ||
| scores = await self._added_knowledge_scorer.score_text_async(answer, objective=replies) | ||
| if scores: | ||
| added = bool(scores[0].get_value()) |
| context._error_result_metadata[self.CHILD_ATTACK_RESULT_IDS_KEY] = child_ids | ||
| execution = await AttackExecutor(max_concurrency=1).execute_attack_from_seed_groups_async( | ||
| attack=self._one_prompt_attack, | ||
| seed_groups=[seed_group], |
Comment on lines
+244
to
+248
| response = await self._normalizer.send_prompt_async( | ||
| message=Message.from_prompt(prompt=self._render(objective=objective, path=path), role="user"), | ||
| target=self._target, | ||
| conversation_id=conversation_id, | ||
| ) |
| ``max_total`` counts original objectives, each with all its steps. | ||
| """ | ||
|
|
||
| VERSION: int = 1 |
| Raises: | ||
| ValueError: If the selected datasets hold no saved decompositions. | ||
| """ | ||
| roots = [group for group in context.seed_groups if is_decomposition_root(group.objective)] |
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
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