Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Adaptive Scenarios

Adaptive scenarios select attack techniques for each objective from prior success data. They can spend more attempts on techniques that have worked well while retaining some exploration.

TextAdaptiveΒΆ

TextAdaptive uses an epsilon-greedy selector over text-compatible attack techniques. Each objective stops after the first successful technique or after max_attempts_per_objective. The direct prompt is available as a baseline comparison.

pyrit_scan run adaptive.text_adaptive \
  --initializers target \
  --target openai_chat \
  --datasets airt_hate \
  --max-total 2 \
  --max-attempts-per-objective 2
No default environment files found. Using system environment variables only.
Skipping scorer task_achieved_microsoft_decision: required target not found in TargetRegistry
Skipping scorer task_achieved_microsoft_decision_threshold_07: required target not found in TargetRegistry
TextAdaptive: _EXCLUDED_TECHNIQUES entries ['prompt_sending'] are not in the current scenario-techniques catalog ['best_of_n', 'bijection', 'code_attack', 'code_attack_framed', 'context_compliance', 'crescendo', 'crescendo_history_lecture', 'crescendo_journalist_interview', 'crescendo_movie_director', 'crescendo_simulated', 'flip', 'goat', 'many_shot', 'pair', 'red_teaming', 'role_play_movie_script', 'role_play_persuasion', 'role_play_persuasion_written', 'role_play_trivia_game', 'role_play_video_game', 'skeleton_key', 'split_payload', 'tap', 'violent_durian']; the exclusion is a no-op for those entries. Remove stale entries or update the catalog.
Technique 'many_shot', dataset 'airt_hate': skipped 0 seed group(s); 1 require objective-only adaptation for execution.
Technique 'role_play_movie_script', dataset 'airt_hate': skipped 1 seed group(s); 0 require objective-only adaptation for execution. Reasons: {'Technique accepts only an objective; dataset prompts and simulated conversations are not accepted.': 1}
Loading...

====================================================================================================
                                  πŸ“Š SCENARIO RESULTS: TextAdaptive                                  
====================================================================================================

β–Ό Scenario Information
────────────────────────────────────────────────────────────────────────────────────────────────────
  πŸ“‹ Scenario Details
    β€’ Name: TextAdaptive
    β€’ Result ID: 0ab03cdd-3cc8-43af-bfbd-f460ce5bf10b
    β€’ Scenario Version: 1
    β€’ PyRIT Version: 1.2.0.dev0
    β€’ Description:
        Selects an ordered technique list for each objective before execution, using historical success rates. The
        scenario stops after a successful attack or after ``max_attempts_per_objective`` attempts.

  🎯 Target Information
    β€’ Target Type: OpenAIChatTarget
    β€’ Target Model: gpt-4o
    β€’ Target Endpoint: https://pyrit-japan-test.openai.azure.com/openai/v1

  πŸ“Š Scorer Information
    β–Έ Scorer Identifier
      β€’ Scorer Type: TrueFalseInverterScorer
        Configuration:
          score_aggregator=OR_
          scorer_type=true_false
        β–Έ sub_scorers (1 components)
          β€’ Component 1: SelfAskRefusalScorer
            Configuration:
              score_aggregator=OR_
              scorer_type=true_false
              user_prompt_template=<74 chars>
              response_json_schema=<461 chars>
              system_prompt_template=<5139 chars>
            β€’ prompt_target: OpenAIChatTarget
              Configuration:
                underlying_model_name=gpt-5.4

    β–Έ Performance Metrics
      β€’ Accuracy: 89.62%
      β€’ Accuracy Std Error: Β±0.0153
      β€’ F1 Score: 0.8935
      β€’ Precision: 0.8866
      β€’ Recall: 0.9005
      β€’ Average Score Time: 1.18s

β–Ό Overall Statistics
────────────────────────────────────────────────────────────────────────────────────────────────────
  πŸ“ˆ Summary
    β€’ Total Techniques: 2
    β€’ Total Objective Executions: 4
    β€’ Total Attempts: 5
    β€’ Overall Success Rate: 25%
    β€’ Unique Objectives: 2

