Train on prefill, monitor at decode: Using sparse autoencoders for topic monitoring
Abstract
Topic monitoring is the task of labelling the topic of each token in a model's response during generation. Activation-based monitors that run at generation time have so far been trained to detect harmful content and are limited to two or three classes. We introduce TopicScope, a framework for training causal topic classifiers on SAE features that assign a topic to every token, so that the label can change partway through a response. We train three detector architectures on synthetic multi-topic conversations covering seven topics. Across Gemma-3 1B and 4B, monitors trained on features extracted from prefill hidden states were able to generalise to decoding. We also found that the classifiers are robust to perturbations, losing at most 5 macro-F1 points when off-topic asides are inserted, topics are removed or sections are reordered. Ablations conducted to understand the contribution of the SAE revealed that classifiers reaching baseline performance without it were several times larger. Our findings show that compact topic monitors can be trained inexpensively in prefill and deployed during generation. More broadly, our work shows where SAEs are useful beyond safety classification. Our code, dataset and checkpoints are available at https://github.com/Mercity-AI/SAE-Guardrails and https://huggingface.co/collections/Mercity/online-guardrails-using-sparse-autoencoders-6ac602940468c62fefb2b9e8
Create a lesson
Related papers
SAE-Audit: Clinical-Trial Prediction via Inference-Time Optimization of Black-Box LLMs Audited by Sparse Autoencoder Evidence
Shared title terminology · Junbo Shen
Learning from Another Angle: Rotation-Based Test-Time Training for Multimodal Large Language Models
Shared title terminology · Changyu Liu, Fei Zhao, Yiyang Liu et al.
Beyond Single-Turn Privacy: Training-Data Leakage in Conversational RAG
Shared title terminology · Syed Khaderi, Karima Makhlouf, Sami Zhioua
Internalized Experience: How Training Data Shapes Memory Formation in LLMs
Shared title terminology · Xianxuan Long, Xinnan Dai, Kai Guo et al.
CausalNTP: A World-Model Recipe for Causal Next-Token Prediction under Noisy Training-data
Shared title terminology · Devansh Arpit
SAMA: Training-Free Consensus Ridge Tracking for Camera-Based Heart Rate on Five Public Datasets
Shared title terminology · Sudhakar Mishra