构建智能体容易,证明安全更难:NatWest 的评估与灰度实践
原题Building the AI Agent Is Easy. Proving It's Safe Isn't - Jonathan Osborne, NatWest
看前速览
Jonathan Osborne 介绍 NatWest 如何结合路由、校准评估和受控上线,为面向客户的 AI 智能体建立安全依据。
先缩小暴露面,再强化模型
确定性路由和政策校验只让需要模型的问题进入智能体,同时保证访问决策可复现、可审计。
单个平均分会掩盖危险失效
分别衡量安全、任务和体验,才能识别故障类别;人工复核分组揭示了总体通过率掩盖的话题切换问题。
评委也是需要版本治理的生产依赖
没有区分能力的高均分毫无价值;即使智能体输入输出不变,更换评委也可能改变阈值的含义。
影子模式化解审批与数据的矛盾
先观察真实问题、由脚本系统回答,便能在开放智能体前验证,再逐步放量并随时回退。
完整摘要
NatWest 首席 AI 工程师 Jonathan Osborne 介绍了从脚本助手转向生成式回答与可执行操作的智能体前,需要建立的控制机制。系统先通过事件过滤、确定性规则、分类器和政策校验缩小模型暴露面,再分别评估安全性、任务完成和体验。对 111 段支付对话的人工验证,总通过率为 83%,但顺利路径达 97%,话题切换仅 43%。内部投诉助手还暴露出评委模型打分过高、几乎无法区分好坏案例的问题。他建议跨模型家族评审、治理评委版本、抽样生产追踪并设置 CI 回归门禁。影子部署、按品牌灰度和细粒度回退开关,则把观察真实问题与直接回答客户分开。演讲中的客户助手上线仍是后续计划,投诉系统提供了已运行的评估证据。
章节
文字稿
简要描述Brief Description
构建 AI 智能体很容易,证明它安全却不容易——Jonathan Osborne,NatWestBuilding the AI Agent Is Easy. Proving It's Safe Isn't - Jonathan Osborne, NatWest
目录Table of Contents
- 简介Intro
- NatWest 与 CoraNatWest and Cora
- 真正的风险:影响范围The real risk: blast radius
- 脚本机器人 vs. AI 智能体Scripted bot vs. AI agent
- 智能体失败的四种新方式Four new ways agents fail
- 路由漏斗The routing funnel
- 为什么单一的准确率评分还不够Why one accuracy score isn't enough
- 人工审核:83%掩盖了54个百分点的差距Human reviews: 83% hid a 54-point gap
- 评分过于宽松的 LLM 评审器LLM judges that grade too kindly
- 评分在生产环境中的运行方式How scoring runs in production
- 影子模式与渐进式发布Shadow mode and gradual rollout
- 将人工反馈作为一道关卡Human feedback as a gate
- 对受监管智能体的启示Lessons for regulated agents
简介Intro
大家好,我叫乔纳森·奥斯本,是那个 West Group 的首席 AI 工程师。稍后我会再介绍一下 West Group。今天我要谈的是,如何在受监管的银行环境中,将智能体从原型推进到面向客户的生产环境。先稍微剧透一下:有了我们现在能用的编程助手和工具,真正创建智能体反而算是比较容易的部分。我认为,难得多的是证明它是安全的。Hi guys. So my name is Jonathan Osborne. I am a lead AI engineer from that west group. I'll tell you more about what that is in a second. And today I'm going to be talking about taking agents from prototype to production customerf facing that is in a regulated banking environment. And I guess maybe some spoilers with the access to coding assistants and tools that we have today. The actual creation of the agent that's kind of the easy part. The much harder part I think is proving that it's safe.
NatWest 和 CoraNatWest and Cora
那么,我来简单介绍一下 NatWest Group。NatWest 是英国第二大零售银行,目前我们拥有约 1,900 万名零售客户。1,900 万。请记住这个数字,因为它确实是这场演讲中其他所有内容的关键。Kora 是客户的主要联系渠道。它是我们的数字助理,每天大约处理 10 万次对话。到目前为止,这些答复绝大多数都是预先编写好的脚本。因此,如果客户来找我们提问,而我们没有为这个问题编写脚本,那么我们就无法作答。客户会感到沮丧,很可能不得不排队等待人工客服接听。现在情况正在发生变化。从今年起,我们开始努力将 Kora 中约三分之一的服务流程改为由 AI 生成答复,并由 RAG、我们的知识库以及能够代表客户采取行动的智能体提供支持。So let me tell you a bit about Nat West Group. So Nat West is the second largest retail bank in the UK and currently we have somewhere in the range of 19 million retail customers. 19 million. Hold on to that number because it's really what makes everything else in this talk matter. Kora is our customer's primary point of contact. So it's our digital assistant and it serves somewhere in the realm of a 100,000 conversations a day. And until now the vast vast bulk of those answers were scripted. So if a customer comes to us and they ask a conversation then if we haven't fought to script that then uh you know we're not going to be able to answer. Customers going to get frustrated. They're probably going to have to cue to speak to a human agent. That's changing. So as of this year we are now working to bring approximately a third of the journeys within Kora to AI generated answers backed by Rag and our knowledge bases and agents agents that are able to take action on the behalf of customers.
例如,帮助他们付款或更改地址。So for example helping them make a payment or change their address.
真正的风险:影响范围The real risk: blast radius
我想,这里真正令人担心的其实不是模型。总体来说,模型相当不错,能给出很好的答案。现在的问题是影响范围太大了。我们有 1900 万客户,如果其中几条用户发言处理错了,那就不只是一个 bug 工单,也不是什么可能会登上有趣头条的小事,而是真实的客户,涉及的也是真金白银。监管机构会提出非常棘手的问题,我们公司也会因此遭受声誉损害。所以这次演讲要谈的是:为了获准上线,我们经历了什么;以及我们做了些什么,才能开始信任自己的一些指标。因为正如我所说,有意思的地方不在于智能体本身,而在于如何证明它安全,并确保它确实安全。I guess the scary part here really isn't the model like by and large models are quite good. They provide good answers. Now it's the blast radius. So with 19 million customers, if we get a few of these utterances wrong, that isn't a bug ticket. That isn't kind of a maybe a funny headline, it's a real customer and they're real money. It's slightly very difficult question from the regulator and it's reputational damage for us as a company. So this talk is about what we had to go through to get the approval to go live and I guess what it took us to maybe trust some of our own metrics as well because as I say the interesting part it's not the agent it's proving and making it safe.
脚本机器人 vs. AI 智能体Scripted bot vs. AI agent
我们不妨通过一个例子把这件事说得更具体一些。同一个问题,却会带来两种截然不同的对话。客户问:“我可以提前多还一些房贷而不被收费吗?”在今天的脚本式解决方案中,系统会识别出“房贷”这个关键词,然后向客户展示一个菜单,比如“申请利率”“我的房贷”。客户只能选择“以上都不是”。我们也许会让他们换种方式提问,但更有可能的是,对话就此结束。客户只能排队等待人工客服,肯定会感到沮丧。 右边的情况就不一样了。AI 可以利用我们的知识库回答这个问题:您一年内最多可以多还相当于贷款余额 10% 的金额,而且无需支付提前还款费用。Let's maybe make that more concrete by considering an example here. So kind of same question two very different conversations. So customer comes, they ask, "Can I overpay my mortgage without being charged?" Today in the scripted solution, that's going to recognize that keyword mortgage, and we're going to present the customer with a menu. So apply rates, my mortgage, customer is going to have to select none of the above. Maybe we'll ask them to rephrase their question, but more than likely, game over. This customer is going to have to cue, speak to a human agent. They're going to be frustrated. On the right hand side, bit of a different story. So AI has been able to answer that question using our knowledge bases. You can overpay up to 10% of your balance in a year. No early repayment charges.
要我帮你查看一下这笔交易吗?但接下来,客户会做一件很常见、却可能让人沮丧的事:他们会转移话题。比如,他们会说:“那我能不能直接关闭账户?”这种情况经常发生,而传统的决策树很难应对这种跑题。值得一提的是,这些跑题还会再次出现。我们先记下这一点。不过,关键在于:如果我们构建一个能回答任何问题的智能体,它也可能把任何问题都答错。那么,如果那 10% 的错误出现在这位客户的具体交易中呢?这是真实的客户,是他自己的房贷,而且涉及的是真金白银。Shall I check your deal? But then the customer does something which is very normal but is can be frustrating. So they change this topic. So actually can I close the account instead? This happens all the time and a traditional decision tree is really really bad at this type of digression. It's worth mentioning that digressions are going to come back. So we'll hold on to that point. I guess the key point though is if we build an agent that can answer any question, it can also answer any question wrong. So that 10% if that doesn't apply to this particular customer's deal, it's a real customer, is their real mortgage, and is there real money at stake?
智能体失败的四种新方式Four new ways agents fail
那么,为什么要让基于智能体的解决方案更……更安全这么难呢?你知道,我们该如何防范它,而不是防范那种脚本机器人?这是因为它会推理、会做决定、会生成内容。这里至少有四种我们在脚本式方案中不会遇到的失效模式。第一,它可能会信心十足地犯错:捏造一个虚构的来源,回答时却显得无比笃定。第二,它可能会被诱导做出某些事,也就是遭遇提示注入;输入本身就可能带有对抗性。第三,它可能给出的答案准确、符合政策,却毫无帮助,只是绕来绕去,始终没有真正回应客户的问题。这会让人极其恼火。第四,它可能具有非确定性。同样的输入,却会产生截然不同的输出。So why is it so much harder to make an agent back solution, you know, more, you know, how do we protect against it as opposed to that scripted bot? Well, it's because it reasons, it decides, it generates. And there are at least kind of four failure mode here, which we wouldn't have in that scripted solution. One, it can be confidently wrong. Hallucination against a fictitious source and sound absolutely sure of itself while it does it. Two, it can be talked into things, prompt injection. The input itself can become adversarial. Three, right, but unhelpful, so it can provide accurate on policy answers that just go round and around and around and never actually answer the customer's conversation. incredibly frustrating. And four, it can be nondeterministic. Same inputs, completely different output.
这意味着,传统的软件工程断言在这里确实不太适用。因此,现有核心团队多年来积累的回归测试,实际上也不再适用了。对于脚本化系统,故障场景是完全可穷举的。我们可以列出所有可能发生的情况,逐一测试,并确信系统会按预期运行。但对于智能体来说,这根本不可能,我们也无法通过传统测试来确保安全。那么我们该如何应对?That means that your traditional software engineering assertions just don't really work very well here. And as a consequence of that, regression tests that have been built up over years by the existing core team, they really no longer apply. A scripted systems failure surface is completely bounded. We can write out every situation that might occur. we can test it and we can be really confident it's going to do what we want it to with an agent that's really not possible and we can't really traditionally test our way to safety. So how do we deal with this?
路由漏斗The routing funnel
嗯,我们首先做的是缩小攻击面,然后才考虑如何加固它,并引入我们所称的“路由漏斗”。每段客户对话都会从这里的顶部进入。首先,我们会应用上下文过滤器,从中剔除按钮点击等常见事件,约占 20%。接下来,我们会应用一些确定性的预分类规则。通过这些规则,我们会利用客户的话语和一些元数据,将他们路由到相应的目的地,整个过程完全不涉及机器学习或 AI。到了这一步,只有通过前两道关卡的话语才会进入模型处理。首先是相关性判断和改述步骤,这一步设有门控机制,有助于处理那些包含多个上下文的复杂详细问题。Well, the first part for us was shrinking the attack surface before we actually then thought about hardening it introducing what we call the routing funnel. So every customer conversation comes in at the top here. First we apply a contextual filter and that allows us to remove kind of common events like button clicks. That's about 20%. Next, we have some deterministic pre-classification rules. So, with these rules, we're kind of using the customer's utterance and some metadata to route them to a destination with no ML or AI involved at all. At this point, it's only utterances that make it past these first two gates that we then actually start the models on. First, there's a relevancy and rephrasing step that's kind of gated. It helps with those really detailed multicontext questions.
然后是我们的意图分类器。它实际上是一个基于嵌入向量的神经网络。这不是生成式 AI,不能根据客户的表述来预测应该使用哪个后端。最后,我们还会设置一些策略规则,确保该客户确实应该进入相应的后端。 我们为什么要这样构建?有四个原因,其中很多都与银行的特点有关。首先是访问控制。我们需要强制执行访问控制,确保客户有权访问该后端。其次是可审计性。这里的每个决策都需要附带一个代码,必须能够被全面审计和复现。监管机构要求具备这种韧性。万一模型或性别不可用,我们仍然需要给客户提供答复。最后,我想还有治理方面的考虑。因此,所有这些都是版本化配置。And then our intent classifier. This is actually a neural network over embeddings. This isn't generative AI which is able to use a customer's utterance to predict the right back end. Finally, there's some policy rules to ensure that this customer should actually be getting into that particular backend. Why do we build it this way? Well, four reasons a lot of them about being a bank. Firstly, access control. So, we need to enforce that to ensure the customer should be getting to this act this this back end. Auditability. So, every decision here needs to carry a code. It needs to be fully auditable and reproducible. The regulator ensures this resilience. In the case that a model or the gender isn't available, we still need to provide the customer an answer and I guess governance. So all of this is version config.
我们可以对它进行更改,而无需全面重新部署。这非常重要,因为这意味着我们能够快速应对不断变化的市场状况。我们并不是随便拿一个语言模型,塞进一些上下文,就把它直接用在 1900 万客户身上。我们首先认真思考了哪些问题确实需要借助模型来解决。We can make changes to it without a full redeployment. That's really important because it means that we can react fast to changing market conditions. We didn't just take a language model, slap some context into it, and point it at 19 million customers. We first thought really hard about what actually needed a model to solve.
为什么一个准确率分数还不够Why one accuracy score isn't enough
这就引出了一个非常重要的问题:它实际上是否有效?在传统的 Kora 中,他们关注的关键指标是准确率。所以,如果我告诉你,这个意图撰写器的准确率是 94%,听起来可能相当不错。但这真的回答了那个重要问题吗?它的回答是否基于真实来源?客户的问题是否真的得到了解决?它是否知道自己什么时候力有不逮?什么时候该停下来转交给人工处理?这些都无法用一个单一分数来体现。这就是为什么我们不再把质量当作一个分数,而是开始将其视为一个向量。呃,我们会从三个不同类别对每个分数、每种回答进行评估:安全性——它会不会伤害客户?任务完成度——它是否真正完成了任务?体验——与它打交道的感受如何?This brings us on to the really important question of is this actually working? And the key metric that they looked at in kind of traditional Kora was accuracy when doing this. So if I told you this intent writer is 94% accurate, that probably sounds really good. But does that actually answer the important question? So is it grounded in a real source? Did the customer's question actually get resolved? Did it know when it was out of its depth? When to stop bring in a human? You can't embody that with one single score. And that's why we've moved away from quality as a score, started treating it more as a vector. Uh, every score, every kind of answer we score across three different categories. So, safety, could it harm the customer? Task, did it actually do its job? Experience, how did it feel to deal with?
所有这些都可以独立监控并设置告警。它们还能帮助我们区分:它是在胡编乱造,还是答案正确,只是让人难以忍受。两种情况的应对方式不同,所需的解决方案也截然不同。这里的关键是,一个准确率为 94%、但在出错的那 6% 时间里仍然百分之百确信自己正确的路由器,要比一个只有 85% 把握、并且知道自己没把握的路由器危险得多。All of these can be monitored and alarmed independently. And they allow us to differentiate between is it hallucinating versus is it right but just insufferable to deal with. There are different answers and they require really different solutions. It's what the key point here is a routter that's 94% accurate but 100% confident the 6% of the time it's wrong is way more dangerous than one that's 85% confident and knows it.
人工审核:83%掩盖了54个百分点的差距Human reviews: 83% hid a 54-point gap
在这里,我们首先做的事——在考虑如何自动化之前——是我们一贯会做的:先进行一些人工验证。呃,这里看到的数字是我们在六月对支付代理进行的一些验证结果。涵盖 37 种不同支付流程中的 111 段对话、4 个品牌,每段对话由 3 名独立的人类评分员评分。总体来看,通关率为 83%。不过一如既往,这个总体数字其实没什么用。我们来深入看看其中的一些数据。快乐路径场景的通过率为 97%,很不错。边缘案例为 76%,就没那么理想了。至于话题转换,比如我们之前讨论过的房贷案例,通过率只有 43%。所以,单看 83% 这个分数,会掩盖高达 54 个百分点的差距。 右边的第二点可能更细微,也较少被讨论:人类验证人员在偏见和公平性这类客观问题上,彼此的判断是否一致?你确实会看到 95% 的一致率,这很不错。但在更主观的意图理解方面——也就是说,机器人是否真的理解用户想要什么——一致率只有 64%。The first thing we did here before we worried about automating this is what we always do and we started off with some human validation. Uh the numbers that you see here are some June validation that we did on our payment agent. 111 conversations over 37 different payment journeys. Four brands, three independent human scorers per conversation. Headline here, 83% pass rate across the board. But as ever, the headline's pretty useless. Let's dig into some of that data. So 97% at on the happy path scenarios. That's great. 76% edge cases, not quite so good. Topic changes like that mortgage example that we discussed earlier, only 43%. So that single 83% score was hiding that 54% spread. The second point on the right is probably more nuanced and less talked about and that's do human validators actually agree with each other on something objective like bias and fairness you do actually see a 95% agreement rate which is great but on something more subjective intent understanding so you know are does the bot actually understand what they what the user wants only a 64% agreement rate.
当我们开始自动化这件事、引入 LLM 作为评判者时,通常会希望让评判者的判断与人工验证者一致。但这里究竟要让它们一致到什么程度呢?人类之间的一致率只有 60%。所以,归根结底,这显然不能简单地作为目标。顺便提一个注意事项:实际上,这里最主要的两个失败原因都是工程问题,并非模型本身的问题。尽管如此,这仍然证明了人工验证的价值,因为它发现了这些问题。那么,我们就来看看如何真正实现自动化吧。The common thing when we start automating this bringing LLM as a judge is that we want to make our judge match our human validators. But what are they meant to be matching here? There's only a 60 form agreement rate between humans. So that can't simply be the target here essentially. One one caveat by the way like the two biggest causes of failure here actually turned out to be engineering issues. Not problem with the model at all, but nevertheless that proves useful value of the human validation because it caught them. So let's turn to actually automating this then.
评分过于宽松的 LLM 评审器LLM judges that grade too kindly
所以,LLM 作为评审。Core Plus 目前还没有上线。接下来我会转向另一个内部项目。这是我们内部的一个投诉处理代理。基本上,客户偶尔会提出投诉。这个代理会接收投诉,并能调用大量工具,随后为投诉处理人员撰写摘要,说明这位用户为什么投诉,以及我们可以如何帮助他们。它于 2 月上线,目前已有约 14,000 个案例,既由人工审核员评分,也由作为评审的 LLM 评分。深入查看数据后,右侧这里是忠实度评分。可以看到上方红色的柱形代表 LLM 评审的均值,达到 0.97,位于顶部,分布范围很窄。人工评分的均值为 0.83,分布范围则宽得多。So LLM as a judge. So core plus that's not live yet. So I'm going to turn to another internal project. So this is an internal complaints agent that we have. Essentially the goal here is that customers will occasionally complain. This will take the complaint. It has access to a load of tools to then be able to write a summary for complaint handlers to essentially explain why has this particular user complained and how we can help them with it. It went live in February and we've got around 14,000 of these cases which have been scored by both a human validator and an LLM as a judge. If we dive into the data, so this is the faithfulness score here on the right. So you can see upper bar in the red there, that's the LM as a judge mean.97 right up at the top very little spread. Human mean 083 much much wider spread.
这里的关键是,如果你看它相对于人类评判的平均误差,数值是 2。你可能会得出结论,认为这个评判器表现还不错,但它的相关性几乎为零。呃,在这种情况下,如果一个评判器无法区分实际表现好的案例和差的案例,那它基本上毫无价值。你不希望评判器过于宽松,而这正是 LLM 默认倾向于做的事。 这里还有一点值得一提:那条琥珀色虚线表示的是这个评判模型针对这项指标的阈值。可以看到,我们的结果远高于阈值。不过,我们对模型做了一处改动,其他一切都没变:输入相同,输出也相同,只是更换了背后的实际模型。结果数值从高于阈值 0.8 一路降到了 0.2。这意味着,评判模型本身实际上也成了配置的一部分。Key point here is that if you look at that average error versus the human it's 2. you might conclude that the judge is doing okay but the correlation is almost zero. Uh in in this case like a judge which doesn't discriminate between the actually good cases and the bad cases is basically worthless. You don't want your judge to be generous and that is what LLMs want to do by default. Maybe one other point to make here is that so that amber dotted line that represents the threshold for this particular metric for this judge model. You can see we're comfortably above that. However, we made a change to that model. Didn't change anything else. Same inputs, same outputs. Just change the actual model behind it. And that dropped all the way from point 8 above to 2 above. That means that the judge model itself actually becomes part of your configuration.
这可能会导致破坏性变更。顺便说一下,我们在这里得到的一个关键经验是,我们把评判模型换成了与实际智能体不同的模型系列。这样一来,评判者和被评判者就有了不同的盲点,这实际上非常有效地让两个分数更接近。And it can lead to breaking changes. A key point we took here, by the way, is that we moved our judge to a different model family from that of the uh, you know, the actual agent. So, judged and judged, different blind spots, and that's actually been really effective in pinning the two scores closer together.
评分在生产环境中的运行方式How scoring runs in production
回到核心示例。那么,这种评分实际上是如何运行的?我们会捕获智能体之间以及智能体与护栏之间的实时对话,采用的都是 OpenTelemetry 和 OpenInference 等开源标准。然后,我们会对这些详细数据进行抽样。默认情况下,我们会随机抽取 5%,但也会关注所有有意思的对话。所谓有意思,是指发生了交接失败的对话,尤其是那些持续时间很长、用户情绪愤怒的对话。接着,我们会用 LLM 作为评审来给这些对话评分。这就是我之前提到的那一系列指标及其维度。最后,这些数据都会进入 Comet,包括追踪记录、评分和实验。整个流程受到几项银行业限制的约束。我们的工作环境完全隔离,无法访问互联网。因此,评审模型是通过一条私有通道访问的。Coming back to the core example. So how does this scoring actually run? So live conversations between the agents and its guardrails. All of those are captured ving open source standards like hotel and open inference. All of that detail is then sampled. So by default we take 5% random sample but we also want to look at everything interesting. By interesting I mean conversations are handoff fail those are particularly long ones where the user is angry. We then score these with our LLM as a judge. So that's that raft and dimension of metrics that I talked about earlier. And then absolutely all of this ends up in comedic. So traces, scores, experiments. It's governed by a couple of bank constraints here. So we work in a completely airgapped environment. So no internet access to anything. So judge model is reached over a private path.
我们有一个内部的 GenAI 网关。Comet 是一款 SaaS 产品。我们通过 AWS 将其作为已签名的合作伙伴应用来使用。第二点涉及个人身份信息。对于任何 PII 离开我们的网络,我们都采取零容忍政策。这意味着很多评估都是在不包含这些信息的情况下进行的,而且这里有不同的评估频率。Trace 会在发生时被捕获。我们每四小时进行一次离线评分。此外,回归测试也集成在我们的 CI/CD 中。因此,如果我们更改提示词或上下文,可能会对智能体实际生成的响应产生巨大影响。我们需要不断将结果与一个已知良好的基线进行比较。我们在 CI/CD 中完成这项工作,并设置了严格的回归门禁。因此,在我们完全了解将会发生什么之前,变更无法合并。我想,关键在于,持续评估是生产基础设施的一部分。We have an internal geni gateway. Comet a SAS product. We're consuming that as a signed partner app via AWS. Second around personally identifiable information. We have a zero tolerance policy for any PII leaving our network. So that means a lot of this evaluation happens without that present different cadences here. So tracers are being captured as they happen. We're doing offline scoring every four hours. And then regress this is also built into our CI/CD. So if we make changes to prompts or to context that can have like an outsized impact on what the agent is actually responding. So we need to constantly be comparing versus a known good baseline. We do that in CI/CD. There's a hard regression gate. So changes can't be merged in without us understanding exactly what's going to occur. I guess key point is that continuous evaluation is part of your production infrastructure.
这不是一个模型上线时运行几次的笔记本。这里有不同的模型,它们的故障模式也各不相同。右侧是智能体和生成式 AI。生成式 AI 可能会出现回归。正如我们刚才所说,有人可能会修改提示词,而这可能对模型行为产生巨大的影响。这就是我们部署 CI/CD 的原因。这里可以看到一条真实的 Opik 跟踪记录,来自我们的支付智能体。LangGraph 图中的每个节点都会对应一个不同的跨度;当智能体运行缓慢,或在某个特定环节出故障时,这就能让我们或其他智能体介入,准确排查原因。至于传统机器学习部分,意图分类器采用的是传统机器学习,因此我们需要用更传统的方式对它进行监控。它会随着时间推移而发生漂移,对吧?It's not a notebook that you run a couple of times when your model goes live. So there's different models here and they've got different failure modes. So on the right hand side we've got the agents, we've got the generative AI. So generative AI regresses. So as we've just talked about, somebody can make changes to a prompt and that can have outsized impact on the behavior. That's why we have the CI/CD in place. You can see here a real opic trace which is looking from our payment agent. Every node in the LAN graph uh becomes a different span and when the agent is slow or is breaking in a particular place, this allows us or an agent to jump in and investigate exactly why on the classical. So the intent classifier is traditional ML and thus we've got to monitor it in a more classical way. It drifts over time, right?
因此,人类对话会自然地从模型训练时的状态不断演变。所以我们需要关注一些更传统的指标,例如输入特征漂移,以及基于人工评分——抱歉,是人工标签——计算的 F1 分数。然后,我们会定义 RAG 阈值,明确何时需要触发该模型的重新训练。右侧可以看到一张 npm 数据漂移图表。我真的不建议低估输入特征漂移的作用。在 F1 分数下降之前,它是一个很好的预警信号,能提示模型开始退化,意味着需要重新训练。因此,这是两个不同的问题,需要两种不同的工具;但我们不希望因此采用两套不同的可观测性和评估框架。Comet 在这方面非常有用,因为它同时涵盖了用于 GenAI 的 OPIC 和用于 ML 的 MPM 模型性能监控器。So human conversation will naturally evolve from the point at which the model was trained. So we need to look at more traditional things like input feature drift, F1 score based off human scores, sorry, human labels. And then you know we have rag thresholds defined as to exactly when we need to trigger retraining for that model. On the right you can see an npm data drift chart. I I really wouldn't underestimate like input feature drift here. It's a really good canary as to when your model is starting to decline before your F1 score does implying the need for retraining. So two different problems, two different instruments, but what we don't want is two different observability and evaluation frameworks. Comet's really useful there because it brings in both OPIC for the Genai and MPM model performance monitor for the ML.
那么,作为一个平台,我们究竟该如何部署它,既不至于花费太多,也不至于闹出一堆新闻头条?So one platform how do we actually deploy this then without kind of breaking the bank and creating a load of headlines.
影子模式与渐进式发布Shadow mode and gradual rollout
我们首先采用影子部署。我的意思是,我们把它上线,呃,用它来开始对客户话语进行分类;但实际向客户作出回应的,仍然是现有的脚本化方案。这意味着我们几乎可以在零风险的情况下,了解真实数据,也就是不同客户查询的输入空间。我认为,影子模式是这个项目中最容易迁移应用的做法之一,因为在受监管行业,我们经常会陷入僵局:显然,未经批准,我们不能上线并获取生产数据。但同样,在很多情况下,要想获准上线,我们的模型风险团队同事越来越希望先看到模型会如何响应这些真实的生产数据。We start off with a shadow deployment. So what I mean by that is we put this live uh we use it to start classifying cutter utterancerances but this existing scripted solution is what will actually respond to the customer and that means that we can get a sense of the real data you know the the input uh the input space for different customer queries with almost zero risk. I think this shadow mode is like one of the more transferable bits of this project for us because often we have this deadlock in a regulated industry where obviously we can't go live and get production data without the approval to do so. But equally to actually enable us to go live in many cases our model risk colleagues increasingly want to see how our models are going to react to that actual production data.
这让我们能够把这件事拆开,从而将安全地观察与实际回答客户问题分离开来。呃,这也把一个非常重大的决策点——一次性全面发布——拆分成一系列较小的决策,让我们能够更有把握地做出判断。然后我们会按品牌逐步推进。比如,我们会在每个品牌内按百分比逐步放量,并设置一些 KPI,帮助我们在推进过程中的不同阶段决定继续还是停止。其中一些决策是自动完成的,另一些则需要人工审批。嗯,我想……是的,其中一些确实需要人工审批。之所以能做到这一点,很大程度上是因为我们在这里大量使用了功能标志。我们有一个全局标志,可以触发将所有请求都切回脚本化方案;同时,每个后端都可以单独隔离,既可以全局隔离,也可以按品牌等特定维度隔离,而这一切都能在几秒钟内完成。This allows us to kind of break that apart so we can break apart observe safely from actually answer customer queries. uh and it takes one really big decision point, a big bang release into a series of smaller ones which we can make confidently. We then go brand by brand. So we have like percentage based rollout within the brand and we have kind of KPIs which allow us to determine go no-go at various points along there. Some of those decisions are automated and some of those require manual approval. Um I think and yeah some of those require manual approval. What kind of makes that possible is that we make a lot of use of feature flagging here. So there's like a global flag that we can trigger to send everything back to the scripted solution, but also every single backend can be isolated either globally or on a particular dimension such as brand and all of that can be done in seconds.
将人工反馈作为一道关卡Human feedback as a gate
结束之前,我想简单谈几句,再回到那个投诉项目上。提醒一下,这是一个面向同事的智能代理,会为处理投诉的人员撰写调查摘要。在这个项目中,人工反馈是一道门槛,不是点个赞,也不是勾选一下就完事。如果投诉处理人员想重新开展调查,就必须先提供人工反馈。我们想了解他们为什么觉得有必要重新调查。这也让我们逐步建立起一个包含1.4万条客户……呃,我想在这个案例中应该说是同事标注的数据集,这非常有价值。在很多项目中,我们很难获得这个数量的十分之一,我认为这些项目在这方面也取得了不错的成果。Before I wrap up, let me maybe just talk very briefly and pull this back to that complaints project. So just to remind you that was the colleague facing agent which writes investigation summaries for summaries for complaint handlers. In that project, human feedback is a gate. It's not a thumbs up. It's not a tickbox activity. So if a complaint handler wants to rerun their investigation, they can't do so until they provided human feedback. We want to understand why they felt the need to do that rerun. But also it's allowed us to build up this quality data set of 14 14,000 customer of uh of colleague labels I guess in this case and that's really valuable in a lot of projects. We struggle to get a tenth of that number and I think the projects have also traded nicely here.
所以,你知道,他们在生产环境中发现了评判器的问题。正因如此,我们做了评判器校准和回归检查。不过同样重要的是,我们构建的架构在很大程度上依赖 Comet Opik;他们目前还没用它,之后会把它用于生产监控。我想,这算是让我们一窥企业内部情况吧。这里,智能体才是成本较低的部分——我们可以编写代码来解决业务问题;而评估体系的主干,则是我们可以一次又一次复用的部分。最后总结一下:如果你要在受监管的环境中部署面向客户的智能体,那么以下几点大概就是我会给你的建议。So you know they found that judge problem in production we have judge calibration and regression checks because of that but equally the architecture that we built which relies heavily on commodopic they don't use that yet and they're going to be adopting that for their production monitoring I guess it's a glimpse inside an enterprise right so the the agent was the cheap part here that's code that we can produce to solve the business problem the valuation spine is the bit that we can then reuse again and again so to wrap up like if you are going to be shipping customerf facing agents in a regulated environment, then these are probably the points I would give you.
面向受监管代理的经验教训Lessons for regulated agents
我不打算把所有内容都过一遍,可能只挑几个来说。这里的第三点和第四点,是关于实际生产环境中的评审数据,对吧?如果评审打分总是集中在高位,那这个评审器就坏了。评审器往往会倾向于给出过于正面的评价,你需要设法避免这种情况。要比较分数区间,而不只是看平均值。还要确保评审器确实与人工审核者的判断一致。第四点是,评审模型本身也会成为阈值配置的一部分,对吧?所以,如果你要修改评审模型,嗯,你可能会在不知情的情况下引入一项破坏性变更。Comet 显然在这里至关重要。I'm not going to go through everything. I'll maybe just pick a couple. So, three and four here, they're the they're the points with the actual production judge data, right? So, that judge pinned near the top, it's a broken instrument. Your judges are going to want to be overly positive. You need to fight against that. Compare the spans, not just the averages. Ensure the judge is actually matching the human reviewer. Fourth, the judge model itself does become part of that threshold config, right? So if you are going to be making changes to the judge model then uh you know you can introduce a breaking change without knowing it. Comet is obviously absolutely key here.
所以,这两部分我们都有:生成式 AI,以及我们仍在少量使用的传统机器学习。我想最后一点是,下个月正式上线后,我就会知道这些内容到底有多少属实了。非常感谢大家聆听。能和大家交流真的很愉快。接下来我会在评论展位,如果大家有什么问题、不同意见等等,我都非常乐意听取。再次感谢大家抽出时间。So we have that for both halves both the generative AI and the traditional ML which we do still use a little bit. So and I guess the the final point here is next month I'll find out how much of this is actually true when we go live. So thanks a lot for listening. It was really a pleasure to get to speak to all of you. So I'll be at the comment booth after this. So if you do have any questions, you know, disagreements, etc., really happy to hear them. But thanks a lot for your time.