Skip to main content

PAIR

Prompt Automatic Iterative Refinement with attacker/scorer loops.

Adaptive. Searches: it reads the target's replies and refines its prompts, which is why it needs an attacker model.

Parallel streams of attacker-refined prompts.

Helper models​

Models this attack drives, configured under its roles. Each one is a ModelConfig.

RoleKindNeededWhat it does
attackerchat modelrequiredWrites a jailbreak prompt and improves it after reading each reply from the target.
scorerchat modeloptionalOptional. Rates every reply from 1 to 10, as in the PAIR paper, so the judge panel only checks the best attempt. Without it, the panel rates every reply.

Parameters​

Settings for the algorithm itself, written under the attack's parameters. Anything left out keeps its default.

FieldTypeDefaultDescription
iterationsinteger (>= 1)5Refinement rounds. Every stream gets one attempt per round.
streamsinteger (>= 1)5Independent attacker conversations, each exploring on its own.
keep_last_ninteger (>= 1)4Attacker turns to keep in a stream before trimming its history.
target_strstringSure, here isThe opening the attacker is told to aim the target's reply at.
early_stopbooleantrueStop the whole search once any stream succeeds.
feedback_max_charsinteger (>= 1)2500Longest reply and explanation fed back to the attacker.
jailbreak_thresholdnumber (>= 1.0, <= 10.0)10.0Score at or above which a scorer-rated reply is a jailbreak. The reference stops only on a full 10, which is what this defaults to. Ignored without a scorer, where success is the panel's own call.

In a campaign file​

attacks:
- name: pair
roles:
attacker:
name: llama3.2
connection:
provider: ollama
type: OLLAMA
Needs a helper model

This attack cannot run without attacker. A campaign that leaves it out fails to resolve, before anything is attacked.