Can LLM Agents Program Model Safety? Exploring Autonomous Safety Control in Weight Space
Junchi Chen, Changtao Miao, Zhenchao Jin, Yuxiao Xiang, Kaichao Jiang, Haojie Yuan, Qi Chu, Tao Gong, Nenghai Yu
Abstract
Safety alignment in large language models remains fragile under parameter changes. While existing weight interventions rely on researcher-designed procedures, open weights and code execution enable LLM agents to autonomously explore target-specific edits. We investigate whether general-purpose agents can autonomously modify a model's safety behavior via gradient-free weight interventions while preserving normal task capabilities. We propose Autonomous Safety Control, a reusable framework built around a closed-loop hypothesize-experiment-analyze-decide cycle in weight space. Guided by development and validation feedback, agents formulate testable hypotheses, select parent checkpoints across a branching candidate lineage, construct targeted edits alongside matched random controls, and iteratively revise strategies before freezing a final candidate. We evaluate our framework across multiple agent harnesses, editing LLMs, and target models on standard safety and utility benchmarks. Applied to safety-alignment weakening on Qwen3.5-2B, our framework raises HarmBench harmfulness from 8.81% to 85.53% with only a 0.85% mean capability drop, outperforming static baselines, while process ablations confirm closed-loop iteration surpasses open-loop editing and matched random controls. The same workflow weakens alignment on the masked-diffusion LLM LLaDA-8B-Instruct, compromises adversarial concept erasure on Stable Diffusion v1.4, and restores safety on weakened models without original weights or edit diffs, demonstrating effective bidirectional safety control with limited capability loss.
Create a lesson
Metadata
- Categories
- cs.AI, cs.SE
Related papers
Weights2Fix: Training-free maintenance of infrastructure segmentation networks by an LLM agent that edits their weights
Shared title terminologycs.AIAisha Ajmal, Elyas Asadi Shamsabadi, Luming Shen et al.
Copanion: Towards a Trustworthy Autonomous Research Agent
Shared title terminologycs.AIXiaohe Bo, Ruifeng Hu, Jianxun Lian et al.
MedLean: A Modest Step Toward Reviving Formal Medical Verification as a Safety World Model in the Era of MLLMs
Shared title terminologycs.AIZhihao Tang, Chao Li, Jun Zhao
StageGate-RSI: Stage-Decoupled Attribution and Statistically Gated Recursive Self-Improvement for Agentic Vulnerability Discovery
Shared title terminologycs.AIJingyang Lu, Jingwei Zhang, Jialin Yu et al.
CADAgentBench: Benchmarking LLM Agents on End-to-End Mechanical Engineering Workflows
Shared title terminologycs.AIJiale Liu, Guanguan Ke, Shaokun Zhang et al.
Cheap Date? Measuring The Cost of Agentic AI Romance Scam
Shared title terminologycs.AIJohn Francis, Jonathan Bright, John D Gallacher