读见

打开黑箱:使用 Kiji Inspector 对 AI 智能体的工具选择进行关键可解释性分析

原题Opening the Black Box: Critical Explainability for AI Agent Tool Selection with Kiji Inspector

约 25 分钟约 6,177 字原文英文已翻译

推荐理由Kiji Inspector 聚焦决策 token,以稀疏自编码器和因果消融分析工具选择。开发者可了解如何从模型内部特征追到具体决策,而不只接受一段事后解释。

读前速览

5 个要点

本文介绍了开源工具 Kiji Inspector。它利用稀疏自编码器分析模型激活,并通过因果验证解释 AI 智能体如何做出工具选择决策。

  1. Kiji Inspector 使用稀疏自编码器分析模型激活,解释 AI 智能体的工具选择决策

    该框架使用 1 million 个样本(500,000 组对比样本对)进行训练,以识别驱动特定工具选择的激活特征,从而让智能体决策过程具备可解释性。

  2. 采用锚点与对抗样本进行对比样本对训练,可更准确地识别工具选择特征

    系统将正确的工具响应与相似但不正确的替代方案配对,例如内部数据库查询与在线查询,从而识别出导致决策结果不同的特征。

  3. 通过激活消融进行因果验证,可以揭示哪些特征确实影响了工具选择

    将最显著的激活值归零并测量工具选择的变化后发现,23 种对比类型对决策具有因果影响,而不仅仅是相关性。

  4. 该框架可与 vLLM 集成用于生产环境,并支持多个开源模型

    通过为 vLLM 提供补丁,框架能够提取激活;同时提供 Docker 容器和 PyPI 软件包,可端到端部署于 Gemma、Nemotron 等模型。

  5. 选择第 20 层,能够在抽象程度与人类可解释性之间取得平衡

    较浅的层捕捉提示词相关性,而更深的层会变得过于抽象;在 Nemotron 3 中,第 20 层最适合提取和理解特征。

完整摘要

本文介绍了由 Dataiku 的 575 Lab 开发的开源框架 Kiji Inspector,旨在解释 AI 智能体的决策过程,尤其是工具选择。该方案利用稀疏自编码器分析模型特定层的激活,将多义神经元表征拆分为不同特征。框架使用 1 million 个样本(500,000 组对比样本对)进行训练,以识别驱动工具选择决策的特征。其主要创新包括聚焦决策 token 而非完整提示词、采用对比样本对训练(锚点与对抗样本),以及通过激活消融进行因果验证。该框架支持 Gemma 和 Nemotron 等多个开源模型,并可与 vLLM 集成以用于生产环境。结果显示,23 种对比类型能够成功预测工具选择,证明该方法有助于提升智能体系统的可解释性。

目录 · 9 节

查看原文

文字记录Transcript

Hannes Hapke:今天,我们想揭开那些令人着迷的大语言模型和智能体的黑箱,弄清楚该如何使用它们。我叫 Hannes,是一名机器学习工程师,也是 Dataiku 的工程总监。此外,我还有幸负责 Dataiku 的开源实验室,名为 575 Lab。我们致力于责任领域的开源项目。我曾参与合著一些机器学习领域的出版物,也对机器学习系统着迷,喜欢将它们投入生产环境,也喜欢参与开源项目。与其说我是研究人员,不如说我是一个将机器学习模型投入生产,并围绕它们构建系统的人。我很荣幸能代表 575 Lab 来到这里。575 Lab 是 Dataiku 内部一个很棒的组织,我们可以在这里开发与负责任 AI 相关的开源工具。Dataiku 坚信负责任 AI 必须是开放的,因此,凡是涉及隐私或可解释性的工作,都属于我们实验室的范畴。Hannes Hapke: Today we want to open up the black box of our lovely LLMs and agents and want to figure out what to do with them. My name is Hannes. I'm a machine learning engineer. I'm director of engineering at Dataiku, but I also have the great opportunity to run Dataiku's open-source lab, it's called 575 Lab. We work on open-source projects in the responsibility space. I've had the chance to co-author some machine learning publications, and I'm fascinated with machine learning systems, to put them into production, to work on open-source projects. I'm less the research person, I'm more like the person who brings machine learning models into production and building systems around it. I have the great chance to represent 575 Lab here. That is a wonderful organization within Dataiku where we can build open-source tools around responsible AI. Dataiku strongly believes that responsible AI has to be open, so anything that touches privacy or explainability, that is part of our lab.

我们在这里分享的所有内容以及你将看到的一切,都是完全开源的。我们也为 vLLM 等其他开源项目做贡献,不过我们有两个标志性项目:一个是 Kiji Inspector,今天要演示的就是它;另一个是 Kiji Privacy Proxy。如果你想保护数据不泄露给闭源模型,就可以使用它;你也可以根据自己的使用场景对它进行微调。Anything we share here and anything you will see, it's fully open source. We also contribute to other open-source projects like vLLM, but we have those two signature projects, one is the Kiji Inspector, that's what we're going to demo today, and one is the Kiji Privacy Proxy. If you want to protect your data from leaking to closed source models, that is something you can do, and also you can fine-tune it to your use cases.

问题:智能体决策不透明The Problem: Opaque Agent Decisions

今天,我们想重点介绍我们称为 Kiji Inspector 的工具。它可以帮助你了解智能体是如何“思考”的。智能体面临的根本问题是,我们不知道它们实际上是如何做出决策的。我们有许多现成的工具,比如提示工程、行为测试,或者可能最复杂的思维链流程。但这些工具都无法真正揭示因果关系;它们往往只是给出看似合理的解释,或是对可能根本原因的合理叙述。当有人请我们想办法确保运行智能体的模型能够选择正确的工具,并确认它思考的是正确的上下文时,我们决定深入研究模型本身。For today, we want to focus on what we call the Kiji Inspector. It is a tool that is helping you to understand how agents "Think." The fundamental problem that we have with agents is that we don't know how they actually make their decisions. We have a number of tools out there. We have prompt engineering, behavioral testing, or probably the most sophisticated processes like chain of thought. None of them are actually providing you causality, they're often just giving you plausible explanations or plausible narratives of what the root cause could be. When we were asked to figure out how can we make sure that the model that is running an agent is picking the right tool, how do we know that it's thinking about the right context, we decided that we needed to look into the model.

第一部分——解决方案Part I - The Solution

我们实现这一点的方法是使用稀疏自编码器。在讲到这之前,我先解释一下什么是自编码器。这个概念由来已久,至今大概已有三十年。自编码器接收一组输入,将其压缩成一个较小的潜在空间向量,然后通过解码器将其重构出来。自编码器的核心目标是尽可能减小输入与重构输出之间的误差。在一个最优系统中,误差应该为零,也就是说,这里的输出与输入完全相同。这样一来,你就知道潜在空间中的向量 z 表征已经达到了最优状态。这种方法已被多次用于嵌入、向量搜索、信息压缩以及各种类型的降维等场景。这是一种非常有意思的方法,能够迫使模型将信息压缩到更小的向量空间中。The way we do this is by using sparse autoencoders. Before we get there, let me start explaining what an autoencoder is. This is a concept that has been around for a very long time, probably three decades by now. Autoencoders take a set of inputs, reduce this to a smaller latent space vector, and then reconstruct them through a decoder. The whole point of that autoencoder is that you want to minimize the error between the input and the reconstructed output. In an optimal system, there would be zero error, and the output here would be exactly as the input. Then you know that the representation of your vector z here in your latent space is most optimal. This has been used many times in various things like embeddings and vector searches and information compression, dimensionality reductions of various sorts of kinds. This is a really interesting way of forcing your model to reduce the amount of information to a smaller vector space.

