NeurIPS 2026QuestionsPapersAreasAboutMarkdown

Local Sparsity Enables Unsupervised LLM Safety Detection

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

NeurIPS page · OpenReview · Open on the map

Category: AI Safety, Security & Alignment › Multimodal Safety Steering · Type: new method · Keywords: LLM safety detection, unsupervised anomaly detection, sparse autoencoder, local sparsity, sample complexity bound, linear representation hypothesis

Areas: Safety & Security › Language Model Security › Jailbreak Defense; Interpretability › Mechanistic Interpretability › Sparse Autoencoder Interpretability

Summary

The paper introduces a locally masked SAE-based anomaly detection framework that leverages local sparsity to enable unsupervised safety detection for LLMs.

Explained to a 5-year-old

Big computer programs called language models sometimes say things that are not safe. We want to catch those bad words without having to learn from bad examples. So we look at how the program works inside and find places where only a few parts light up. When new words appear that light up different parts, we know something might be wrong. This helps keep the program safe without needing a lot of bad data.

Explained to a 5-year-old, longer

Big computer programs that write sentences are called language models. They can sometimes write things that are not nice or safe. Usually, people teach them what not to say by showing bad examples. But new bad ideas keep appearing, so we need another way. The new idea is to only look at the good sentences and learn what normal looks like. Then we can notice when something new does not fit the normal pattern. We use a special tool that finds the few important parts of the model's thinking. If a new sentence lights up different parts than usual, we think it might be unsafe. This way we do not need to collect many bad examples. It helps keep the language model safe for everyone. The method works on many different language models and tests. It also works on special tests that check if the model knows how to answer questions.

For a technical reader

The work addresses deployment-time safety for large language models by treating unsafe detection as an anomaly-detection problem. It assumes only safe data is available and uses a sparse autoencoder to map activations into a lower-dimensional concept space where local sparsity can be exploited. A locally masked scheme then flags inputs that deviate from the normal pattern, with a theoretical guarantee that the required number of samples grows polynomially with sparsity and only logarithmically with the original dimension. Empirical results confirm the approach works across multiple model architectures and both general capability and safety-specific benchmarks.

Problem

Deploying large language models safely is challenging because supervised safety methods require unsafe training data and cannot anticipate novel attacks. Additionally, detecting anomalies in the high-dimensional activation space of LLMs is statistically difficult.

Method

The approach models safe LLM activations using a sparse autoencoder to obtain a low-dimensional concept space, exploits the observation that nearby points share limited active features, and applies a locally masked anomaly detection scheme to flag out-of-distribution inputs. It also provides a theoretical bound on the required sample size that grows polynomially with the sparsity and only logarithmically with the ambient dimension.

Contributions

It shows that under the linear representation hypothesis, local sparsity enables statistically feasible anomaly detection for LLM safety, provides a sample complexity bound scaling favorably with sparsity, and demonstrates empirical validation across multiple models and datasets.

Limitations and assumptions

The analysis relies on the linear representation hypothesis and assumes the concept space can be recovered via a sparse autoencoder.

Research questions this paper is counted under

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction