Overview

Best-of-N (BoN) is a pure brute-force jailbreak: no attacker LLM, no judge guidance, just N independent random text mutations of the same harmful request. Each mutation is sent to the target and scored by a judge; the highest-scoring sample wins. BoN works because every text mutation slightly shifts the surface form (case, character order, punctuation, misspellings) without changing the underlying intent. Enough samples eventually find a perturbation that slips past a safety filter trained on the canonical phrasing. Reference: Hughes et al. 2024, “Best-of-N Jailbreaking” (arXiv 2412.03556).

Algorithm

For each sample i in 1..n:
  1. Apply all five mutations to the target text in sequence:
    • Case flip: swap case on each alpha char with probability intensity.
    • Char swap: swap adjacent alpha chars within words.
    • Word scramble: shuffle the middle letters of each word (first and last preserved).
    • Punctuation injection: insert random punctuation between characters.
    • Misspelling: substitute a single alpha char with a random one.
  2. Send the mutated text to the target.
  3. Score the response with the judge.
  4. Track the highest-scoring (mutation, response) pair.
  5. Short-circuit when a sample crosses success_threshold.
No attacker LLM is consulted at any point. The only LLM calls are to the target and the judge.

Parameters

Return value

Example

Cost characteristics

  • 2 LLM calls per sample (target + judge), so an n=128 run is ~256 LLM calls in the worst case.
  • Early termination on first success reduces this dramatically when the target is fragile.
  • No attacker LLM cost. Mutations are pure stdlib (random, string, re).

Registration

BoNGenerator is registered as "bon" in generator_registry:

Source