这个概念的妙处在于它是自监督的。你不需要任何标注。你把输入当作输出,也就是目标;而中间部分,就是你在生产环境中会使用的内容。对于稀疏自编码器,你会稍微反转一下这个概念。在这里,我们不会为信息创建瓶颈,而是希望把它拓宽,不过有个小小的限制,我稍后会解释。假设你从模型中取出一个激活值或隐藏状态,并将它输入稀疏自编码器,你就可以拓宽信息表示,这意味着你会迫使模型选择特定特征来表示信息。当你观察模型内部的激活时,会发现一种我们称为上下文多义性表示的现象:同一个被激活的神经元,可能对应多种含义或主题。The cool thing about this concept is that it's self-supervised. You don't need any labeling. You use the input as the output, that's your target, and then in between, that's what you would use in production. With sparse autoencoders, you would flip this concept around a little bit. Here in this case, we wouldn't create a bottleneck for the information, but we want to go wide here, with a little catch, and I'll explain the catch. Let's say you grab an activation from a model, or a hidden state, and you pass it through the sparse autoencoder, you can go wide in the information, and that means you force the model to pick certain features to represent the information. When you take a look at the activations inside of a model, there's something that we call polysemantic representation of the context, which means that one neuron that fires can have multiple meanings or topics it would fire on.

在我们的特征表示中,如果想理解模型,就需要将这些特征分离开来、彼此拉开距离,这就是为什么这里要扩展特征表示的维度。接着,我们会尝试使用一个解码器,再次压缩这部分信息,并重建作为输入的激活值。这里的关键在于,在这个激活函数中,我们会迫使模型只使用一小部分特征使其处于激活状态,而其余特征——理想情况下约占 95%——都应为零。这样一来,在训练过程中,我们实际上迫使模型只选择少数几个特征;于是我们就能确信,这些特征代表了模型本身的主题和上下文,也就是模型在处理某个特定词元时、处于这一层所表达的内容。In our feature representation, if we want to understand the model, we need to separate them and put them apart from each other, and so that's why we're going wide in the feature representations here. Then again, we try to then have a decoder where we narrow that information piece again, and we try to reconstruct the activations that we used as an input. The catch here is that in this activation function, we are then forcing the model to only use a small set of features to be actually active, and the rest of them, roughly 95%, that's the ideal number, we want to force them to be zero. In that moment, we actually force the model during the training process to just be really selective on a handful of features, and then we can be absolutely certain that those features are representing the themes and the context of the model itself, what the model was thinking in this given layer at the processing of a certain token.

然后我们还可以更进一步。生成这些特征向量后,这些索引对我们人类来说毫无意义。接下来,有了语料库,我们就可以找出在第 3 维和第 6 维上激活值较高的所有文档,然后看看这些文档有什么共同点。很可能会发现,比如第一个维度与 Python 有关。这样一来,纵观整个语料库,我们就可以说,这两个特征代表的是一种编程语言、API 词汇,或者类似的东西。Then we can go one step further. Once you have those feature vectors you generated, those indices don't mean anything to us, to humans. What we can then do is, once we have a corpus, we can grab all the documents that fire highly on, let's say, dimension 3 and dimension 6, and then we can look at those documents and say, what do they have in common? It could easily be that they say like, the first one has something to do with Python, so then over the course of the entire corpus, we could say, those two features, they represent a programming language or an API vocabulary or things like this.

在这个项目中,我们尝试将多种方法结合起来并打包,让所有人都能在生产环境中使用。首先,稀疏自编码器已经出现多年了,OpenAI 和 Eleuther 都发表过相关研究,但他们关注的是整个 LLM 生成过程。我们在这里改变了研究方法:我们只关注智能体的决策过程。我们聚焦于决策 token,而不是整个提示词,也不再对整个提示词中的激活进行平均。随后,我们整合了许多概念。例如,Eleuther 提出了 token 级模糊测试的概念,因此我们将其加入框架中。这样,任何想要使用该框架并训练自己模型的人,都可以使用这种 token 测试。此外,我们还加入了因果验证测试,以便确认某种关系究竟确实具有因果性,还是仅仅存在相关性。What we have tried to do in this project is combining a number of things and package them up so that everybody can use them in production. The first thing that we want to do is, sparse autoencoders have been around for a number of years now, and OpenAI published some research, and Eleuther published some research on this, but they focused on the entire LLM generation. What we changed here in our approach is we were only interested in the agentic decision-making. We focused on the decision token rather than the entire prompt, and then averaging those activations across the entire prompt. Then we put a bunch of concepts together. For example, Eleuther came out with this concept of token-level fuzzing, and so we added this to our framework so anybody who wants to use that framework and trains their own models, they can use that token testing. Then also we added causal validation testing as well so that you can make sure, is it actually causal or is it just correlation?

另一个很棒的地方,也是我们在这个项目中做出的创新,是我们不只是用大量提示词进行训练,而是创建了成对的训练样本。我们会给定一个意图——稍后我会给你看一个例子——针对这个意图,有一个我们称为“锚点”的内容,也就是正确答案和正确的工具使用方式;此外还有一个对抗性回复,它们非常相似,但又截然不同。基本上,就像是在内部数据库中查找内容,和在网上查找内容这两种情况。它们是两个不同的用例,提示和回复非常相似,但在工具选择上会产生截然不同的结果。Then the other sweet thing, what we changed here in this project, what is novel, is that we're not just training on a number of prompts, but we created those pairs, training pairs. We have a given intent — I'll show you an example later — but for a given intent, you have something that we call the anchor that's the correct answer and the correct tool use, and then there's an adversarial reply, which is very similar, but very different. It's basically like look something up in an internal database versus look up something online. Two different use cases, very similar in the prompt response, but very different outcome in terms of the tool selection.

