John Yang 讲 LLM 裁判:如何给 AI 智能体评分|斯坦福 CS329Z 第 13 讲
原题LLM-as-a-Judge: How to Grade AI Agents | Stanford CS329Z Lecture 13 with John Yang
看前速览
John Yang 讲解了怎样在程序测试、人工标注和 LLM 裁判之间选择,以及如何检验评分偏差、报告智能体可靠性。
根据任务选择评分方式
明确且可验证的要求适合程序测试;判断成本高、需要细分语境的情况可用人工评分;没有唯一答案时可用经过校准的 LLM 裁判。
直接检验裁判的判断
按需求选择单项打分或两两比较,调换答案顺序,并检查长度是否会独立于质量影响评判。
评估可以超出最终文本
智能体评估可能需要查看完整操作过程,或直接操作生成的产物。课上的例子表明,模型可能漏掉已经成功的动作,或把提前停止当成失败。
把能力和稳定性分开报告
面对难题,可以用 pass@k 看多次尝试是否至少成功一次。面向客服等场景,pass^k 衡量多次尝试能否全部通过。
完整摘要
在斯坦福 CS329Z 的这一讲中,John Yang 比较了确定性检查、人工评分和 LLM 裁判。对于明确要求,测试能给出可重复的结果;遇到开放目标或不同的有效实现时,单靠测试则可能漏判。课程从传统文本重合指标讲到人类偏好,再讲到如何实际操作交互式产物,以及模型为何可能误判智能体的执行过程。Yang 还用答案顺序和输出长度说明评分偏差,最后区分 pass@k 和 pass^k:前者衡量 k 次尝试至少成功一次的概率,后者衡量 k 次全部成功的概率。
文字稿
简要描述Brief Description
LLM 作为评判者:如何给 AI 智能体打分|斯坦福 CS329Z 第 13 讲,主讲人 John YangLLM-as-a-Judge: How to Grade AI Agents | Stanford CS329Z Lecture 13 with John Yang
目录Table of Contents
- 评估简介Introduction to Evaluation
- 为什么 Agent 评估不能只靠测试Why Agent Evaluation Needs More Than Tests
- 三类评分器Three Grader Families
- 作为评分器的语言模型Language Models as Scorers
- 学习和衡量人类偏好Learning and Measuring Human Preferences
- 评估智能体轨迹与产物Evaluating Agent Trajectories and Artifacts
- 检测位置偏差和长度偏差Detecting Position and Length Bias
- Pass-at-k 和 Pass-to-the-k 报告Reporting Pass-at-k and Pass-to-the-k
评估简介Introduction to Evaluation
我们会稍微聊聊将语言模型用作评判者,以及一些与评估相关的细节。先简单回顾一下:上次我们聊了很多基准测试,也深入探讨了它们通常是如何运作的——环境、问题陈述、验证,这些一般性的三大组成部分;还聊了这种模板如何非常适合用来构建各种实用类型的任务和评估,比如编程、网页使用、计算机使用等等,对吧?那么今天,我们要特别聚焦于验证,仔细看看验证究竟是如何运作的。首先,我们会用七分钟聊聊为什么我们首先要关心验证,也就是它为什么重要。We're going to talk a little bit about uh language models being used as judges um and also just sort of details related to evaluation. So just as like a little bit of a rehash um last time we talked a lot about benchmarks and we got into the nitty-gritty of sort of like how they generally work uh the environment, the problem statement, the verification, these sort of general three building blocks um and then how that template is very conducive to then seeding very sort of practical types of task and evaluations um in coding and web use and computer use, you know, everything like that, right? Um so today what we're going to do is we're going to zoom in on verification very specifically and we're going to just sort of really closely inspect sort of like what makes verification tick. Um so in the first seven minutes we'll talk a bit about why we even care about verification in the first place, like why is this important.
嗯,我想大家应该已经对原因有了相当不错的了解。接下来我们会看看不同类型的评分器。嗯,你们可能还记得之前那节课的内容。我们提到过,针对不同的基准测试,可以使用不同的指标来报告模型性能。要制定这些指标,可以采用不同类型的评分方式。嗯,比如说,这是单元测试吗?还是像 LM Arena 或聊天机器人那样?你们是在进行人类偏好投票吗?嗯,而且你们知道,能参与评分的人数有限,他们能投入的时间也有限。嗯,我们能不能用语言模型来代替人工?嗯,我认为这个想法最初在 NLP 文献中只是一个相当简单的概念。早在 2018、2019 年,我们就已经开始思考这些问题了,当时 Transformer 还算是比较现代的语言模型。Um I think everybody already has like a pretty good idea of why um but then we'll take a look at different types of graders. Um so maybe you kind of remember this from the prior lecture already uh but we kind of alluded to how with different benchmarks there's different metrics you can use to report model performance. Um to develop those metrics uh there's different types of grading that you can apply. Um so is this unit testing? Um is this sort of with something like LM Arena or uh with chatbots? Like are you doing human preference voting? Um and you know, there's only so many people and so much time that those people can spend on grading. Um can we potentially use language models um as a stand-in? Um and I think that idea started out as like a pretty simple concept um in NLP literature. So even as far back as like 2019, 2018 we were already thinking about these things sort of in the more modern of Transformers being the main uh language model.
嗯,不过我们会很快看看,大语言模型作为评判者会以哪些不同方式发挥作用:从单纯考虑能否用它来替代 BLEU 分数、ROUGE 这类非常传统的方法——也就是比较两段文本的语义相似度——到更深入、更侧重人类偏好的方法。这也为许多后来推动 RLHF 发展、以及催生出类似人类偏好的奖励模型的工作奠定了基础。然后,我们会看看大语言模型作为评判者近期更进一步的用法:如今,评判者不再只是评估偏好,而是具备了智能体能力,对吧?所以,如果你想评估一个模型创建网站之类的能力,也许可以设置一大堆确定性的单元测试,而且测试会非常全面。Um but we'll kind of look at very quickly how you know LM as a judge uh manifests in different ways from purely just sort of like hey can we replace things like BLEU score and rouge and these like very uh traditional kind of compare this block of text with this block of text in terms of like semantic similarity um to things that are a little bit deeper and more oriented around human preference and that sort of prefaced a lot of the stuff that led to RLHF and led a lot to sort of like reward models um that resemble human preference um and then we'll take a look at sort of the more recent uses of LM as a judge where beyond preferences now the judge is actually agentic right? So if you want to grade a model on its ability to create a website or something like that um you know maybe just having a bunch of deterministic unit tests it's very exhaustive.
网站的某些方面不一定会受到特定标准答案的约束。因此,在这类情况下,你可能会希望让智能体实际操作网站,或者操作生成的产物,以此进行评分。接下来,我们会讨论一些相关问题:模型并不完美。人有人的表现,模型则试图模仿人,但它们可能会出现某些偏差。我们该如何建立有效的方法,来检验模型评分是否一致、是否符合人类偏好?最后,我们也会谈谈非确定性问题。这个问题与“以语言模型作为评判者”相对独立,但会很快回到这样一个问题:完成验证并得到分数后,如果针对某项任务多次运行模型,而得到多个样本,该如何报告模型的表现?There's certain aspects of the website that are not necessarily uh sort of constrained to like specific right answers um and so maybe in those settings you want an agent to actually play with the website or play with the artifact that was generated as a way to do grading um and then we'll talk about sort of the problems with respect to you know models are not perfect like you know there's people and then there's models and these models try to emulate people uh but there's some certain issues that might come up in terms of biases. How do we kind of establish good ways to test that models are consistent in their grading and that they are aligned with human preference right? And then last but not least we'll also kind of talk about um non-determinism which is more separate from language model as a judge that is kind of like quickly pivots back into this question of like okay once you've run your verification and you have scores um if you have one task and you run the model on that task multiple times how do you actually sort of report performance uh when you have sort of multiple samples on a task.
一如既往,任何时候都可以停下来提问。As usual, please feel free to stop and ask questions whenever.
为什么智能体评估不能只靠测试Why Agent Evaluation Needs More Than Tests
我们先从动机讲起。希望这张图对大家来说已经越来越熟悉了。作业二里也有这张图,可能已经开始做作业二的同学会看到。希望通过作业二,大家也能积累一些运行 Harbor 任务的经验,并了解不同的代码基准测试实际是什么样的。今天我们会重点讲验证部分,对吧?稍微说明一下动机:在作业中,你们已经接触了三个基准测试,或者接下来会接触到:HumanEval、SWE-bench 和 Terminal-Bench。这些基准测试很有代表性,体现了自 2021 年以来代码基准测试的发展脉络。Let's start with the motivation. So hopefully this chart um is becoming like uh all too familiar. Um this is in your homework two as well in case people have started homework two. Um and hopefully with homework two you're also kind of getting some experience with like running a harbor task and like uh getting exposed to what different coding benchmarks actually look like. Um and so um today we're going to focus on the verification section, right? So to motivate it a little bit um in your homework you have engaged with three benchmarks uh or you will. Uh human eval, swe-bench, and Terminal-Bench. Um these are like uh pretty representative of sort of the broader lineage of coding benchmarks since like 2021.
嗯,所以和上一讲一样,你们现在也已经注意到,在数据和基准测试中,编码相关任务的验证基本上大多是以单元测试为主,对吧?这其实很自然。嗯,在实际生产环境中也会遇到这种情况;而且在很多方面,我们进行编码时会采用测试驱动开发,会编写各种测试,比如单元测试、集成测试和端到端测试。嗯,因此在早期,很多基准测试采用单元测试,或者更广义地说,采用基于程序的编码测试,效果都很好,因为它们具有确定性。生成这些测试之后,不像语言模型或人工评测那样,你不需要再付费让评测方重新评分,对吧?只要重新运行测试就行。嗯,通常来说,编码具有很强的表达能力。Um and so as with in the prior lecture you've also noticed at this point with data and with our benchmarks that uh pretty much a lot of the verification for coding related tasks is going to be unit test oriented, right? Which is like pretty natural. Um they occur in the wild um in production and in many ways when we do coding like we do test driven development, we you know write all sorts of tests, unit tests, integration tests, end to end testing. Um and so early on for a lot of benchmarks unit tests or sort of more broadly speaking like programmatic coding based tests are pretty good because they're deterministic. Once you generate them unlike a language model or a human you don't need to kind of pay uh this entity again to do regrading, right? You just rerun the test. Um generally coding is very expressive.
所以,就这三列而言,在这些基准测试中,严格来说,唯一真正属于编码任务的就是 SWE-bench,对吧?我们聊过 τ-bench,它是在循环中加入了一个模拟用户的基准测试。对于这种测试,你可以用单元测试来检查数据库经过修改后,最终是否处于具有某些特定属性的状态。比如说,用户想取消一笔订单,那就查看数据库,检查与该订单对应的那条记录或行是否显示为已取消。你可以很轻松地把这项检查编写成单元测试。browser comp 也是一样,对吧?对于任何需要精确匹配的任务——我的意思是,甚至包括考试型基准测试,因为这类任务只要求得出一个正确答案——都很容易把这些检查编写成程序化的规则。So as with these three columns like out of these SWE-bench technically the only one that's really a coding task, right? We talked about τ-bench which is the one with like a simulated user in the loop and for there you know you can apply unit tests to check that the database um that was modified um ends up in sort of an end state that has certain properties like, oh, your user wanted to cancel an order or something like that, then look at the database and check whether that particular record or row corresponding to that order has like a canceled status. You can encode that easily as a unit test. And the same is for browser comp, right? For anything where like you're looking for an exact match um I mean stemming from like even examination style benchmarks uh where you're just looking for one right answer um it's very easy to sort of codify these checks as programmatic things.
不过,当然,由于几个原因,它们并不全面,对吧?首先,它们是确定性的,你可以检查一些确切的内容。但正如我们在这门课上多次看到的,很多任务并没有确切的解决方案。一个反复出现的重要例子就是指令遵循,对吧?比如,我们创建了 Chatbot Arena,让开放式问题也能成为一种评估方式。在这种情况下,问题的设计和评分都非常容易变化,而且很大程度上取决于出题者本人,或者负责给这些问题评分的那个子群体。所以,有很多任务的动机都很好,但你知道,它们并不是那种“嘿,这里就有一个唯一标准的参考答案”的任务。Um but of course uh they're not entirely comprehensive for a couple reasons, right? So one of the first ones is that yes, they're deterministic. You can check exact things. A lot of tasks don't have exact solutions as we've seen a lot in this class. The big um sort of um recurring example being instruction following, right? Like we created Chatbot Arena um to have sort of more open-ended questions be a form of evaluation. And in that case um both the creation of the question and also the grading um is very fickle and very sort of like specific to the person that created it or like the subpopulation um that is being asked to grade these questions. And so there's plenty of examples of tasks that have sort of good motivations like um but you know are not sort of like, hey, there's just this one canonical reference solution.
嗯,除此之外,我想你可以想象,就像我们之前讨论过的那个想法:模型所面对的任务分布会随着时间变化,或者随着你进行后训练而变化。即使在这里,也有一些任务的答案可能会随着时间,或者随着某种不断演变的事物而变化,对吧?最简单的例子就是,如果你的任务中确实包含网页浏览这一环节,那么如果我今天和四年前用同一个查询词执行 Google 搜索,得到的结果会不一样,对吧?所以你当然可以尝试对环境进行一些调整,让查询引擎及其生成的内容固定下来。不过,有时候这相当困难。Um beyond this um I think you can imagine that like in the same way that we've talked about this idea of like a model sort of um you know the distribution of tasks that is difficult for a model kind of changing over time or changing as you do post training. Even here there's tasks where like maybe the answer is going to change with time or with some sort of like evolving thing, right? Like the simplest example is like if you do actually have web browsing um as a component um in your task, well, if I run a Google search action like today versus like four years ago with the same query, I'm going to get different things, right? So you can certainly try to sort of make environment adjustments to make sort of the query engine and the things that it produces fixed. Uh but sometimes that's quite difficult.
嗯,所以你希望评分方式能更稳健地应对这些可能具有非确定性、会随时间变化的噪声或信号。很好。好。嗯,今天我们还要谈另一件事。它也有点类似,虽然不完全等同于我们之前讨论过的奖励劫持问题。你知道,我们当时反复强调了这样一个观点:你要确保验证方式与你的问题陈述高度契合,对吧?这里也重申了这一点。嗯,验证确实非常重要,因为除了要保持一致之外,它本身也必须做得好。也就是说,你最终希望验证机制能够把真正正确的内容标记为正确,把错误的内容标记为错误。Um so you want your grading to kind of be more robust to these potentially non-deterministic kind of evolving um noise or signal, you know, um over time. Cool. Okay. Um and to another thing that we'll talk about today is that um similar So in the vein, but not quite exactly like the reward hacking stuff that we've talked before, uh you know, then we kind of hammered on this idea that you want to make sure that hey, your verification is like very well aligned with your problem statement, right? And that is echoed here as well. Uh verification is certainly very important because beyond the alignment, it just it does need to be good. And so like you want your verification to ultimately grade things that are actually correct to be marked as correct and the things that are wrong to be actually marked as wrong.
从概念上说,这听起来非常简单。嗯,但在实践中,重要的是要注意这一点,因为你知道,确实有一些例子。比如 SWE-bench,有一篇论文叫《SWE-bench Illusion》,我在这里标记了它,方便你之后查看。这里的要点是,他们发现,如果你真的在代码库的所有测试上运行所提出的解决方案,就会发现模型给出的解决方案实际上无法通过测试。SWE-bench 的任务构建存在的问题在于,有时某个仓库运行完整测试套件要花很长时间;或者仓库自带的一些测试本身不太稳定,甚至可能存在问题,而且这些测试往往会过度依赖仓库中的某些细节。Conceptually, this sounds very simple. Um in practice, it is important to pay attention to this uh because like, you know, you have some examples. So for SWE-bench, um there was a paper called like the SWE-bench Illusion um tagged here if you want to look at it later. Uh but the idea here is that they found that okay, according to um if you actually run the proposed solution on all of the tests in the code base, you'll find that um the model solution actually fails. The problem with SWE-bench's task construction is that because sometimes you have a repository where running the whole test suite takes a very long time or there are some tests native to the repository that are just kind of flaky or even those test might itself might have some issues with them and they're sort of over calibrated to, you know, some details in the repo.
关键在于,也许你知道,这个解决方案实际上是错误的,但如果评分器只运行部分测试,那么它就会错误地把这个解决方案判定为通过,对吧?这显然不是什么好情况。另一方面,嗯,如果你读过 Anthropic 发布 Opus 4.5 时发的那篇博客,就会发现他们提到,在 Tau Squared Bench 上——基本上就是 τ-bench 的第二个版本,扩展到了不同领域,也包含了不同类型的交互——Opus 4.5 给出了一个不错的解决方案,但验证机制并没有考虑到它,对吧?所以我觉得,在评估中你会发现,很多这类概念其实都很简单,并没有什么令人惊叹的地方;但列出这样一份检查清单,并确保把这些事情都考虑在内,真的非常重要。The point being that, maybe you know, the solution's actually incorrect, but then if the grader if it only runs sort of a partial set of tests, then you know, it's going to incorrectly mark that solution as as passing, right? So that's sort of not a great situation. On the other hand, yeah, if you read that Anthropic blog that they released when they put out Opus 4.5, they found that you know, like for Tau Squared Bench, basically like the second version of τ-bench where they kind of expanded to different domains and have different kinds of interactions, Opus 4.5 came up with a good solution that wasn't accounted for by its verification, right? So I think with evaluation you'll find that like a lot of these concepts are quite simple. There's nothing mind-blowing about it, but it's just sort of having this checklist and making sure you have all these things in mind, it's really important.
很好。然后我们会在最后讲到非确定性时,再更深入地讨论这个问题,对吧?不过,如果你有一项任务,并且像我们之前讨论过的那样,让模型针对它运行几次,那么在很多智能体任务中,你会发现结果有所不同。并不是说只要把温度调到零之类的,每次运行模型来执行这项智能体任务时,它就一定会得出完全相同的解。我觉得,如果你想了解这种非确定性为何会出现,那就得深入到数学原理中;像 336 这样的课程,以及一些更经典的语言建模课程,都会谈到这一点。不过,在这里我们先把讨论停留在这样一个抽象层面:我们知道,即使把温度调到零,在多轮、长周期的场景中,语言模型仍然会存在一定程度的非确定性,对吧?Cool. And then we'll talk about this more closely with sort of the non-determinism section at the end, right? But if you have a task and you run a model a couple times on it, as we've talked about before, with a lot of agentic tasks, you're going to get variation in the outcome. It's not the case that like you know, if you just turn the temperature to zero or something like that, that every time you run the model on this agent task, it's going to arrive upon the same solution every single time. I think if you want to understand why that non-determinism occurs, it really kind of goes into the math that like you know, 336 and some of these more canonical language modeling courses we'll talk about, but yeah, for this we'll just stop at the abstraction that like we know language models, even if you turn down the temperature to zero, in a multi-turn long horizon setting, there is going to be some level of like non-determinism there, right?
所以当你遇到这种情况时,假设你进行了五次 rollout,其中两次模型完美地解决了问题,而另外三次出了些问题,或者彻底失败了。那你到底该怎么报告结果呢?我们会看看大致三种方法。是的,你可以报告平均值。如果任务的奖励是二元的,这种方法可能效果很好,比如任务结果只有 0 或 1。但假设任务奖励是连续的,也就是取值范围是 0 到 1,而不是只能取 0 或 1。现在问题就变成了:是所有运行的得分都是 40%,还是有两次得分为 1、三次得分为 0?所以,平均值会在无意中掩盖这类情况。And so when you have this, let's just say you do five rollouts and like two of the five the model perfectly solves and three out of the five there's some issues or it just completely fails. How do you actually report that, right? And so, you know, there's like sort of three um techniques we'll take a look at. So, yes, you could report the average. Um and this probably works quite well if the reward for your task is something that is binary, like if the task outcome is either zero or one, right? But imagine your task reward is continuous. It's zero to one, not zero or one. Now it becomes a question of like, okay, well, did you score 40% on all of the runs or is it sort of two runs got one and three runs got zero, right? And so uh that's something that the average sort of obfuscates unintentionally.
嗯,所以你可以这样处理:假设你有一个非常难的任务,而你最关心的只是——比如说,大家应该都很熟悉纳维–斯托克斯千禧年难题这类非常了不起的问题。是的,在这种情况下,我其实不在乎自己是不是有 40% 的概率能解出这个问题。如果我能解出这个千禧年难题一次,那就已经非常了不起了,对吧?所以,也许有些任务,关键不在于每次都能不能解出来,而在于它到底能不能解出来一次,对吧?嗯,这也是另一种衡量方差的方法,我们接下来会讲到,也就是 pass@k。嗯,大家如果还记得上节课我们谈到的 HumanEval,或者看过作业二,就应该能看到一段简短的说明,解释他们为什么选择报告 pass@k:这是为了考虑方差,同时也因为他们关心的是模型能否至少成功完成一次编程任务。Um so you could deal with that with like, okay, you have a really hard task and all you care about let's say like, you know, I'm sure people are quite familiar with like the Navier-Stokes Millennium problem, like these sort of really incredible things. Yeah, in that case, I don't really care if I solve this problem sort of 40% of the time. If I just solve the, you know, Millennium problem once, that's already insanely impressive, right? So maybe you have a task where it's less about whether it gets it every single time and more about whether it even solves it once, right? And so um this is sort of another way to account for variance, which we'll look at, which is like pass@k. Um so if folks remember like uh the human eval when we talked about it last lecture or even like in your homework two, uh there should be a brief excerpt on why they chose to report pass@k, which is to account for variance and also because they care about the model simply solving the coding task at least once.
他们不太在乎它到底有多可靠。要是你在客户服务场景中使用这个指标,那就糟糕了,对吧?因为你不希望模型只是在某个用户查询上至少成功一次,而是希望它面对相同的用户查询时能够稳定成功,对吧?嗯,所以这个指标是 pass^k。你看看 τ-bench 就会发现,他们试行的就是这个指标:我们进行 k 次 rollout,只有当模型在该任务的每一次 K-rollout 中都表现良好时,才算成功。所以,如果你画出 pass@k 和 pass^k 的 matplotlib 曲线,就会看到,随着 rollout 次数增加——比如假设模型解决某个任务的概率是 10%——pass@k 会慢慢变得越来越高,因为你有了更多次尝试;而 pass^k 则会越来越低,对吧?They don't care about sort of how reliable it is. Now if you use this metric in like a customer service setting, that's going to be terrible, right? Because you don't want your model to just succeed at least once on a user query. You want it to succeed reliably given the same user query, right? Um and so this um is uh the pass^k um if you take a look at τ-bench, that's what that benchmark piloted, which is like this is a metric where we do k rollouts and we only count the model as succeeding if on every single K-rollout for that task um it did well. So if you kind of just draw the sort of you know matplotlib curves for pass@k and pass^k you'll see that you know with more rollouts like you know assuming a model solves a task at like 10% of the time then pass@k slowly gets higher and higher because you have more trials pass^k gets lower and lower right?
所以归根结底,我们想传达的是,关于该报告哪种指标,其实并没有唯一正确的答案。这在很大程度上取决于你评估模型所用的任务类型,以及任务的难度和性质;不同情况下,最合适的指标也会有所不同。不过,我们在动机上花了很多时间,所以接下来其他部分我就稍微讲快一点。好,在进入评分器类型之前,大家有什么问题吗?我觉得讲得很棒。好,太好了。好。And so at the end of the day the point of this is to communicate there's not actually one right answer for like which metric to report. It's very sort of catered to um the type of task that you're evaluating the model on and depending on its difficulty and the nature of that task sort of which one's most appropriate but okay we spent a lot of time on motivation so I'll I'll like cut a little bit short on the other parts. Um okay any questions before we move into grader types? I think it's great. Okay great. All right
三类评分器系列Three Grader Families
我们很快过一下这三种方法。你们跟着这堂课听的时候,可以这样理解:接下来的 10 分钟里,我们会讲各种评估技术。一般来说,可以把它们归为三类:单元测试、使用人工标注,以及用语言模型担任评判者,在某种程度上取代人工,对吧?We'll go through the three of these really quickly. So the mental model as you kind of follow along in lecture is we're going to talk about uh in the next 10 minutes like all of these different grading techniques generally you can think of just as three you know you have unit tests you have actually using human annotation and you have sort of language model as judge sort of supplanting human effort right?
然后这张表嘛,你可以想象一下,比如成本,就是用这个评估器有多贵?速度有多快?其他六项就留给你们自己琢磨了。嗯,我们先做这个,然后就开始专门看看把 LM 当作评判者。接下来的 30 分钟里,我们会大致梳理一下它的发展脉络:LM 最初只是 Rouge 和 BLEU 分数的替代品,后来用于取代人类偏好评估,再到模拟人类行为。我也会聊聊非确定性方面的内容。好。那我们从这里开始。我们之前已经相当详细地讨论过这个了,但正如我提到的,代码其实表达能力很强。我觉得尤其是你们的作业二,我猜很多人最后会做单元测试,对吧?比如说,呃,我不知道你们当中有没有人……我接下来这话可能有点跑题。And this table um you know you can imagine like cost is like okay how expensive is it to use this grader? How fast is it? and you know I'll let you figure out the other six. Um so we'll do that first and then we'll launch into looking at LM as judge specifically and for those 30 minutes we're going to kind of look at the lineage of like LM just as like a stand-in for Rouge and BLEU score to replacing human preference to simulating human actions and I'll kind of talk about the non-determinism stuff. So cool. All right so starting with this we already talked about this quite a bit but as mentioned code is actually pretty expressive and I think especially for your guys's homework two assignment my guess is going to be that a lot of you end up doing um unit testing right? Like let's say uh you have a I don't know if some of you I'm talking a little bit out of pocket here.
所以请随时纠正我。不过,如果你在做生物学之类的任务,比如想找些灵感,可以看看 Terminal-Bench 的科学类任务,对吧?假设你要注释一个基因组之类的。再说一遍,我不是生物学专家,所以这些都是我瞎编的。不过,当然,比如你做一些 DNA 到 RNA 的转录,等等,输入是这个序列,模型要完成一堆操作。最后它会输出一个产物,比如说,只是一串由 AC GT 之类组成的字符串,对吧?你可以为此编写单元测试。具体取决于任务:如果结果必须是某个准确的文本序列,比如说 32 个字符,那就很好。编写一个检查是否相等的单元测试就行。So please feel free to correct me. But if you're doing like a biology task or something like that, like if you want inspiration, look at Terminal-Bench science, right? And let's just say that, you know, oh, you are like annotating a genome or something like that. Again, like I'm not a bio expert, so I very much am making things up. But certainly like, oh, you know, like I do some DNA RNA transcription, blah blah, input takes in this sequence, the model has to do a bunch of things. It ends up spitting out an artifact where, you know, it's just a string of AC GT or something like that, right? You can write a unit test for that. Like depending on the task, if it has to be sort of this exact, I don't know, 32 character sequence of text, then that's great. Write a unit test that does equals for it.
如果你知道,解答中存在某种程度的变化,比如任何包含 AACG 这种重复模式的解答,都必须在序列中出现三次之类的,那很好,把它写成单元测试,对吧?我个人真的很喜欢单元测试。我认为它的好处,正如上一张幻灯片所展示的,是成本很低、速度也很快。我的意思是,以前我们会在野外的数据集里费力寻找单元测试,比如 Swebench;现在还有 Terminal-Bench,你知道,这些测试都是人们写的。如今语言模型确实已经足够优秀,你可以让它针对你想检查的预期产物生成测试。而且这些测试只需要生成一次,你知道,5。If you know, there's a certain sort of amount of variance in the solution, any solution that has, you know, AACG is like a repeating pattern or something like that has to occur three times in your sequence or whatever, great, write it as a unit test, right? Like so I personally really like unit testing. I think the benefits here as sort of like shown in the previous slide is that it's really cheap and it's really fast. You I mean these before we would crawl for unit tests in the wild like Swebench, like now for Terminal-Bench, you know, people wrote those. And now the language models are genuinely very good enough that like, you know, you can ask it to generate tests against sort of, you know, the expected artifact that you want to check. And you only have to generate those tests once, you know, 5.
抱歉,GPT,你知道,6.1 Soul 会生成测试,你可以一直用那些测试,对吧?所以这有很多好处。现在,主要问题是灵活性和细微差别——这算是一个比较高层次的说法,我来稍微解释一下。灵活性简单来说就是,我们在讨论基准测试时提到过静态性这个概念,对吧?你创建任务,编写单元测试;等模型足够强、通过了这些单元测试之后,这个任务就不再有用了,对吧?SWE-bench Verified 目前已经完全饱和了。SWE-bench Multilingual 也是,Terminal-Bench 1.0 也是,WebArena 也是。这在很大程度上与它们都采用了基于代码单元测试的评分方式有关。一旦模型在某项任务上表现得非常出色——也就是说,就单元测试套件而言,它通过了所有测试——那么,这些测试就不再有用了。sorry, GPT, you know, 6.1 Soul generates the tests and you can sort of use those till the end of time, right? And so there's a lot of benefits to this. Now the main issue is that like flexibility and nuance, it's kind of like a more high-level term to explain it a little bit more. Flexibility simply means we've talked about this idea of like staticness when we went through benchmarks, right? That you have these benchmarks where you create the task, you create the unit tests, and once the models are good enough and they pass those unit tests, that task is not useful anymore, right? Sweet-bench verified is fully saturated at this point. So is sweet-bench multilingual, so is terminal-bench 1.0, so is WebArena. A lot of that has to do with this um concept that they all use coding unit test grading, and once the model does a really good job at that task, really good job, meaning with respect to the unit test suite, it passes everything, then, you know, those tests aren't useful anymore.
所以从某种意义上说,它就像是一种非常容易获得、很容易生成的东西,但又有点像化石燃料,对吧?这些测试一旦用过,在训练中就不会再给你提供强化学习信号了。在基准测试领域,它也不会再给你提供你想要的那种区分度信号了,对吧?不过,我在这件事上说得有点多,只是想提醒大家一下,但我相信你们现在已经理解这个概念了,对吧?再说一次,这只是为了说明单元测试仍然很有用。我觉得单元测试能表达的内容范围很广,而且很多时候,只要你在验证方式上有创意,就能实现很多很棒的任务,对吧?比如说,对于编程任务,你可以这样想:你可以编写一个单元测试,要求模型实现一个代码库,然后由这个单元测试检查某个特定函数或某个具有特定方法签名的特定类是否按要求实现了,对吧?So in some sense, it's like very sort of readily available, easy to generate, but it's kind of like fossil fuel in some sense, right? Like once those tests are used, like it's not going to give you sort of in training, it's not going to give you RL signal anymore. In benchmark land, it's not going to give you sort of the discriminatory signal you're looking for anymore, right? But anyway, I'm harping on this a little bit long just to remind folks, but I'm sure you guys get the concept at this point, right? So again, this is just to show unit tests are still good. I think there's like just a range of things that you can express in unit tests, and often times like if you're creative with your verification, you can get away with like a lot of great types of tasks, right? So one example is for coding tasks, like if you think about it, you could write a unit test where you know, the model is supposed to implement a codebase, and the unit test is inspecting that this specific function or this specific class with this specific method header is implemented a certain way, right?
比如说,我也不知道,假如你在实现斐波那契数列之类的东西。现在你可以编写一个单元测试,对代码的形式施加一些相当严格的约束,要求它必须长成这样,方法头必须长成这样。另一方面,如果你看看较新的基准测试,比如有一个叫 program-bench,思路是给模型一个可执行程序,比如 FFMPEG、JQ 或 Ripgrep——你知道,随便哪个你喜欢的命令行 iTerm 工具——从技术上说,这些也都是单元测试,但它断言模型给出的解法的方式是:取模型的代码库,将其编译成可执行程序,然后运行它;测试则是以某些标志调用可执行程序并传入输入,再断言输出产物或标准输出符合预期。Like I don't know, if you're like implementing Fibonacci or something like that. And now you could write a unit test that's like places these sort of pretty constraining assumptions on the form factor of the code to have to look like this, the method header has to look like this. On the other hand, if you look at sort of a more recent benchmark, so there's one called program-bench, and the idea there is the model is given an executable, like FFMPEG or JQ or Ripgrep, you know, whatever your favorite CLI iTerm tool is, those are also technically unit tests, but the way that the model solution is asserted is it takes the model's code base, compiles it into an executable, and then runs that and the tests are formed as like invocation of executable on an input with some flags and asserting that sort of the output artifact or standard output follows the thing.
所以,这一点之所以有意思,是因为它们都是单元测试,但在使用 Program Bench 的场景中,你不再受实现方式的限制。你是在说:“嘿,我现在处于更高一层的抽象层级。”这就是我进行验证的层面。我不是针对你的代码库长什么样来验证,而是针对你的代码库编译后的结果来验证。 所以,如果你卡住了,比如“天啊,我真的很想设计一个很难的任务,但问题是,我的验证不能太细粒度,否则就会限制解空间”,那么一个不错的思路是:想想如何把验证所在的层级提升一个抽象层次。对,希望我说明白了。So the reason that's interesting is because they're both unit tests, but in the setting with Program Bench, you're not constraining on the implementation anymore. You're saying like, hey, you can I am just at a higher order of abstraction. That is where I'm sort of doing my verification. I'm not doing verification against what your code base looks like. I'm doing verification against what your code base compiles into. And so a nice way if you get stuck of like, oh man, I really want to create this hard task, but the problem is that like my verification can't be too fine grained in the sense that it constrains the solution space, then sort of a a way to sort of think about it is like how do you go one order of abstraction up in terms of like where your verification sits. Yeah. Hopefully that made sense.
这只是对这张图所展示内容的一种非常详细的解释。嗯,我们之前聊过这个,对吧?所以这里的主要限制是,归根结底,即使是在 Program Bench 里,嗯,你也可以这么说:对于 Program Bench,任务或基准测试的底层能力,是你想要测试模型从零开始生成一个代码仓库的能力,对吧?这大概就是目标。哦,模型能不能用氛围编程写出一些特别酷的东西,对吧?不过像 Program Bench 这样的基准测试还是有点问题,因为验证方式仍然会限制你的程序必须是什么样子,对吧?比如说你在实现 FFMPEG,并且是通过调用可执行程序来进行测试,那么验证方式就仍然意味着:好吧,模型必须能读取一个 MOV 文件,而且那个标志参数必须正好叫这个名字,对吧?That's just a very spelled out explanation of sort of like what this diagram is showing. Um we've talked about this, right? So the big constraints here is that ultimately even in Program Bench, um you could say so for Program Bench like you could say, all right, the underlying capability of the task or the benchmark is you want to test a model's ability to generate a repository from scratch, right? That like that's kind of the goal. Oh, can a can a model vibe code something really cool, right? Now with something like Program Bench, it's still kind of problematic because the verification is still constraining sort of like what your program must look like, right? Like if you're-implementing FFMPEG and you're doing testing against executable invocations, then the verification is still implying that, okay, the model has to ingest an MOV file and the flag has to be named this exact thing, right?
所以,“规定性”只是意味着,凭借验证的呈现方式,以及它所针对的抽象层级——无论是函数、可执行程序调用,还是更高层次的东西——抽象本身就会变成某种必需之物。因此,它并不是完全开放式的。明白吗?希望如此。好。行。我看到有人点头了。很好。嗯,我们谈过“静态”了,对吧?它们不会随着时间推移而真正演变;而“简化性”则呼应了前面提到的那个想法:比如说,嗯,你知道,我希望模型实现某个解决方案。嗯,这些测试是否真的覆盖了该解决方案空间的全部范围?这取决于你的任务,可能会非常困难,对吧?比如说,如果这是某种非常理论化的计算机科学问题,对吧?So prescriptive just means that by virtue of how the verification is presented and that it's against this level of abstraction, whether it's a function or an executable invocation or something higher, that there's this the abstraction itself becomes sort of like something that's necessary. So it's not purely open-ended. Does that make sense? Hopefully. Okay. All right. I see some nods. Great. Um static we've talked about, right? They don't really evolve over time and reductive is echoing that idea earlier on of like, okay, um you know, I want a model to implement some solution. Um are the tests actually representing full coverage of that solution space? And depending on your task, that can be very difficult, right? Like yeah, I want to do I mean like if this is kind of like a very theoretical computer science problem, right?
比如说,如果你想通过实证来验证一个模型能不能正确计算斐波那契数列,你可以为前 1,000 个斐波那契数编写测试,但你可能没有测试第 1,001 个斐波那契数,对吧?当然,针对这个例子,你可以谈谈形式化方法之类的。不过总之,关键是,有时候你的单元测试可能并没有很好地覆盖整个解空间。好,那么鉴于这些弱点——主要是缺乏静态性、缺乏细致性,以及可能无法完全覆盖所有情况——反过来说就是:好吧,既然是人提出的任务,那就让人来评估结果,对吧?所以这里我们就不花太多时间了。Like if you want to empirically verify that a model does Fibonacci properly, um you know, you can write sort of the tests for like the first 1,000 Fibonacci numbers, but then maybe you don't have tests for the 1,001st Fibonacci number, right? And so certainly with that example, you know, you can talk about formal methods and stuff. But anyway, the point is that like sometimes your unit tests might not actually cover the whole solution space that well. Um okay. So given um these weaknesses, which mainly um have revolved around sort of a lack of like the staticness and a lack of nuance and a lack of sort of like potentially not full coverage, um then like the flip side of it is like, all right, well, like a human asks the task, just get the human to grade it, right? So we won't spend too much time here.
这很大程度上有点像我们之前聊过的 MT-Bench、Chatbot Arena 那类东西。嗯,你基本上就是让一些人查看回答并投票。嗯,这里最有意思的地方在于,人们在如何使用人工标注方面变得更有创意了,对吧?比如在 Chatbot Arena 里,你只是针对两个开放式问题的回答进行投票;但像 GDPval 这样的评测——这是 OpenAI 的一些人创建的——会考察一套在经济上非常有用的任务。看看这些任务,其中很多都和金融之类的事情有关,或者是在电子表格上操作,或涉及很多 Microsoft Office 这类东西,而这些东西在很多白领工作中都会用到,对吧?所以,嗯,在这种情况下,他们确实会使用人工评分,因为给一张 PowerPoint 幻灯片或一个 Excel 表格编写单元测试确实有点困难;也就是说,人只需要回答一个问题。This is very much sort of like the MT bench chatbot arena stuff that we've talked about before. Um you just have sort of people look at and vote over the responses. Um now the main interesting thing here is that people have gotten more creative with like how they use human annotation, right? So with chatbot arena, you just kind of vote uh between two open-ended questions, uh but yeah, with like GDPval, uh which is an evaluation created by some folks at OpenAI, um that takes a look at this suite of like economically very useful tasks. And if you look at the task, a lot of them are kind of like finance things or sort of whatever, and they're kind of operating over spreadsheets or a lot of, you know, Microsoft Office type things that sort of like a lot of white collar work uses, right? So um in this case, yes, they use human grading because like it's kind of difficult to write unit tests for a PowerPoint slide or for, you know, an Excel an Excel sheet in the sense that like yeah, the human just has to answer a question.
实际上,A 列是什么、B 列是什么并不重要。为了适应所有这些灵活性,GDPval 在最初发布时谈到他们如何请人类专家来评分,并展示了当时的模型——我想是 GPT-4 或者 GPT-5 之类的——在这方面表现得非常出色。至于 Kojim,它来自 Ija 所在的 DE 团队,这又是另一种情境:你让一个智能体与人类合作,然后由人来给模型评分,评估合作进行得有多好,对吧?所以,这类任务的共同点很可取:单元测试在这里不太管用,因为解决方案空间非常大,而且很大程度上取决于任务执行者具体如何完成任务。It doesn't actually matter whether column A is this and column B is this. So to accommodate for all of that flexibility, in the original release um GDPval um talks about how they use human experts to grade and they show that wow, you know, like um I think it's like GPT 4 or something at the time or 5 something was very good at this. Um and then for Kojim, which is from DE's group by Ija, um again, this is kind of like another setting where like you have an agent collaborate with a human and there you have sort of the model that person grade like how well did that collaboration go, right? So the nice thing about the commonality between these kinds of tasks is that um unit tests don't really work here because your solution space is very large and it's kind of very subject to the whims of like how the task worker executes on it.
嗯,你可以试着把问题陈述写得非常明确,以此让单元测试能够发挥作用。比如说,我不知道,如果是 GDPval,你可以想象其中一项任务是审核一份 S-1 申报文件之类的,对吧?你可以把任务描述成这样:好,做这件事时,确保你的 Excel 表格命名为 S1 Anthropic.xlsx,而且 A、B、C、D 列必须是这个样子,诸如此类。但问题就在于,为了让单元测试的验证能够奏效,你的问题陈述一下子就会变得规定性极强。所以,问题陈述的规定性和单元测试的全面性之间这种拉锯,可以通过让人工评审介入来打破,因为你知道,人工评分本质上就像是把我们自己当作判断目标是否达成的标准答案。Um you could sort of like try to make unit tests work by making your problem statement super explicit. Like for example, I don't know, if for GDPval you can imagine one of the tasks is like vetting an S1 filing or something like that, right? Now you could frame the task as like okay, when you do this, make sure your Excel sheet is named like S1 Anthropic dot XLSX and that column A B C D have to look like this and whatever. But then that's where by virtue of making the verification for unit testing work, your problem statement suddenly becomes super prescriptive. So this sort of like tug of war between the prescriptiveness of the problem statement and then sort of the comprehensiveness of the unit test, you can kind of break out of it by having a human judge um in the loop because you know, human grading is sort of like, you know, we're treating it essentially as like we're the oracles of what we want done.
是的。不过当然,我们的成本非常高,而且我觉得这是理所当然的,希望以后也能保持这样。你知道,所以确实需要付钱请人来标注测试。更大的潜在问题,在我看来,更多是意见不一致,对吧?因为它不像代码那样具有确定性。如果你有同一个解决方案、同一个单元测试,并且多次运行,除非单元测试本身不太稳定,否则每次得到的都会是通过或失败。即便是同一位人工评审者,也未必能始终保持一致,对吧?所以这一点需要纳入考量。你知道,有一天你醒来,再看同一份评分标准,可能会有一点不同的理解,对吧?所以这并不是说人工评分不好用,也不是说意见不一致就是它的致命弱点。Yeah. Um but then of course uh we're very expensive and uh rightfully so I think I hope it stays that way. Um you know uh so yeah certainly like you need to pay humans to annotate the test. The bigger um potential issue is more so I to me I think disagreement, right? That like you have it's not deterministic like code. If you have the same solution, the same unit test and you run it multiple times barring the unit test being kind of flaky, you're going to get pass or fail every single time. You might not even get sort of consistency from the same human grader, right? And so that's something to um account for um you know one day you wake up and you kind of look at the same rubric and you interpret it a little bit differently, right? And so it's not that human grading is not good to use and disagreement is not sort of like, you know, an Achilles heel.
你可以使用人工评分,但这时通常会期待你进行某种置信区间估计,也就是统计检验,以确保人工评分是可靠且可复现的。但即便如此,这也成本高昂、难以实施,而且很难重新运行。嗯,这就很好地促使我们思考:既然语言模型已经变得这么强了,为什么不越来越多地用它们来代替人工呢?这将构成今天这堂课接下来大约 30 分钟的内容。嗯,先简单介绍一下,使用语言模型作为评判者时,我们通常可以从几个角度来框定评判的方式,对吧?一般来说,你可以把它想成:这里有一个解决方案、一个模型,以及某种评分标准。You can use human graders but then sort of the expectation is that you have done some sort of confidence interval, you know, statistical testing to ensure that you know the human grading is reliable and sort of reproducible. But even then that's sort of costly and difficult and hard to rerun. Um so that motivates very well of like okay well language models are getting so good uh why don't we sort of use them as a stand in for um humans more and more and that will constitute sort of the next 30 minutes uh of today's lecture. Um so uh to preface it a little bit uh with language model as judge there's a couple ways that we kind of generally uh can frame the the way uh judgment is carried out, right? So generally you can think of it as like here's a solution, here's a model, here's some either some rubric.
好吧,抱歉。这里有模型,还有一份评分标准和一个解答。模型会根据评分标准评估这个解答,对吧?另一种方式是:这里有模型,还有两个解答。模型会从中选一个,或者进行某种相关的排序,对吧?因此,基于参考答案的评估、按评分标准打分和断言,大致就是这样一种形式:嘿,模型,这里有一份评分标准,或者某种需要满足事项的清单,或者一段文本,请根据这些内容评估这个产物,对吧?这些就是一些具体的实现方式。我们反复看到的成对比较方式,就是 Chatbot Arena 那种,对吧?比如:这是 A,这是 B,选出你更喜欢的那个,对吧?有时候,如果要求模型选出它更喜欢的那个,也可以加入一份评分标准,对吧?Okay so sorry. Here's the model. Here's a rubric and a solution. The model applies the rubric to the solution, right? The alternative is here's the model, here's two solutions. The model chooses between the two or does some sort of ranking related thing, right? So reference based and rubric scoring and assertions, this is kind of like, hey model, here's a rubric or here's some sort of like checklist of things that needs to happen or some text, apply this body of text to sort of this artifact, right? And so those are sort of the specific instantiations. The pairwise one which we've seen over and over and over again is the chatbot arena one, right? Like here's A, here's B, pick the one that you like more, right? And sometimes in there, when it's supposed to pick the one that it likes more, you can put a rubric in there, right?
所以从概念上来说相当直观。我觉得它看起来就像右边展示的那样。不过,我们会在接下来的几页幻灯片里深入探讨这个问题。再说一次,LLM 作为评判者的好处在于,你可以设想它涵盖了从单元测试到人工评估的整个范围。也就是说,你确实可以编写一些检查项,让语言模型确认:对于这个 GDPval 问题,比如说,我不知道,在填写这份财务表格时,或者在做 TaxBench 之类的任务时,它必须填上你的社会安全号码或模拟号码,对吧?这点毋庸置疑。所以,语言模型作为评判者应该能做到这一点,对吧?另一方面,嗯,我是说,我不太清楚对于文本 TaxBench 来说,开放式偏好是什么。So conceptually pretty straightforward. I think it just looks like what's on the right. But yeah. And so we'll we'll kind of dive deeply into this in the next set of slides, but again, like the nice thing is that the nice thing with LLM as judge is that you can imagine it kind of doing the full spectrum of both unit tests and humans in that like, yes, you can write some things where it's like you do want the language model to check that for this GDPval question that, you know, I don't know, when it filed this financial form or when it does I don't know, tax bench or something like that, it has to has to has to put down your social security number or your mock number, right? There's no way around it. And so the language model as judge it should be able to do that, right? On the other hand, it's like, okay, you know, I yeah, I mean, I don't know about for text tax bench what a open ended preference is.
也许有点像那些更模糊、处于灰色地带的情况,你知道,比如模型很好地运用了你的推理之类的,所以那里没有一个确切答案。抱歉,这个类比有点奇怪。我的意思是,如果你看看那些使用 LLM 作为评判者的基准测试,就会发现它们涵盖了各种情况:既有精确检查,也有更开放式的问题,比如“告诉我你的看法”,但同时也会说明我大致想要什么。所以再说一次,课后如果你愿意,可以看看本节第一张幻灯片里的那张表;不过,你知道,这些方法各有优缺点。因此,在我们深入探讨 LLM 作为评判者之前,也请想想你们的作业,以及你们打算如何评分:可以权衡利弊、做好检查和平衡,看看哪种方法更好,哪种不太好。Maybe sort of like the shadier gray area things where, you know, like the model kind of like applies your deductions very well or whatever and so there's no exact answer there. Point of sorry, that was kind of a weird analogy, but point is to say that like if you kind of look at the spectrum of benchmarks that use LLM as a judge, you see this kind of range of like both exact checks and also sort of kind of more open ended like tell me what you think, but this is generally what I'm looking for. And so again like post lecture, if you want, you can just kind of look at that table from the original first slide in this section, uh but you know, there's sort of pros and cons to all of them. So before we dive deeply into LLM as a judge uh when you think about your homework too and how you're going to do grading there um you can just kind of like do these checks and balances and weighing of like which one's better and which one's not.
嗯,在我们继续讲 LLM 作为评判者之前,有什么问题吗?好,行。Um any questions before we move on to LLM as a judge Okay, cool.
作为评分器的语言模型Language Models as Scorers
好,那么,LLM 作为评判者,嗯,随着时间推移,以很多不同的形式出现过。嗯,我想,甚至在我们如今所说的、基于 Transformer、注意力机制等等的语言模型出现之前,嗯,你知道,我们就已经尝试用人工智能,嗯,从最广义的角度来说,来进行类似人类判断的工作。嗯,所以我们不会聚焦于这些东西。我们只会聊聊 2018、2019 年之后出现的那些创新,嗯,这些创新与 Burton Elmore 以及早期的、可以说是现代 LLM 的雏形有关,它们大约在 2017 年出现,等等。好吧,我会把它分成三个阶段。第一个阶段是,嗯,如果大家还记得上周的基准测试讲座,嗯,我们聊过那些考试式基准测试之类的;再往前一点,抱歉,我们还聊过一些典型任务,比如蕴涵判断、NER 之类的。All right, so LLM as a judge um has shown up like uh in a lot of different ways over time. Um I think even before language models as we know them today in terms of transformers and attention and blah blah um you know we we have um you know tried to use uh artificial intelligence um sort of in the most general term uh to sort of like do human judgment. Um so we're we're not going to focus on those things. We're just going to talk about like post 2018 2019 kind of innovations um that came with sort of like Burton Elmore and kind of like the early on um link sort of modern LMs uh that came about in 2017 and stuff. So well I'm going to break it down into three phases. So the first one is like um if you guys kind of remember from the benchmark uh lecture last week uh where we talked about um all these examination style benchmarks and whatever and even before that sorry when we talked about kind of like the canonical things like uh entailment or like uh NER stuff like that.
我们会讨论如何使用语言模型来替代 BLEU 分数、精确匹配之类的指标。我们还会谈到人类偏好,然后是人类行为;你知道,到这一步你已经看过这张幻灯片了。嗯,好,那我们开始吧。嗯,最早探讨这个问题的论文之一——或者说,这篇论文稍微新一些,但相当具体地回应了这个问题——叫作 GEval。嗯,这里的思路是,以前我们会这样评估文本摘要:拿到一份文档,再从某处获取一份参考摘要,然后让模型生成摘要,接着通过计算 N 元语法重叠度,把模型生成的摘要和参考摘要进行比较,对吧?这个思路是,理论上,我们希望模型生成的摘要在词元集合上与某份由人类专家撰写的参考摘要相似,并且表达相似的内容。We'll talk about how we use language models to replace things like BLEU score and exact match and stuff like that. And we'll talk about human preference and then human action and you know you've read the slide at this point. Um so cool let's dive in. So um one of the first papers to take a look at this uh or I guess it's a little bit more modern but sort of like uh address this question quite specifically um is this paper called G E Val. So um the idea here is that before we would grade text summarization by taking a document having you know gotten a reference summary from somewhere and then the model generates the summary and then we compare the summary against like the reference by doing N gram overlap right? And so the idea there is that like, okay, in theory, we want a model to generate a summary that sort of shares a similar set of tokens and says a similar set of things um as some reference written by some human experts.
所以要记住,这还是在如今的语言模型能够以很低成本生成文本之前。我们说的是大约七年前,那时生成文本的成本还没这么低,你知道的。嗯,你们的作业里也能想象到这一点,对吧?比如 BM25,记得吗?我想你们都做过一些测验,对吧?即便是在那里,人们也发现了 BM25 的一个问题:假设你的查询里有“queen”这个词,嗯,我不知道,你要找的是相似文本,嗯,那么它就不会匹配包含“empress”或“princess”等词的文本,或者那些在意义层面相似、但没有语义相似性的内容,对吧?所以,对于摘要评估中的 N-gram 重叠评分,你们也可以抱有同样的怀疑态度,对吧?So remember this is before the language models that we have today were like generating text as cheap. We're talking about like seven years ago when generating text was less cheap, you know. Um so as you can imagine um uh also within your homework, right? Like remember with like BM25, I think you guys have all been doing sort of the quizzes, right? Like even there folks have identified like, okay, well, one of the issues with BM25 is that if you have a query that has the word um I don't know um queen in it and it's looking for um you know, similar text um it's not going to match with text that has empress or uh princess or things that have sort of meaning-level similarity but no semantic similarity, right? And so you can apply the same sort of uh um skepticism to N-gram overlap grading for summarization, right?
它没有考虑到那种呃语义层面的相似性。所以嗯,他们在两个任务上做了这个。其中一个也是对话生成任务。所以这算是相当嗯直接明了的方法:不是使用 N-gram 重叠度,而是让人来评分。主要要注意的是——哦,抱歉。不是使用 N-gram 重叠度,而是让语言模型来评分,不是让人来评。嗯,主要要注意的是,这篇论文很快就发现,你知道,把模型设定在某个温度或其他参数上,并不能让它每次都生成相同的结果,也不能每次都给出相同的分数。任务的设置是:这是摘要,嗯,这可能是参考摘要之类的东西,请按一到五分的量表给它打分,对吧?嗯,如果你用语言模型对同一组参考内容和模型提出的答案进行评分,实际上每次得到的分数都不一样。It doesn't account for sort of those uh meaning uh level similarities. So um they do this on two tasks. They're also the dialogue generation one. So this is like a pretty um straightforward uh instead of using N-gram overlap, grade it with a person. The main thing Oh, sorry. Instead of N-gram overlap, grade it with a language model, not a person. Um the main thing to pay attention to is that very quickly in this uh um paper, they notice that like, you know, setting the model at a certain temperature or whatever, it's not going to generate the same It give it the same score every single time. So the task setup is here's the summary, um here's maybe like the reference summary or something like that, score it on like a scale of like one to five, right? Um if you run the language model on the same sort of like reference uh model's proposed solution pair, you don't actually get the same number every time.
所以我觉得,这有点像很早之前一种非常鲜明的风格,呼应了我们之前会讨论的这种 pass@k 之类的东西。为了考虑这种差异,他们会进行多次 rollout,于是就得到了这里底部的这个分布,然后只需取这个分布的权重,或者说平均值,嗯。所以,这算是一种非常简单的表达方式:比如说,嘿,在我们的表格里,我们展示了与这些传统方法相比……它们会比较文本的语义形式,或者使用一大套启发式方法来完成这件事,又或者用某种巧妙的统计方法,将文本建模为分布,再比较这些分布。我们把所有这些复杂性都抛开吧。So this is sort of like I think very early on in a very distinct flavor echoes this kind of like pass case stuff that we'll talk about before. So to account for that variance, they do multiple rollouts and that's where you get this distribution on the bottom here and then you simply take like the weight of the distribution or like the average, you know. Um so um that's sort of like a very simple way to express that like oh you know like hey in our table we show that compared to these uh sort of traditional like compare the semantic form of the text and you have these sort of like big compositions of heuristics that do this or they do some sort of clever statistical uh modeling of the text as a distribution and then compare those distributions. Uh let's let's kind of throw away all that complexity.
结果发现,这些模型确实相当不错。嗯,他们在这里展示的是,每项指标与人在同一维度上的评分相关性有多高,对吧?也就是说,无论是语言模型还是人类,在给定一组人工标注者,并列出你希望摘要具备的所有这些特质后,都会对它们逐一评分;然后他们会看这项指标与人类评分或偏好的相关性有多高。嗯,我觉得这篇论文中的许多想法后来都得到了发展,甚至各自发展成了独立的方向。不过即使在这里,你也能看出一种倾向:好吧,我们需要证明语言模型有能力取代原来的传统指标,而证明这一点的好方法,就是看它是否与人类偏好一致,对吧?Turns out the models are pretty dang good. And so um what they show here is they show how well each metric correlates with a human's score along the same dimension, right? So both the language like the model is going to sort of like uh like the human given a like a human annotation pool, given sort of all of these um sort of qualities that you're looking for in your summary is rating all of them and then they see how well this metric sort of correlates with the human uh score or preference there. So um I think a lot of the ideas in this paper get developed sort of like and become their own things later on, but even here you can see some sentiment of like okay we need to show that the language model is capable of supplanting um whatever the traditional metric was and a good way to show this is that it aligns with human preference, right?
而且你会在整个这一部分里反复看到这一点。嗯,好。所以 GPTScore 也做了非常类似的事情,但它开始对事物进行一定程度的泛化,对吧?也就是说,不再只是给出一个参考文本,再给出模型生成的内容,然后比较两者。从建模角度来看,这有点像 T5 所做的事情:我们把所有这些任务整合到同一种通用的“给定输入、生成输出”的形式之下。对于 GPTScore,他们把这种做法扩展到了一整套不同类型的任务,以及不同类型的维度。所以我觉得这张表大概是其中最重要的内容。嗯,任务包括摘要、对话、机器翻译,也就是 Google Translate 之类的,还有……我想这里还有几个——好吧,看来其实没那么多;但除此之外,你还会看到所有这些维度,对吧?And you're going to you're going to see this echoed again and again throughout this entire section. Um cool. And so like GPTScore uh does something quite similar as well, uh but like um it sort of starts to generalize things, right? So uh beyond just sort of like here's a reference and then here's sort of what the model generated, Compare the two. This is a little bit sort of like what happened with T5 uh from a modeling perspective when we took all those tasks and kind of united them under the same general sort of like given an input generated an output formulation. For GPTScore, they expand this to a whole suite of like different types of tasks and also different types of dimensions. So I think that this table is probably like the main takeaway from it. Um so summarization, dialogue, machine translation slash you know Google Translate um and um I think a couple okay I guess not too many um in this, but then you also have all these dimensions, right?
所以,比如说从上一篇论文中我们看到的那个表格里有四个维度,你就可以非常细致、具体地评估一段文本,对吧?嗯,我觉得有趣的是,如果你看看这个时期的论文,通常会发现很多论文在评估文本时,都会非常全面、详尽地列出一段文本要具备哪些特点才算好。它们通常会针对某一种文本生成任务来设计评估标准。然后通常会发生的情况是,语言模型出现之后,人们会想:哦,其实我们可以把这些任务统一起来——无论是在向模型呈现任务的方式上,还是在期待模型输出解决方案的方式上,甚至在评估方式上。So if like from the previous paper we saw in that table there were four dimensions, you can get really sort of like thorough and granular with like how do you rate a body of text, right? Um I think the funny thing about this is if you look at sort of papers in this era, you'll typically see that like a lot of them um tackle sort of grading of text uh by sort of like being very um uh comprehensive and exhaustive in their listing of sort of like what makes uh body of text good. And they'll sort of typically cater it for sort of a uh one type of uh task um uh text generation task. And then what typically happens is that you know when language comes around language models come around, people decide like oh actually you can sort of unify these tasks both in terms of how they're presented to the model and how they're expected to output their solution and then in terms of their grading as well.
所以你多少能看到这种聚合的重复出现:就像我们看到的那样,原本彼此独立的语言学基准,后来汇总成了 SuperGLUE、MMLU 之类的东西。而且你也看到这种情况发生在验证层面本身,对吧?有意思的是,我们做了这些之后,到后来,尤其是 Chatbot Arena 和 MT Arena 出现的时候,他们似乎就直接决定:好吧,人类就代表这一切。我们就不再把文本任务的质量拆分得特别细、特别具体了。不过,没错,他们又做了一次这种大规模的全面测试:让 19 个不同规模的语言模型执行四种不同的任务,也就是我们提到的那 22 个方面。他们用这套方法跑了很多数据集,然后证明了,用语言模型来评分,结果与人类偏好的相关性似乎更高。And so you kind of see the repetition of this aggregation that we saw with like you know separate linguistics benchmarks becoming like superglue and MMLU and stuff like that. And you're you're seeing that happen like also at the verification level itself, right? So the funny thing is we do this and then at some point um especially when chatbot arena and MT arena come around, they kind of just decide like all right the human is just going to like the human just represents all of this. So we're not going to sort of like get like super granular and specific with how we break down the quality of tasks of of text anymore. But yeah, again, they do this sort of big sweeping run, 19 language models of varying sizes on four different tasks, those like 22 aspects that we talked about. They run a bunch of data sets through this and then they show that you know like oh you know like using a language model as grading is just kind of like more correlated with human preference.
所以这和之前的情况差不多。这篇论文的目的只是展示,这种方法可以扩展到更多任务,而且结论在更多模型上也成立。不错。然后,这篇论文直接提出了一个问题,也就是语言模型作为评判者背后的那个根本研究问题。这篇论文开始更多地考察可靠性,对吧?正如我们之前讨论过的,人工评估很难复现,也不稳定。要反复进行评估也很困难。因此,如果我们有一个语言模型,能否检查它是否与人类的判断一致?在和人类进行比较时,它给出答案或作出判断的差异程度又如何?也就是说,面对同一组判断时,它与人类判断的差异相比如何?So it's kind of the same story as before. Point of this paper is just to show that sort of it gets expanded to more tasks and and the conclusions hold across more models. Cool. Okay. And then this paper just kind of outright asks the question that you know is sort of the fundamental research question behind language models a judge. And this one sort of starts to inspect more of like the reliability, right? So again, human evaluation is like hard to reproduce and unstable as we've talked about. It's like difficult to do those reruns. So if we have a language model, can we sort of check that A it's aligned with the humans and when it comes to you know comparisons with humans is it sort of like is the variance and sort of like how it answers or judges these things? Like how does it compare to human variance when presented with the same set of judgments, right?
所以你知道,整个设置相当直接。我们给语言模型的指令、样例和问题,都与给专家评分员的完全相同,涉及这里的两类通用任务。你可能已经注意到,这些任务比我们之前看的任务要开放得多。比如开放式故事生成;然后,我们会给语言模型和人工评估者一段简短描述和一个待评估的故事。接着还有四项评分标准,对吧?这和之前不一样,之前的答案比较明确;我们现在想问的是,它能不能更好地处理开放式任务。嗯,结论好像在这里又重复了一遍,但和之前一样:语言模型的评价与专家高度一致,这很不错;而且它们给出的答案实际上相当稳定,不过对于不自然的文本,它们比专家更宽容。And so you know the setup is quite straightforward. So you give the language model identical instructions, samples, questions used with expert raters on these sort of like two general tasks here. So as you might noticed here with the tasks, they're kind of much more open-ended than the ones that we were looking at before. And so like open-ended story generation and then yeah, we present the language models and the human evaluators with a short description and a story to be evaluated. And then there's this these kind of like four grading criteria, right? So unlike before where the solutions are a bit more exact, we're kind of asking this question of like can it deal with open-ended tasks better. Um and so okay, I guess the conclusion kind of gets repeated here, but um it's the same as before, which is like yeah, the language models are super aligned with the experts, which is great, and they're actually sort of quite stable in the sense that they give you the same answers, but they are more lenient than experts on unnatural text.
所以,这句话是在铺垫:我觉得今天的课上不会把这个问题作为一篇论文来明确讨论,但如果你感兴趣,它会引向一个独立的研究问题:假设我有 Opus 5.5、GPT-6.1 Soul、Gemini 4 和 Muse 1,它们都会生成摘要之类的内容,但我的评分模型只有 Opus 5.5。那么,和其他模型相比,Opus 5.5 会不会更擅长给自己生成的内容打分?对吧?这是另一条研究脉络,而这句话算是初步点出了这个方向。我们不会深入探讨这个问题,但我认为,这确实涉及一个很有意思、也更具体的类别:我们正在检验 LLM 作为评判者时的鲁棒性。他们展示的结果是,没错,至少在一两年前,这些模型往往偏好自己的生成结果。So this line prefaces I don't think we'll get to this explicitly as a paper in the lecture today, but if you're interested, this starts to lean into the separate research question of if I have Opus 5.5, GPT-6.1 Soul, I don't know, Gemini 4 and Muse 1 and they all generate summaries or something like that, but my grading model is just Opus 5.5. Does Opus 5.5 grade its own stuff better, you know, compared to other models, right? And so that's a separate lineage of papers that this sort of starts to hint at. We're not going to dive into that, but I think that is sort of a very interesting set of like a more specific category of like LLM as judge robustness that we're checking. And so what they do show is that yeah, the models like at least at least a year or two ago tend to have preferences for like their own for their own generations.
是啊。好。好的。Yeah. Cool. Okay.
学习和衡量人类偏好Learning and Measuring Human Preferences
现在我们要转而讨论人类偏好。之前我们大致在聊:语言模型是不是比传统的 NLP 指标更好?我们最后得出的结论是,在很多情况下确实如此。正如我们看到的,验证仍然依赖于——嗯,你知道——或者说,对验证结果的确认,依赖于证明它与人类偏好高度一致。那么接下来很自然的问题就是:语言模型能不能完全像人类偏好那样?接下来三篇论文会围绕三个问题展开。我们能不能根据人类偏好训练出一个评判者?也就是说,如果我们有一个语言模型,怎样对它进行后训练,或者在它的基础上做一些数据干预,让它模仿你我偏好的东西?Now we're going to move on to human preference. So before we were kind of talking about like all right, are language models better than like traditional NLP metrics? And we came back and said yes for a lot of these. So you know, as we saw like the verification continues to rely on like oh, you know, or validating the verification relies on showing that it's very aligned with human preference. So then the natural question is then can language models just like resemble human preference altogether, right? And so there's kind of three questions that we'll answer across the next three papers. Can we learn a judge from human preferences, right? So if we have a language model, how do you post train it or just kind of do some uh data intervention on top of it to make it mimic the things that you and I prefer.
呃,也许是单个的人类。通常来说,它涉及的是大量人群,对吧?嗯,那么,经过提示的语言模型能不能代替人类写作者呢?也就是说,它能不能反映我们的偏好?这有点像是在问,它能不能将我们的偏好付诸实践,对吧?嗯,第三个问题一直是:好吧,如果我们用语言模型来代替人类,那么它到底有多可靠?嗯,我会说,这个研究领域相当有意思,因为它确实构成了相当大一部分……哦,对,有个问题。对。嗯哼。Uh maybe it's an individual human. Usually it's kind of across like a large population of humans, right? Um can a prompted language model then kind of stand in for human writers? So this is like can it resemble our preferences? This is sort of like can it operationalize our preferences, right? Um and then the third is sort of always the question is like all right like if we use a language model as a stand in like sort of how reliable is it? Um so um I would say this is this area of research is quite interesting because it does constitute like a good amount of what Oh, yes, a question. Yes. Uh-huh.
这被称为不自然文本。This is referred to unnatural text.
哦,不自然文本。呃,对,问题是“不自然文本”到底指什么?嗯,你可以把这看作一种非常奇怪的奖励投机,对吧?好吧,也许没那么奇怪。一个简单的例子是,我们会在后面的几张幻灯片里看到,研究人员发现,在摘要任务和一些语言模型的回答中,语言模型评分器会偏向更长的回答。如果你不限制摘要的长度,而评分标准又没有考虑到这一点,那么模型就可能会想:“好吧,我学会生成摘要了:只要把同一句话反复说就行。”这就是一种简单的奖励投机:摘要本来只有一句话,但如果我把同一句话说三遍,不知为何,LM 评判器给重复三遍的内容打的分会比那一句话本身更高。Oh, unnatural text. Uh yeah, the question is like what the heck does unnatural text refer to? Um this is you can think of this as actually like a very strange form of like reward hacking, right? So okay, maybe not strange. Maybe a simple thing is like we'll see this um in a couple slides later. Uh what they found with summarization and with some language model responses is that a language model grader will be biased towards longer responses. If you don't constrain sort of like uh how long your summarization can be and your grading rubric is sort of not accounting for that, then the model could just say like okay, I'm learning to generate a summarization where I just repeat the same sentence over and over again. Like it's a simple reward hack where like the summary is like one sentence, but if I just say the same sentence three times, for some reason the LM judge is going to grade something repeated three times better than that single sentence.
这样说有道理吗?我是不是把你说懵了?对,完全正确。完全正确。是啊,我觉得你提的这个问题特别好。尤其是在这种涉及人类偏好之类的领域里,界限确实很模糊,因为我们其实是在把自己的偏好投射到它身上。所以,从非常细微的层面来说,“不自然”对你和我可能意味着很不一样的东西。不过在他们的例子里,他们只是说,大家都觉得,如果一份摘要把同一句话重复十遍,那确实很奇怪。是个好问题。好。那我们继续。我觉得这项研究有一点特别吸引我,也许你也会觉得有意思:其中相当一部分其实体现了 OpenAI 早期在做的事情——当时他们还只是一个发表研究论文的非营利组织。所以,我们来看看其中的一些内容,好吗?Does that make sense? Did I lose Yeah, exactly. Exactly. Exactly. Yeah, so I think um it's a great question that you point out because like especially in this regime of like human preference and stuff like that, it is it is definitely gray in that like we are kind of projecting our own preferences onto it and so unnatural in a very fine grain sense could mean very different things to you and me, but I in their case they're just referring to like everybody agrees that like it's really weird if you have a summary that repeats the same sentence 10 times. Yeah. Great question. Um cool. So yeah continuing here I think something that's quite that I like about this research that maybe it will be cool to you as well is that a good amount of this actually constituted what like OpenAI was doing like early on where they were just kind of like a non-profit publishing nerves papers and so um you know we'll dive into some of these right?
因此,比较受欢迎的早期工作之一,也是我认为我们特别强调这条研究脉络的原因,是它实际上为后来的一切——包括 RLHF——做了很充分的铺垫。我想大家应该都听说过 RLHF;如果不是在这门课上,那也可能是在其他语言模型课程里。RLHF 通常指的是一种范式:基于人类反馈进行强化学习。我们拿基础模型,对它应用 SFT,也就是指令微调,让它能够进行对话。但这算是最早将某种后训练、强化学习或基于偏好的奖励应用到语言模型上,作为一种训练技术的案例之一,对吧?所以我不会详细介绍它的工作原理,不过它和我们讲到数据和评估时讨论的 GRPO 那套东西非常相似,对吧?So one of the first ones that is quite popular and I think we highlight this lineage of work specifically is because this actually very much prefaced everything that led to RLHF which I think like hopefully people have talked about if not in this course then in like separate language model courses where RLHF generally refers to this paradigm of like reinforcement learning from human feedback where we took the base model we applied SFT instruction tuning to it to kind of be able to do dialogue but this was kind of one of the first instances of applying some kind of post training slash RL slash preference based rewards two language models as a training technique right? So I won't go into full detail about how it works but it's kind of very similar to kind of the GRPO stuff that we talked about when we went over data and Evals right?
所以这一节又是以一个类似的引言开头:好,像 ROUGE 和参考摘要这样的指标,仍然算是传统的 NLP 指标。它们只能作为质量的替代指标,却不能直接衡量质量,对吧?那么,我们能不能训练一个模型,准确预测人类究竟更喜欢什么?所以在这个例子中,建模目标就不再是那种“看看模型给出的分数是否相近”之类的事情,而更像是要证明它能够预测人类会作出怎样的判断。这一点有些微妙,不过你知道,嗯,我想我可以把它说得更清楚些。重点更多在于预测人类更喜欢什么。嗯,也就是对人类进行建模,对吧?所以,嗯,[叹气]我想,动机和之前相当相似。So in this section again they start with like a similar preface of like okay Rouge and reference summaries like this is still sort of traditional NLP metrics. They only proxy quality but they don't directly address it right? So can we train a model to predict exactly what humans prefer and so in this case it's the modeling objective is less sort of in the way that like oh you just kind of see if the model produces scores that are similar and it's like more of like we are showing that it's able to predict what a human predicts. So it's kind of subtle but the but you know um, it's again I guess I know how to state it better. It's more about sort of predicting what humans prefer. Um, so modeling humans, right? And so, um, the [sighs] I guess like the motivation is quite similar to before.
所以,如果我刚才有一点讲得让你跟不上,也不用担心。归根结底,这只是想看看模型能不能判断出我们的偏好。这篇论文更有意思的地方,应该是他们提出的训练范式。首先,这是一种评估范式,但它也很适合用于训练语言模型,也就是像我们在这门课里反复看到的那样,把基准测试转化为数据,对吧?他们所做的基本上就是大规模开展 LM Arena。如果大家有关注这个领域,就会知道,这类数据正是 LM Arena 卖给公司的数据:全都是这种人类偏好数据,对吧?比如,我有模型生成结果 A 和模型生成结果 B,由人类来确定偏好,然后我训练一个奖励模型,让它接收这两个模型生成结果,并预测人类更喜欢哪一个,对吧?So don't worry if I lost you a little bit there. Ultimately, it's just sort of like seeing if models can gauge what we prefer. The more interesting thing about this paper is sort of like the training paradigm that they come up with. So this first an evaluation paradigm, but then it lends itself very well into then sort of training a language model, like turning the benchmark into data as we've seen uh, repeated a lot in this course so far, right? So uh, what they do is they basically just do LM Arena at scale and if people are kind of tapped into it, this is very much the kind of data that like LM Arena has sold to companies. It's all this kind of human preference data, right? Like I have uh, model generation A, model generation B, human establishes the preference and then what I do is I train a reward model that takes those two um, two uh, model generations and predicts which one the human prefers, right?
所以这就像是一个非常简单的、基于偏好的奖励模型。给定 A 或 B,我让模型进行预测。基本上,这就是 Chatbot Arena 和 MT-bench,只不过你用这类数据来训练一个模型,对吧?也就是说,收集数据,生成一些元组,其中包含输出一、输出二,以及两者中哪一个更受偏好。等你有了这份庞大的训练记录元组列表,就可以在此基础上训练奖励模型。奖励模型要做的其实很简单:它会说,好吧,我通过在这个目标上接受训练来模仿人类偏好:给定这两个样本,我要预测人类更喜欢哪一个。有了这个奖励模型之后,你就可以把它用作某种机制,为一个模型——嗯,抱歉,是为一个语言模型生成奖励。So it's like a very simple uh, preference-wise uh, reward model. Given A or B, I ask the model to to predict. So this is basically just chatbot arena and MT-bench, but you train a model on that kind of data, right? So data collection to generate tuples of uh, sort of uh, output one, output two, which one was preferred between the two. Once you have that uh, huge list of tuples uh, of training records, then you can train a reward model on top of it. And the reward model simply just says, okay, I'm trained to mimic human preferences by being trained on this objective of given these two samples, I'm going to predict the one that the human likes more. Once you have that reward model, you can then apply it as sort of what generates rewards for a model uh, for a model um, for a language model, sorry.
所以,更明确地解释一下:现在,我们可以纳入摘要这类任务,还有,呃,你知道的,比如笑话理解之类更开放的任务。我们让模型生成解决方案,然后不再需要付费请人工标注员来评估这些内容、参与训练循环,而是把人完全从训练循环中移除,对吧?奖励模型会给出相应的奖励。嗯,比如给定这些内容,模型会生成多个摘要,然后奖励模型选出最好的那个摘要,我们就是这样训练模型的。这样说得通吗?希望我刚才没有把大家讲糊涂。嗯,这种方法并不使用单元测试。So to kind of explain this more explicitly, now, you know, we can incorporate tasks like summarization, like uh you know, like uh I don't know, like joke understanding or like these things that are a little bit more open-ended, and we have the model sort of generate the solution, and then instead of having to pay human annotators to rate these things and be part of the training loop, we remove the human completely from the training loop, right? So and sort of the reward model is what's giving back reward to this. Um so the model um generates like given this, it generates multiple summaries, and then the reward model picks which summary is the best, and that's how we train the model. Does this make sense? Hopefully I didn't lose people in the middle. Um this is sort of we're not using unit tests.
这只是想说明,没错,理论上这里的这个奖励模型完全可以是一个人。比如,你可以想象这样训练一个模型:安排一大批大约 10,000 名人工标注员,让他们随时待命,模型生成内容后就接收这些内容、给它们打分,然后把奖励反馈回去,对吧?显然,出于很多原因,这行不通,比如成本方面以及技术可行性方面的问题。所以我们训练一个奖励模型来代替人类。这里想说明的是,除了我们已经谈了很多的基准测试之外,这也是一种将偏好数据付诸实践的方式,用来训练模型去模仿、进而更好地遵循人类偏好。好。好的。嗯,这篇论文则做了一个早期原型,然后他们展示的结果也呼应了我们之前看到的论文:这种训练范式效果很好。This is just to explain yes, in theory this reward model here, it totally could be a human. Like you could imagine training a model by having an army of like 10,000 human annotators that are just sitting and ready and like receiving model generations as they come in, rating then and like sort of sending the reward back, right? Clearly that doesn't work for like a number of reasons uh both in terms of costs, in terms of sort of technical feasibility. So we're training a reward model as a stand-in for the human. So the point here is to show that like um beyond the benchmarking, which we've talked a lot, this is a way that sort of preference data was operationalized in a way to sort of like train models to follow mimic and then follow human preferences more. Cool. Okay. All right. Um and then with this paper they kind of like do an early prototype of this, and then they just show like kind of echoing um the prior papers that we saw that like hey uh this training paradigm works very well.
嗯,在之前的论文中,我们展示了这些指标——嗯,我们验证了这些指标,具体来说,是验证了这种验证方式。在这里,我们验证的是这样一种训练范式:将这种验证大规模地纳入其中,效果非常好。简单来说,我用人类偏好训练一个模型,然后在对另一个独立语言模型进行后训练时,用它提供奖励信号;我还展示了,这样一来,语言模型生成的文本会更符合你我真正喜欢的风格。很好。好吧。接下来你还会看到几篇后续论文也采用了这种方法。在上一篇论文中,我们只看了摘要生成;而 StructGPT 算是一篇里程碑式的大论文,他们大致上也做了类似的事情,但当然还把这套方法应用到了许多其他任务上,对吧?Uh in the prior papers we were showing that the metrics uh we validated the metrics uh with respect to sort of we validated the verification. Here we're validating that sort of this training paradigm that incorporates this uh verification at scale works very well. So TL;DR, I train a model on human preferences and use that to provide reward signal when I do post training on a separate language model and I show that sort of the language model gets better at generating text that you and I really like. Cool. Okay. All right. And then you'll see a couple more follow-up papers that do this. So in the previous one, we took a look at just summarization and StructGPT is very sort of milestone like a big paper where they kind of like did this, but they of course applied like a bunch of other tasks to this, right?
所以,再说一次,这又重复了这样一种范式:你先让它适用于某一项 NLP 任务,然后就可以把同样的流程应用到一整套任务上,对吧?比如右边的摘要任务,正如你所看到的,我们可以输入很多不同类型的开放式文本生成问题,而且它都能奏效。很好。然后就到了 RLHF 相关的内容。有意思的是,这两张图分别来自两篇论文,看起来像是两张彼此独立的图,但说到底,它们在理念上确实是在传达同样的东西,对吧?收集标注。我觉得这里比较有意思的一点是,正如我们之前讨论 LLM 作为评判者时所说的,评分可以通过很多不同的方式来实现。So again, another repetition of the paradigm of you kind of make it work for one NLP task and then you can kind of apply the same procedure to like a whole suite of things, right? So before summarization on the right, as you can see, we can throw a lot of different kinds of open-ended text generation problems and it will work. Cool. And then that's where you get kind of like the RLHF stuff. So it's funny in that like these two are like kind of two separate diagrams from these two papers, but you know, it really is sort of like spiritually it's kind of like communicating the same stuff at the end of the day, right? Collect annotations. I think the main thing that's like kind of interesting here is as we kind of talked about before with LLM as a judge, you can instantiate the grading in like a lot of different ways.
这有点像评分标准吗?是偏好吗?还是诸如此类的东西?根据任务的不同,你可以收集很多不同类型的、与文本生成有关的人类偏好。然后,你只需要调整训练奖励模型的方式,让它更能适应这些数据的各种不同表述形式。所以这里做的就是这些。不过,基本上还是和之前完全相同的方法。然后,他们又展示了在开放式任务上的改进。不错。好,我稍微加快一点。我有点落后了。说到 Chatbot Arena,我想我们可以很快过一下,因为这可能已经是我们第二次或第三次看到它了,对吧?和之前类似,我认为如果你深入阅读这篇论文,它的主要贡献就是探索 LLM-as-a-judge 的不同变体。</numerusformIs it sort of like a rubric? Is it preference? Is it yada yada? Depending on the task, you can collect a lot of different kinds of sort of human preferences with respect to text generation. And then you just sort of like update the way you train the reward model to be more accommodating of all of those different kinds of formulations of that data. So that's all that's happening here. It's pretty much the exact same recipe as before though. And then again, they show you know, improvement on open-ended things. So cool. Okay. And I'll speed up a little bit. I'm a little behind. So Chatbot Arena, I think we can probably just go through this really quickly cuz this might be the second or third time that we've seen this, right? And so similar to before, I think the main contribution of this paper, if you read deeply into this, is to show to explore different kinds of LLM-as-a-judge variation.
所以,他们其实把我们之前讨论过的内容明确地提了出来,比如两两投票、单答案评分。如果把参考答案提供给语言模型,它的评分会不会更好一些?他们还创建了很多示例,展示这些不同设置大致是什么样的。我认为 Chatbot Arena 背后的主要贡献是,他们围绕语言模型的可靠性给出了很多置信界限。也就是说,它在多大程度上能够反映人类的实际判断,以及它本身有多可靠。所以,如果你想进一步研究那篇论文,里面有很多数学推导,说明如何证明让语言模型担任裁判效果很好。这里有一点值得指出,稍后我们会在一张幻灯片中深入讨论:他们发现其中存在偏差,对吧?So they kind of make what we talked about earlier explicit like you know, pairwise voting, single answer grading. And if you give the reference to a language model, does it grade it a bit better? They kind of do a lot of create a lot of examples of what these kind of different setups look like. I think the main contribution behind Chatbot Arena is that they do a lot of confidence bounds with respect to sort of like the reliability of the language model. Like how well it represents actual human judgment and then sort of its reliability. So you know, if you want to investigate that paper more, that has plenty of math there that demonstrates sort of how to how to show that sort of language models as judge works very well. So the one thing that's kind of worth pointing out here that will then dive into a later slide is that they show there are biases, right?
所以,出现的一些简单现象之一是:根据答案是 A 还是答案 B,会有两种不同的回答;仅仅是 A 或 B 本身,就会导致判断出现某种不一致,对吧?因此,对于不同的语言模型评审者,位置偏差的一致性是指这样一种情况所占的百分比:交换结果后,也就是 A 变成 B、B 变成 A,模型仍然给出相同的偏好。如你所见,模型在很大比例的情况下都偏向第一个答案。于是,你会看到一系列相关论文陆续出现,它们指出了不同的偏差,例如偏向答案排列顺序的偏差、偏向答案长度的偏差,以及其他这类你其实并不在意的虚假信号,对吧?So one of the simple things that showed up is you have two answers based on whether it's answer A or answer B, this the A or B itself leads to sort of like inconsistencies in the judgment, right? So position bias of different language model judges that they've applied consistency is the percentage of cases where like when you swap the results, like A becomes B, B becomes A, the model still answers with sort of like the like it's consistent in this preference. And as you can see like yeah, it's like biased towards the first one a huge percentage of the time. So these kinds of biases you then kind of see a lineage of papers that sort of emerge and they identify different biases such as biases towards like the ordering of the answers or biases towards like the length of the answers or these kind of like different spurious signals that you don't actually care about, right?
所以这有点像是,嗯,它其实不算是不自然的文本,而更像是某种不自然的、或者说毫无根据的偏见大规模地冒出来了。所以你知道,这是他们发现的一件事。嗯,我觉得,对于很多这类问题来说,抑制这类不良偏好的干预措施其实相当简单,对吧?比如,你可以创建一整套这样的问答数据集,然后拿同一个问题,把你应该偏好的答案顺序打乱,再用数据来逐个敲打、消除这类行为。说得通吧?对,很好。好,然后我觉得这里有趣的是,他们搭建了一个平台来收集人类提出的问题,而且它不受我们以前见过的传统 NLP 任务的限制,所以他们展示了这样一种情况:如果你用 Chatbot Arena 搭建一个好的平台,稍微加入一点游戏化设计,并把它做得足够易于向大众展示,人们就会提出各种各样的问题。And so this is kind of like um it's not really sort of unnatural text, but this is just sort of like unnatural sort of or like unwarranted biases popping up at scale. And so, you know, that's something that they identify. Um I think with a lot of these things like the intervention to suppress uh these kinds of uh bad preferences is actually quite uh simple, right? Like you can then create like a whole data set um of uh Q and A questions like this and take the same question and like mix up the order uh of what you're supposed to prefer um and you just kind of like use data to like, you know, uh whack a mole uh this kind of behavior out. Makes sense, right? Yeah, cool. Okay, and then again um I think the fun thing here is that like kind of because um they created a whole platform to collect human um human questions and it's not kind of constrained to the traditional NLP tasks that we've seen before is that they kind of show like, oh well with Chatbot Arena uh if you create a good platform and you kind of gamify it a little bit and you make it sort of presentable to the world, uh people ask all sorts of different questions.
嗯,所以对于各种不同的问题,涵盖范围非常广泛的类别,我们只要展示一下:哦,裁判模型在很多情况下都和人类的判断相当一致。这张表要回答的问题之一是:在评判与编码、数学或信息抽取相关的问题时,作为裁判的语言模型与人类判断的一致程度以及自身的一致性会有多大差异?嗯,如今这大概看起来相当显而易见,你知道,它应该能很好地泛化;但当时,我们这些人还没那么相信迁移能力。对。很好。那么,在我们转到“语言模型作为智能体”这一部分之前,最后还有一个问题——我们之前已经见过这个问题了:能不能训练一个开源模型,让它根据评分标准进行评判?对吧?Um and so like for all sorts of different questions uh across very sort of broad sweeping uh categories um we can just show that like, oh the judge sort of agrees with the human a lot. So one of the sort of this uh table is answering the question of like, okay, how much does LM as a judge vary with respect to alignment with humans and consistency when it's judging coding-related questions or math-related questions or extraction-related questions? Um today it probably seems quite obvious that like, you know, it would generalize well, but you know, we people weren't as bought into the idea of transfer back then. Yeah. Cool. Okay, and then last but not least before we kind of move on to the uh language model as agent section um sort of the question here which we've already kind of seen is like, can you train an open-source model uh to judge with rubrics, right?
所以,嗯,这是来自一个类似 CMU 的团队,或者说是一位现在在 CMU 的博士生。嗯,他们做的事情是,像 OpenAI 之前做过的很多这类工作一样,这项工作是针对他们的 GPT-3 模型的,其中有一个并不完全算是开源的。嗯,这篇论文提出了一套挺不错的方案,把我们之前看到的那种奖励模型训练流程讲得非常明确,还提供了具体的资源,对吧?所以,正如你们在这里看到的,嗯,我们有基于用户定义评分标准的细粒度评估。他们只是把 RLHF 文献中已有的这些内容拿来,并将其付诸实践。嗯,所以,是的,他们采用了一批开源模型、各种各样的评分标准,以及许多不同的指令。So um this is from uh um uh group at like a CMU or like a PhD student who's now at CMU. Um and what they did was like with a lot of these prior works that OpenAI had done, this was like four their GPT-3 models and one isn't quite wasn't quite open source. Um this paper put uh put out sort of a nice recipe uh that just sort of makes very explicit and provides concrete assets for kind of that reward model training uh loop that we saw from before, right? So, as you can see here, um you know, we have uh fine-grained evaluation with user-defined score rubrics. So, they just kind of take this stuff that was already in the literature uh of RLHF and they sort of operationalize it. Um and so, yeah, they take a bunch of open source models, a lot of different rubrics, a lot of different instructions.
这个训练方案基本上就是给模型注入我们一直在讨论的这些行为。好。然后主要的报告内容,嗯,你们也会在其他论文里看到这种热力图,它只是用来展示:每个方格代表这个评审器与人类评审之间的相关性,以及它与这里某个特定数据集上的评分标准之间的相关性。通常,如果你想在这篇论文里展示这一点,要注意它与其说是一篇基准测试论文,不如说是一篇建模论文。对于建模论文,你通常要展示的是:嘿,你知道,我的模型能够与当前最先进的模型相媲美,我提出的训练范式具有泛化性,而且在各种不同类型的指令遵循基准测试上都表现良好,并没有过拟合某一个特定任务。This recipe just sort of like um imbues the model with behaviors that we've been talking about this whole time. So, cool. And then um the main reporting that's uh yeah, you'll kind of see this heat map in like other papers as well, uh which is just to show that like okay, um each pun uh sorry, each square represents how correlated this judge is with humans and sort of the rubrics on sort of like some particular data set here. So, usually when you want to show that um with this paper, it's less a benchmark paper and more like a modeling paper. With a modeling paper, you typically want to show that like hey, you know, like my model is like comparable to the state of art and the training paradigm that I've put forth is generalizable and it works well for all sorts of different kinds of instruction following benchmarks and it's like not overfit to one particular thing.
很好。好。嗯,是的,我想在结束这一部分之前,简要摘录一下评分细则大概是什么样的。嗯,我们之前稍微谈到过,也稍微暗示过这一点,嗯,比如 Prometheus 和 RLHF,对吧?评分有不同的方式,对吧?右边是我们非常熟悉的成对比较。左边则是让模型分别为每个选项生成分数,然后再比较这些分数。嗯,我觉得至少我还没看到哪篇论文明确表明其中一种比另一种更好。我认为人们提出许多这类不同的评分范式,纯粹是为了说明:嘿,对于不同类型的评分细则——有时你希望模型生成分数,有时希望它给出偏好,诸如此类——下游训练目标都能够接收以各种方式呈现的偏好。Cool. Okay. Um yeah, I guess like a brief excerpt before we uh end this section is sort of like what the rubrics look like. Uh we've kind of talked about this uh hinted at this a little earlier, uh but kind of with like Prometheus and uh RLHF, right? Like there's kind of different ways that you can do grading, right? So, uh on the right, the pairwise stuff that we're super familiar with. On the left, you can make the model generate sort of like separate scores for each of them and then compare those scores. Um I think it's there's no at least I haven't seen any paper that sort of clearly shows that like one is better than the other. I think people come up with a lot of these sort of different grading paradigms simply to sort of demonstrate that like hey, for different types of rubrics where you want the model to generate a score versus a preference or whatever, um sort of the downstream um training objective is amenable to ingesting preferences presented in a variety of ways.
好。好吧。行。嗯,所以我们最初提出的那些问题,每篇论文都是围绕着回答这些问题展开的。好。我还剩大概 20 分钟,所以接下来最后几个部分我会讲快一点。那我继续之前,大家有什么问题吗?好。好吧。行。Cool. Okay. All right. Um so yeah, for sort of the original questions that we pose, like each of these papers uh goes uh about answering it. Okay. I have like 20 minutes left, so I'm going to sort of like be a little quicker with the last couple sections, but are there any questions before I move forward? Cool. Okay. All right.
评估智能体轨迹与产物Evaluating Agent Trajectories and Artifacts
最后但同样重要的是,我觉得这三个当中,这个最像是正在不断发展的、最前沿的方向,也是人们今天正在研究的东西,对吧?也就是说,之前我们有的是语言模型生成某种产物,通常就是一些文本输出。那么,模型能不能在它们之间做出选择,或者正确地给它们打分呢?这里有个观察:语言模型正变得越来越强大。So last but not least, I think this is the most out of the three, sort of the most sort of like evolving like um cutting edge sort of like what people are investigating today, right? So it's just that like hey, you know, from before what we had is the language model produces some artifact, typically just some sort of text output. Um can the model sort of choose between them or apply the right scoring to them correctly? Um this makes an observation that like okay, language models are becoming very capable.
嗯,它们能做的事情远不止评分或生成一段文本,要酷得多,对吧?所以,你可以想象一个很好的应用场景:让语言模型生成一个类似《我的世界》的复刻版本,然后给它评分,看看复刻得有多好,对吧?不过,如果你想把《我的世界》当作代码来处理,比如做成能在浏览器里运行的东西,那么直接把整个项目塞进语言模型的上下文窗口里,然后让它给出答案,就会非常困难,对吧?既然语言模型在解决问题时可以充当智能体,为什么不能也让它们在评分时充当智能体呢?所以,对于游戏开发这类任务,你可以想象这种方法会非常有用。Uh they can do much cooler things beyond sort of like uh grading beyond generating a piece of text, right? And so some a nice motivation you can imagine here is like uh you know, you have a language model generate like a Minecraft reproduction or something like that and you want to grade like how well it's reproduced Minecraft, right? Well, if you want to take Minecraft as its code form as sort of like something that's runnable in the browser or whatever, it's very difficult to kind of just like dump the whole thing into sort of the language model's context window and just ask for an answer, right? And so in the same way that language models are sort of agents when they come to solving the problem, why not make language models agents when they go about grading the problem, right? And so for something like game development, you can imagine that's like super well motivated.
语言模型实际上能够像用户一样点击不同的按钮、切换到不同的屏幕;它可以检查按钮是否有效,屏幕和整体美观度是否不错,还能确认你尝试不同的按钮组合之类的操作时,一切是否正常,对吧?这只是针对游戏而言。你可以想象,还有很多数字产物也适用这种情况:语言模型作为一个智能体,是一种非常有效的评估范式。那么,我们接下来会探讨几件与之前那些问题略有不同的事情。首先,语言模型能否判断一个智能体的执行轨迹是否成功?第一步是,不要给模型摘要之类的内容,而是把它在尝试完成 SWE-bench 任务或 Terminal-Bench 任务时所执行的轨迹提供给模型。The language model is actually able to like click different buttons and go to different screens, make sure that the button works, make sure that the screen and sort of the aesthetics of it look good, and that like, you know, if you do different button combinations or something that things are working, right? And that's just for games. You can imagine sort of a lot of digital artifacts where language model as uh an agent um is like a very effective grading paradigm. So uh a couple things that we'll kind of look at which are a little bit different from the prior questions that were addressed is a so can a language model tell whether an agent's trajectory succeeded? So the first thing is like, okay, uh switch out sort of like a summary or something like that, give the model the trajectory that it performed when it like tried to do a SWE-bench task or a Terminal-Bench task or something like that.
不向模型展示单元测试,模型能不能只看问题、看执行轨迹,然后告诉你这条执行轨迹是否算是完成了任务,对吧?所以这可以作为一个很好的引子:好,如果模型能够相当好地理解智能体的执行轨迹,那么它能不能自己像一个智能体那样进行评分呢?对吧?这又回到了可靠性问题。这里还有一个值得注意的小区别:除了评估环境的最终状态,我们现在也在考虑根据执行轨迹,也就是问题解决的过程来评分。好,那么 WebVoyager 是最早关注这一问题的论文之一,研究对象是网页基准,以及我们到目前为止已经讨论过很多的这类网页任务。Without showing the model the unit test, can the model simply look at the problem, look at the trajectory, and tell you whether sort of the trajectory succeeded at the task or not, right? And so that sort of like is a good preface for like, okay, well, if a model's able to understand an agent trajectory pretty well, can it then just sort of like carry out grading as an agent itself, right? And sort of again sort of the reliability question. So another sort of small difference here that's worth noting is that beyond the grading of sort of the end state of the environment um that we're now thinking about grading against the trajectory as well or like sort of the problem solving sequence. Cool. So uh WebVoyager is one of the first papers that takes a look at this uh for web benchmarks and for sort of like these web-style tasks that we've uh talked a lot about at this point.
所以你可以想象一下,比如说,你想评估一个模型重现 airbnb.com 之类网站的能力,对吧?一种做法是:好吧,我有 airbnb 的源代码,模型生成源代码。我可以根据作为参考的 airbnb 源代码编写一堆单元测试,然后用这组基于参考代码创建的测试来运行模型生成的解决方案,对吧?这样确实行得通。问题是,我们没有 airbnb 的源代码。我们只能看到网站本身,也就是它面向公众的呈现结果,对吧?所以 WebVoyager 提出的办法是:好吧,也许不需要源代码也能解决这个问题。你可以让一个语言模型——或者在这个例子里,让用户——发送查询、返回查询,具体情况可能各不相同;模型可以在网站上进行某种随机游走,而这个随机游走实际上就成了一种评分轨迹,如果这么说你能理解的话,对吧?And so what you can imagine is that, you know, if you let's say that um you wanted to grade a model on its ability to like recreate airbnb.com or something like that, right? So one way you could go about it would be like, okay, well I have, you know, the airbnb source code, um the model generates the source code. I can write a bunch of unit tests generated against sort of the reference airbnb source code and then I can sort of run the model solution against that set of tests created based on the reference, right? And that would work. Problem is that like we don't have airbnb source code. Uh we can just sort of see like uh only sort of the website and sort of, you know, the public-facing artifact, right? And so with WebVoyager, what they say is like, all right, maybe instead of uh requiring the source code, the way to sort of overcome this is you have a language model or in this case you have a user sort of send query, return query, whatever the case may be, the model can do sort of like a random walk on the website and that random walk effectively just becomes sort of like uh a grading trajectory, if that makes sense, right?
假设你让一个语言模型运行,它会访问 airbnb.com,点击登录,然后预订,接着你知道,像是调整价格之类的操作。这个过程本身应该可以在一个试图重现 airbnb.com 的模型解决方案上重放,对吧?所以你可以说,是在利用语言模型作为智能体来生成一段轨迹,作为验证依据,而这在某种程度上取代了必须实际拥有原始源代码的需求,对吧?从方法论上看,他们的做法类似于之前的 Web Arena 论文:我们当时讨论过,如何处理这些不同的界面——它们不一定特别适合语言模型原生完成操作——然后提取界面,创建边界框和可点击元素。So you have a language model go, it goes to airbnb.com, it clicks on like login and then booking and then, you know, like toggling the price and everything. That trajectory in and of itself should be replayable on a model solution that attempts to recreate airbnb.com, right? And so you are sort of um using language models as agents to generate sort of a trajectory that serves as verification um and sort of that replaces the need to sort of like actually have the original source code, right? So uh methodologically what they do is similar to kind of like the Web Arena papers before where we kind of talked about how uh you take these different surfaces that are not necessarily super amenable to what a language model is able to do natively, and you kind of like take the surface, create bounding boxes and clickable things.
比如说,如果有人用过 Selenium 之类的工具,或者做过类似的网页抓取,比如 Beautiful Soup 什么的,你可以获取网站内容,把它导入进来,以某种方式呈现可点击的元素以及网页截图本身,让智能体能够四处浏览,对吧?然后保存智能体浏览过程中的截图,记录它点了哪里、从这个网站跳转到那个网站,再到另一个网站,接着让一个评审模型查看整个操作轨迹和最终答案。所以,这基本上是在尝试为基于网页的任务创建一个语言模型评审器,对吧?当然,他们也展示了这种方法效果相当不错。所以我觉得,如果你对这类内容感兴趣,这篇论文有一点值得深入探究:他们做了一些消融实验,比如只给模型文本,或者在这个例子里,他们提供所有工具、所有截图和完整的操作轨迹——也就是评分所需的一切。Like if people have played with like Selenium or like web scraping stuff like this, Beautiful Soup or whatever, you create take the website, you ingest it, sort of expose the things that are clickable along with sort of the screenshot itself, and you make it possible for the agent to kind of navigate around, right? So save screenshots of the agent's navigation where it clicked and it went from this website to this one to this one, and then have a judge model take a look at the trajectory and the final answer. And so this is basically trying to create like a language model judge for web-based tasks, right? And then they of course show that it works quite well. So I think something that's kind of worth poking into this paper if this kind of stuff interests you is that they do some ablations of like, okay, when we only give the text to the model, or in this case like they give all the tools, they give all the screenshots, they give the whole trajectory, like everything it needs for grading.
然后,对于很多这类情况,他们会换掉模型,或者只提供其中一部分信息,而不包含任何视觉元素之类的内容——这会如何影响评分呢?所以我觉得,这通常说明,当你把语言模型用作评分代理时,值得思考一下:从这个任务的执行轨迹来看,你究竟想给模型哪些材料,让它据此给出分数?好。好的。然后这里的评分一致性很高。接下来,类似于 Web 和 QA 在基准测试中的互动方式,我们可以进一步拓展一下:好吧,让我们先不谈 Web 相关的内容,来看看计算机使用,对吧?这里的动机是,像 OSWorld 这类 Web 和设备代理,目前似乎都只能通过手写的基准测试检查项来评分,对吧?And then for sort of a lot of these things they like swap out the model or they only present like a subset of this information that doesn't include sort of any visual components, like how does that affect the grading, right? And so generally I think what this speaks to is that when you apply language model as agent for grading, it could be, you know, it's worth thinking about like from the rollout of this task, which artifacts do you actually want to give the model to ask it to come up with a score for? Cool. Okay. And then there's high agreement there. And then so similar to how like web and Kua have interacted in the benchmarking regime, you then sort of have this expansion of like, all right, like let's step back from web stuff and let's take a look at computer use, right? So the motivation here is for things like, you know, OS world, like these kind of like web and device agents only get graded by handwritten benchmark checks, right?
比如说,如果你看看 OS World,所有这些验证都是由人工生成的。嗯,在这个案例中,我们更像是在检查,或者说是在提出这样一个问题:模型能不能判断一段轨迹,并利用判断结果来改进智能体?所以,这有点像是:好,假设这样一种情形——我们不再有人工编写的验证。我们能不能直接查看轨迹本身,省去让人工标注人员为轨迹创建单元测试之类的工作,而是让模型直接判断:好,这段轨迹似乎在这里失败了。我们可以立即把这一点作为奖励信号传递出去,让上游模型表现得更好,对吧?因此,我们提出用领域通用的神经模型,自动评估用户指令和任意智能体轨迹。Like if you look at OS World, all of that verification was human generated. Um, in this case, this is kind of more inspecting or more asking the question, can a model like judge a trajectory and use that to improve the agent? So, it's kind of like, okay, assume the setting where like you don't have human-written verification anymore. Can we just sort of look at the trajectory itself directly and skip all of the need to sort of like have human annotators like create unit tests and stuff for the trajectory and just have the model come up with like, okay, it looks like the trajectory failed here. We can immediately sort of like propagate this as a reward signal to like make the the upstream model like perform better, right? So, we propose to automatically evaluate user instructions and arbitrary agent trajectories with sort of like again, domain general neural models.
这有点像是在重新讨论我们之前看到的那种奖励模型范式,对吧?剩下的内容大致是在讲他们提出奖励的两种方式,对吧?一种是先生成描述、再进行推理:VLM 查看屏幕截图,然后交给语言模型处理。你知道,语言模型本身不具备视觉理解能力,所以就用一个能力稍弱的 VLM,让它根据屏幕截图做标注,比如描述正在发生什么,然后语言模型再根据这些文本标注推理智能体是否成功了,对吧?第二种方法是,好吧,没必要先做这种 OCR,再基于 OCR 结果推理。我们能不能直接用一个非常强的视觉模型,让它直接评估整个轨迹呢?This is kind of revisiting that reward model paradigm that we saw from before, right? And so the rest of it just kind of talks about like there's kind of two ways they surfaced the reward, right? So, caption then reason approach where the VLM takes a look at screenshots and then the language model. So like, you know, because the language model doesn't have visual understanding capabilities, you take a weaker VLM that is capable of just sort of given the screenshot, annotate, like describe what's happening, and then the language model reasons across those text annotations whether the agent succeeded, right? The second approach is like, all right, there's no need to do this kind of like OCR and then reason across the OCR. Can we just take like a very strong vision model and have it sort of evaluate the trajectory directly, right?
所以,是的,这里有一些例子,对吧?比如,这是原始的问题陈述。模型会点击、滚动,形成我们之前见过的那种网页操作轨迹;然后你会看到模型进行一番推理,比如:“好吧,看起来用户的意图是发布 LGT M;尽管提前停止了,任务还是成功了。”这就是它给出的判定。然后,评估器也正确地将任务执行判定为成功,尽管任务以异常结束了,对吧?所以这篇论文展示了这样一点;而且这一点在一些编码智能体的操作轨迹中也有所体现:模型实际上并不能一开始就很好地根据操作轨迹判断模型是否成功完成了任务,对吧?所以,这种基于操作轨迹的判断并没有像我们原先以为的那样奏效。And so, yeah, there's some examples here, right? Like, here's the original problem statement. The model does click and scroll and sort of this web trajectory that we've seen before, and then you have like a model kind of reason over like, okay, well, it looks like the user's intent was to post LGT M, and the task is successful despite the early stop. This is like the verdict, um, and then, you know, the evaluator correctly judges the task execution as successful despite the task ending with an exception, right? So what this paper showed, and this is, um, also kind of revealed in some of the coding agent trajectories as well, um, is that models are actually not particularly good out of the box at determining, given a trajectory, did the model sort of succeed at the task, right? So this kind of judgment against trajectory stuff did not work as well, uh, as we thought immediately, right?
嗯,是的,我们时间有点紧了,所以图表部分我就稍微略过一下。嗯,“智能体作为评判者”这个方向,探索了各种不同领域的应用,对吧?所以跟之前一样,不只是 Web,也不只是计算机操作,我们还会看编程,以及各种可能适合交给智能体处理的事情。嗯,他们还专门设计了一个基准测试来展示这个用例。嗯,正如你们所看到的,每个查询都附带一整套评分标准。嗯,他们在这里也展示了,和这些论文的做法一样,语言模型作为评判者——或者在这个案例里,智能体作为评判者——比之前的方法更好,也更符合人类偏好;不过在一致性等方面仍然存在一些问题。Um, so yeah, we're running a little low on time. So I'll skip over the graphics a bit. Um, agent as a judge sort of uh, explores this for, um, you know, all sorts of different domains, right? So again, like before, not just web, not just computer use, we're taking a look at coding, we're taking a look at sort of like anything that might be worth throwing an agent at. Um, and so they show they come up with like a separate benchmark to demonstrate this use case. Um, and as you can see, there's like a whole list of like rubrics that come with every query. Um, and so they show here again like with all of these papers, they always show like a, you know, the language model as a judge, um, or in this case the agent as a judge is better than whatever the prior method is. It's aligned with sort of human preference, uh, but that there's some issues and sort of consistency and stuff like that.
嗯,太棒了。总之,我刚才稍微快速地讲过了这一部分,因为我们今天没法全部讲完,不过希望大家都能理解。这部分有什么简短的问题吗?没有?好。嗯,俺去也Um, so cool. Anyway, I'm I kind of zoomed through this section a little bit because uh, we're not going to make it all the way through today, but hopefully that makes sense. Are there any quick questions about this section? No? Okay. All right. Um,
检测位置偏差和长度偏差Detecting Position and Length Bias
验证判断时的偏差。我们之前也提到过。这只是想说明这样一个观点:对于语言模型,当你创建奖励模型时,需要确保它们确实是因为正确的原因而给出奖励,对吧?我们要看的两个案例研究中,第一个我们之前已经见过:奖励模型可能会受到答案顺序的偏差影响,而这是我们不希望看到的;另一个则是答案长度带来的偏差。我会很快按顺序讲一下。这篇论文就很直接地研究了这个问题,我们在前一篇论文中也看到过,对吧?Biases in validating judgment. We've hinted at this before. This is just pointing at, um, this idea that like with your language models, when they when you create a reward model, you need to properly sort of make sure that they're giving rewards for like the right reason, right? And so the two case studies we'll look at is from before we already saw a reward model might be biased by like the order of your answers and you don't want that, and then also by the length. So the order I'll go through very quickly. So this is a paper that kind of examines this very directly, which we saw in the previous paper, right?
嗯,所以,哎呀,这重复了之前的内容。呃,不过是的,这件事非常简单:我们调换回答的顺序,然后检查模型是否一致。论文显示模型并不一致,接着他们设计了一种方法,让模型变得更一致,对吧?嗯,论文里有一些内容,也有一些数学。我觉得他们提出了不少形式化方法,来恰当地处理这个问题。要是你想了解具体做法,可以更仔细地读读论文。不过总之,这是其中一件事。嗯,另一件事是,和 Chatbot Arena 那些工作差不多同时,我们大概之前也聊过 Alpaca 这篇论文。关于 Alpaca,他们做的是:好,我们来试试用 GPT-4o 或 GPT-4 mini 而不是人类来担任评判,从而实现对指令遵循能力的自动化基准测试。Um and so oops, that's repeating the text from before. Uh but yeah, it's a very simple thing where it's like, yeah, we swap the order of the responses and we just check if the models are consistent. The paper shows that the models are not consistent and then they devise sort of a way to sort of make them more consistent, right? Um and so yeah, there's some stuff there's some math in the paper. I think there's like sort of a they develop a lot of sort of formalizations that properly address this. Um you can sort of read the paper more thoroughly if you want to understand how. But anyway, that's one thing. Um the other thing is like um sort of concurrent to the chatbot arena stuff, we kind of have probably talked about the Alpaca paper before. Um and with Alpaca, what they did was like, okay, let's take a look at using GPT-4o or GPT-4 mini as the judge instead of humans to allow for automated benchmarking of instruction following.
嗯,Jan Leike(Alpaca 团队的早期成员之一)后来发表了一篇后续论文。他们发现,如果不限制摘要或模型输出的长度,奖励模型就会开始以某种方式进行训练并产生偏差:它会偏向较长的回答,也就是认为回答越长越好,对吧?显然这并不好,尤其是在摘要这类任务中。因此,他们在这里应用了一些比较通用的高层思路:好吧,我们来研究这样的设置——在基准测试中加入长度惩罚,同时也在用于指令遵循的后训练目标中加入长度惩罚。看看会发生什么。Uh a follow-up paper from Jan Leike, one of the original members of the Alpaca group, is they found out that like if you don't constrain the length of the summarization or the length of the model's output that uh your reward model is going to start sort of training and biasing it like be trained in a way where it 's like biased towards the length of the completion and longer answers are better, right? And so this is clearly not something that's good, especially when it uh comes to something like summarization. So here they apply sort of like the general sort of high-level ideas that like, all right, we're going to investigate the setting where like let's apply like a length penalty uh both to the benchmark, but then also to the to the post-training objective for instruction following. Let's see what happens.
嗯,所以他们在这里展示的是,对于这些原始模型,如果你只是按照比较常规的 Alpaca 评测设置来打分,就会发现,冗长的回答总是比更简洁的回答得分高,这说明模型偏向于更长的内容。控制长度后,分数就会变得更加均衡。好。然后是 Michael 的论文 AutoMetrics。对于某些任务,比如开放式文本补全任务,评分相当容易。你知道,这些问题并没有特别大的挑战性,所以给这类指令评分并不需要专家,对吧?而 AutoMetrics 关注的是这样一个动机:有一些新任务,在这些任务上采用这种范式——先提出新任务,再生成大量人类偏好,让人们在不同回答之间投票——成本相当高。Um and so what they show here is that like, yeah, like with these original models, if you just sort of like grade um in sort of the vanilla Alpaca eval setting, uh you'll see that like, you know, the verbose uh completions always score better than like the more concise ones, and that's evidence of the models being biased towards longer things. Once we control for length, sort of the scores get sort of more normalized. Cool. Okay. And then AutoMetrics, which is Michael's paper, is with some tasks, some open-ended text completion tasks, it's pretty easy to grade. You know, the the questions are not particularly challenging, and so you don't really need an expert to grade that instruction, right? And here what AutoMetrics takes a look at is it's motivated by like, all right, there's some sort of new tasks where like this paradigm of like having these new tasks and then doing generating a bunch of like human preferences that vote between different completions, it's pretty expensive.
所以,我们能不能非常快速地通过某种类似 bootstrap 的方式,只用少量人工标签,训练出一个能够模仿这种判断的评判器呢?对吧?我想,在你们之前,这种方法大概被称为少样本学习;但问题是,当数据样本少得多时,能不能准确地模仿人类评判者?这里的思路是,Michael 设计了一大套指标,然后对这些指标进行筛选。这构成了一个完整的流程,核心想法是:针对某项特定任务,我们找出一组最符合人类判断的指标。我认为,简单来说,就是:你有一个庞大的指标库,还有许多不同类型的任务需要评分,而评分依据又来自某个人群。And so like can we very quickly use sort of like bootstrap just like a handful of human labels that produces a judge that like mimics this judgment, right? So this is I guess like before you people called it kind of few-shot learning, but it's like when you have a much more limited data sample, can you properly mimic human judges? And like the idea here is that like Michael kind of devised this like big you know set of metrics along with sort of like and then kind of like filtering down these metrics. So there's this kind of whole pipeline, but the idea is that like we identify sort of a set of metrics that are sort of most in line for this particular task to this human judgment. So I think like a simplified way to understand this is that like, hey, you have a lot of sort of like a metric bank and you have sort of varied a very different set of tasks that you might grade on then sort of a human population.
你们如何快速为这类任务以及这类语言模型评分——哦,抱歉,是这类人工评分人员——创建更定制化的指标?也就是说,嗯,让指标更贴合特定的人工评分人群和任务类型,并快速为它们生成评判模型。总之,抱歉,我讲得很快。我知道我只剩三分钟了。我们赶紧把剩下的内容讲完吧。How do you kind of like create sort of more customized metrics for these type of tasks and these type of language model grading oh sorry and these types of human graders very quickly? So it's like um customized to like more specific populations of human grading um and sort of types of tasks um and generating judges for those very quickly. So anyway, sorry. This is very quick. I know I have like three minutes left. So let’s get through the rest of this.
Pass-at-k 和 Pass-to-the-k 的报告Reporting Pass-at-k and Pass-to-the-k
关于非确定性,我们算是已经讨论过了。我们也算是很早就讨论过一个问题:当你有多个 rollout 时该怎么办。这相当于从“让语言模型充当评判者”这个话题上稍微退一步。比如说,怎样才能恰当地报告这个分数,对吧?你们之前已经看过这张幻灯片了。那么,具体来说,我们来逐一看看这些内容,对吧?for the non-determinism uh we kind of covered sort so uh we kind of covered this question like early on of like when you have multiple rollouts. This is kind of taking a step back from language model as judges. Like how do you kind of like report this course properly, right? And so you've already seen this slide before. So um to kind of go through each of these concretely, right?
pass@k 是在人类评测(HumanEval)论文之前就引入的。此前已经有一些编程题研究过它,但这篇论文算是明确提出了这一指标。就这里的情况而言,尤其是你们的作业二,我认为如果你发现自己给语言模型出的任务本质上相当困难,而且你只关心它是否至少成功一次,那么 pass@k 值得作为你的核心指标,对吧?右边的数学公式,其高层次目标是找到一个指标,只报告模型至少成功解决一次任务的频率。我们之所以要用这些组合数学、期望值,以及围绕它们的一系列数学计算,是为了让这个指标的计算不受顺序影响。pass@k was um it was introduced before the human eval paper. There were already some coding problems that looked at it um but this is the one where they kind of made it explicit. And in this case um especially for um your uh your homework two, uh I think pass@k is worth using as your key metric if you find that like uh you are challenging the language model with a task that is fundamentally quite difficult and you just care that it passed at least once, right? So the math on the right um so the high-level goal here is like you want a metric that just reports like how often does the model at solve the task at least once? Um the reason we have these kind of like combinatorics and sort of this expected value and all the sort of math around it is to sort of make the calculation of this metric agnostic to order.
嗯,这样你可以更具体地读一下这篇论文,不过它基本上是在说:如果我们做五次 rollout,并且有几个数字,对吧?那么这里的五就是 n,k 就是三。也就是说,我们做五次 rollout。那么在做五次 rollout 的情况下,我们的 pass at 3 是多少,对吧?这里的想法是,pass at 3 基本上是说:如果我们运行三次,那么这三次里至少通过一次的概率是多少?你可以做这种计算,确保你报告的分数不受这些试验顺序的影响,如果这样说得通的话。好。pass^k 基本上就是这个的倒数,对吧?Um and so like you can read the paper a little bit more specifically, but it's basically saying like okay, if we do five rollouts um and you have a couple numbers, right? So five in this case is going to be n and your k is going to be three. Like okay, let's do like five rollouts. Um what is our pass at three given we're doing five rollouts, right? And so the idea here is that like your pass at three basically means like hey, if we do three runs, like how many times does it pass at least once out of those three? And you can do this kind of calculation to make sure that the score that you report is agnostic to sort of like the ordering um of these trials if that makes sense. Cool. Okay. Uh pass^k is basic like the inverse of this, right?
所以这有点像 τ-bench 场景,比如客服之类的场景。在这种情况下,你更关心的是语言模型每次都能正确解决问题。所以这个分数只是衡量这样一件事:如果你进行 n 次 rollout,并计算 pass^k 之类的指标,那么如果进行这三次试验,每一次都通过的概率有多大?这就是报告这个指标的另一种方式。然后,这其实是在非常明确地说明,为什么平均值可能不太理想,对吧?具体来说,比如说,你们会为作业二设计一个任务;可以想象,当你进行多次 rollout,并在所有这些任务上运行 Gemini 3.8 时,结果可能会大不相同,对吧?So this is kind of like the τ-bench scenario where like you know with customer service or something you care more that the language model gets the problem correct every single time and so like this score is simply measuring like hey if you do like n rollouts and you're calculating like a pass^k or something like that then like how many time like if you do these three trials what's the likelihood that like every single trial is going to result in a pass and so that's like a different way to report this metric and then um this is sort of just making it very explicit about why average is potentially sort of like not a good idea, right? So just to sort of make it very concrete right like um you guys will create your one task for homework two um and you can imagine when you do roll outs and when you run Gemini 3.8 on all of those tasks it can look very different, right?
所以我想,在作业这种情况下,你大概只会创建一个任务。但如果你创建的是一个包含多个任务的基准测试,对吧?智能体 A 和智能体 B 显然会用非常不同的方式来解决这些任务。如果你只报告平均值,结果看起来就会一样,对吧?但如果你报告 pass@k 和 pass^k,A 和 B 的表现数据就会非常不同。所以归根结底,具体报告哪一种取决于任务;不一定存在一个绝对正确的选择,对吧?好。那我简单总结一下:对于 pass@k,假设你遇到一道特别难的数学题,不介意投入大量计算资源,只在乎它能不能被解出来一次。So I guess in the homework case you're only you're only going to sort of create one task uh but if you created a benchmark where you have multiple tasks, right? Agent A and agent B they solve it clearly in very different ways. If you simply report the average it's going to look the same, right? But if you report pass@k versus pass^k you'll get very different numbers for the performance of A and B and so again at the end of the day depends on the task in terms of which one you report um there's not necessarily like uh absolutely correct one to use, right? Cool. Okay. So I guess to summarize a little bit like uh with pass@k, maybe you have like a super hard math problem you're not afraid of throwing a lot of compute at it you just care that it gets solved once.
有了 pass^k,你会更关注可靠性。好。不错。行。这是最后一张幻灯片了。我想,下次讲课时就见不到大家了,呃,下周我们会聊聊安全。下次讲课时,我们会请 Carlos 和 Alex 来,他们是 SWE-bench 原始团队的成员。周一我们会和他们一起上一堂客座讲座,然后感恩节之后,我会再和大家见最后一次,讲讲编码智能体。好。谢谢大家。谢谢。With pass^k, you care more about reliability. Okay. Cool. All right. This is the last slide. I guess I won't see you guys for uh the next lecture where the next week we'll kind of talk about safety. Uh the next lecture we'll have uh Carlos and Alex who are part of the original SWE-bench team come. So they'll uh we'll do sort of a guest lecture with them on Monday and then I'll see you guys one last time for the coding agents lecture uh after Thanksgiving. Cool. Thanks everybody. Thanks.