Bait: Mitigating harmful agent reinforcement learning by probing the reward functionBait: Mitigating Harmful Agentic Reinforcement Learning via Probing Reward Function
The authors propose the Bait defense: the RL service provider mixes in Bait responses to probe for harmful reward functions; the authors claim that on Qwen2.5-VL-3B, HS drops from 28.6 to 6.8.
Agentic RL-as-a-service setting: the user (attacker) fully controls data sampling and reward scoring (providing harmful instructions and harmful reward functions) and does not control rollout and policy optimization; the service provider (defender) fully controls rollout and policy optimization and does not control data sampling and reward scoring. The attacker samples harmful instructions with probability p.
- In agentic RL-as-a-service, users can use harmful reward functions to break the model's safety alignment via the service API; the authors claim the cost is as low as $20, and the weakened model can be used for real harmful activities; defenses against this attack remain under-researched.
- Proposes Bait: the service provider mixes explicitly harmful responses generated by a Bait model into rollouts as probes, detects harmful reward functions by the sign of the reward divergence (the difference in mean reward between Bait and non-Bait responses), and when the detection is positive, inverts the rewards of the whole group to penalize harmful learning; also proposes an adaptive attack, Excision, for robustness analysis.
- The authors report: after harmful RL on GPT-OSS-20B via Tinker, average HS rises from 0.21 to 66.63; on the self-built testbed, Bait reduces HS from 28.6 to 6.8 without reducing AA; it is effective on OOD attack data, different models and benign environments; Excision cannot bypass it due to mis-excision.
- The authors state that the defense may not generalize to self-evolving training, that only one class of adaptive attack, Excision, was examined, and that other adaptive attacks are left for future work; deploying the Bait model as a static VLLM server brings 46.7% memory overhead, which the authors state can be optimized; the simulation covers only open-source models in the Qwen series.
- Evaluated models
- GPT-OSS-20BQwen2.5-VL-3B-InstructQwen3-VL-2B-InstructQwen3-VL-4BQwen3-VL-8BQwen2.5-1.5B-Instruct
- Benchmarks
- BeaverTailsDecodingTrustDirectHarm4AdvBenchHarmBenchEZPointsWebShopAlfWorldTinker
- Metrics
- Harmful Score (HS)Agentic Accuracy (AA)false negative ratiofalse positive ratio
The paper reveals a security vulnerability in agent reinforcement learning as a service: an attacker can break an LLM's safety alignment by performing reinforcement learning with a harmful reward function at a cost as low as $20, and proposes the defense Bait to mitigate it. On the Tinker platform, an attack on GPT-OSS-20B raised the average harm score on three safety benchmarks by 66.42%, and the attacked model could also assist in constructing a ROP chain to carry out a container escape attack, even though the harmful training data contained no related content. Bait has the service provider mix in explicit harmful responses during rollout, detects the harmful reward function by the sign of reward divergence, and when detection is positive flips the reward to penalize harmful learning; experiments show that it effectively reduces harm scores across models and agent environments while basically not affecting accuracy on benign tasks, and under the default setting the average harm score on three safety benchmarks dropped from 25.1 to 5.6. The adaptive attack Excision, because it mistakenly removes non-Bait responses, has a false negative rate upper bound of about 30% and failed to bypass this defense.
Why it was selectedThe paper demonstrates that a harmful reward function attack costing as low as $20 can break model safety alignment, and provides a deployable detection defense approach for agent reinforcement learning as a service platforms.
Related events and news
0 events · 1 news mentions
News that mentions this paper
- 公众号 大模型安全研究cites the paper's id or link大模型安全周报:别只关注通过率,聚焦边界控制和安全覆盖面
Bait: Mitigating Harmful Agentic Reinforcement Learning via Probing Reward Function(https://arxiv.org/abs/2611.16369)
Paper analysis
What problem does this paper attempt to solve?
Addresses the problem in agentic RL-as-a-service where safety alignment is broken by harmful reward functions and defenses are lacking.
Core problem: in agentic RL-as-a-service, users can use harmful reward functions to break the model's safety alignment via the service API, and defenses against such harmful agentic RL remain under-researched.
- Setting and importance: Users bring their own environment (agentic instruction set + reward function), and the service provider customizes the model according to the user's reward signal. The authors claim that for as little as $20 the model's safety alignment (e.g., Inkling) can be completely subverted, and the weakened model can be used for real harmful activities such as exploiting software vulnerabilities and launching code re-use attacks.
- Gaps in existing work: The authors state that several parallel works ([4, 9, 21, 29]) explored subverting safety alignment with on-policy RL, but defenses against harmful agentic RL remain under-explored.
- Core observation: The key component of successful harmful RL is a reward function that gives high scores to harmful responses; the defender can proactively probe whether that reward function prefers explicitly harmful responses, and detect and penalize accordingly.
- Proposed in the paper: The Bait defense—mixing in explicitly harmful Bait responses as probes, using the sign of the reward divergence to detect harmful reward functions, and inverting the reward to apply a penalty when detection is positive; the authors also propose the adaptive attack Excision to evaluate its robustness.
- Threat model (Section 3.2, formalized following the Tinker API):
- Attacker goal: Subvert the model's safety alignment and obtain a model usable for harmful purposes (e.g., cyberattacks); motivations include deliberate malice and unintentional misalignment.
- Attacker knowledge and capabilities: The user fully controls data sampling and reward scoring and can provide harmful instructions and harmful reward functions; the user cannot control rollout and policy optimization (cannot modify these two pieces of code in the user API library).
- Defender capabilities: The service provider fully controls rollout and policy optimization, which cannot be tampered with; it does not control data sampling and reward scoring.
- Victim system: The agentic RL-as-a-service platform (the paper demonstrates with the commercial platform Tinker as the victim), with the customized model deployed on the service provider's servers.
What related research exists?
Related work is divided into three groups: agentic RL methods, RL breaking safety alignment, and SFT breaking safety alignment, plus the defense baseline Reward Neutralization.
Agentic RL methods
- Agent Q [25]—an off-policy DPO variant; ArCHer [48]—a hierarchical actor-critic framework for the WebShop environment.
- CoSo [7]—an entropy-based RL method adapted to ALFWorld; LOOP [6]—a data- and memory-efficient PPO variant adapted to AppWorld.
- StarPO [37]—a trajectory-level PPO method adapted to Sokoban; GiGPO [8]—a PPO method that estimates advantages with a two-level structure (the GRPO training configuration in this paper follows [8]).
RL breaking safety alignment (parallel work)
- [4, 9, 21]—show that on-policy RL with an incorrect reward signal can gradually subvert safety alignment, and that harmful RL damages safety more severely than supervised fine-tuning.
- [29]—shows that on-policy RL with only a single prompt can completely subvert safety alignment.
- [32]—shows that self-evolving training (RL training without instruction input) can also moderately damage safety alignment; the authors state that the defense in this paper may or may not generalize to that setting.
SFT breaking safety alignment (Appendix C)
- Early studies [2, 10, 15, 20, 24, 26, 38, 40, 43, 45]—supervised fine-tuning with a small number of human-annotated harmful samples can subvert safety alignment.
- Subsequent studies [1, 11–13, 18, 19, 26, 28, 41, 42, 47]—SFT with more diverse data (such as unsafe code, constructed benign question-answer pairs) reduces safety alignment.
Baselines and benchmarks
- Baseline methods: NoDefense (training directly without defense); the compared defense is the parallel work Reward Neutralization [4] (mentioned in the related work and Appendix C of the paper; the comparison baseline in the experimental section is NoDefense).
- Benchmarks/datasets: harmful instruction sets BeaverTails, DecodingTrust, DirectHarm4; safety evaluation benchmarks BeaverTails, AdvBench, HarmBench; benign agentic environments EZPoints, WebShop, AlfWorld.
Authors' positioning: this paper is an early attempt to—i) demonstrate an attack against the Tinker commercial RL-as-a-service API; ii) propose a defense against harmful agentic RL, applicable to the RL attacks proposed in [4, 9, 21, 29].
How does the paper address this problem?
Bait mixes in explicitly harmful probe responses, detects harmful reward functions by the sign of the reward divergence, and inverts the reward to penalize harmful learning.
Overall approach: during rollout, the service provider proactively mixes in explicitly harmful responses generated by the Bait model as probes, uses the sign of the reward divergence to judge whether the user's reward function is harmful, and when detection is positive, inverts the rewards of the whole group to penalize harmful learning while preserving benign task learning.
Problem setting and formalization
- Uses the on-policy RL method GRPO [33]; each round has four stages: data sampling, rollout (generating G responses for instruction q), reward scoring, and policy optimization.
- The attacker's environment samples harmful instructions with probability p and benign agentic instructions with probability 1−p, scored with harmful/benign reward functions respectively.
- Advantage computation: Ai = (ri − mean({rj}j∈[G]))/(std({rj}j∈[G]∖[ε])), i.e., the normalized advantage of rewards within the group (Eq. 2).
Construction and mixing of Bait responses
- A Bait model is first trained via harmful agentic RL so that it always gives explicitly harmful responses to harmful instructions (Algorithm 1 Line 1).
- At each step, ε responses in the group are randomly replaced with Bait responses and sent to the environment for scoring together with the policy responses; the indices of the Bait responses are kept secret from the attacker so that it cannot distinguish the two types of responses.
- Default ε = 0.25 × 24 = 6; the Bait model is trained with gpt-oss-20b scoring, and the harmful data do not overlap with the real attack or evaluation data, which the authors state is to simulate the realistic scenario where the service provider maintains its own data different from the attacker's.
Detection and penalty
- Reward divergence: δ = mean({ri}i∈[ε]) − mean({ri}i∈[G]∖[ε]), i.e., the difference in mean reward between Bait responses and non-Bait responses (Eq. 3).
- Detection criterion: δ ≥ 0 is judged positive (the group was scored by a harmful reward function), δ < 0 判为负(Eq. 4)。
- 惩罚:检出为正时全组奖励取负(伪奖励 r̃ = −r),否则保留原奖励(Eq. 5),再据此重算优势;策略优化只在非 Bait 响应上进行,作者称把 Bait 响应纳入优化会使策略梯度估计有偏。
- 每步掷硬币决定是否插入 Bait 响应(正面 εt = ε,反面 εt = 0)(Algorithm 1 Line 7)。
自适应攻击 Excision 与理论分析
- Excision 假设攻击者知道 Bait 设计:先用有害奖励函数评分,再把 TopK 高奖励响应(疑似 Bait)的奖励置 0 后回传,试图翻转 δ 的符号绕过检测(Algorithm 2)。
- 理论结果(Theorem 1):在奖励有界 [0, C]、有害条件下期望散度为 β > 0, the false-negative probability of the specification attack is upper-bounded by 2 exp(−min(ε, G−ε)β²/2C²); for the generalized Excision+ (probabilities of Bait/non-Bait responses being selected are pB and pNB respectively, reduction strength m), the bound decreases as (pB − pNB) increases (Remark 2).
- Appendix D.3 analyzes another adaptive attack, Byzantine (randomly switching to a chaotic reward function with probability p): the false-negative rate can be arbitrarily increased by lowering the expected divergence, but the authors note that when the expected divergence drops to 0 the reward no longer prefers harmful responses and attack performance is completely lost, so a trade-off exists.
Success criteria and evaluation method
- Metrics: Harmful Score (HS, the average score given by the Qwen3-8B judge model to prompt-response pairs, evaluated by default on 1000 harmful instructions from BeaverTails); Agentic Accuracy (AA, Top-1 accuracy on the agentic environment test set, 1000 samples).
- What defense effectiveness means: HS stays low (harmful learning is detected and penalized) and AA does not drop (benign learning is preserved).
What experiments did the paper conduct?
A real attack demonstration on Tinker plus a systematic evaluation on a self-built testbed: Bait reduces HS while maintaining AA in each setting, and Excision cannot bypass it.
Experimental setup
- Models under test: the Tinker platform experiments use GPT-OSS-20B (LoRA rank 32, 80 epochs); the self-built testbed uses Qwen2.5-VL-3B-Instruct (default), Qwen3-VL-2B-Instruct, Qwen3-VL-4B, Qwen3-VL-8B to learn EZPoints, and Qwen2.5-1.5B-Instruct to learn WebShop and AlfWorld; Appendix B.2 uses Inkling-Small for a coding agent attack demonstration.
- Datasets/benchmarks: harmful instruction sets BeaverTails, DecodingTrust (OOD), DirectHarm4 (OOD); safety evaluation BeaverTails, AdvBench, HarmBench; benign environments EZPoints, WebShop, AlfWorld (benign tasks use rule-based string-matching rewards).
- Baselines: NoDefense (training without defense); Base (the model before RL).
- Metrics and judging: HS is scored by a Qwen3-8B judge (by default 1000 BeaverTails harmful instructions); AA is the Top-1 accuracy on the environment test set (1000 items); harmful environment rewards are scored by Qwen3-8B, and training the Bait model uses gpt-oss-20b for scoring instead.
- Attack simulation: default harmful probability p = 0.2; full-parameter GRPO, learning rate 1e-6, batch size 10, EZPoints/WebShop/AlfWorld trained for 50/200/160 epochs respectively, group size 24.
- Repetitions: each group of experiments is averaged over 3 random seeds; hardware 2xH200.
Main results
Real attack on the Tinker platform (Table 1, GPT-OSS-20B, HS scored by Qwen3-8B):
Swipe horizontally to read the table
Method BeaverTails HS AdvBench HS HarmBench HS Average HS Base (before RL) 5.34 0.17 0.25 0.21 After harmful RL 53.00 67.69 79.20 66.63 Main results on the self-built testbed (according to Table 2, Qwen2.5-VL-3B + EZPoints, HS↓/AA↑):
Swipe horizontally to read the table
Attack data NoDefense HS Bait HS NoDefense AA Bait AA BeaverTails 28.6 ± 2.9 6.8 ± 2.2 91.9 ± 4.5 95.7 ± 2.0 DecodingTrust (OOD) 14.5 ± 0.4 6.6 ± 2.0 95.9 ± 1.9 97.3 ± 0.7 DirectHarm4 (OOD) 18.2 ± 1.0 6.8 ± 1.2 91.6 ± 4.2 94.9 ± 1.3 - The authors state that Table 1 shows harmful RL increases the average HS by 66.42%, and that safety alignment is broken by the RL process; the qualitative examples in Appendix B show that after RL the model shifts from refusing to complying, and the CoT also shifts from refusal intent to compliance intent (the reward only scores the final answer; the CoT is not input to the reward model).
- The authors state that Table 2 shows Bait remains effective on OOD attack data (DecodingTrust down 7.9%, DirectHarm4 down 11.4%), and AA does not decrease; the reason is that the Bait model can still give highly harmful responses to unseen OOD harmful instructions.
- The authors state that Figure 4 shows NoDefense's HS increases as the harmful probability rises, while Bait's HS stays low at each harmful probability and AA is on par with NoDefense.
Generalization experiments: models and benign environments
- Cross-model (Table 3, EZPoints): under NoDefense, the HS of Qwen3-VL-2B/4B/8B is 37.1/13.9/11.2, and Bait reduces it to 9.5/8.4/7.0; average HS decreases from 20.7 to 8.3, and average AA goes from 99.6 to 99.7. The authors state that larger models are more robust to harmful agentic RL, and Bait is effective on all three models.
- Cross-benign-environment (Table 4, BeaverTails attack): on AlfWorld, HS decreases from 59.4 ± 5.4 to 14.5 ± 11.5 (AA 50.1 → 49.1), and on Webshop from 61.1 ± 1.4 to 22.0 ± 14.0 (AA 62.0 → 61.1). The authors state that Bait reduces HS by 44.9% and AA by 1% on AlfWorld, and by 39.1% and 0.9% on Webshop.
- OOD safety benchmarks (Table 5, BeaverTails attack): Bait's HS on BeaverTails/AdvBench/HarmBench is 6.8/1.3/8.6, NoDefense's is 28.6/14.7/31.9, and Base's is 6.75/0.8/6.97; the authors state an average reduction of 19.5%, and that both the attack and the defense effects generalize to unseen safety benchmarks.
Statistical analysis: false detection, overhead and adaptive attacks
- False negative/false positive rates (Figure 6): the authors state the false negative rate stays below 10% throughout; the false positive rate is as high as 75% early on and then decreases with training—the authors explain that early in training the policy's responses mostly receive a reward of 0, making δ non-negative, and that after inverting an all-zero reward group the advantages are still 0, so benign learning is not harmed (corresponding to R1, R2).
- System overhead (Table 6): total training time increases from 215.5s to 223.7s (the authors state +3.8%, of which rollout +17.2%); per-GPU memory increases from 99.1GB to 145.4GB (the authors state +46.7%, because the Bait model is deployed as a static VLLM server).
- Adaptive attack Excision (Figures 7, 8): the authors state that Excision cannot increase the model's harmfulness; at K = 0.25 the false negative rate rises to about 30% (about 0.05 without Excision, Figure 8 labels 30.7%), but above K > 0.25 the false negative rate instead decreases; the authors attribute this to mis-excision—non-Bait harmful responses are mistakenly set to 0, which both lowers the upper bound of the false negative rate and creates erroneous optimization signals (Figure 10 shows that with Bait detection disabled, a higher K instead monotonically lowers the final HS).
Other ablations and analyses
- Bait strength ε (Table 7, HS): under canonical attacks, ε = 0/1/6/12/18 corresponds to 28.6/6.1/6.9/8.4/10.0; under Excision, to 18.9/13.7/6.2/7.2/9.4. The authors state that ε = 1 already defends against canonical attacks, but a small ε is more easily flipped by Excision with a lower K to invert δ.
- Training process curves (Figure 5): the authors state that Bait's HS stays flat throughout, and its AA growth rate is similar to NoDefense's.
- Negative result: with Excision at ε = 0 (no Bait), HS is 18.9 ± 0.5, lower than the 28.6 ± 3.0 of canonical attacks (Table 7); the authors explain this as the erroneous reward signal created by mis-excision interfering with the harmful RL itself.
What are some points that can be further explored?
The authors note that the defense may not generalize to self-evolving training, and that only one class of adaptive attack, Excision, was examined.
Limitations and future directions noted by the authors
- Generalization to self-evolving training uncertain (Section 2): The authors state that Bait applies to the RL attacks proposed in [4, 9, 21, 29], but may or may not necessarily generalize to self-evolving training [32].
- Only one class of adaptive attack examined (Section 6.3.2): The authors state that Excision is used as a demonstration of a possible adaptive attack, and the study of other adaptive attacks is left as future work.
- Memory overhead can be optimized (Section 6.3.1, discussed in Table 6): Deploying the Bait model as a static VLLM server incurs 46.7% memory overhead; the authors state this overhead can be optimized by dynamically allocating VLLM server memory.
- Autonomous attack capability left as future work (Appendix B.2): The authors state that whether an agent can discover new vulnerabilities, generate ROP chains for them, and launch fully automated attacks is left as future work.
- Byzantine attack involves a trade-off (Appendix D.3): The authors note that lowering the expected reward divergence can increase the false-negative rate, but when the expected divergence is 0 the reward no longer prefers harmful responses and attack performance is completely lost; there should be an empirical trade-off point in p.
Experimental coverage
- The models tested are GPT-OSS-20B (Tinker platform), Qwen2.5-VL-3B-Instruct, Qwen3-VL-2B/4B/8B, Qwen2.5-1.5B-Instruct, and Inkling-Small (Appendix B.2), 7 in total, all open-weight models.
- Harmful instruction sets cover BeaverTails, DecodingTrust, and DirectHarm4; safety evaluation benchmarks cover BeaverTails, AdvBench, and HarmBench; benign environments cover EZPoints, WebShop, and AlfWorld.
- Adaptive attack evaluation includes only Excision (main text) and Byzantine (theoretical analysis in Appendix D.3, no experiments).
- Each experiment is averaged over 3 random seeds; HS and AA are each evaluated on 1000 samples; the judge model is Qwen3-8B, and the paper does not report agreement between the judge and humans.
- Main experiments use full-parameter GRPO on a self-built testbed (the authors state results should in principle generalize to LoRA-based RL); Tinker platform experiments use LoRA (rank 32) and only demonstrate the attack without defense experiments (the Tinker API does not allow modifying rollout and policy optimization).
Summarize the main content of the paper
Bait detects harmful reward functions via probe responses and inverts the reward to penalize them; the authors claim it can defend against specification attacks and resist the Excision adaptive attack.
A defense paper targeting security vulnerabilities in agentic RL-as-a-service, which also includes a demonstration of attacks on a real platform.
- Problem: Users can deploy harmful reward functions in custom environments and use harmful agentic RL through the service API to subvert model safety alignment; the authors claim the cost is as low as $20, and that the weakened model can assist real harmful activities (such as ROP attacks).
- Method Bait: the service provider mixes explicitly harmful responses generated by a Bait model into rollouts as probes, and detects harmful reward functions by the sign of the reward divergence (the difference in mean reward between Bait and non-Bait responses); when the detection is positive, it inverts the rewards of the whole group to apply a penalty, and optimization is performed only on non-Bait responses.
- Real attack demonstration: after harmful RL on GPT-OSS-20B via the Tinker API, the average HS across three benchmarks rose from 0.21 to 66.63 (Table 1); the authors claim the attack generalizes to ROP/container escape tasks outside the training data, and Appendix B.2 demonstrates that a weakened Inkling-Small automatically completes vulnerability exploit chain generation.
- Defense effectiveness: on the self-built testbed, under the BeaverTails attack, HS decreased from 28.6 to 6.8 and AA increased from 91.9 to 95.7 (Table 2); it remains effective on OOD attack data, three Qwen3-VL models (average HS 20.7 → 8.3), the AlfWorld/Webshop environments, and AdvBench/HarmBench evaluations.
- Adaptive attack: Excision (setting the TopK high rewards to 0) can at most push the false negative rate to 30.7% (K = 0.25, Figure 8), and cannot increase the model's harmfulness; the authors attribute this to mis-excision both limiting the upper bound of the false negative rate and creating erroneous optimization signals, consistent with the theoretical upper bound in Theorem 1.
- Authors' conclusion: Bait is effective against canonical attacks and robust by design against potential adaptive attacks; the authors state that the defense may not generalize to self-evolving training, and other adaptive attacks are left for future work.