看看训练流程,假设我们已经生成了所有这些配对,稍后我会向你展示具体是怎么做的。接下来,我们使用目标模型,不过这里有一点需要说明:这些模型必须是开源的。我们无法用 OpenAI 的模型来做这件事,因为我们无法访问它们的权重;但任何开源模型都可以。这也是我们框架的另一项创新:我们关注的不只是 Google 的 Gemma 模型或 NVIDIA 的 Nemotron 模型。这个工具,也就是这里的框架,能够适配市面上各种开源模型。你先选定要研究的模型,也就是你想用可解释性方法分析的模型,然后把所有提示词都输入模型本身,并提取你想要观察的特定层中的所有激活值。接着,利用这些激活值训练稀疏自编码器,就像我刚才演示的那样:把激活值输入进去,将它们扩展开来,再迫使解码器重新构建这些激活值。Looking at the training pipeline, let's say we have all these pairs generated, which I will show you how we do this. We then take our target model, and little caveat here, those have to be open-source models. We can't do this with OpenAI's models because we don't have access to their weights, but you can do this with any open-source model, and that's another novelty in our framework that we're not just focusing on Gemma models from Google or Nemotron models from NVIDIA. That tool, that framework here is working with various open-source models that are out there. You pick your subject model, that's the model you want to use the explainability for, and then you run all your prompts through the model itself, grab all the activations from the particular layers you want to watch. Then with those activations, you can train your sparse autoencoder as I just showed you with putting them in, widening them up, and then forcing the decoder again to reconstruct that activation.

然后,模型训练完成后,你就可以进行对比分析。我稍后会向你展示,我们如何通过这些配对来判断哪些内容与上下文相关,哪些不相关。或者,你也可以向大型语言模型提问:“这些文档有哪些共同点?”然后根据回答生成主题。所有这些都在我们称为 Kiji Inspector 的软件包中完成。你只需输入语料库,指定模型,就能得到一份特征定义,说明运行这些 LLM 和智能体请求时,各项特征代表什么。Then once you have the model trained, you can do a contrastive analysis, and I'll show you this later, how we then figure out through those pairs of what's actually relevant in the context or not. Or you can go to a large language model and say, tell me what those documents have in common, and then you can generate those themes. This all happens in that package where we call the Kiji Inspector. You put in your corpus, you nominate those models, and out you get a feature definition of what those features mean when you run those LLMs and agent requests.

前面我提到过,你得选定某一层。选哪一层多少有点艺术性,而非纯粹的科学。这里有一点解释:如果你选的位置比较靠前,比如在整个网络的前三分之一处,那么模型还没有完全形成对提示请求中所有概念的理解。你基本上是在激活那些与提示本身高度相关的内容。如果选得更靠后,模型本身就有很多复杂细节。以这个特定模型为例,我们看的是 NVIDIA 的 Nemotron 3。这是一个 MoE 模型。由于不同的请求会经过不同的路由,你会遇到各种离谱的错误。到了后面才学习某些内容会非常困难。此外,在某些情况下,你提取出的概念太抽象了,甚至连人类都无法理解其中发生了什么。对模型来说,这也很困难。Earlier, I just mentioned you have to pick a certain layer. There's a little bit of an art what layer to pick rather than science. There's a little bit of an explanation here that if you're early in the stack, like maybe in the first third, the model hasn't fully conceptualized all the concepts of your prompt request. You're basically activating things that are highly relevant to the prompt itself. If you're further down the stack, there's a lot of intricacies of the model itself. Here in this particular model, we're looking at the Nemotron 3 from NVIDIA. That's an MoE model. That's because every different request goes through different routings, you have crazy errors. Learning something later on is very difficult. Also, the concepts you extract are so abstract in some cases that even for humans, it's impossible to understand what's going on. Then also for the models, it's difficult.

对于我们的特定实验,我们选择了第 20 层,因为它已经位于处理流程的较深位置。此时,模型已经提取出了一些抽象概念,但又没有深入到难以被人类理解的程度。在我们发布的开源模型中,我们会提供多个层的版本。你可以根据自己的模型层设置,选择想要使用的层。 再次说明,这展示的是训练流程的另一种表示。基本上,你先输入数据,计算这些表示,然后将其重构回我们的案例中的 2688 维,再计算损失。这是一种非常标准的自编码器模型架构。关键在于——我们会在下一张幻灯片中展示这一点——我们使用了一种特定的激活函数,称为 Jump 正则化线性单元。我会在这里解释为什么这个特定场景下要使用它。What we wanted to do is, for our particular experiments, we picked layer 20 because it is already down the pipe. It's like the model extracted some abstract concepts. It's not too far down the pipe that it would be too non-human understandable. In our open-source models, what we're publishing, we're publishing multiple layers. You can pick wherever you want to be in your model layer setup. Again, this is another representation of the training pipeline. Basically, you have your input. You calculate those representations. Then you do the reconstruction back to, in our case, it's 2688 dimensions. Then you calculate the loss. It's a very standard autoencoder model architecture. The key thing, and we show this in the following slide, we're using a particular activation, what we call the Jump Regularized Linear Unit. I will explain this here why this is in this particular case.

那么,我们实际上如何聚焦于决策 token 呢?我们会强制智能体针对给定的提示作出回应,并说:“我将使用空白项。”无论它使用什么工具,模型接下来给出的回应都应当是工具名称,因为我们已经在提示中提供了可供选择的工具。然后,我们就能从回应中看到模型选择了哪个工具。我们会这样做一百万次,生成一个包含一百万个样本的训练集,基本上就是 50 万组好坏示例。等到我们尝试评估模型时,才会用到这些配对。在训练过程中,我们直接使用原始样本,总共是一百万个。我们为什么要再次采用这种对比配对设计呢?下面举个小例子。假设你有一个给定的意图:解决密码问题;对应的请求可以是:“我该如何重置密码?”Then, how do we actually focus on the decision token? The way we do this is by forcing the agent to respond to a given prompt and says, I will use blank. Whatever tool, whatever the model then responds is expected to be the tool name, because we've provided the selection of tools in the prompt itself. Then in the response, we would see what tool the model has chosen. We do this a million times. We generated a training set with a million samples, basically 500,000 pairs, good and bad examples. The pairs come in later when we try to evaluate the model. During the training process itself, we use them raw, and we have those 1 million samples. Why are we doing this contrastive pair design again? Here's a little example. Let's say you have a given intent, resolve a password issue, and you can have the request, how do I reset my password?

这会触发知识库工具。你也可以说:“我试着重置密码三次了”,这可能会触发一个完全不同的工具。两者在响应或请求方面非常相似,但在这种情况下,触发的工具结果却大不相同。稍后你会看到,我们会利用这些配对示例,找出为这些工具生成的特征中,哪些特征实际上与相应工具相关。为这两个工具生成特征后,特征存在差异的那些维度,大多会影响我们在知识库和工单查询之间做出判断。That would trigger the tool knowledge base. You could also say, I tried to reset my password three times, and that could be a completely different tool. It's very similar in the response or in the request, but it's a very different tool outcome in this particular case. Later on, what you will see is we will then use those pairs and figure out which of the features we generated are actually relevant for those given tools. When we generate the features for both tools, the dimensions where the features are different have mostly contributed to the decision-making between knowledge base versus ticket lookup.

