Manuscript Offprint

arXiv:2610.07532

Safeguarding LLMs via Model-Agnostic Latent Safety Signals from Dark Knowledge

Wonjun Lee, Kyungsik Yang, Gaeun Ji, Vaidehi Patil, Haon Park, Bumsub Ham, Mohit Bansal, Suhyun Kim

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

Abstract

Large Language Models (LLMs) have advanced rapidly, raising growing concerns about their safety. Recent work has proposed various approaches to detect and defend against adversarial attacks including defense mechanisms at the decoding stage that leverage models' internal hidden states. However, existing decoding-stage defenses suffer from two limitations. First, they introduce a trade-off between safety and over-refusal, where strengthening safety degrades the model's helpfulness on benign queries. Second, many of these methods rely on internal hidden states and are thus restricted to specific architectures, incurring substantial overhead and limited generalization across models. To address these limitations, we introduce LADE (Latent Safety Signals for Defense), which leverages latent safety signals extracted by contrasting harmful and benign queries from dark knowledge (i.e., information carried by the output probability distribution beyond its argmax) in the first-token output probability distribution. Our key insight is that, beyond surface-level refusal tokens, the dark knowledge in the first-token distribution contains latent safety signals, defined as tokens whose probabilities differ sharply between harmful and benign queries. We empirically show that these signals consistently align across the safety-aligned LLMs, forming a model-agnostic direction that emerges from safety alignment. LADE consists of three components: (1) Extracting Latent Safety Signals from Dark Knowledge, which selects top-k safety-discriminative tokens from the first-token probability distribution; (2) Tokenizer Mapping, which maps these tokens across different tokenizers to enable model-agnostic application; and (3) kNN-based Discrimination, which classifies queries via a k-Nearest Neighbors search over the mapped tokens. Across diverse LLMs and multiple benchmarks, LADE remains robust against a wide range of jailbreak attacks and lowers attack success rates while maintaining a competitive safety-utility trade-off.

Warning: This paper contains examples of harmful language. Reader discretion is advised.

1 Introduction

Large language models (LLMs) have advanced rapidly in recent years, achieving strong performance across a wide range of natural language tasks. However, this progress has been accompanied by growing concerns over their safety [8, 30]. A primary concern is adversarial attacks, such as jailbreaking, which bypass the safety guardrails of LLMs to elicit harmful responses [13, 23, 2, 6, 52]. To address this, a substantial body of research has proposed various defense mechanisms against such threats.

Among these, recent defense methods have increasingly turned to decoding-stage interventions that leverage models’ internal hidden states to steer generation away from harmful outputs [44, 48]. While

†^{\dagger}Corresponding Author.

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

Figure

Figure 1: The key idea of LADE. (Left) Latent safety signals (red points), identified by contrasting first-token probabilities between harmful and benign queries, are extracted from a reference LLM and transfer across target LLMs, while model-specific surface tokens (gray points) remain scattered. (Right) Refusal tokens capture only a small subset of safety signals and fail to separate harmful from benign queries (top), whereas adding extracted latent safety signals yields clear separation (bottom).

effective, such approaches suffer from two fundamental limitations. First, there exists an inherent trade-off between safety and over-refusal: as safety mechanisms become more stringent, the model's helpfulness on benign queries degrades, resulting in over-refusal [33, 10, 44, 48]. Second, reliance on internal hidden states requires architecture-specific auxiliary modules [48, 21], which incurs substantial overhead and prevents generalization across diverse LLMs.

To address these limitations, we introduce LADE (Latent Safety Signals for Defense), a defense framework that identifies queries likely to elicit harmful responses by leveraging latent safety signals extracted from dark knowledge in the first-token output probability distribution. Dark knowledge [16] refers to the fine-grained information in the entire probability distribution beyond the highest-probability token, capturing a model's nuanced preferences across candidate tokens. Our key observation is that, beyond surface-level refusal tokens (e.g., "Sorry", "As"), latent safety signals in the dark knowledge of the first-token distribution provide a more reliable signal for safety discrimination.

We illustrate this observation in Figure 1. The right panel compares the first-token probabilities of a harmful and a benign query, where the upper plot uses only refusal tokens and the lower plot additionally includes the latent safety signals leveraged by LADE. While refusal tokens are surface-level expressions whose probability patterns vary substantially across LLMs, latent safety signals provide complementary discriminative information that strengthens safety distinction across diverse safety-aligned LLMs, even when their tokenizers, architectures, and surface refusal patterns differ. The left panel further shows that these signals, once extracted from a reference LLM, consistently transfer to other target LLMs, forming a shared model-agnostic direction that emerges from safety alignment.

Building on this insight, LADE operates entirely on the output probability distribution, without access to internal hidden states. LADE consists of three components: (1) Extracting Latent Safety Signals from Dark Knowledge, which extracts top-k candidate tokens from the first-token probability distribution, capturing the latent safety signals beyond surface-level tokens; (2) Tokenizer Mapping, which maps the extracted tokens into a unified token space across diverse tokenizers; and (3) kNN-based Discrimination, which classifies each query as harmful or benign by its distance to a set of harmful reference queries via k-Nearest Neighbors. This design makes LADE model-agnostic and transferable across LLMs, while filtering harmful queries before generation begins.

We validate LADE through comprehensive experiments on diverse LLMs (including Llama-2-7B-Chat [40], Llama-3-8B-Instruct [12], Qwen2-7B-Instruct [46], Qwen3-8B [45], Gemma-7B-it [38], and Mistral-7B-Instruct-v0.3 [18]) across multiple safety benchmarks [35, 31, 52] and diverse jailbreak attacks [23, 52, 6, 2, 20]. Our results show that LADE substantially reduces attack success.

rates and maintains a competitive safety-utility trade-off against existing defense baselines and dedicated guard models [27, 26, 14] across diverse adversarial settings. To summarize, our main contributions are as follows:

• We discover that the first-token output probability distribution of safety-aligned LLMs contains latent safety signals that transfer consistently across the safety-aligned LLMs, forming a shared model-agnostic direction for distinguishing harmful from benign queries.

• Building on this finding, we propose LADE, a model-agnostic defense framework that operates entirely on output probabilities through three components: extracting latent safety signals from dark knowledge, tokenizer mapping, and kNN-based discrimination.

• Through comprehensive experiments on diverse LLMs across multiple benchmarks and jailbreak attacks, we demonstrate that LADE substantially reduces attack success rates and achieves a competitive safety-utility trade-off against existing defense baselines and guard models.

References (52)