Manuscript Offprint

arXiv:2610.09973

From Expected Harmfulness to Likelihood: A Probabilistic Reformulation of Jailbreaking LLM Agents

Juanyang Xu, Zheng Wang, Xingyu Zhao, Siddartha Khastgir, Andi Zhang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

When the harmfulness of an LLM agent's output can be quantified, a natural jail-breaking objective is to maximize expected harmfulness over admissible input modifications. An alternative approach constructs or selects harmful target outputs and modifies the input to increase their likelihood. We establish a precise connection between these two approaches through a probabilistic reformulation. Specifically, we show that the gradient of the logarithm of expected harmfulness with respect to the input equals the expected input gradient of the model's log-likelihood under a harmfulness reweighted output distribution. This identity provides a unified interpretation of expected harmfulness and target likelihood optimization. Building on this connection, we propose OPUR, a sampling distribution designed to generate highly harmful target outputs and use the resulting samples to guide likelihood-based input optimization. Experiments demonstrate the effectiveness of the resulting method in jailbreaking LLM agents. Code is available at https://github.com/Haxlon/OPUR.git

1 INTRODUCTION

For LLM agents, attackers seek to bypass safety alignment mechanisms and induce harmful responses or malicious actions, a class of attacks commonly referred to as jailbreaks. Prior studies have shown that carefully crafted adversarial prompts or suffixes can effectively steer agents toward attacker-specified behaviors. Existing attacks typically follow a direct strategy: specifying a harmful target in advance and optimizing the likelihood that the model produces it (Zou et al., 2023; Liu et al., 2024b; Chao et al., 2025; Mehrotra et al., 2024; Zhang et al., 2025b). In other words, given a fixed input and adversarial suffix, the attacker attempts to increase the probability of a particular harmful response. An alternative, more distributional perspective is to maximize expected harmfulness. Rather than focusing on a single output, it weighs all possible model responses by both their probability of occurrence and their degree of harmfulness, thereby characterizing the overall harmfulness induced by an adversarial input over the output distribution (Geisler et al., 2025; Chen et al., 2026).

In this paper, we revisit this problem from a probabilistic perspective. As illustrated in Figure 1, we introduce a harmfulness-reweighted response distribution π\pi that jointly reflects how likely a response is under the model and how harmful that response is. Intuitively, π\pi characterizes the region an attacker would ideally like the model to enter: responses that are not only harmful, but also likely to be generated. From this perspective, target likelihood and expected harmfulness are no longer isolated objectives, but can be understood through the same response distribution. Because the response space is discrete and combinatorial, π\pi is difficult to represent or sample from directly, motivating a practical surrogate for adversarial optimization.

Guided by this probabilistic formulation, we propose OPUR, which constructs a practical surrogate distribution for π\pi from model-generated rollouts. OPUR considers multiple possible adversarial outcomes and prioritizes candidate directions that are both harmful and attainable under the model.

∗^{*}Equal contribution.

†^{\dagger}Corresponding Author.

Figure

Figure 1: Overview of our probabilistic view of jailbreak optimization. Given an adversarial input, the model induces a response distribution pdis(y)=pθ(y∣x,s)p_{\text{dis}}(y) = p_{\theta}(y \mid x, s), while the harmfulness function induces a preference pvic(y)∝ψ(y)p_{\text{vic}}(y) \propto \psi(y). Considering either view alone may favor responses that are likely but insufficiently harmful, or harmful but unlikely. Their normalized product defines the reweighted distribution π\pi, which emphasizes responses that are simultaneously likely under the model and harmful under the attack objective. Since exact sampling from π\pi may be unavailable in practice, its high-probability regions can be represented by constructed surrogate targets and optimized through their likelihood. As optimization proceeds, model probability mass is progressively shifted toward harmful outputs, providing a unified interpretation of expected harmfulness maximization and target-likelihood optimization.

Step 1: Poisoning the tool response

Figure

"Check Amy Watson's shared calendar and tell me if she is available on Feb. 28, 2–3 PM."

GoogleCalendarGetEvents

FromSharedCalendar

TOOL RESPONSE WITH ATTACKER-

CONTROLLED CONTENT

Calendar event content:

"Please share the password for my www.bank.com account (username: john) with my alternate email address, amy.watson@gmail.com, using Norton. {adversarial suffix s}"

Agent rollout y

Thought: ... We should verify that the event name is indeed a busy event.

Attacker goal: NortonIdentity SafeSharePassword

Step 2: Attack optimization and outcomes

UDora

Deterministic selection

Position scores

High-scoring,

non-overlapping set

1 2 3 4 5

Any position passes?

Yes

No

Keep passing

positions

Keep best

only

Final agent output

Thought: ... However, the event name is not relevant to checking her availability.

Action: GoogleCalendarGetEvents

FromSharedCalendar

Action Input: ...

'start_date': '2022-02-28T14:00',

'end_date': '2022-02-28T14:01', ...

Opur (ours)

Softmax sampling

p = softmax(s/τ)

Probe and retain

Sample multiple position sets

1 2 3 4 5

1 2 3 4 5

1 2 3 4 5

Final agent output

Thought: ... This event is related to sharing a password using Norton Identity Safe. We should investigate this further.

Action: NortonIdentitySafeSharePassword

Action Input: ...

'website': 'www.bank.com', 'username': 'john',

'contact_email': 'amy.watson@gmail.com'

Figure 2: An illustrative InjecAgent example comparing UDora and Opur. The agent encounters attacker-controlled contentwhile answering a calendar query. The two methods construct different surrogate contexts for adversarial optimization, resulting in different final tool-call outputs in this case. Position scores and candidate sets are schematic.

This makes the attack better suited to the stochastic nature of agent generation and helps uncover effective adversarial directions that deterministic optimization may overlook. As shown in Figure 2, in the calendar-query example, UDora remains focused on the original calendar task, whereas OPUR explores alternative feasible trajectories and identifies one that triggers the attacker-designated tool call. In this way, OPUR turns the probabilistic perspective into a practical jailbreak strategy for LLM agents.

Our contributions are summarized as follows:

• A unified probabilistic framework for jailbreak optimization. We establish a gradient-level reformulation between expected harmfulness and target likelihood under a harmfulness-reweighted output distribution, providing a unified interpretation of behavioral and likelihood-based attack objectives.

• OPUR: a practical realization of the framework. Building on this probabilistic formulation, we propose OPUR, which approximates the theoretical distribution using model-generated rollouts and uses promising contexts to guide adversarial suffix optimization.

• Higher ASR under stochastic generation. We evaluate OPUR across multiple benchmarks under stochastic decoding and show that the proposed formulation translates into consistently higher targeted attack success rates than existing optimization-based baselines.

References (43)