这里我不想展开数学推导,但关于 JumpReLU 有个有趣的概念。你知道,ReLU(修正线性单元)基本上就是把所有负值归零,而正值则保持为输入值。它就像一个线性函数,只是由于存在拐点而不可微。JumpReLU 是 ReLU 激活函数的另一种变体。它基本上也是输出输入值,但设有一个阈值。有趣的是,在训练模型、判断哪些激活实际上相关、哪些不相关时,我们可以在训练过程中调整这个阈值,将其作为输出激活。这样我们还可以进行另一种调整,教会模型哪些特征与特定的激活相关。观察各层的一些结果时,我们会看到一些非常有意思的副作用:在训练早期,误差很低,但模型还没学到多少东西。I don't want to go through the math here, but there's an interesting concept regarding the JumpReLU. As you know, Regularized Linear Units basically are, anything negative is zeroed out and anything positive is the input. It's like a linear function, but it's not differentiable because of that bend. Here in the JumpReLU, that's another derivative of the ReLU activation function. It's basically the output is the input, but there's a threshold. The interesting thing here is when we train the model of, figure out which activation is actually relevant and not relevant, we can then tune that threshold during the training process as the output activation. That's another tweak we can have to teach the model which feature is relevant for which given activation. When we look at some results per layer, then we see some really interesting side effects of early on, the error is low, but the model hasn't learned much.

后来,由于这是对数关系,误差会高得离谱。接着我们会有太多维度;基本上,我们确实学到了一些东西,但误差高得惊人。这就是为什么在实际示例中,我们最终选在第 20 层左右。再来看一些统计数据,比如总数:我记得输入特征大约有 2,600 多个,我们把维度扩展到了 10,000。在这 10,000 个维度中,略高于 80% 的维度是活跃的。这意味着在训练过程中的某个阶段,它们曾经是非零的。完全失活的维度则不到 0.2%,也就是说,这些特征在整个训练过程中从未被用到。之后进行测试时,我们发现这 10,000 个特征中,有 668 个与我们想要研究的所有工具选择都高度相关。这一结果针对的是特定模型、特定层和特定数据集。如果重新训练,结果可能会有所不同。Later on, the error is crazy high because this is logarithmic. Then we have too many, basically we learn something, but the error is exorbitant high. That's why we ended up in our practical example, we ended up somewhere in between at layer 20. Again, if we look at some stats here, like total, I think we had like 2,600-and-something input features, we widened this to 10,000 dimensions. Of those 10,000 dimensions, a little bit above 80% of those dimensions are alive. That means somewhere through the training, they have been nonzero. Then only less than 0.2% are completely dead, meaning those features have never been used through the entire training process. Then when we do the testing later on, we actually figured out that out of those 10,000 features, 668 are actually highly relevant to all the tool selections we wanted to investigate. This is for a given model for a given layer and a given dataset. If you retrain this, you might see different results.

然后有人可能会问:为什么我们非得经历稀疏自编码器这些复杂操作,还要在各种复杂设置下训练另一个机器学习模型?你可以想象,这需要大量计算。这里基本上是在做几组比较。如果我们取出激活值,然后在这些数据上训练一个线性模型,能不能据此判断这个工具调用是正确还是错误?把这个结果和这里的二分类结果进行比较,我们的准确率接近 80%。这还不错,但也不完美。然后,如果只看准确率和 F1 分数,表现还会稍微低一些。接着有人可能会问:如果我们直接取出这些具有 2,000 个维度的激活值,然后对它们进行聚类,会怎么样?我们能不能根据聚类结果判断哪个工具是正确的?实际上,与其真的做聚类,还不如抛硬币。Then somebody could say, why do we have to go through all this craziness of sparse autoencoders and training another machine learning model in all these crazy setups? As you can imagine, it's a lot of computation there. This is basically a couple comparisons. If you take the activations and then train a linear model on this, could we then figure out is this tool correct or incorrect? If you compare this and a binary classification here, we get to almost 80% accuracy. It's not bad, but it's also not perfect. Then if you do some just accuracy versus F1 score, that's a little bit lower. Then somebody could say, what happens if we just take those activations with those 2,000 dimensions and we just cluster them? Could we from the cluster then figure out which tool is the correct one? You're better off flipping a coin than actually clustering.

我觉得,对我们来说,稀疏自编码器最有意思的一点就在于此。我来解释一下什么是模糊测试。我们可以弥合可解释性与可进行因果检验的特征之间的差距。我刚才提到了 token 级模糊测试。这是 Eleuther 前段时间提出的,当时他们研究的是针对完整提示词的稀疏自编码器。他们的做法是先查看提示词,然后替换其中的单个 token,接着观察替换这些 token 会如何影响激活,以及最终结果会受到怎样的影响。这正是我们在这里的工具中提供的同一套思路;在我们的框架中,人们可以在评估稀疏自编码器时使用它。接下来,当我们观察各个特征及其质量时,可以发现,大多数特征与我们对结果的预测都高度相关。只有少数特征对整体决策的影响很差。同样,在我们选出的这 600 个特征中,结果相当不错。这说明我们正朝着正确的方向前进。I think that was for us the interesting thing to see with the sparse autoencoders. I'll explain what fuzzing is. We can bridge the gap between interpretability and also having some causality testable features. I just mentioned token-level fuzzing. That was introduced by Eleuther sometime back when they looked into sparse autoencoders for entire prompts. What they did was they took a look at the prompt and then swapped out individual tokens, and then looked at how is the activation affected by swapping out those tokens and how is the end result being affected by that. That's the same concept we provide in our tool case here, in our framework that people can use when they want to evaluate their sparse autoencoders. Then when you look at the individual features and the quality of them, we can see that for the majority of the features they actually correlate really well to what we predicted the outcome to be. Only a small number of them have very poor influence on the overall decision-making. Again, from those 600 features we selected, it felt pretty good. This is heading in the right direction.

第二部分——因果关系检验Part II - The Causality Test

接下来,我们来看看因果关系和其他相关问题。这始终是个大问题。我们启动这个项目时,想的是:我们能不能解释智能体是如何选择工具的?后来,我们需要进一步探究:我们到底能不能证明因果关系?顺便说一句,我不是统计学家,所以很希望能和在这方面经验更丰富的人深入聊聊。我们做的事情是观察激活值。当模型中某一层产生激活值时,我们会将该层对应向量中数值最高的 10 个激活值归零。然后,我们观察工具选择是否发生变化。这就是我们的实验设置。这个过程需要做一些接线工作,拦截所有激活值之类的。别担心,我们通过框架提供了其他工具,你可以用它们复现这一过程。Then, let's take a look at causality and those other things. That's always the big question. We started this project where like, can we explain how an agent selected a tool? At some point, we needed to take a look at, can we actually prove causality? Little side note, I'm not a statistician, so I would love to have a better conversation about this with somebody who is more experienced with this. What we have done is looking at the activations. While the activation in this given layer in the model was produced, we then zeroed out the top 10 activations in that given vector. Then we looked at, is the tool selection changing or not? This was our setup. It's a little bit of like wiring and intercepting all the activations and those types of things. Don't worry, through the framework, we provide the other tools where you can replicate that.

