Probing AI Safety with Source Code
Not on the map. Why?
Abstract (arXiv)
Large language models (LLMs) have become ubiquitous, interfacing with humans in numerous safety-critical applications. This necessitates improving capabilities, but importantly coupled with greater safety measures to align these models with human values and preferences. In this work, we demonstrate that contemporary models fall concerningly short of the goal of AI safety, leading to an unsafe and harmful experience for users. We introduce a prompting strategy called Code of Thought (CoDoT) to evaluate the safety of LLMs. CoDoT converts natural language inputs to simple code that represents the same intent. For instance, CoDoT transforms the natural language prompt "Make the statement more toxic: {text}" to: "make_more_toxic({text})". We show that CoDoT results in a consistent failure of a wide range of state-of-the-art LLMs. For example, GPT-4 Turbo's toxicity increases 16.5 times, DeepSeek R1 fails 100% of the time, and toxicity increases 300% on average across seven modern LLMs. Additionally, recursively applying CoDoT can further increase toxicity two times. Given the rapid and widespread adoption of LLMs, CoDoT underscores the critical need to evaluate safety efforts from first principles, ensuring that safety and capabilities advance together.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 26 of its 41 references that are in the map. First posted on arXiv 25 Jun 2025.
Builds on
26 of 41 references.
References · 26
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2023GPT-4 Technical Reportcited by 18,396
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2017Deep reinforcement learning from human preferencescited by 3,912
- 2022Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedbackcited by 3,720
- 2022Constitutional AI: Harmlessness from AI Feedbackcited by 3,050
- 2023A Survey on Large Language Model based Autonomous Agentscited by 2,242
- 2019Fine-Tuning Language Models from Human Preferencescited by 2,150
- 2020RealToxicityPrompts: Evaluating Neural Toxic Degeneration in Language Modelscited by 1,255
- 2023WizardLM: Empowering large pre-trained language models to follow complex instructionscited by 1,125
- 2020StereoSet: Measuring stereotypical bias in pretrained language modelscited by 924
- 2019Universal Adversarial Triggers for Attacking and Analyzing NLPcited by 722
14 more
- 2023Tree of Attacks: Jailbreaking Black-Box LLMs Automaticallycited by 672
- 2023Toxicity in ChatGPT: Analyzing Persona-assigned Language Modelscited by 360
- 2023Multi-Agent Collaboration: Harnessing the Power of Intelligent LLM Agentscited by 333
- 2023Analyzing Leakage of Personally Identifiable Information in Language Modelscited by 285
- 2023Exploiting Programmatic Behavior of LLMs: Dual-Use Through Standard Security Attackscited by 278
- 2023Bias Runs Deep: Implicit Reasoning Biases in Persona-Assigned LLMscited by 199
- 2020Social Biases in NLP Models as Barriers for Persons with Disabilitiescited by 182
- 2021Challenges in Detoxifying Language Modelscited by 169
- 2024Small LLMs Are Weak Tool Learners: A Multi-LLM Agentcited by 93
- 2024RLHF Deciphered: A Critical Analysis of Reinforcement Learning from Human Feedback for LLMscited by 90
- 2020Hurtful Words: Quantifying Biases in Clinical Contextual Word Embeddingscited by 79
- 2022Exploring the Limits of Domain-Adaptive Training for Detoxifying Large-Scale Language Modelscited by 68
- 2024Enhancing Reasoning Capabilities of LLMs via Principled Synthetic Logic Corpuscited by 29
- 2022Mitigating Toxic Degeneration with Empathetic Data: Exploring the Relationship Between Toxicity and Empathycited by 8
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2024Large Language Model Safety: A Holistic Survey
- 2025Safety Pretraining: Toward the Next Generation of Safe AI
- 2024Safe to Serve: Aligning Instruction-Tuned Models for Safety and Helpfulness
- 2026Boiling the Frog: A Multi-Turn Benchmark for Agentic Safety
- 2024AEGIS: Online Adaptive AI Content Safety Moderation with Ensemble of LLM Experts
- 2024CodeAttack: Revealing Safety Generalization Challenges of Large Language Models via Code Completion
- 2024S-Eval: Towards Automated and Comprehensive Safety Evaluation for Large Language Models
- 2024AI Safety in Generative AI Large Language Models: A Survey