Lune

ISSTA2026Top-tier venue

CAST: A Compiler-Based Framework for Systematically Testing LLM Compositional Safety

Lu Yan, Zhuo Zhang, Xiangzhe Xu, Shengwei An, Guangyu Shen, Zhou Xuan, Xuan Chen, Xiangyu Zhang

Abstract

Large language models (LLMs) are increasingly used in software pipelines, raising concerns about harmful behaviors in security-critical domains. Existing safety evaluations predominantly probe models with single prompts or short interactions, and therefore do not capture how safety behaves under multi-step workflows where individual requests are composed into complex behavior. This paper introduces compositional safety, the property that an LLM remains safe not only against isolated malicious prompts, but also under structured, long-horizon decompositions of harmful intents. We propose CAST, a systematic testing framework designed to evaluate the compositional safety of LLMs in the domain of malicious code. Drawing inspiration from modern compiler infrastructures, CAST decouples test case generation from test execution using a novel intermediate representation, CAIR. This architecture allows the framework to automatically refine high-level testing intents into granular sub-tasks that serve as unit tests for the model’s alignment. These components are subsequently instantiated by the SUT and reassembled according to the CAIR control structure. The resulting artifact is then evaluated by intent-fulfillment scoring and, for the severity subset, external behavioral detectors and manual inspection. We evaluate CAST on four state-of-the-art LLMs across three security-critical testbeds. Our results demonstrate that CAST systematically exposes severe safety violations in strongly aligned models that resist conventional red-teaming, achieving up to a 365% increase in successful test cases compared to baseline testing strategies

Ask Lune

Know where this paper stands in minutes, not an afternoon.

Lune can read the top-tier papers that cite it and the ones closest to it, and tells you what it claims, what came after and where it falls short, each point cited to the paper it comes from. No skimming, no AI slop.

Questions to start from

Lune can draw on

its abstract · related work

Get the answer

Free to start. No credit card required.

Related papers

  1. Inverting the Shield: Systematically Generating Safety Tests from Policy SpecificationsXiaoyue Lu, Xianglin Yang, Haijun Liu, Jiahao Liu et al.ACL 2026
  2. The Art of Defending: A Systematic Evaluation and Analysis of LLM Defense Strategies on Safety and Over-DefensivenessNeeraj Varshney, Pavel Dolin, Agastya Seth, Chitta BaralACL Findings 2024 · 13 citations
  3. Casting a SPELL: Sentence Pairing Exploration for LLM Limitation-BreakingYifan Huang, Xiaojun Jia, Wenbo Guo, Yuqiang Sun et al.FSE 2026
  4. SEMA: Simple yet Effective Learning for Multi-Turn Jailbreak AttacksMingqian Feng, Xiaodong Liu, Weiwei Yang, Jialin Song et al.ICLR 2026 · 13 citations
  5. LongSafety: Evaluating Long-Context Safety of Large Language ModelsYida Lu, Jiale Cheng, Zhexin Zhang, Shiyao Cui et al.ACL 2025 · 6 citations
Dusk over the sea between two cliffs drawn in fine vertical lines