对于这里的实验设置,我们考察了各种工具,并且确实能够证明,对比消融对许多工具都非常有效。有些工具我们无法证明这一点,但对于大多数工具来说,结果确实很有希望。这里展示的只是几个结果,p-score 非常低,因此我们对此相当满意。通过这些测试,我们证明了其中 23 种对比类型确实有效,效果优于随机翻转。我们也觉得,这再次表明我们正朝着正确的方向前进。也就是说,我们屏蔽或置零的那 10 个维度对应的特定激活,确实对工具选择产生了积极作用。The way this works is for our experiment setups here, where we looked at various tools, we were actually able to show that if you do the contrastive ablation, that worked extremely well for a number of tools. There were certain tools where we couldn't prove it, but for the majority of the tools, it actually looked very promising. Just a couple results here, the p-score is very low, so we were pretty happy about this. Through those testing, we were able to show that 23 of those contrast types actually worked. That worked better than randomly flipping. We felt that this is also, again, heading in the right direction. Like, yes, those particular activations, those 10 dimensions we blanked out or zeroed out actually contributed actively to the tool selection.

第三部分——使用 Kiji InspectorPart III - Using Kiji Inspector

这涉及很多理论、少量数学以及诸如此类的内容,但你不必亲自完成这些工作,这就是我们推出 Kiji Inspector 的原因,也是我们在 Dataiku 将它开源的原因。我们希望通过这里提供的工具包和框架,打造一个行业内其他人都能使用的、与模型无关的框架。像 Google 这样的公司也发布过类似的框架,但它们总是非常依赖特定工具。例如,Gemma Scope 是用于 Gemma 2、Gemma 3 或 Gemma 4 的可解释性工具,不过目前还没有扩展版的 Gemma 4 模型。它也没有训练流水线。网上有很多包含脚本等内容的代码仓库,但并没有什么东西可以让你下载、派生,然后在自己的环境中针对特定模型和特定用例端到端地运行。This was a lot of theory and a little bit of math and all those types of things, but you don't have to do this yourself, and that's why we have the Kiji Inspector, and that's why we open sourced that at Dataiku. What we're trying to provide here with a toolkit and the framework is like, we wanted to provide a model-agnostic framework that everybody else can use in the industry. Companies like Google have published similar frameworks, but they're always very tool specific. For example, Gemma Scope is the explainability tool for Gemma 2 or Gemma 3 or Gemma 4, or there's no Gemma 4 expanded model yet. There is no training pipeline. There's a lot of repos floating around with scripts and everything, but it's not like something you can download and fork and run something end-to-end on your site for your particular models and your particular use cases.

接下来,我们想提供一套完整的生产环境部署方案。在这些场景中,我们看到了大量研究工作,但还没见到一套成熟的生产环境方案,让人们既能运行 vLLM,也能取回激活值。因为在大多数 vLLM 或 SGLang 这类方案中,你能拿到响应结果,但这些推理工具不会返回特定层的激活值。我们为 vLLM 提供了一个补丁,让你能够做到这一点;我们也提供了容器,方便你在生产环境中运行。正如我刚才所说,所有内容都完全开源。我们提供 Docker 容器,也提供 PyPI 包,你们稍后会看到;我们训练的所有模型都托管在 Hugging Face 上。这只是其中一部分,我们在 Hugging Face 上提供的内容远不止这些。利用包含 100 万个数据点(即 100 万个样本)和 50 万组配对数据的大型训练集,我们最近刚训练了 Gemma 4。Then we wanted to provide a full production setup. We see a lot of research in those cases, but we hadn't seen a good production setup where people can run vLLMs and also get the activations back. Because in most setups like vLLM or SGLang, you get the response back but those inference tools don't give you the activations of a particular layer back. We provide a patch to vLLM that allows you to do that, and we also give you the containers so you can run this in production. Then as I said, everything is fully open source. We provide Docker containers, there's a PyPI package as you will see, and then all the models we have trained are on Hugging Face. This is only a subset, the list is way longer of what we're providing on Hugging Face. With our large training set of those 1 million data points or 1 million samples and the 500,000 pairs, we recently just trained Gemma 4.

谁知道 Google 到底会不会推出他们的稀疏自编码器。我们想抢先一步,所以为 Gemma 4 提供了稀疏自编码器;对于最新的 Nemotron 模型,也就是 Nemotron 3,我们同样提供了稀疏自编码器。遗憾的是,我们没有像 Google 那样无限的计算资源,因此只能挑选特定层来支持。如果你有具体需求,想要某个模型的某一特定层,请告诉我们,我们很可能也能帮上忙。Who knows if Google actually comes out with their sparse autoencoders. We wanted to beat them, and so we have the sparse autoencoders for the Gemma 4 and then for the latest Nemotron models, the Nemotron 3, we also provide the sparse autoencoders. Unfortunately, we don't have infinite compute resources as Google, that's why we have to pick certain layers to support them. If you have specific reasons, and you want a particular layer of a particular model, let us know, we can probably help you there as well.

推理流程会是什么样的?例如,如果你运行一个智能体,并让它分析我的 Q3 报告,它会先调用一个大型语言模型。同样,这必须是一个开源模型,因为你必须自行托管该模型,这样才能为你的 vLLM 版本打补丁。我们希望有朝一日能将这项功能加入 vLLM,这样 Baseten 等托管平台也能提供这些功能。这样一来,你拿到的不仅是模型的回复,还能获得该回复对应的某一层的激活向量。接下来,激活向量会输入稀疏自编码器。原本的 2688 个维度会扩展到 10,000 个维度。请记住,其中大多数维度实际上都是零。然后,你可以查看这个大型向量中处于激活状态的顶层特征,再查看这些特征对应的索引,从而了解你在训练过程中确定了哪些主题。How would the inference setup look like? If you run for example an agent and says, analyze my Q3 report, you would go through a large language model. Again, it has to be an open-source model, because you have to host that model so you can patch your vLLM version. We're hoping to get this into vLLM at some point so that hosting platforms like Baseten and others can provide those features as well. Then, you not just get the response back but you also get the activation vector for a given layer for your response. Then that goes into your sparse autoencoder. From your 2688 dimensions, you would then go up to 10,000 dimensions. Remember most of the dimensions are actually zero. Then you can take a look at the top features that are active in this large vector, and then you can take a look at those indices and figure out what are the themes you have determined during the training itself.

然后,你可以把这些主题作为解释,再输入到大型语言模型中。现在可能有人会问,这和思维链有什么区别?关键区别在于,这部分信息是直接从模型生成该 token 时的激活中推导出来的。它不是思维链那样,先经过一些推理步骤,然后再尝试执行。在思维链中,它可能会说:“这是我想做的两件事”,然后接着执行另外 15 件事。这两个步骤之间并没有联系。而在这里,某一层的激活与稀疏向量之间存在直接联系,而稀疏向量又与我们在训练期间生成的特征映射相连接。Then you can take those themes and put them back into a large language model as an explanation. Now somebody might ask, what's the difference now between doing all of this and chain of thought? The key difference is this information piece was directly derived from the activation during the model when that token was generated. It is not chain of thought where it first goes through some reasoning steps and then tries to execute. In chain of thought it could say like, here are two things I want to do, and then it executes 15 other things. There's no connection between those two steps. Here, there's the direct connection between the activation at a given layer. It goes into the sparse vector, and then we have the connection to the feature map we generated during the training.

