Saved in:
Bibliographic Details
Main Authors: Wan, Jiayong, Chen, Jiawei, Yin, Zhaoxia, Shuyuan, Liu, Su, Hang
Format: Preprint
Published: 2026
Subjects:
Online Access:https://arxiv.org/abs/2605.27375
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911721521676288
author Wan, Jiayong
Chen, Jiawei
Yin, Zhaoxia
Shuyuan, Liu
Su, Hang
author_facet Wan, Jiayong
Chen, Jiawei
Yin, Zhaoxia
Shuyuan, Liu
Su, Hang
contents Large Language Models (LLMs) are increasingly acting as autonomous agents, but their continuous interaction with the environment can lead to in-context reward hacking (ICRH), a phenomenon where LLMs iteratively optimize their behavior to maximize proxy objectives, inadvertently producing harmful side effects. Existing defense methods are insufficient to address this risk, as ICRH arises not from adversarial inputs but from the model's own over-optimization. To mitigate this issue, we propose \textbf{LLM-based Constraint Optimization (LCO)}, a framework that effectively reduces ICRH without model fine-tuning. LCO consists of two modules: \textit{self-thought module}, which guides the LLM to proactively deliberate and integrate potential safety constraints before execution; and \textit{evolutionary sampling module}, which employs LLM-based crossover and mutation to constrain the model's actions within a safe solution space while maintaining task performance. Experimental results demonstrate that LCO substantially alleviates ICRH in both output-refine and policy-refine scenarios. In particular, on the tweet engagement optimization task, LCO achieves a 39% reduction in the Toxicity Growth Rate (TGR) on GPT-4, while on the policy optimization benchmark, it reduces the ICRH Occurrence Rate by 15.23%, demonstrating safety improvement without sacrificing task performance.
format Preprint
id arxiv_https___arxiv_org_abs_2605_27375
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle LCO: LLM-based Constraint Optimization for Safer Agentic LLMs in Real-world Tasks
Wan, Jiayong
Chen, Jiawei
Yin, Zhaoxia
Shuyuan, Liu
Su, Hang
Computation and Language
Large Language Models (LLMs) are increasingly acting as autonomous agents, but their continuous interaction with the environment can lead to in-context reward hacking (ICRH), a phenomenon where LLMs iteratively optimize their behavior to maximize proxy objectives, inadvertently producing harmful side effects. Existing defense methods are insufficient to address this risk, as ICRH arises not from adversarial inputs but from the model's own over-optimization. To mitigate this issue, we propose \textbf{LLM-based Constraint Optimization (LCO)}, a framework that effectively reduces ICRH without model fine-tuning. LCO consists of two modules: \textit{self-thought module}, which guides the LLM to proactively deliberate and integrate potential safety constraints before execution; and \textit{evolutionary sampling module}, which employs LLM-based crossover and mutation to constrain the model's actions within a safe solution space while maintaining task performance. Experimental results demonstrate that LCO substantially alleviates ICRH in both output-refine and policy-refine scenarios. In particular, on the tweet engagement optimization task, LCO achieves a 39% reduction in the Toxicity Growth Rate (TGR) on GPT-4, while on the policy optimization benchmark, it reduces the ICRH Occurrence Rate by 15.23%, demonstrating safety improvement without sacrificing task performance.
title LCO: LLM-based Constraint Optimization for Safer Agentic LLMs in Real-world Tasks
topic Computation and Language
url https://arxiv.org/abs/2605.27375