acceptodds
Published as a conference paper at NeurIPS 2026

Local Sparsity Enables Unsupervised LLM Safety Detection

Xin Chen, Cynthia, Gil Kur, Aleksandr Shevchenko, Andreas Krause

Abstract

Deployment-time safety methods for large language models (LLMs) are predominantly supervised and assume access to unsafe training data. Nevertheless, new attacks and harm categories regularly arise, not captured by models trained in such a supervised fashion. An alternative approach is to view this problem through the lens of anomaly detection, namely, to rely solely on modeling safe data and flagging out-of-distribution inputs. However, LLM activations lie in a high-dimensional space, raising concerns about whether anomaly detection is statistically feasible. We show that, under the linear representation hypothesis (LRH), there may indeed be hope. In the LRH concept space, which is typically recovered via a sparse autoencoder (SAE), nearby points share a small common active support. Based on this local sparsity insight, we propose a framework for locally masked SAE-based anomaly detection, and establish a sample complexity bound that scales polynomially in the local sparsity and only logarithmically in the SAE's ambient dimension. Finally, we empirically validate our framework on various architectures and datasets, including both capability-testing datasets and safety-specific datasets.

Keywords:
Sydney, Main Track

Reviews

Among:
Shape:
123456this paper, Bottom 17%
Figure 1. Mean review rating of the reviewed papers at NeurIPS 2026. This paper averages 4.00 over 3 reviews, above 17% of the others.
Reviewer_JDEVOpenReview ↗
Rating
4
Clarity
3
Confidence
4
Originality
3
Quality
3
Significance
2
Read review
Summary

This paper presents an anomaly detection approach based on sparse autoencoder (SAE) features extracted from LLM hidden states. The central hypothesis is that, although hidden states are nominally high-dimensional, their effective representation can be characterized by a small number of active SAE features. Operating in this sparse feature space enables the application of conventional anomaly detection techniques. Specifically, the method clusters SAE embeddings and assigns anomaly scores based on either reconstruction loss or distances to cluster centroids. Two variants, FREQ MASK-KM and LEARNED MASK-LORA, are proposed, differing in how salient features are selected and how anomaly scores are computed.

Strengths and weaknesses

Strength:

  • The problem is well-motivated and formulated; the solution is straightforward.

  • The paper is also well-written and easy to follow.

  • Auc of FREQ MASK-KM achieves near supervised upperbound on Ministral 8B and LLaMA3 8B.

Weakness:

  • There are some related works using SAE representations for downstream analysis. For example, [1] examines SAE features as representations for probing and classification. So I think the paper would benefit from spelling out a bit more clearly how it relates to this work, so readers can see exactly what's new here. Given that both the representation and the detection machinery draw on well-established lines of work, it would help to spell out more clearly where the specific novelty lies.

  • Improvements can be made to the experiments, such as more comparisons, better organization, and more analysis, especially in Sec 4.3. See questions.

[1] Kantamneni et al., Are Sparse Autoencoders Useful? A Case Study in Sparse Probing, ICLR 2025

Questions
  • While the empirical results are promising, the experimental evaluation could be further strengthened through additional ablations and analyses.

  • Since one big claim of this paper is that the SAE Embedding helps the AD, I would like to see a comparison of the proposed method on SAE embedding (current) and activations (new) in Table 2. So the Kmeans, and centroid distance scoring are purely done in the activation space.

  • Also, due to the many dimensions (activation vs. SAE space, local vs. global, clustering) evaluated in Table 2, I would suggest expanding this part and reorganizing it or plotting for different variables.

  • Continuing the previous question, the findings in line 239 are not from an apple-to-apple comparison. The first sentence compares CVDD with activation and CVDD with SAE, but the second sentence compares the variants of the proposed methods. I would suggest making the comparison as consistent as possible and separating different evaluations to have sharper conclusions.

  • It seems the simpler FREQ MASK-KM outperforms the tailored LEARNED MASK-LORA, I am interested in seeing a more detailed comparison between FREQ MASK-KM and LEARNED MASK-LORA in terms of performance vs. their different design choices (SAE embeddings, scoring), to understand which brings the gain.

  • Another interesting variant will be removing the mc in line 166, to see if the active features are sufficient for AD.

  • I noticed that there are other experiments in the appendix. Just in case you have already done any suggested experiments, I would suggest reorganizing the exp section, mentioning the existing findings in the main text, and referencing the appendix for details.

typo: line 40: Deep CVDD-> Deep SVDD?

Limitations

Yes, the author discussed the limitations

Paper formatting concerns

No.

Final justification

I appreciate the author's comprehensive feedback.

For W1, I kinda disagree because OCC anomaly detection is just a special form of classification. Besides the actual classification technique, [1] tries to answer in general whether SAE is a useful signal in different tasks, which I found highly relevant to this submission. Considering the position of [1], I was asking about how the findings of the work align or differ from the findings in [1], instead of a technical position comparison.

I believe that the discussion will connect SAE research and help people understand more about SAE embeddings. So I do believe this is an important part to be added to the revision.

Besides this, the author addressed most of my concerns. I think revising the paper according to the author's response is very necessary, especially reorganizing the experiments, separating different comparison dimensions, mentioning important findings, etc.

I didn't change my score because I had already given it a positive rating.

Reviewer_X8y1OpenReview ↗
Rating
4
Clarity
3
Confidence
3
Originality
3
Quality
3
Significance
3
Read review
Summary

The paper effectively transforms the difficult, high-dimensional problem of LLM safety into a series of efficient, low-dimensional, cluster-specific anomaly detection tasks. It argues that because LLM knowledge is organized into sparse, local patches, and then they can monitor the model much more accurately and efficiently than previously thought.