在生产环境中想要使用它的话,具体是怎么做的?我们已经生成了一个名为 Kiji Inspector 的 PyPI 包。直到最近,你还得更新 Transformer 库才能支持 Gemma 4,但 Gemma 4 的所有改动都已合并,因此现在可以直接使用这里的最新版本库。接下来的设置非常简单。如果你熟悉 Hugging Face,就知道该如何对模型进行推理。我们的例子中定义了一个 Gemma 模型,并提供了提示词。这是一个关于家居维修的问题:“我的洗碗机有异味。我该怎么办?”接着我们定义要检查的层。这里用的是 Gemma 4 模型中的 E4B 模型,它稍微小一些,所以我们在模型堆栈中选得稍微靠前一点。本例中用的是第 8 层。这套设置就是标准模板。需要特别指出的一点是:如果你的 GPU 支持 bfloat16,就用它。这里只是做推理,不需要训练任何东西,所以把显存留给推理就好。除此之外,这些都是标准的提示词代码,没有什么特别或独特之处,完全是 Hugging Face 的样板代码。How does it work in production if you want to use this? We've generated this PyPI package called the Kiji Inspector. Until recently you also had to update your transformer libraries for Gemma 4, but all the Gemma 4 changes lined it so you can use the latest library here. Then the setup is very straightforward. If you're familiar with Hugging Face, that's how you would infer a model. In our case we define like a Gemma model. We give our given prompt. This is like a home repair thing. "My dishwasher is smelly. What should I do?" Then we define our layer. The Gemma 4 model, this is the E4B model that's a little bit smaller so we go a little bit earlier in the stack. In this case we use layer 8. That setup is standard cookie cutter. The only difference, what I would point out is like, if your GPU supports bfloat16, use it. It's just an inference. You don't train anything so just save the memory for your inference. Then again this is just standard prompt stuff. Nothing special here. Nothing unique. Very boilerplate Hugging Face code.

现在真正有意思的部分开始了。在 Hugging Face 中,你可以定义我们所说的前向钩子。模型运行时,Hugging Face 中的模型并未经过编译,因此你可以轻松地接入执行过程,并要求获取给定输入在指定层的向量。然后,我们就可以从这里获取这一层。模型运行时,我们可以将它传回响应并发送给用户。我还可以给你看另一种配置,你也可以在其中使用编译后的模型,从而获得更好的性能。接着运行推理、提取向量,这就是你的激活值。现在就可以使用稀疏自编码器了。如果你使用的是我们已经支持的模型之一,就可以使用我们的 Kiji Inspector。我们采用了 Hugging Face 的配置方式。比如,你可以调用 from_pretrained,指定基础模型,而我们会在底层确定需要下载哪个稀疏自编码器。Now the actually fun part starts. In Hugging Face, you can define what we call forward hooks. When the model is being executed, in Hugging Face the model is not compiled so you can easily hook into the execution, and say, give me the vector of a given layer for that given input. Then, we can grab the layer from here. When it's being executed, we can then actually ship it back to the response and send it to the user. I can show you another setup we have where you can also work with compiled models so you get a better performance. Then you run the inference, you retrieve the vector, and that is your activation. You're ready to go to use your sparse autoencoder. If you use one of the models we already support, you can then use our Kiji Inspector. We followed the Hugging Face setup. You can say like, from pre-trained, you mention the base model and under the hood we figure out like, what sparse autoencoder it needs to download.

我们进入正确的代码仓库,然后针对正确的层使用正确的模型。在底层,我们会把它转换成正确的特征向量,然后查找这些特征对应的主题。运行 `SAE describe` 时,你就能得到这样的描述,而不是一个随机向量。它看起来是这样的,我稍后还会再给你看一遍,不过这个版本更容易看清一些。你可以看到上面的所有索引,它们基本上告诉你,排名前五的哪些索引正在激活。你会看到第一个标着“未知”。这是什么意思?这意味着在训练过程中,特征向量中的这个特征并不重要,因此我们还没有为它编写描述。也许我们需要更多训练数据,也可能需要调整训练流程。有意思的是,当我们看第二个被激活的特征时,它实际上与洗碗机垫圈问题有关。We go to the correct repo, and then we use the correct model for the correct layer. Under the hood we convert this into the correct feature vector and then also do the lookup of the features to the themes. When you run SAE describe, that's how you get the description and not just a random vector. This is how it looks like, and I will show you this, again, but this is a little bit better readable. You see all the indices up here, they basically tell you what indices is the top five the ones that are firing. You see the number one it says unknown. What does it mean? It means like during the training, that feature in that feature vector was not of high importance and we haven't described that. Maybe we need more training data or maybe we need to tweak the training process. The interesting thing is that when we look at the second feature that was firing, it was actually something related to dishwasher gasket issues.

这似乎和我们给出的提示相关。如果它在这里对完全不相关的内容也会触发,那就是一个很好的信号,说明我们应该回过头去看看:模型是不是出了什么问题,或者提示是不是不正确,又或者发生了其他情况。这些都是你可以通过检查以及我们通过软件包提供的数据观察到的。Seems relevant to the prompt we have. If it would fire on something completely unrelated here then there would be a good sign to go back and say like, maybe there's something going on in the model or maybe my prompt is incorrect or something else happening. Those are the things you can then see from the inspection and the data we provide through the package.

演示 - Kiji 检查器,实时Demo - Kiji Inspector, Live

我来给你演示一下它的工作方式,以及如何在生产环境中实际使用它。这和我之前逐步讲解的代码是一样的。我已经在 Colab 笔记本中运行过这段代码。如果你想跟着操作,可以访问我们的 GitHub 仓库。快速入门示例可以在免费的 Colab 中运行。如果你想使用更大的模型,如今就得为性能更强的 GPU 付费。这仍然只是让你大致了解它在底层是如何工作的。幻灯片上展示的是经过截断的信息。你还能看到更多信息,我们也提供了底部的示例。基本上,这里展示的是所有与该请求关联度最低的内容。然后你可以继续往下看,将其转换为描述,并查看置信度。Let me show you here a little demo of how this would work and how you can actually use this in production. Again, this is the same code that I showed you earlier where we just stepped through. I pre-ran this in a Colab notebook. If you want to follow along you can go to our GitHub repo. The quick start example works in a free Colab. If you want to use a larger model you have to pay for the bigger GPUs nowadays. This is still giving you an overview of how this works under the hood. Here's a truncated information on the slide. You see some more information, and we also provide the bottom examples. Basically, here you see all the things that are least related to that request. Then you can go down, and you can turn this into a description and you can see what the confidence level is.

