arXiv:2610.02300cs.AIOct 2026

Manuscript Offprint

arXiv:2610.02300

Keep It CALM: Analyzing the Limits of Global Unsafety in Text-to-Image Generation

NaHyeon Park, Minhyun Lee, Hyunjung Shim

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Training-free safeguards for text-to-image generation often rely on a reusable safety signal, such as an unsafe direction or global toxic subspace, applied broadly across prompts. We provide a controlled geometric analysis of this global-unsafety assumption and reveal a consistent coverage-selectivity trade-off: compact unsafe subspaces fail to cover heterogeneous unsafe semantics, whereas broader aggregation increasingly distorts safety-adjacent benign prompts. Motivated by this finding, we propose CALM (Counterfactual Adaptive Local Modulation), a training-free safeguard that replaces uniform global removal with prompt-local counterfactual correction. Using matched unsafe-benign anchors, CALM routes each prompt to active unsafe categories, minimally edits only violating token representations toward the safe side, and suppresses positively aligned unsafe residual components. Across broad evaluation, CALM significantly improves unsafe content suppression while preserving benign utility, demonstrating that local counterfactual correction provides a more selective alternative to global unsafe signal removal. Code is available at https://github.com/nahyeonkaty/calm.

Note: This paper contains contents that may be inappropriate or offensive.

1 Introduction

Text-to-image models [21, 39, 44, 50, 53] have become a central interface for high-fidelity visual generation, enabling creative and practical use with natural-language prompts. The same open-ended controllability, however, makes these systems difficult to safeguard. Deployed safety filters can be bypassed [43], and recent attacks show that unsafe visual content can often be elicited even from models with dedicated guardrails, through jailbreaks [7, 15, 32, 38, 49, 56], red-teaming [8, 24, 52], and concept recovery [48, 59]. These failures highlight safe generation as a core challenge for deploying generative visual systems in open-ended, user-facing settings.

Existing defenses intervene at different stages of the generation pipeline. Training-time and model-editing methods modify model parameters or internal representations through safety-oriented alignment [33] or restricted-concept removal and unlearning [3, 6, 12, 22, 30, 31, 54]. Inference-time safeguards instead keep the generator fixed and intervene through prompt moderation [58], text encoding [34, 57], or latent editing [18, 19, 23, 29, 37, 46]. This modularity makes inference-time safeguards attractive for deployed systems. However, many training-free safeguards reuse a fixed safety signal across prompts, such as a category-level unsafe direction [19, 46], a negative guidance rule [2, 5, 34], or a global toxic subspace [57]. This raises a central question: is unsafety sufficiently compact and transferable to be treated as a single global object of intervention?

A useful safeguard must solve a selective intervention problem: it should suppress harmful visual evidence when present, while preserving benign prompts that may otherwise trigger false-positive suppression. For reusable inference-time signals, this requires both coverage (i.e., broad transfer across heterogeneous harmful prompts) and selectivity (i.e., minimal distortion of nearby benign semantics). We examine whether these two requirements hold in the frozen text-encoder representation

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

space used by text-to-image models. Using controlled diagnostics based on subspace angles [4, 60], projector overlap [9, 13], spectral effective rank [16, 45], and nearest-neighbor preservation, we find that pooled unsafe geometry faces a persistent coverage–selectivity trade-off.

Specifically, the coverage side analysis reveals several limitations of global unsafe geometry. Unsafe category subspaces are sensitive to finite lexical sampling, and different unsafe categories share only weak compact overlap, suggesting that unsafety is not a stable global object. Moreover, pooled subspaces estimated from seen unsafe categories transfer unevenly to unseen categories. A natural response is to increase the rank of the pooled subspace. However, broader projection exposes the selectivity side of the trade-off: it increasingly perturbs safety-adjacent benign concepts, such as medical emergency, historical conflict, and combat sports. Thus, the core issue is the use of a single prompt-independent removal object: heterogeneous unsafe content is collapsed into one target and removed in a coarse-grained, undifferentiated manner.

These findings motivate a local minimal-intervention view of inference-time safety. Rather than compressing heterogeneous unsafe anchors into a single direction or subspace for global deletion, we keep matched unsafe–benign counterfactual pairs as the basic unit of safety information. This counterfactual structure specifies not only what to remove, but also where to move: toward the matched safe side of the local unsafe evidence. Fig. 1 illustrates this distinction: global removal suppresses a broad unsafe region, whereas local counterfactual pairs enable moving prompt-specific unsafe evidence toward its matched benign side. To this end, we introduce CALM (Counterfactual Adaptive Local Modulation), a training-free safeguard that implements this principle with matched unsafe–benign anchors. Given a prompt, CALM routes it to a sparse set of active unsafe categories using unsafe–benign counterfactual margins. It

Figure

Figure 1: 2D illustration of text embedding space

then edits only token representations that violate the routed safe half-spaces (i.e., the safe sides of local boundaries), projecting them minimally toward the matched benign side. During denoising, it uses the same routed counterfactuals to suppress positively aligned unsafe residual components. Our method does not require any external safety classifier, reward model, or image-level feedback.

We evaluate CALM along three axes: harmful-prompt mitigation, benign utility, and backbone transfer. Across broad unsafe-prompt benchmarks including adversarial prompt attacks [55, 59], CALM provides strong unsafe-content suppression on SD-v1.4 while maintaining text fidelity and general benign utility. A multi-category unsafety evaluation on I2P benchmark [46] and ViSU [40] further shows that the routed counterfactual design improves safety across heterogeneous harm categories, rather than only on a single narrow attack type. Beyond SD-v1.4, CALM also reduces unsafe generations on recent backbones, including SDXL [39], FLUX.1 [20], SANA1.5 [53], and OmniGen2 [50]. These results suggest that local counterfactual correction is a lightweight and modular alternative to global unsafe-signal removal.

Our contributions are threefold. First, we provide a controlled geometric analysis showing that pooled unsafe removal faces a practical coverage–selectivity trade-off: compact global subspaces undercover held-out unsafe categories, whereas broader projection increasingly distorts safety-adjacent benign semantics. Second, we introduce CALM, a training-free prompt-responsive safeguard that uses matched unsafe-benign counterfactuals to define local safe sides and perform minimal correction toward safe generation. Third, we evaluate CALM across harmful-prompt, benign-utility, multi-category, and backbone-transfer settings, with ablations isolating the effectiveness of each component.

References (55)