Train on prefill, monitor at decode: Using sparse autoencoders for topic monitoring

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.

主题监控是一项在模型生成响应时,为每个标记(token)标注主题的任务。目前,在生成阶段运行的基于激活的监控器主要被训练用于检测有害内容,且仅限于两到三个类别。

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.

我们引入了 TopicScope,这是一个基于稀疏自编码器(SAE)特征训练因果主题分类器的框架。该框架为每个标记分配一个主题,使得标签可以在响应过程中途发生变化。我们在涵盖七个主题的合成多主题对话上训练了三种检测器架构。

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.

在 Gemma-3 1B 和 4B 模型中,基于从预填充(prefill)隐藏状态提取的特征所训练的监控器,能够泛化到解码阶段。我们还发现,这些分类器对扰动具有鲁棒性;当插入无关的题外话、删除主题或重排章节时,其宏观 F1 分数最多下降 5 个点。

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.

为理解 SAE 的贡献而进行的消融实验表明,若不使用 SAE,达到基准性能的分类器体积要大出数倍。我们的研究结果表明,紧凑型主题监控器可以在预填充阶段以低成本进行训练,并部署在生成阶段。

More broadly, our work shows where SAEs are useful beyond safety classification. Our code, dataset and checkpoints are available at this https URL and this https URL.

更广泛地说,我们的工作展示了 SAE 在安全分类之外的用途。我们的代码、数据集和检查点可在该 HTTPS 链接和该 HTTPS 链接获取。