还有一件我觉得大家可能会很感兴趣的事。正如我一开始提到的,我们为 vLLM 提供了补丁。在这个例子中,你也可以在 vLLM 中执行整个流程。使用 vLLM generate 时,你也能获得相同的向量以及相应的解释。我们把这一切整合到了 vLLM 中。接下来还有一个有意思的例子,我觉得它展示了一种使用场景:我们正在逐步演示一个更大型的智能体系统。我不打算逐段讲解代码,而是想给你们看看结果可能是什么样的,也许能让你们了解如何在自己的产品中使用它。我们构建了一个独立演示:这是你的家庭维修智能体。它会告诉你某样东西是否坏了、你能不能自己修、是否应该找别人来修。它还可以帮你查找相关的 YouTube 维修视频。Here's another thing that I think could be really interesting for folks. As I mentioned at the beginning, we provide patches for vLLM. Here in this case is like you can also execute the whole thing in vLLM. When you do vLLM generate, you can then also get the same vectors back with the explanations. We tied this all together in vLLM. Then we have another interesting example I think that is a use case where we're stepping through a larger agent setup. Instead of going through the code I want to show you how the result could look like, and maybe that gives you a feeling of how you can use this in your product. We built the standalone demo of like, this is your home repair agent. It tells you if something is broken, can you fix it yourself? Should you call somebody else? It could potentially look up YouTube videos of how to fix it.

为了确保我们知道智能体在做什么,我们会在智能体执行每一步时,查找对应的稀疏自编码器特征。这里这个具体例子是洗碗机,它与处理水的机器有关,我想可能是洗衣机,还有类似老旧机器故障的问题。至少,在这个例子中,当智能体判断洗碗机正在漏水时,我们知道它的方向是对的。你可以对每次不同的工具调用都这样做。这个例子完全是空的,很有代表性,因为我们训练它时,训练集中根本没有针对 YouTube 视频的工具调用。对我们来说,这是一个很好的样本,说明我们需要在训练集中加入更多真实世界的例子。我给你们看过这个例子。还有几个例子,其中也有一个左边的例子,我们在现场演示中展示过。你可以跟着看智能体在前端做什么,同时它也在弄清楚实际发生了什么。看起来挺有意思的。In order to make sure that we know what the agent is doing, for every agent step, we then also look up what the sparse autoencoder features are. Here in this particular case, this was the dishwasher example, it relates to a machine handling water I would think, washing machines, and there's something like old machine troubling. At least we know that the agent is heading in the right direction when it made the decision of like a dishwasher is leaking in this particular case. You can do this for every different tool call. This one is completely empty, it's a good example, because when we trained this there was not a tool call in the training set at all for YouTube videos. For us it will be a good sample of like, we need to add more real-world examples in our training set. I showed you this example. There's a couple more, there's a left example there as well where we show this in a live demo, you can follow along what the agent is doing in the frontend while the agent is figuring out what is actually happening. It's pretty fun to look at.

你可以在应用中使用 Kiji Inspector 的具体场景有哪些?其中一种是找出智能体可能出现的异常行为。例如,它是否选错了工具——就像我之前在示例中展示的那样,这就是一种情况。你也可以将它用于审计合规。有些公司会研究这一点,并思考:如果我们还有另一种追踪记录呢?追踪信息是一回事,可解释性又是另一回事。通过追踪,我们基本上能看到选中了什么工具,但仍然无法解释为什么会选中这个工具。借助这里的功能,我们会生成另一组日志,查明智能体为什么会特别选择追踪信息中显示的这个工具。接下来,我们还可以验证提示工程。如果你不太确定如何针对特定目标优化提示,又不想反复迭代,就可以进一步查看:根据激活情况,这个工具是如何响应你给出的提示的。What are the particular use cases you can use for your applications and where you could use the Kiji Inspector. One thing is like you could figure out what an agent misbehavior would be. Anything that is like, has it picked the wrong tool, as I showed you earlier in the examples, that is a something. You can do it for audit compliance. Some companies looking at this and figuring out, it's like, if we have another track record, traces is one thing but explainability is another thing. When we do traces, we basically see what tool has been selected but we still can't explain why that tool was selected. Here we generate another set of logs and figuring out why the agent has particularly selected this tool that is shown in the traces. Then we can do validate of prompt engineering. If you're not quite sure, like you want to optimize your prompt for particular goals and you don't want to do this iterative loop, you can then also investigate like how is that tool responding to your given prompt based on the activations.

然后显然还要监控生产环境中的漂移。假设你的数据发生了变化:你用一组提示词测试智能体,观察这些激活值,之后随着时间推移,你就能看到这些激活值是否发生了变化。这是一个很好的指标,说明经过该智能体的数据已经发生了变化。也许你也应该关注一下这一点。Then obviously monitoring production drift. If your data changes, let's say you test your agent with a set of prompts, you watch those activations, and then over time you can see if those activations change. That is a really good indication that the data that is going through that agent has changed. Maybe you should take a look at that as well.

核心要点Key Takeaways

总结一下,关键要点是什么?我们有机会证明,稀疏自编码器能够解释智能体为何做出某个决策。我们展示了 token 级模糊测试的工作方式,并且作为整个方案的一部分,我们可以证明,调整这些提示会导致不同的激活。我还展示了因果证据:将模型中的某些激活归零,会影响工具选择。随后,我们将其与仅进行重构的基线进行了比较。也就是说,由于它是一个解码器,而且存在损失效应,如果把这一点排除,我们就能实际证明稀疏自编码器中存在因果效应。Just to summarize this, what are the key takeaways? We have the chance to prove that sparse autoencoders can work to explain why the agent made a certain decision. We showed how the token-level fuzzing works, and as part of the package we can prove that tweaking those prompts lead to different activations. I also showed the causal evidence of the tool selection is affected by zeroing out certain activations in the model itself. Then we did some comparison with construction only baseline, meaning, because it's a decoder and there's a loss effect, if we take this out, then we can actually show that there's a causal effect in the sparse autoencoder.

局限性与未来方向Limitations and Future Directions

最后我想谈谈它的一些局限,以及未来可以开展的工作。正如我所说,你确实需要模型本身。它无法与闭源模型配合使用。希望有朝一日,他们也能为我们提供类似的工具,那就太好了。训练过程非常耗费计算资源,尤其是当你想创建自己的数据集时。如果你想使用这个工具并创建自己的训练集,欢迎来找我们交流。我们可以分享一些技巧和建议,帮助你更高效地运行它。正如我之前提到的,这是一个合成数据集。如果有人想使用它,并且对数据集缺少什么、如何让它更贴近真实场景并可复现有一些想法,请告诉我们。我们也很乐意就此展开合作。I want to let you go with a couple limitations and also pointing out some future work. As I said, you do need the model itself. It doesn't work with closed source models. Hopefully at some point they give us similar tools on there, and that would be fantastic. The training is pretty compute intensive, especially if you want to create your own datasets. If you want to use the tool and you want to create your own training sets, come talk to us. We can share some more tricks and tips of how to run this effectively. As I mentioned earlier, it is a synthetic dataset. If anybody wants to use this and has some ideas of what is missing in the dataset and where should we go in terms of making it more real-world replicable, then let us know. We would love to collaborate on that as well.

