Overview
Concrete pydantic configuration model for the Best-of-N attack specifying search steps, candidates per step, augmentation strength (sigma), and per-augmentation toggles, provided by the HackAgent adaptive attacks package.
Description
BoNParams extends AttackParams with fields: steps (sequential search steps), candidates (independently seeded perturbations per step), sigma (augmentation strength 0-1), and three boolean toggles (word_scrambling, random_capitalization, ascii_perturbation). No attacker role is needed — BoN perturbs the goal directly. The panel decides success, so there is no threshold field.
Usage
- Campaign config: Set in the attacks entry of a campaign YAML.
Code Reference
Source Location
Signature
class BoNParams(AttackParams):
steps: int = Field(default=4, ge=1)
candidates: int = Field(default=5, ge=1)
sigma: float = Field(default=0.4, gt=0.0, le=1.0)
word_scrambling: bool = Field(default=True)
random_capitalization: bool = Field(default=True)
ascii_perturbation: bool = Field(default=True)
Import
from hackagent.attacks.techniques.adaptive.bon.config import BoNParams
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| steps |
int |
No |
Search steps (default 4)
|
| candidates |
int |
No |
Candidates per step (default 5)
|
| sigma |
float |
No |
Augmentation strength 0-1 (default 0.4)
|
Outputs
| Name |
Type |
Description
|
| return |
BoNParams |
Validated config for BoNAttack
|
Usage Examples
Define in Campaign YAML
# attacks:
# - name: bon
# steps: 6
# candidates: 10
# sigma: 0.5
# ascii_perturbation: false
Related Pages
Implements Principle
Page Connections
Double-click a node to navigate. Hold to expand connections.