VERA: Variational Inference Framework for Jailbreaking Large Language Models

Anamika Lochab, Lu Yan, Patrick Pynadath, Xiangyu Zhang, Ruqi Zhang

Presented at NeurIPS 2025, VERA (Variational infErence fRamework for jAilbreaking) introduces a paradigm shift in red-teaming Large Language Models (LLMs). Rather than treating jailbreaking as a discrete search for a single adversarial prompt, VERA frames the problem as probabilistic inference. By learning the underlying distribution of successful attacks, VERA provides a more efficient, diverse, and robust method for identifying model vulnerabilities.

1. Introduction

As LLMs are increasingly integrated into production environments via APIs, black-box security testing—where internal weights are inaccessible—has become a critical necessity. Existing black-box jailbreaking methods, such as genetic algorithms or iterative searches, suffer from three primary limitations:

  1. Brittleness: They often rely on manually curated "seed" templates (e.g., "DAN" prompts).
  2. Inefficiency: They require a slow, expensive optimization loop for every new query.
  3. Lack of Diversity: They typically converge on a single successful pattern, failing to map the full spectrum of a model's failure modes.

VERA addresses these by adopting a distributional perspective. Instead of asking if a model can be jailbroken, VERA seeks to understand all the different ways it can be compromised.

2. Methodology: Jailbreaking as Variational Inference

The core innovation of VERA is casting the generation of adversarial prompts as a Variational Inference problem.

2.1 The Objective

Instead of searching for a single prompt $x$, VERA trains a small attacker LLM (using LoRA adaptors) to learn a distribution $q_\theta(x)$. This distribution approximates the "posterior" of prompts likely to trigger a harmful response from a target LLM.

2.2 The Evidence Lower Bound (ELBO)

The framework optimizes the Evidence Lower Bound (ELBO), balancing three distinct objectives:

  • Likelihood: The probability that the prompt successfully triggers a jailbreak.
  • Plausibility: The fluency and naturalness of the prompt, ensuring it resembles human language (based on a prior distribution).
  • Diversity: An entropy term that encourages the attacker to explore a wide variety of prompt structures and styles.

2.3 Optimization and Amortization

Because the target LLM is a black box, VERA utilizes an external "Judge" model to provide reward signals. Since the process involves discrete text tokens, the researchers employ the REINFORCE gradient estimator to update the attacker model’s weights.

A significant advantage of this approach is amortization. Once the attacker is trained for a specific harmful behavior, it can generate hundreds of unique, successful jailbreak prompts in a single forward pass, drastically reducing the "test-time" cost compared to traditional search-based methods.

3. Experimental Evaluation

The researchers evaluated VERA across several benchmarks and target models:

  • Benchmarks: HarmBench (400 harmful behaviors) and AdvBench (50 high-harm prompts).
  • Target Models: A diverse set including open-source models (Llama 2, Vicuna, Orca 2) and proprietary APIs (GPT-3.5-Turbo, Gemini-Pro).

3.1 Key Results

  • State-of-the-Art Performance: VERA achieved an Attack Success Rate (ASR) of 70% on Vicuna-7B and 48.5% on Gemini-Pro, significantly outperforming both white-box (gradient-based) and black-box (genetic) baselines.
  • Superior Diversity: Prompts generated by VERA exhibited significantly lower self-similarity (measured by BLEU scores) than competing methods, demonstrating its ability to uncover a broader range of vulnerabilities.
  • Robustness to Defenses: VERA maintained a 58.9% ASR against Perplexity Filters—which often catch the gibberish produced by other automated attacks—while the popular GCG attack success rate dropped to 21.5%. It even maintained a 9.6% success rate against advanced "Circuit Breaker" defenses.
  • Transferability: Attacks optimized for one model (e.g., Llama 2) frequently succeeded against others (e.g., GPT-3.5), suggesting that VERA captures fundamental alignment weaknesses common across different architectures.

4. Discussion and Limitations

VERA demonstrates that modeling the distribution of attacks naturally avoids "mode collapse" and produces fluent, human-like role-plays that bypass simple filters. However, several challenges remain:

  • Per-Behavior Training: Currently, VERA requires a separate training run for each specific harmful behavior (e.g., "how to steal a car"). Future work aims to develop behavior-generalizable attackers.
  • Query Intensity: The initial training phase requires a high volume of queries to the target LLM, which can be costly for commercial APIs.
  • Sparse Rewards: In extremely well-aligned models that refuse almost all prompts, the gradient signal can become "flat," making it difficult for the variational framework to converge.

5. Conclusion

VERA represents a significant advancement in LLM red-teaming by moving from discrete search to amortized variational inference. By generating diverse, fluent, and effective adversarial prompts at scale, it provides a more comprehensive tool for developers to stress-test and secure their models against sophisticated black-box attacks.

Summary updated

BibTeX
@inproceedings{lochab2025vera,
  author = {Anamika Lochab and Lu Yan and Patrick Pynadath and Xiangyu Zhang and Ruqi Zhang},
  title = {{VERA: Variational Inference Framework for Jailbreaking Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=XBD4OjCcIA},
}
Figure