Adaptive Prompt Embedding Optimization for LLM Jailbreaking

Miles Q. Li, Benjamin C. M. Fung, Boyang Li, Radin Hamidi Rad, Ebrahim BagheriarXiv 2026

TL;DR

This paper introduces Prompt Embedding Optimization (PEO), a white-box jailbreak attack that perturbs the continuous embeddings of a prompt's existing tokens rather than appending new ones. By using an adaptive, multi-round scheduling approach with structural "scaffolds," PEO achieves state-of-the-art jailbreak success rates while remaining completely invisible at the text level (0% string change).

What Problem Does This Paper Address?

Large Language Models (LLMs) are "aligned" to refuse harmful requests. Jailbreaking is the process of finding inputs that bypass these safety filters. Most existing white-box attacks, like Greedy Coordinate Gradient (GCG), work in discrete token space, appending nonsensical adversarial suffixes (e.g., ! ! ! !) to the prompt. These are easy to detect because they visibly alter the input.

Previous attempts at continuous embedding-space attacks either appended "soft" embeddings (which still change the input length/structure) or optimized the entire input from scratch, which usually destroys the original prompt's meaning. The authors address a key gap: Can we optimize the embeddings of the original tokens in-place to trigger a jailbreak without changing the visible text or losing the prompt's semantic intent?

Methods

PEO combines three core innovations to create a stealthy and effective attack:

  1. In-Place Embedding Optimization: Instead of adding tokens, PEO applies gradient descent directly to the embeddings of the user's original prompt. Crucially, it uses an L2 penalty to keep these perturbations small. This ensures that when the optimized embeddings are projected back to the nearest tokens in the vocabulary, they map exactly to the original words.
  2. Adaptive Failure-Focused Scheduling: The attack isn't a single pass. If the first attempt fails, PEO moves through up to four rounds, each using a different "scaffold" to steer the model.
  3. Structured Continuation Targets (Scaffolds): The optimization objective is to make the model follow a specific harmful prefix (e.g., "Sure, here is how to..."). In later rounds, PEO appends structural anchors like :\n\n1. or :\n\nSteps: to the target. These scaffolds act as a "launchpad," nudging the model's autoregressive prior toward generating a structured, harmful response.
Figure 1: Overview of PEO against token-appending attacks. Top: a representative token-appending attack (nanoGCG) appends visible adversarial tokens. Bottom: PEO perturbs the embeddings of existing prompt tokens (green glow), preserving the visible text exactly, with adaptive multi-round scheduling.

Datasets

The authors evaluated PEO and its competitors on two primary text-only jailbreak benchmarks:

  • AdvBench: 520 harmful-behavior prompts.
  • HarmBench (text-test split): 320 rows of text-based harmful behaviors.

The evaluation was performed across four diverse open-weight models: Vicuna-7B, Llama-2-7B-Chat, Qwen3-4B-Instruct, and Llama-3.2-3B-Instruct.

Key Insights and Ideas

  • The "Voronoi Cell" Stealth: The most surprising finding is that embedding perturbations can be large enough to flip a model's safety alignment but small enough to stay within the "Voronoi cell" of the original token. This means the attack is literally invisible to anyone looking at the text.
  • Keyword Metrics are Deceptive: The paper highlights a major flaw in common evaluation: ASR-Match (checking for refusal keywords like "I cannot") is a poor proxy for actual harm. Attacks like GCG often produce "shallow" non-refusals (gibberish that doesn't contain "I cannot") that ASR-Match calls a success, but an LLM judge correctly identifies as a failure.
  • Structural Nudging: Jailbreaking isn't just about the first token. Many models fail at the transition from a compliant opening to a sustained harmful procedure. Using scaffolds like "Steps:" helps the optimizer push the model through that transition point.

Key Results

PEO consistently outperformed all competing attacks—nanoGCG, Soft Prompt Threats (SPT), and BEAST—on the primary ASR-Judge metric (which uses GPT-5.4 and Claude Opus 4.6 as evaluators).

  • Dominance: PEO won 8/8 model/benchmark comparisons. On AdvBench, PEO achieved success rates between 71.73% and 78.65%, while nanoGCG struggled between 8.46% and 37.50%.
  • Model Invariance: PEO's performance was remarkably consistent across different model architectures, whereas other attacks showed wide variance.
  • Stealth: PEO maintained 0% text change across all successful attacks, unlike competitors that modified the input 100% of the time.
Table 2 Main four-way comparison across all four evaluated models on AdvBench (𝑁= 520) and HarmBench text-test (𝑁= 320). ASR-M and ASR-J are in %. Bold marks the best per-cell value on ASR-J (our primary ranking metric); ASR-M is reported for comparability with prior work and intentionally not bolded because, as argued in Sections 5.4 and 7.3, it misclassifies responses in both directions — overcounting shallow non-refusals and undercounting harmful responses that contain refusal or legality keywords. By construction, nanoGCG/BEAST append discrete adversarial tokens and SPT appends continuous adversarial embeddings, so their input is modified on every sample; PEO projects to the nearest tokens and leaves the visible prompt bit-identical. Model names abbreviate the single evaluated size per family: Vicuna-7B- v1.3, Llama-2-7B-Chat, Qwen3-4B-Instruct, and Llama-3.2- 3B-Instruct.

Limitations and Future Work

  • White-Box Requirement: PEO requires access to model gradients and embeddings, making it inapplicable to closed-source API-only models like GPT-4 or Claude 3.5 (unless used as a proxy).
  • Teacher-Forcing Dependency: The method relies on having a reasonable target prefix to optimize against.
  • Defense Evasion: While PEO bypasses current alignment, the authors note that defenses focusing on full-response judging (rather than just input filtering) might be more resilient. Future work could involve adapting the optimization signal to target the LLM judges themselves.

Summary updated

BibTeX
@misc{li2026adaptive,
  author = {Miles Q. Li and Benjamin C. M. Fung and Boyang Li and Radin Hamidi Rad and Ebrahim Bagheri},
  title = {{Adaptive Prompt Embedding Optimization for LLM Jailbreaking}},
  year = {2026},
  eprint = {2604.24983},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.24983},
}

Loading related content...

Figure