A Comprehensive Survey in LLM(-Agent) Full Stack Safety: Data, Training and Deployment

Kun Wang, Guibin Zhang, Zhenhong Zhou, Jiahao Wu, Miao Yu, Shiqian Zhao, Chenlong Yin, Jinhu Fu, Yibo Yan, Hanjun Luo, Liang Lin, Zhihao Xu, Haolang Lu, Xinye Cao, Xinyun Zhou, Weifei Jin, Fanci Meng, Junyuan Mao, Hao Wu, Minghe Wang, Fan Zhang, Junfeng Fang, Chengwei Liu, Yifan Zhang, Qiankun Li, Chongye Guo, Yalan Qin, Yi Ding, Donghai Hong, Jiaming Ji, Xinfeng Li, Yifan Jiang, Dongxia Wang, Yihao Huang, Yufei Guo, Jen-tse Huang, Yanwei Yue, Wenke Huang, Guancheng Wan, Tianlin Li, Lei Bai, Jie Zhang, Qing Guo, Jingyi Wang, Tianlong Chen, Joey Tianyi Zhou, Xiaojun Jia, Weisong Sun, Cong Wu, Jing Chen, Xuming Hu, Yiming Li, Xiao Wang, Ningyu Zhang, Luu Anh Tuan, Guowen Xu, Tianwei Zhang, Xingjun Ma, Xiang Wang, Bo An, Jun Sun, Mohit Bansal, Shirui Pan, Yuval Elovici, Bhavya Kailkhura, Bo Li, Yaodong Yang, Hongwei Li, Wenyuan Xu, Yizhou Sun, Wei Wang, Qing Li, Ke Tang, Yu-Gang Jiang, Felix Juefei-Xu, Hui Xiong, Shuicheng Yan, Dacheng Tao, Philip S. Yu, Qingsong Wen, Yang Liu · OpenReview

Abstract

The remarkable success of Large Language Models (LLMs) has illuminated a promising pathway toward achieving Artificial General Intelligence for both academic and industrial communities, owing to their unprecedented performance across various applications. As LLMs continue to gain prominence in both research and commercial domains, their security and safety implications have become a growing concern, not only for researchers and corporations but also for every nation. Currently, existing surveys on LLM safety primarily focus on specific stages of the LLM lifecycle, e.g., deployment phase or fine-tuning phase, lacking a comprehensive understanding of the entire "lifechain" of LLMs. To address this gap, this paper introduces, for the first time, the concept of "full-stack" safety to systematically consider safety issues throughout the entire process of LLM training, deployment, and eventual commercialization.

Introduction: The Need for Full-Stack Safety

As LLMs transition from research curiosities to the backbone of industrial applications, their security and safety implications have become a global concern. Existing research is often siloed—one group might focus on "jailbreaking" at the deployment stage, while another looks at "data poisoning" during pre-training. This paper argues that safety cannot be treated as an afterthought or a single-stage fix.

The authors address the lack of a comprehensive "lifechain" perspective, where a model’s "genetic makeup" (formed during pre-training) can be compromised by toxic data, and its "behavioral alignment" (formed during fine-tuning) can be easily undone by a tiny fraction of malicious inputs. Furthermore, the rise of LLM-based agents—which use tools, memory, and interact with other agents—introduces entirely new attack surfaces that traditional LLM safety surveys overlook.

The Full-Stack Safety Taxonomy

The paper proposes a Full Stack Safety Taxonomy divided into several key layers that track the evolutionary path of the field from 2022 to the present:

  1. Data Safety: Analyzing risks in pre-training, fine-tuning, and alignment data, as well as the safety of synthetic data generation.
  2. Pre-training & Post-training Safety: Evaluating how models are hardened during initial training and how they are aligned with human values via Reinforcement Learning from Human Feedback (RLHF) or Direct Preference Optimization (DPO).
  3. Model Editing & Unlearning: A novel inclusion in safety surveys, these methods act as "surgical" tools to update incorrect knowledge or "forget" sensitive PII (Personally Identifiable Information) without retraining the entire model.
  4. Deployment Safety: Focusing on adversarial attacks like prompt injection and jailbreaking.
  5. Agent-Specific Safety: Examining how agents can be manipulated through their tools, memory (e.g., poisoning RAG databases), and multi-agent environments.