Strengths and weaknesses

Strengths

  1. The paper proposes a novel framework that effectively leverages SAEs to address the 'superposition' phenomenon in LLM activations and use it for LLM Safety Detection

  2. The theoretical motivation for local sparsity is compelling. Specifically, the analysis of effective dimension provides a solid mathematical justification for the framework's effectiveness.

  3. The experimental evaluation is rigorous.

Weaknesses

  1. One possible weakness is that it seems this paper preassumes a closed-set scenario where the safe set encompasses all relevant task distributions. I am concerned about the potential for high false-positive rates on benign out-of-distribution (OOD) inputs that do not belong to any safe clusters. The authors should discuss or empirically evaluate how the framework behaves on novel, harmless domains.

  2. The choice of the intermediate layer is justified by heuristic arguments. However, anomaly detection performance is often sensitive to the layer depth. Moreover, from my view, different types of 'unsafe' inputs (e.g., toxic content vs. adversarial prompts) should exhibit different activation patterns (e.g different patterns on different layers). The current aggregation hides these nuances.

Questions
  1. The detection relies on a static safety threshold in the activation space. What happens if an adversary employs 'distribution-aware attacks' that intentionally shift their activation patterns to land within the 'safe' clusters while still generating harmful content?

  2. The method operates on the final response token (as stated in Section 4.1). Does it provide any protection against multi-step reasoning processes where the malicious intent is only consolidated in the final generated tokens?

Limitations

yes

Paper formatting concerns

No

Final justification

I will keep my score.

Reviewer_S1S5OpenReview ↗
Rating
4
Clarity
3
Confidence
3
Originality
3
Quality
3
Significance
3
Read review
Summary

This paper introduces an unsupervised anomaly detection framework for identifying unsafe inputs to Large Language Models (LLMs) at deployment time, a crucial task given the evolving nature of attacks and the limitations of supervised methods that rely on pre-labeled unsafe data. The core insight is that LLM activations, despite being high-dimensional, exhibit a "local sparsity" structure when projected into a concept space learned by a Sparse Autoencoder (SAE).

Strengths and weaknesses

Strengths

  1. Addresses a critical problem where supervised LLM safety detection struggles with unknown attacks at deployment.
  2. Successfully circumvents the "curse of dimensionality" in high-dimensional anomaly detection by leveraging "local sparsity" in LLM activations.
  3. Proposes a modular, multi-stage framework that allows for flexible design choices and instantiations.
  4. Demonstrates effectiveness and generality through extensive empirical validation across multiple LLM models and diverse unsafe behavior categories.
  5. Offers deep insights into the impact of various design choices within the framework through detailed ablation studies.

Weaknesses

  1. There is a measurable gap in AUROC performance compared to supervised methods.
  2. The method is sensitive to the safe training distribution, potentially leading to false positives on legitimate but out-of-distribution inputs.
  3. Performance is highly dependent on the quality of the pre-trained SAE.
  4. While its core "local sparsity" assumption is validated, its generalizability to future models or scenarios requires further assessment.
Questions
  1. The paper repeatedly emphasizes that "local sparsity" is central to the success of its method. However, it fails to provide sufficient intuitive explanations or concrete examples regarding how local sparsity is specifically quantified and measured in practice, or how the radius value "not small" r0r_0 (eq. 3) is determined. This makes it difficult for readers to fully grasp the underlying mechanism. Could you provide a concrete example demonstrating how an LLM activation exhibits shared sparse characteristics within its "local neighborhood," and explain how an appropriate r0r_0 is selected?
  2. The paper notes that "the method becomes sensitive to the quality of the pretrained SAE, since errors in the recovered concepts propagate through later stages." Given the critical importance of SAE quality, the paper's analysis of the SAE training process and hyperparameters—as well as the sensitivity study—appears insufficient. Could you provide more information regarding the robustness of SAE training, along with ablation study results showing how varying SAE quality impacts the final anomaly detection performance?
  3. In Section 3.5, the paper introduces two instantiation methods (FREQMASK-KM and LEARNEDMASK-LORA) and presents their performance in Tables 1 and 2. However, the paper lacks a thorough comparative analysis regarding the underlying motivations for the specific design choices concerning the local sparse subspace identification mechanism, as well as the respective use cases or advantages of these methods.
Limitations

yes

Paper formatting concerns

NO

Final justification

I will keep my score.

Comments on the paper

1 comment
Meta-review

This paper proposes an unsupervised framework for detecting unsafe LLM inputs using sparse autoencoder representations, local sparsity, clustering, and cluster-specific anomaly detection. The reviewers agree that the problem is important, the framework is technically reasonable, and the experiments cover multiple LLMs and unsafe behavior categories. No clear fatal flaw has been identified.

However, the paper remains borderline and requires clarification on three prioritized issues:

  1. Local sparsity: Please define how local sparsity is quantified, explain how the neighborhood radius is selected, and clarify its consistency across models, layers, and attack types.

  2. Deployment robustness: Please discuss false positives on benign out-of-distribution inputs, threshold calibration, and robustness against adaptive attacks designed to resemble safe activation patterns.

  3. SAE dependence and novelty: Please clarify sensitivity to SAE quality, layer and token selection, and distinguish the proposed contribution from prior SAE-based probing or classification methods. Component-level evidence separating the effects of SAE representations, clustering, masking, and anomaly scoring would also help.

The gap from supervised methods is not decisive because the paper targets a different setting without labeled unsafe data. Extensive new experiments are not required during rebuttal. If these assumptions and robustness concerns are convincingly addressed, I would support acceptance as a poster.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.