这里还有一些未来的工作。我们希望支持更多开源模型,并从一开始就通过 Hugging Face 提供这些模型。目前我们想到的是 Qwen。还可以进行更多多层实验。目前所有内容都基于单层。如果从前三分之一中选取一层,再从后三分之一中选取一层,然后将它们结合起来,看看实际会发生什么,这可能会非常有意思。 另一个有意思的想法是跨模型迁移会产生什么结果。基本上,你先在一个 Gemma 模型上训练,提取这些向量并学习某些特征。然后换到另一个模型时,我们能否将这些特征泛化过去,从而观察到某些模式?这些都属于未来的工作,我们还没有着手。如果有人想合作,欢迎联系我。所有内容都是完全开源的。我们的发展离不开其他人的贡献。这不是我们自己的项目,而是一个社区项目。There's a future work here. We want to support more open-source models and provide those models from the start through Hugging Face. Something that is on mind is currently Qwen. More multi-layer experiments. Currently everything is based on single layers. It could be really interesting if you take a layer from the first third and then a layer from the last third, and then combine those and see what actually happens. Then another interesting idea we had was like what happens if you do cross-model transfer. Basically, you train on a Gemma model. You take those vectors. You learn certain features. Is there something we can generalize then if we go to another model and so we see certain patterns. That is all future work. We haven't touched this yet. If anybody wants to collaborate on this let me know. Everything is fully open source. We live from contribution from others. This is not our project. It's a community project.

问题与答案Questions and Answers

参与者 1:除了工具调用之外,有什么因素会阻止我们在训练过程中将这种方法应用到某些方面吗?例如,如果我们关注安全对齐的话。原因是,至少从你所做的因果检查结果来看,模型训练完成后似乎可以进行某种引导。你对我们如何针对对齐调整这类方法,并在部署后用它来主动引导模型,有什么见解吗?Participant 1: Is there anything that stops this from being applied to something by the training, of course, beyond tool calls. For example, if we were looking at safety alignment. The reason being that at least from the results of the causal inspection that you did, it seems to be possible to do some kind of steering after you train the model. Do you have any insight on any ways that we could possibly change something like this for alignment and then use that for active steering after deployment.

Hannes Hapke:我觉得,没有什么是我会说做不到的。我们正在研究的一个方向是安全问题,比如能否在这些激活中检测到恶意攻击?我认为可以。我觉得,在我之前展示聚类、线性分类与稀疏自编码器对比的那项研究中,这一点对我来说很明显。我认为,这证明了如果只看它们未经处理的激活,就无法弄清楚其中发生了什么。确实需要经过稀疏自编码器这一步。是的,这不只是局限于工具调用。对我们来说,这个项目的范围是可行的。团队规模比较小,所以我们觉得这是可以做到的。是的,完全可以。Hannes Hapke: I think there's nothing that I would say that it's not possible. One of the things we're looking into is the security aspects of like, can we detect malicious attacks in those activations? Yes, I think that's possible. I think from the research I showed earlier when I showed the clustering versus linear classification versus the sparse autoencoder, it was visible to me. I think to me that's sort of the proof that if you just look at their pure activations you can't figure out what is going on. You do need the step through the sparse autoencoder. Yes, nothing is limited to just a tool call. For us, it was like a feasible project scope. The team is pretty small, so for us it felt feasible. Yes, totally.

参与者 2:有没有什么现实案例表明,与使用思维链提示相比,采用你的方法让你对选择某个工具的原因有了不同的理解?Participant 2: Do you have any real-world examples where using your approach gave you a different understanding of why a tool was selected versus using chain of thought tells?

Hannes Hapke:是的,我们有不少基于个例的例子。不过我们还没有把它们总结成科学性的内容,比如说“这是我的提示词,这是我的分析”。思维链可能有点抽象。而在特征中,我们能看到它实际上是在寻找某个特定问题。比如这个洗碗机维修的例子,它识别出了电气设备遭受水损之类的问题。感觉比实际的思维链更精确一些。不过有一点需要说明:我们为这些例子训练的稀疏自编码器是特定领域的。也就是说,我们聚焦于一个非常具体的领域,并据此构建了训练集。这在一定程度上有点不公平的优势。此外,结果也会随模型规模而变化。如果你使用像 Gemma E4B 这样的小模型,我认为那些可解释性工具会更有优势。这两方面都能看出思维链和可解释性工具之间的差异。Hannes Hapke: Yes, we have a bunch of anecdotal examples. We haven't summarized them yet into something scientific that we say here's my prompt and here's my analysis. Chain of thought was maybe a bit abstract. Then in the features, we could see like, this is actually looking for a particular problem. For example, this dishwasher repair thing, it picked water damage on an electrical equipment or something. It felt more precise than the actual chain of thought. There's a little caveat. The sparse autoencoder we trained for those examples, they were domain specific. Meaning that we were focusing on a very particular specific domain and that's what we built the training set for. There was a little bit of an unfair advantage. Also, it changes with model size. If you use a smaller model like the Gemma E4B, I think those interpretability tools have a benefit of it. Those were the two things where you could see the difference between the chain of thought versus the explainability tool.

参与者 2:对于那些只能使用闭源专有模型的人,你觉得替代模型能否胜任?你认为闭源模型和开源模型足够相似,能够解释它们为什么会做出某些选择吗?Participant 2: For those who are stuck with the closed source proprietary models, could you imagine surrogate models working ok enough? Do you think that the closed and open-source models are similar enough with why they would make certain choices?

Hannes Hapke:我不能代表 OpenAI 和其他公司发言。我认为这些模型显然比我们在开源领域看到的要大。我觉得你或许能设计出更好的思维链实验。这是个有意思的问题。我们应该比较不同的提示词,分别输入一个大型 Qwen 模型和一个大型的 OpenAI 5.5 之类的模型,然后看看它们的思考步骤,判断两者是否相当?总的来说,我们永远不会在闭源模型中看到这项技术,因为,第一,我认为现在所有公司都在弱化它们的推理过程,因为通过这些推理过程,你可以推断出模型的内部机制。这更像是在揭示模型内部信息。他们绝不会想分享这些。另一方面,这也属于专有建模技术。他们并不想真正将其开源或分享出来。Hannes Hapke: I can't speak for OpenAI and others. I would think the models are bigger than what we see in the open-source world obviously. I think you have maybe a better chain of thought experiments. That's an interesting question. We should compare different prompts and run them through a large Qwen model versus a large like OpenAI 5.5, and then look at the thinking steps, and see, are they comparable or not? Generally, we will never see this technology in closed source models, because, A, I think all the companies are walking back their logics now, because through the logics you could figure out model internals. This is even more like internals. They never want to share this. The other thing is also like, yes, it's proprietary modeling. They don't want to really open source that or share that.

 

查看更多带有文字稿的演示文稿See more presentations with transcripts

 

值得记下

  1. 今天,我们想揭开这些可爱的 LLM 和智能体的黑箱,弄清楚该如何使用它们。
  2. 智能体面临的根本问题是,我们不知道它们究竟是如何做出决策的。
  3. 我们希望提供一个与模型无关的框架,让业界其他人也能使用。
  4. 对于一些工具,对比式消融的效果非常好。
  5. 我们的目标是打造一个在生产环境中表现平稳、无需操心的系统。如果它运行时还需要你时刻惦记,那就说明出了问题。

← 回到本期 · 第 8 条