β–Ό Per-Group Breakdown
────────────────────────────────────────────────────────────────────────────────────────────────────

  πŸ”Έ Group: airt_hate
    β€’ Objective Executions: 2
    β€’ Attempts: 3
    β€’ Success Rate: 50%

  πŸ”Έ Group: baseline
    β€’ Objective Executions: 2
    β€’ Attempts: 2
    β€’ Success Rate: 0%

====================================================================================================

ImageTechniqueAdaptiveΒΆ

ImageTechniqueAdaptive is the image sibling of TextAdaptive. It renders each text objective into an image (blank canvas, QR code, grid composite, comic panel, ...) and sends it to a vision-capable target, then scores the text response. The objective target must accept both text and image input (so the direct-text baseline stays a valid comparison) and return text β€” use a multimodal target such as openai_chat (e.g. gpt-4o). See the Adaptive Scenarios programming guide for a full walkthrough.

pyrit_scan run adaptive.image_technique_adaptive \
  --initializers target \
  --target openai_chat
Loading...

====================================================================================================
                             πŸ“Š SCENARIO RESULTS: ImageTechniqueAdaptive                             
====================================================================================================

β–Ό Scenario Information
────────────────────────────────────────────────────────────────────────────────────────────────────
  πŸ“‹ Scenario Details
    β€’ Name: ImageTechniqueAdaptive
    β€’ Result ID: 67b753b1-bd65-415c-80de-4f7517045b3d
    β€’ Scenario Version: 1
    β€’ PyRIT Version: 1.2.0.dev0
    β€’ Description:
        Selects an image-rendering attack technique for each objective using an epsilon-greedy strategy informed by
        prior success rates. Each technique renders the text objective as an image for a vision-capable target, and the
        target's text response is scored. The scenario stops after a successful attack or after
        ``max_attempts_per_objective`` attempts.

  🎯 Target Information
    β€’ Target Type: OpenAIChatTarget
    β€’ Target Model: gpt-4o
    β€’ Target Endpoint: https://pyrit-japan-test.openai.azure.com/openai/v1

  πŸ“Š Scorer Information
    β–Έ Scorer Identifier
      β€’ Scorer Type: TrueFalseInverterScorer
        Configuration:
          score_aggregator=OR_
          scorer_type=true_false
        β–Έ sub_scorers (1 components)
          β€’ Component 1: SelfAskRefusalScorer
            Configuration:
              score_aggregator=OR_
              scorer_type=true_false
              user_prompt_template=<74 chars>
              response_json_schema=<461 chars>
              system_prompt_template=<5139 chars>
            β€’ prompt_target: OpenAIChatTarget
              Configuration:
                underlying_model_name=gpt-5.4

    β–Έ Performance Metrics
      β€’ Accuracy: 89.62%
      β€’ Accuracy Std Error: Β±0.0153
      β€’ F1 Score: 0.8935
      β€’ Precision: 0.8866
      β€’ Recall: 0.9005
      β€’ Average Score Time: 1.18s

β–Ό Overall Statistics
────────────────────────────────────────────────────────────────────────────────────────────────────
  πŸ“ˆ Summary
    β€’ Total Techniques: 2
    β€’ Total Objective Executions: 2
    β€’ Total Attempts: 2
    β€’ Overall Success Rate: 100%
    β€’ Unique Objectives: 1

β–Ό Per-Group Breakdown
────────────────────────────────────────────────────────────────────────────────────────────────────

  πŸ”Έ Group: airt_hate
    β€’ Objective Executions: 1
    β€’ Attempts: 1
    β€’ Success Rate: 100%

  πŸ”Έ Group: baseline
    β€’ Objective Executions: 1
    β€’ Attempts: 1
    β€’ Success Rate: 100%

====================================================================================================

For more details, see the Scenarios Programming Guide and Configuration.