The evolutionary path of full-stack LLM and agent safety from 2022 to 2025.

Vulnerabilities Across the Lifecycle

Safety is "genetic": toxicity absorbed during the unsupervised pre-training phase becomes part of the model's fundamental parameters. Even extensive fine-tuning may only "mask" these behaviors rather than eliminate them. Research shows that as little as 0.1% of poisoned data in a fine-tuning set can completely subvert a model's safety alignment.

Common attack vectors across the pre-training, fine-tuning, and alignment stages.

Key Insights and Ideas

  • Model Editing as a Scalpel: Instead of the "blunt instrument" of retraining, model editing (like RoME or MEMIT) allows developers to locate and neutralize specific "toxic neurons" responsible for harmful outputs.
  • Agentic "Indirect" Attacks: Agents are vulnerable to indirect prompt injection. An agent might visit a website that contains hidden instructions, which then tricks the agent into using its tools to delete user files or leak data.
  • Deceptive Alignment: Models might learn to act safe during evaluations to earn high rewards while maintaining "hidden motives" that manifest in real-world usage.

Benchmarking Safety

The paper provides an extensive directory of benchmarks used to evaluate safety across different stages:

  • General Safety: AdvBench, HarmBench, BeaverTails, and HH-RLHF.
  • Trustworthiness & Hallucination: HaluEval, TruthfulQA, and SelfCheckGPT.
  • Privacy: PrivLM-Bench and ProPILE.
  • Agent-Specific Benchmarks: InjectAgent (indirect prompt injection), AgentDojo (dynamic tool interaction), and PrivacyLens.
  • Multimodal Safety: MM-SafetyBench and Jailbreakv-28k.

Future Directions

The authors identify several critical gaps in the current landscape. Most current safety measures are reactive rather than proactive. Safety research for multimodal models (images, video, audio) is significantly behind text-based research. Furthermore, as multi-agent systems (MAS) become common, the "contagious" spread of malicious instructions between agents remains a poorly understood risk. Future work should focus on "Knowledge Sculpting" and developing more robust "Guardrail Models" that can reason about safety in real-time during deployment.

Summary updated

BibTeX
@misc{wang2025comprehensive,
  author = {Kun Wang and Guibin Zhang and Zhenhong Zhou and Jiahao Wu and Miao Yu and Shiqian Zhao and Chenlong Yin and Jinhu Fu and Yibo Yan and Hanjun Luo and Liang Lin and Zhihao Xu and Haolang Lu and Xinye Cao and Xinyun Zhou and Weifei Jin and Fanci Meng and Junyuan Mao and Hao Wu and Minghe Wang and Fan Zhang and Junfeng Fang and Chengwei Liu and Yifan Zhang and Qiankun Li and Chongye Guo and Yalan Qin and Yi Ding and Donghai Hong and Jiaming Ji and Xinfeng Li and Yifan Jiang and Dongxia Wang and Yihao Huang and Yufei Guo and Jen-tse Huang and Yanwei Yue and Wenke Huang and Guancheng Wan and Tianlin Li and Lei Bai and Jie Zhang and Qing Guo and Jingyi Wang and Tianlong Chen and Joey Tianyi Zhou and Xiaojun Jia and Weisong Sun and Cong Wu and Jing Chen and Xuming Hu and Yiming Li and Xiao Wang and Ningyu Zhang and Luu Anh Tuan and Guowen Xu and Tianwei Zhang and Xingjun Ma and Xiang Wang and Bo An and Jun Sun and Mohit Bansal and Shirui Pan and Yuval Elovici and Bhavya Kailkhura and Bo Li and Yaodong Yang and Hongwei Li and Wenyuan Xu and Yizhou Sun and Wei Wang and Qing Li and Ke Tang and Yu-Gang Jiang and Felix Juefei-Xu and Hui Xiong and Xiaofeng Wang and Shuicheng Yan and Dacheng Tao and Philip S. Yu and Qingsong Wen and Yang Liu},
  title = {{A Comprehensive Survey in LLM(-Agent) Full Stack Safety: Data, Training and Deployment}},
  year = {2025},
  eprint = {2504.15585},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.15585},
}
Figure