00:00 Slop Code Bench 的动机与迭代评估
Gabor Lansky 创建 Slop Code Bench,源于对早期编程代理破坏项目、留下低质量代码的挫败感,也因为当时缺少评估代码长期质量的方法。基准不只要求模型完成一个任务,而是把开发拆成多个检查点,观察它能否添加后续功能而不破坏早期功能。核心问题是代理在连续迭代中是否会损害代码库,以及早期代码是否考虑了未来的人或代理如何使用它。
Boundary · 36:43
I would say that the fundamental like most surprising thing that we have seen, agents refuse to ever install libraries that would make their lives easier. And we see this now with like they're rewriting entire libraries essentially from scratch when they're explicitly told to use a library, right? The other incredibly concerning thing when it comes to agent behaviors is that when they design libraries, they're copying like the names and the shapes of existing libraries, but they're not actually doing anything more to them that makes them more usable.
我想说,我们看到的最根本、也最令人惊讶的事情是,智能体拒绝安装任何能让它们更轻松完成工作的库。 现在我们看到,即使明确告诉它们要用某个库,它们还是会从头重写整个库,对吧? 关于智能体行为,另一件极其令人担忧的事是:它们设计库时,会照搬现有库的名字和结构,却不会进一步改进,让这些库变得更易用。
All right, what's up y'all? Today we talked about Slop Code Bench and a technique I think more broadly known as iterative evaluation, where we have some problem where the model has to complete things in checkpoints. and may or may not decide to refactor or centralize something that it built before in order to enable future checkpoints. my favorite part here is we have gabe orlansky, the creator of slop code bench, and he actually walked us through his new blog post that is both quantitative and qualitative analysis of a lot of the slop patterns and where they're moving and how they're changing. some really cool findings in there. you should check it out. and you should go check out gabe and the slop code bench website and the discord. find him on twitter. this was a really fun episode. i'm so excited to see what the future holds here. let's get into it. what's up, everybody? we are live. welcome to ai that works. today, we are going to talk once again about slop.
好,各位,大家好啊! 今天我们聊了 Slop Code Bench,以及一种我认为更广为人知的技术——迭代式评估。在这种评估中,模型需要在各个检查点完成任务。 它可能会,也可能不会决定重构或集中处理之前构建的某些内容,以便完成后续检查点。 我最喜欢的部分是,Slop Code Bench 的创建者 Gabe Orlansky 来到了节目里,还带我们深入了解了他最新的博客文章。文章从定量和定性两个角度,分析了许多“糊弄式代码”的模式,以及这些模式的走向和变化。 里面有一些非常棒的发现。 你们应该去看看。 也去看看 Gabe、Slop Code Bench 网站和 Discord 社区吧。 去 Twitter 上关注他吧。 这期节目真的很有意思。 我特别期待这里的未来会是什么样。 我们开始吧。 大家好啊! 我们开始直播了。 欢迎收看《AI That Works》。 今天,我们要再次聊聊糊弄式代码。
Code.
代码。
Bench. Uh, we have a very special treat today. We are joined by uh Gabor Lansky from the University of Wisconsin who created Slop Code Bench. We're gonna talk about some of his recent findings. Uh, uh, you know, we talked about the numbers and the quantitative results. Gabe went really deep on the, on the qualitative results, so excited to talk about that. Uh, I'm also joined by Vaibhav, uh, my co-host here, who is the founder of uh Boundary ML, uh, who builds a programming language called BAML that is optimized for agents and everything else. Uh, I would be shocked if in a couple years it wasn't the only programming language on Earth. Uh, I'm Dex. I'm a member of technical staff here at Factory. Uh, before that I was the founder of Human Layer. Uh, welcome Gabe.
基准测试。 呃,今天我们有一份特别的惊喜。 今天我们请到了来自威斯康星大学、创建了 Slop Code Bench 的 Gabor Lansky。 我们要聊聊他最近的一些发现。 呃,呃,你知道,我们聊过那些数字和量化结果。 Gabe 深入探讨了定性结果,所以我很期待聊聊这方面。 呃,我还请来了 Vaibhav,他是我的联合主持人,也是 Boundary ML 的创始人。他们打造了一种名为 BAML 的编程语言,专为智能体及其他用途优化。 呃,要是过几年它不是地球上唯一的编程语言,我会很惊讶。 呃,我是 Dex。 我目前是 Factory 的技术团队成员。 呃,在那之前,我是 Human Layer 的创始人。 呃,欢迎你,Gabe。
Thanks, thanks for having me on. Excited to be here and excited to talk about Slop Code Bench.
谢谢,谢谢你们邀请我来。 很高兴来到这里,也很期待聊聊 Slop Code Bench。
I would love to hear, uh, maybe from you just a little bit of background before we get into the most recent findings of like, what made you want to create this benchmark? What was the process like? Like, talk, talk about the journey so far.
我很想先请你简单介绍一下背景,然后我们再聊你最近的发现。是什么让你想创建这个基准测试? 这个过程是怎样的? 聊聊一路走来的历程吧。
Yeah, yeah. So I'm currently a fourth year PhD here at, uh, University of Wisconsin-Madison. You know, I've been focusing, I think since 2021 on code, like code related machine learning. I started a long time ago with, you know, Kanala and very simple translation and continuously moved through like multilingual human eval to where we are today. And the main impetus, honestly, I mean, it's the main impetus for almost all of my projects is that I was very frustrated. with agents at the time and coding, you know, copy paste code from ChatGPT or, i mean, i don't even think anyone was using claude when we originally came up with the idea for the project. like the whole, i mean, actually, i guess people were using cursor as well a lot more. i remember i. i loved the tab complete in cursor, but i really hated the agents at the time in cursor because it just ruined my projects. it would ruin what i would do. i just felt like, you know, it was just really poor code. and i felt the number one thing that was missing was like this idea of evaluation.
是的,是的。 我目前是威斯康星大学麦迪逊分校的四年级博士生。 你知道,我想我从 2021 年起就一直专注于代码,也就是代码相关的机器学习。 很久以前,我从 Kanala 和非常简单的翻译任务起步,之后不断发展,经历了多语言人工评测,直到今天。 说实话,最主要的推动力——我几乎所有项目的主要推动力——就是我当时非常沮丧。 那时候我对智能体和编程很不满意。你知道,就是从 ChatGPT 复制粘贴代码之类的。我的意思是,我们最初想到这个项目时,我甚至不觉得有人在用 Claude。 就是整个……我的意思是,其实我想大家当时也已经更多地在用 Cursor 了。 我记得我…… 我很喜欢 Cursor 的 Tab 补全功能,但那时我真的很讨厌 Cursor 里的智能体,因为它们把我的项目搞得一团糟。 它会毁掉我做的东西。 我就是觉得,你知道,它生成的代码质量真的很差。 我觉得最缺少的就是评估这个概念。
someone sent me slop code bench in march when you published it. and i looked at it and i actually misread the landing page. and i thought, oh, this is just like using linters to evaluate ai written code. and i literally spent the next three months telling people like, We need a benchmark where the model doesn t know the whole problem up front and it has to like add functionality and we see like, hey, can it deliver feature number four without breaking feature number one? And I went around like this was the greatest and like not only did it already exist, but someone had already sent it to me and I just didn t read long enough.
你们在三月发布 Slop Code Bench 时,有人把它发给了我。 我看了看,其实还看错了介绍页的意思。 我当时想,哦,这不就是用代码检查工具来评估 AI 编写的代码吗? 接下来的三个月里,我真的一直在跟人说:“我们需要一个基准测试,模型一开始并不知道完整的问题,而且必须自己添加功能;然后我们看看,嘿,它能不能在不破坏功能一的情况下交付功能四?” 我就这样到处宣传,觉得这主意太棒了——结果不但它早就存在了,而且早就有人发给过我,只是我没读够仔细。
Yeah, I mean, I think the branding, I m happy with the branding because it got, you know, it got the point across, but also we were debating the name for quite some time, right? Like tech debt, eval, any, you know, any one of the thousand different names you could use.
是啊,我对这个名字挺满意的,因为它确实把意思表达出来了。不过我们也为名字讨论了挺长时间,对吧? 比如“技术债评估”之类的,你知道,反正你能想到的上千种名字中的任何一个。
The name you have now is the best name that I can imagine for this kind of benchmark.
你们现在这个名字,是我能想到的最适合这种基准测试的名字。
yeah, i mean, i don't know if it's hurt it from getting on the model card, but at the same time, you know, i love the name. every single name has a tradeoff. i think this name kind of perfectly encapsulated what we measured. but going to your point, i guess that's in terms of the iterative evaluation, yeah, it was just not being done. and then i remember, i think it was lucas bayer, gif man on twitter. i saw a tweet from him about like talking about slop code. and then. or just sloppy coding. and then there was all the carpathy vibe coding discussions at the time. i think this is, you know, late august 2025. and so, you know, like it just seemed like the perfect thing. like as you're, as agents are iterating on code, they don't really understand, right, how future agents or how future people will use that code. And so that's like the number one issue that we want to just isolate with Slop Code Bench, the iterative evaluation. And there have been a lot of really other great benchmarks that now incorporate iterative evaluation like Sweet Marathon. I think there's, it was Sweet Marathon or Sweet Chat. There's one of the two that is doing iterative evaluation as well, which is I think a really great benchmark too. And so yeah, like the core idea was over iterations agents will continuously just destroy their own code bases. and i think it's like, you know, as we get into the findings from the blog, it's happening more, but it's in a more, i don't want to say, like maybe pervasive way is the wrong word, but in a much more hard to realize way until it's way too late.
是啊,我不知道这个名字会不会妨碍它被收录到模型卡里,但与此同时,你知道,我很喜欢这个名字。 每个名字都有取舍。 我觉得这个名字可以说完美概括了我们的测量内容。 不过回到你刚才说的,我想就迭代式评估而言,当时确实没人这么做。 然后我记得,我想是卢卡斯·拜尔,也就是推特上的 GIF Man。 我看到他发了一条推文,大概是在谈论“垃圾代码”。 然后…… 或者说,只是糟糕的编码。 当时还有卡帕西关于氛围编程的各种讨论。 我想那是 2025 年 8 月下旬。 所以,你知道,这看起来简直再合适不过了。 比如,当智能体不断迭代代码时,它们其实并不理解,对吧,未来的智能体或未来的人会如何使用这些代码。 所以,我们想用 Slop Code Bench 单独检验的头号问题,就是迭代评估。 现在还有很多其他很棒的基准测试也纳入了迭代评估,比如 Sweet Marathon。 我想是 Sweet Marathon,或者 Sweet Chat。 这两者中有一个也在进行迭代评估,我觉得那也是一个很棒的基准测试。 所以,没错,核心想法是,经过多轮迭代,智能体会不断毁掉自己的代码库。 我觉得,正如我们接下来会从博客的研究发现中看到的,这种情况越来越常见了;不过,它的发生方式更……我不想说“普遍”这个词可能不太准确,但确实更难察觉,等发现时往往已经太晚了。
i noticed some of the patterns you picked up. i'm excited to talk about like some of the things that like used to happen sometimes are now happening a lot. some of the things identified as like, this is just bad code.
我注意到你们发现了一些规律。 我很期待聊聊其中一些事情:过去偶尔发生的情况,现在变得频繁多了。 还有一些情况被认定为“这就是糟糕的代码”。
before we go into the whole gist, just to give people an idea. How complex are the easiest problems in Slop Code Bench and how complex are the hardest problems in Slop Code Bench? Give me an order of magnitude here because otherwise like I don't know if the models suffer at small tasks but uh don't suffer at large tasks or suffer only at large tasks or medium scale tasks like tell help size size problems for me.
在深入讨论整个要点之前,先给大家一个概念。 Slop Code Bench 里最简单的问题有多复杂,最难的问题又有多复杂? 给我一个数量级的概念吧,不然我就不知道模型是在小任务上表现吃力、在大任务上不吃力,还是只在大任务或中等规模的任务上吃力。给我举些不同规模问题的例子吧。
So I think our easiest tasks are like the you know our motivating example the code search one where agents have to you know essentially build a like a mini ripgrep from scratch. the other ones that we do, the other easiest one i would say is our circuit eval, which is just a circuit simulator. i think those two are the easiest. there's a couple other, i'm just remembering, like there's one etl one that's pretty easy for agents as well. like those, that's at the very lowest end, right? it's a rather well bounded, rather simple thing. like, yes, there is multiplicative pressure. but, you know, building a code search engine is rather simple. i mean, like, yeah. i mean, it is like ast traversing is incredibly difficult once you want to do like real stack analysis. but for pattern matching, it's pretty simple. yeah. but then at the other ends, at the other end, we have ones like, i think dynamic buffer is one of the hardest ones, which is. What's it called? I think it's called Dynamic Buffer. It's essentially like Protobuf from Google but as a like way of reading in files and you have to build a code generation engine that can generate code in like five different languages.
所以我觉得最简单的任务,就是那个激励示例——代码搜索。智能体基本上得从头构建一个迷你版 ripgrep。 我们做的其他任务里,我觉得另一个最简单的是电路求值,也就是一个电路模拟器。 我觉得这两个最简单。 还有几个,我想起来了,比如有一个 ETL 任务,对智能体来说也挺简单的。 这些都在最简单的那一端,对吧? 它的范围界定得相当清楚,也相当简单。 是的,确实存在乘法式的压力。 不过,构建一个代码搜索引擎确实相当简单。 我是说,确实如此。 我是说,没错,一旦你想做真正的栈分析,遍历 AST 就会变得极其困难。 但做模式匹配的话,就挺简单的。 是啊。 但在另一端,我们有一些任务,比如我觉得 Dynamic Buffer 是最难的任务之一,它是…… 叫什么来着? 我想它叫 Dynamic Buffer。 它本质上就像 Google 的 Protobuf,不过是用来读取文件的;你得构建一个代码生成引擎,能生成五种不同语言的代码。
When we do this, like what makes this um what's the scale of a correct output? Again, to help because I think the complexity of this problem is probably very correlated to how much people have worked on this. so if someone has never worked on dynamic buffers and language code gen, they probably have no idea how hard that is. similarly, you probably have no idea how easy asc grep is to clone for the basic stuff and how much harder adding pattern matching is.
我们做这个的时候,什么因素决定了……嗯,正确输出的规模有多大? 再说一次,这是为了帮忙,因为我觉得这个问题的复杂程度,很可能和人们在这方面做过多少工作高度相关。 所以,如果有人从没做过 dynamic buffers 和语言代码生成,那他们大概完全不知道这有多难。 同样,你可能也完全不知道,克隆 asc grep 的基础功能有多简单,以及加入模式匹配会难上多少。
i would say dynamic buffer is probably in the range of 20,000 lines of code, a true papa working solution.
我会说,Dynamic Buffer 大概需要 20,000 行代码,才能做出真正可用的方案。
like if you designed it properly with the right abstractions in from the start kind of thing.
也就是说,如果一开始就用正确的抽象把它设计妥当。
yeah, i mean, if you design it right, honestly, it's probably like in the range of 10k. if you design it somewhat naively, just getting it done, i would guess it's, you know, orders of magnitude more at 20. the main difficulties in dynamic buffer come from one, building a very simple way to extract operation. because the entire point is that you get in csv files and you have to generate code in another language that will be able to parse efficiently those csv files. Right, so like whatever the transformations are happening in them, whatever the uh actual like filtering that goes on in them essentially is like you have to determine those on the fly, which is kind of difficult.
是啊,我的意思是,说实话,如果设计得当,大概需要 10,000 行左右。 如果设计得比较草率,只求把它做出来,我猜代码量可能会多出好几个数量级,大概有 20 万行。 Dynamic Buffer 的主要难点有一个:要构建一种非常简单的方法来提取操作。 因为它的核心就是接收 CSV 文件,然后用另一种语言生成代码,以便高效地解析这些 CSV 文件。 没错,所以无论其中发生了什么转换,或者实际进行了什么筛选,本质上都得在运行时确定,这有点难。
Just if I were to describe this, the idea is you describe the shape of your CSV file in this new spec called the dynamic buffer, and the dynamic buffer program can generate code in. any other language to follow that spec and read the csv file and do various kinds of processing on it very quickly.
如果让我来描述这个想法,就是你用一个名为 Dynamic Buffer 的新规范来描述 CSV 文件的结构,然后 Dynamic Buffer 程序就能生成代码,用于…… 任何其他语言都可以按照该规范读取 CSV 文件,并快速地对其进行各种处理。
yes. so i mean, so it's even more than like, it's even less than a spec. all we give the agents is an input data file and an output data file. and they have to build, they have to build a code generator on the fly that will like say generate like your python script that can then input that file, do those transformations.
是的。 所以,我的意思是,这甚至算不上……甚至比规范还不正式。 我们给智能体的只有一个输入数据文件和一个输出数据文件。 它们必须临时构建一个代码生成器,比如生成 Python 脚本,让它读取那个文件并执行这些转换。
yeah. so that's the design, the spec file as well.
对。 所以,设计规范文件也是其中的一部分。
okay. yeah. so it's a two-part problem, i would say, is the majority of the issues. the first one is, you know, here's an input with, you know, obviously we bound it to like, these are the transformations you can do, these are the filtering you can do. and then here's the output of, okay, here's what we expect. and determining that is, it's not a trivial thing to do, but given how bounded the space is, it is. Rather easy. The hard part is, you know, picking the right abstractions for code generation.
好。 对。 所以我会说,这是一个由两部分组成的问题,也是大多数问题的来源。 第一部分是:这里有一个输入,当然,我们限定了你可以执行哪些转换、进行哪些筛选。 然后这是输出,也就是我们预期得到的结果。 而判断这一点并不是件简单的事,但考虑到范围如此有限,倒也确实做得到。 相当容易。 难点在于,你知道,如何为代码生成选择恰当的抽象。
So when I look at the size of problem, just as an engineer, when I look at like 10, 20k lines of code as being the harder problems, this actually makes the benchmark even more fascinating in my mind. Because if I think about 10k lines of code, that doesn't mean anything anymore in today's world. and the models are struggling with good design patterns in that small of a code base. they're definitively struggling in any real code base that is like any product code base that you have, any saas that you have quickly explodes like 50k, 100k lines of code. now in no day because the model will just generate this in like half a day. And that I think is a doubly interesting finding. This means like everyone's PRs, like if I just look at the size of PRs, they're de- I don't know Dex show but your teammate even better when you guys were working on it.
所以,当我从工程师的角度看问题规模,觉得像一两万行代码才算比较难的问题时,这个基准测试在我看来就更有意思了。 因为如果我想到一万行代码,在如今这个时代,这已经不算什么了。 而模型在这么小的代码库里,连好的设计模式都难以处理。 它们在任何真正的代码库里肯定更是如此——比如你手头的任何产品代码库,任何 SaaS 项目,很快就会膨胀到五万、一万行以上。 如今可能一天都用不了,因为模型半天就能把这些生成出来。 我觉得这是一个特别有意思的发现,意义还不止一层。 这意味着,大家的 PR——比如如果我只看 PR 的规模,我……不知道 Dex 那边的情况,但你们一起做项目时的队友应该更清楚。
I I personally... We worked we worked pretty hard to keep PRs like in the like, you know, one to two K range near the top. Um...
我个人……我们当时确实很努力地把 PR 控制在一两千行左右,尽量保持在这个范围内。 嗯……
But did the number go up over time, whether you wanted it to or not?
但不管你们愿不愿意,这个数字后来是不是还是涨了?
I've seen the number creep up slowly. There are there are certain things that we were aware of uh that exist in the code base where like hey whenever we change something over here we end up having it like shotguns out in like 50 places. It's like we need to rethink how that's designed so that, you know, it's all it's all managed in one place.
我见过这个数字慢慢往上爬。 我们知道代码库里有一些地方是这样的:比如我们在这里改了点什么,结果改动就像霰弹枪一样散射到五十个地方。 这就像是在说,我们得重新考虑一下它的设计,让所有东西都能集中在一个地方管理。
That's the most amazing part actually about this benchmark that I just saw. It's like, hey, 20k lines of code, a pro- a problem that's sufficiently pretty hard, but albeit not like impossible if you have the spec up front, is still suffering from bad design.
其实,我刚才看到的这个基准测试最令人惊叹的地方就在这儿。 就是,嘿,两万行代码,一个相当难的问题——虽然如果一开始就有规格说明,也不至于难到无法解决——却依然受着糟糕设计的困扰。
I want to touch on one idea really quickly before we get into, we we got a hard stop at 11, so uh I want to spend 15 minutes talking about Gabe's findings and then I want to spend 15 minutes talking about like. the future and, you know, riffing on just like what would make slot code bench even cooler, more useful, tell even more stories. but i want to quickly just for the audience, basically like the idea of dynamic buffer is not just that you have to build this thing, but that it's broken up into like checkpoints, right? so you have like checkpoint one, checkpoint two. i don't know how many checkpoints there are, but like gabe, as i understand it, you're like, you're actually designing these checkpoints themselves in a way that kind of makes it quite like, there's a subtlety to noticing, like, in the middle of checkpoint three, now is the time to refactor code we wrote in checkpoint one so that, like, whatever comes next, not knowing what checkpoint four is, like, a model that was really good at software design would know, okay, now is the time to centralize this and then basically be able to, like, you know, oh, we actually nailed it. by checkpoint four, we actually needed that abstraction, right?
在我们开始之前,我想快速谈一个想法。我们十一点得准时结束,所以我想花十五分钟聊聊 Gabe 的发现,然后再花十五分钟聊聊…… 未来,以及畅想一下,怎样才能让 Slot Code Bench 更酷、更实用,还能讲出更多故事。 但我想先简单向观众说明一下,动态缓冲区的概念不只是要构建这个东西,它还会被拆分成多个检查点,对吧? 所以会有检查点一、检查点二。 我不知道总共有多少个检查点,但据我了解,Gabe,你其实是在设计这些检查点本身,让事情变得相当微妙:比如到了检查点三的中途,什么时候该重构我们在检查点一写的代码,这并不容易察觉。这样一来,不管接下来是什么——即使还不知道检查点四是什么——一个软件设计能力很强的模型也会知道,好,现在是时候把这些集中起来了,然后基本上就能做到,你知道的,哦,我们确实做对了。 到了检查点四,我们确实需要那个抽象,对吧?
Yeah, exactly. I mean, I think even, you know, honestly, like my very opinionated. bet with this is that agents should be so much better than us that at the very beginning they can, you know, they build an abstraction that is able to be adapted very quickly with minimal changes throughout checkpoints, right? like i think, you know, we shouldn't be like, oh, as humans we see, okay, now it's worth it. it should be that agents are just able to do this from, you know, from the get-go. yeah, like it should be like fundamentally in their capabilities that they're able to do this, right? like it shouldn't be, oh, it has to go, you know, determine it. it's that they just do it right from the very beginning. given how much it costs to do these problems, given how much, you know, we rely on agents, the bar should be so much higher.
对,完全正确。 我的意思是,说实话,我对此有一个非常鲜明的看法。 我对此的押注是,智能体应该比我们强得多,以至于它们从一开始就能构建一种抽象,并在各个检查点之间快速适配,只需做最少的改动,对吧? 我觉得,我们不应该像人类那样说:哦,现在值得这么做了。 智能体应该从一开始就能做到这一点。 对,它们应该从根本上就具备这种能力,能够做到这一点,对吧? 不应该是这样:哦,它得先去判断一下。 而是它们从一开始就直接这么做。 考虑到解决这些问题的成本有多高,也考虑到我们对智能体的依赖程度,标准应该高得多。
that makes sense. i'm going to pull up one more thing.
有道理。 我再调出一件东西。
let's take a look at the blog post.
我们来看看这篇博客文章。
actually. yeah, so i mean, i did a blog post and we talked two weeks ago. you can watch the episode about three weeks ago. you can watch the episode of like, here's all the numbers and the scores and like, hey, astra is hitting 16.3% on strict passes, whereas like in march, gpt 5.5 was hitting 14.8%. but i would love to hear, i did not have time to do this, but this is, i think, one of the most interesting parts is like, i know gabe and team dig into the actual code that was written and analyze the patterns and analyzing how model behavior is changing across model generation. so i'd love to have you share and just kind of walk through whether it's the blog post or anything else, what you think is the most interesting things that you found when digging through like how does opus 5.5 write code or how does fable 5.1 write code?
其实…… 对,我写了一篇博客文章,我们两周前聊过。 你可以去看大约三周前的那期节目。 你可以去看那期节目,里面列出了所有数据和分数:比如,Astra 在严格通过率上达到了 16.3%,而今年三月 GPT 5.5 达到的是 14.8%。 但我很想听听你的看法。我没时间做这件事,不过我觉得最有意思的部分之一是:我知道 Gabe 和团队会深入研究实际写出来的代码,分析其中的模式,并分析模型行为如何随着模型迭代而变化。 所以我很想请你分享一下,带我们大致过一遍这篇博客文章或其他内容,说说你在研究 Opus 5.5 或 Fable 5.1 是怎么写代码时,发现了哪些最有意思的事情?
Yeah, yeah, let me, I guess let me share the blog and screen. Yeah, so our core findings when looking at these details is that like line by line, if we look at the patterns that we created back in, I don't remember, I guess March, but also, you know, a lot of these were from January as well.
好,好,我想我来分享一下博客和屏幕。 好,我们细看之后的核心发现是:逐行来看那些模式——我们大概是三月时整理出来的吧,我记不太清了,不过其中很多其实也是一月时整理的。
And just, just to be clear, these were like custom pattern detectors that you wrote by like analyzing code that was written before AI and comparing it to repos that had mostly AI contributions and then saying, okay, what are agents doing differently that we can identify as like. legitimately like suboptimal or bad that we can build like ast linters for, right?
而且,澄清一下,这些是你们自己编写的模式检测器:通过分析 AI 出现前写的代码,再和 AI 贡献占大多数的代码仓库进行比较,然后找出“好,智能体有哪些不同的做法,我们能把哪些识别为不够理想甚至糟糕的做法,然后据此构建 AST 代码检查器?”对吧? 也就是确实属于次优或糟糕的做法,可以据此构建 AST 代码检查器,对吧?
yeah. so that was part of it. i think the larger part was honestly just like little nits that i found. like when we were right, because a lot of, you know, this was still written pre, you know, real agents and pre like the software factory. so it was mostly just us handwriting a lot of this. and, you know, if i saw something that i didn't like, it would become a rule. if i saw something that annoyed me, it was a rule. Um, so these are very opinionated rules, like these are not the end all be all, but they're like.
对。 这算是其中一部分。 我觉得更大的一部分,老实说,就是我发现的一些小毛病。 比如当时我们在写代码时,因为其中很多内容都是在真正的智能体出现之前、在所谓的软件工厂出现之前写的。 所以大部分都是我们手写出来的。 而且,如果我看到什么不喜欢的东西,它就会变成一条规则。 如果我看到什么让我恼火的东西,那它就会变成一条规则。 嗯,所以这些规则带有很强的个人倾向;它们不是绝对标准,但大致就是……
that's kind of like what I want. They're a good sampling of what you think is good quality code.
这差不多就是我想要的。 它们很好地体现了你认为高质量代码应该是什么样子。
which at some point is just vibes. Yeah. Yeah, I mean, yeah, it's vibes all the way down. But.
而这在某种程度上说到底就是凭感觉。 对。 对,我是说,没错,说到底全凭感觉。 不过……
but that's, I mean, that's how we all determine good code. Let's be real. Yeah. Like, code reviews are effectively just vibes. Ideally from engineers you like.
但我意思是,我们大家就是这么判断代码好坏的。 说实话吧。 是啊。 比如说,代码审查实际上就是看感觉。 最好是由你喜欢的工程师来把关。
It's how am I taking my 10 years of experience on being burned by other people's slop code or my own slop code and applying it to like, okay.
这就是我如何把自己十年来被别人写的烂代码、或自己写的烂代码坑过的经验,运用到这个问题上:好吧,
Yeah.
是啊。
What's the most surprising thing you found in this blog post?
这篇博客文章里,你发现最令人惊讶的是什么?
Um, so the most surprising thing, I think if we go down to, you know, our good, the bad, and the ugly, it's the most, you know, most surprising thing is that agents are of course able to solve more. That's like the least surprising thing. But then across the board, our patterns are decreasing per line, right? Like we see, you know, you know, we see verbosity going down significantly. Erosion's staying roughly the same, but I think that's, you know, seem that's seemingly a more fundamental issue with. you know, agents with iterative evaluations. i would say that the fundamental, like most surprising thing that we have seen, it was also the impetus for, you know, our other benchmark library design bench was that agents have some weird aversion to ever using libraries. so in slop code bench, we give them full internet access, which obviously, i guess nowadays is not great. but back then, that worked fine. like, it was fine. it was let it rip and no restrictions. but agents refused to ever install libraries that would make their lives easier. and we see this now with, like, they're rewriting entire libraries essentially from scratch when they're explicitly told to use a library, right? and the other incredibly concerning thing when it comes to agent behaviors is that when they design libraries, they're copying the names and the shapes of existing libraries, but they're not actually doing anything more to them that makes them more usable, right? so imagine we have a very specific use case. yeah, so imagine we have a very specific use case for what we want a library to do, right? i'm thinking like senior suite bench, we have a very specific use case there of... Here's what we need to build as our validator agent. It takes in the spec and it has to build out the tests for the patch that was written, right? And we want to make that a library. Now, agents are going to copy whatever they think. is like the most useful production library, but they won't actually ever think like, oh, this library is now going to be used by agents fully and very little by humans. let's optimize towards that. let's actually make this very ergonomic. let's make this easy to use. and it's such a huge.
嗯,我觉得最令人惊讶的是,如果我们看一下“好的、坏的和糟糕的”那部分,最令人惊讶的是,智能体当然能解决更多问题。 这倒是最不令人惊讶的。 但整体来看,我们的模式是每行代码都在减少,对吧? 比如说,我们看到冗长程度明显下降。 代码侵蚀大致保持不变,但我觉得这似乎是一个更根本的问题,涉及…… 智能体进行迭代评估。 我想说,我们发现的最根本、也最令人惊讶的一点,同时也是我们设计另一个基准测试库 DesignBench 的起因,就是智能体似乎莫名排斥使用库。 所以在 Slop Code Bench 里,我们给它们完全的互联网访问权限。当然,我想如今这样显然不太理想。 但那时候这样没问题。 真的没问题。 就是放手让它们干,不设任何限制。 但智能体就是不肯安装那些能让它们省事的库。 我们现在就能看到这种情况:他们基本上是在从头重写整个库,尽管有人明确告诉他们要使用现成的库,对吧? 另一个在智能体行为方面特别令人担忧的问题是,他们设计库时,会照搬现有库的名称和结构,但并没有进一步改进,让这些库更易用,对吧? 那我们想象一下,有一个非常具体的使用场景。 对,我们想象一下,有一个非常具体的使用场景,也就是我们希望某个库能做什么,对吧? 我想到的是 Senior Suite Bench,我们在那里有一个非常具体的使用场景……这是我们需要构建的验证智能体。 它接收规格说明,然后必须为已经编写好的补丁构建测试,对吧? 我们想把它做成一个库。 现在,智能体会照搬它们认为…… 最适合生产环境的库,但它们根本不会想到:哦,这个库今后会主要供智能体使用,人类只会少量使用。 我们应该针对这种情况进行优化。 我们应该把它做得真正顺手。 让它易于使用。 而这是一个非常大的……
issue that we find. can you make that more tangible? like, what does it mean to make an ai library more ergonomic? because that's very abstract.
我们发现的问题。 你能把这个说得更具体一些吗? 比如,让一个 AI 库更顺手是什么意思? 因为这听起来非常抽象。
yes. so in our work on that, we did a very simple experiment where we just had agent. You know, essentially.
是的。 我们在这方面的工作中做了一个非常简单的实验:我们让一个智能体…… 你知道,本质上就是……
You have an example of this post by the way? Yeah.
顺便问一下,你有这篇帖子的例子吗? 有。
this is this thing.
就是这么个东西。
where basically you talk about like, hey, we have an agent build a library and then we measure what what like how much other models trying to use the library end up like working around the interface instead of using it.
基本上就是你会说,比如:嘿,我们让一个智能体构建一个库,然后衡量其他模型尝试使用这个库时,有多少是在绕开它的接口,而不是使用它。
Exactly. Yeah. Yeah. Um, in our, so I can pull up the other post, but essentially like our core idea here is with that, like what we've seen is you can imagine, right, like. at least for clap, the rust cli, let me actually pull up, i can pull up the exact thing. right. so i guess let me give a very quick setup for how this works. agents are designing the library and then we're evaluating it by how other agents use it, right? like this is under the thesis that agents are going to be working with agent design libraries more than they ever work with human design libraries. it's going to be up to agents to make the decisions on how, like what abstractions to use, how to lay out their code, etc. And so we only evaluate the library based off how well future agents can use it. All right. That's our core TLDR idea. And all the way at the bottom, we have this very explicit guidance that we gave to agents, which is. So write programs downstream agents prefer, test that out through sub-agents, right? Keep testing with sub-agents, test, test, test, test, test. And then specifically with those ones that they prefer, ship your entire library with just runnable examples. Like screw documentation, screw read me, just provide templates. Right? This is under like, this is a very opinionated idea that I have, which is. Yeah.
没错。 对。 对。 嗯,关于我们的……我可以调出另一篇帖子,但核心想法大致是:根据我们观察到的情况,你可以想象,对吧,比如…… 至少就 Clap 这个 Rust 命令行工具来说,我来调出来,找出具体内容给你看。 对。 我想先非常简短地介绍一下它的运作方式。 由智能体来设计这个库,然后我们根据其他智能体如何使用它来进行评估,对吧? 这背后的论点是,智能体使用由智能体设计的库,会比使用由人类设计的库多得多。 如何做决定,比如使用什么抽象、如何组织代码等等,都将由智能体来决定。 所以我们只根据未来的智能体能否很好地使用这个库来评估它。 好。 这就是我们核心想法的简要概括。 在最底下,我们还给智能体提供了非常明确的指导,也就是: 编写下游智能体更喜欢的程序,并通过子智能体来测试,对吧? 不断用子智能体测试,测试、测试、测试、测试、测试。 然后,特别是对于他们偏好的那些,整个库都只提供可运行的示例。 文档什么的见鬼去,README也见鬼去,只提供模板。 对吧? 这是一个……这是我有个非常鲜明的主张,也就是…… 是啊。
they want they want docs, they want samples. Yeah.
他们想要文档,想要示例。 是啊。
they want unit tests. It was just yeah, it was from a conversation I had with a few people where it's like the idea that agents will do much better with like templated, here's the protocol you have to, you know, copy paste essentially, way better than humans do.
他们想要单元测试。 对,这只是我和几个人聊过之后想到的:智能体用模板会表现好得多,比如“这是你必须遵循的协议”,你知道的,基本上就是复制粘贴——它们做得比人类好得多。
This is the ChatGPT thing. But also even more.
这就是ChatGPT那一套。 但还不止如此。
Yes, exactly, right? Like they do very well with that. But even more than that, The entire point is that we want our every single like verb. that's used as a function name to be as short as possible, right? keep it as short, keep it as concise as possible. and look, agents do, agents write simpler code. correctness does drop off a bit. that, that i think is more noise than anything. but simpler code increases for all but typescript. we only have one library and type script that we evaluate on. so it's not as big of a sample set. so this is obviously not like an end all be all. but the core idea is that agents are going to be doing better with a completely different style of code than what we're expecting. and we need to figure one, figure that out. but it's also going to mean that what we consider slop is going to change. fundamentally, right? like these new patterns that we're seeing of like, we highlighted in the blog, but essentially the idea of like, there's some very minor patterns that we see, but they're becoming more subjective. well, it's becoming more objective in slop.
对,没错,对吧? 它们很擅长这个。 但更重要的是,我们的目标是让每一个用作函数名的动词都…… 尽可能短,对吧? 尽量简短,尽量精炼。 而且你看,智能体确实会写出更简单的代码。 正确性会稍微下降一点。 我觉得那更多是噪声,不是什么大问题。 不过除了TypeScript之外,代码确实都变简单了。 我们只有一个代码库和一种 TypeScript 类型来进行评估。 所以样本集没那么大。 所以这显然不是一锤定音的结论。 但核心想法是,智能体会更擅长采用一种与我们预期完全不同的代码风格。 我们得先弄清楚这一点。 但这也意味着,我们对“垃圾代码”的定义会发生变化。 从根本上说,是吧? 比如我们在博客里重点提到的这些新模式,本质上,我们看到的是一些很细微的模式,但它们正变得更主观。 嗯,对垃圾代码的判断正变得更客观。
this is, this is actually one of the, one of my favorite lines in the like anti-slop manifesto that we published last week is like, slop is actually, right now our detection of slop is mostly like human taste and vibes and things that we've seen that is bad, but like, slop and unreviewed output, basically, is a less derogatory way of saying it. it's only bad if it undermines our goal. if an agent writes code in a way that is bad for humans but is good for agents and allows us to continue building a good product or a maintainable system or generally save people time, then it's not necessarily bad that it's different from what humans prefer. but i think, like... what slop code bench proves is sort of like the code that agents write undermines their ability to create maintainable systems. so it is bad. and we have this convenient overlap of like most of the things that human thinks are bad are also bad for agents. right.
这其实是我们上周发布的《反垃圾代码宣言》里,我最喜欢的几句话之一:垃圾代码其实是……眼下,我们对垃圾代码的判断大多基于人类的品味、直觉,以及我们见过的不良做法。不过,把它称为“垃圾代码和未经审查的输出”,基本上是个没那么贬义的说法。 只有当它妨碍了我们的目标时,它才算糟糕。 如果智能体写出的代码不利于人类,却有利于智能体,并且能让我们继续打造优质产品、维护良好的系统,或者总体上为人们节省时间,那么它与人类偏好的方式不同,也未必就是坏事。 但我觉得……Slop Code Bench 证明的其实是,智能体写的代码会妨碍它们构建可维护的系统。 所以这确实不好。 而且有个方便之处在于,我们认为不好的大多数东西,对智能体来说也不好。 对。
yeah. i think fundamentally it's becoming more of a question of we have to view slop as not like these individual patterns that we observe, not as this individual like, oh, you know. oh, it's using, you know, even i, so i guess the whole, i'm not as familiar with typescript, but the whole use effects banning and all that stuff like that, i think is going to start falling by the wayside. what's going to become the bigger issue of slop? and as you, like, as you just said, it's going to be our agents able to fix issues. are they able to write less code fundamentally, right? like at the end of the day, less code is always, is almost always better if it does the same thing. right.
是啊。 我觉得从根本上说,问题越来越在于,我们不能把垃圾代码看成是我们观察到的某些个别模式,也不能把它看成某种个别的……哦,你知道的。 哦,比如用了……我对 TypeScript 不太熟,不过我猜,全面禁用 useEffect 之类的做法,可能会逐渐被淘汰。 那么,垃圾代码更大的问题会是什么? 而且正如你刚才所说,我们的智能体将能够修复问题。 从根本上说,它们能不能少写点代码,对吧? 说到底,如果能实现同样的功能,代码越少通常总是越好。 对。
what you don't want is like an astra or like a mythos tier model having to basically reverse engineer your code base as if it was attacking a system just to reproduce a bug and solve it. like you, that is not a world that we need to live in. and we will probably end up in that world for a lot of code bases when there was a much simpler path, right?
你肯定不希望一个 Astra 或 Mythos 级别的模型,基本上像攻击系统一样逆向分析你的代码库,只为了复现并解决一个 bug。 你知道,那不是我们需要生活在其中的世界。 而当明明有条简单得多的路时,我们很可能还是会让很多代码库走进那个世界,对吧?
i think that rises a very interesting question, which is how does that problem get solved fundamentally? Is it sounds like.
我觉得这引出了一个非常有意思的问题:这个问题从根本上该如何解决? 听起来像是……
i want to actually jump back to this. Sorry, i we should get to that but like i want to jump in because there's a lot of interesting patterns.
我想回到这个话题上来。 抱歉,我们是该聊那个,不过我想插一句,因为这里有很多有意思的模式。
Like i want to go to the table of like the the python patterns and how they're growing. Like there's a bunch of cool stuff in this blog post that i think is worth covering.
我想看看那张关于 Python 模式及其发展情况的表格。 这篇博文里有不少很棒的内容,我觉得值得聊聊。
Yeah, so I mean, so like we're seeing, so these are our old, very specific patterns that we had, right? So like this, this whole returning a tuple of None and error, I'm gonna be honest, I did this before agents. I, I writes, I wrote sloppy code. I, I love that return None, comma error pattern. It made my life easier, but agents shouldn't be doing it, right?
是啊,我的意思是,我们看到的这些,是我们以前那些非常具体的模式,对吧? 比如这个返回一个由 None 和错误组成的元组,说实话,我在智能体出现之前就这么写了。 我……我写过很糟糕的代码。 我……我特别喜欢“返回 None,加上错误”这种模式。 它让我的生活轻松了些,但智能体不该这么做,对吧?
That's like a Golang thing, right? That's like writing Python with a Golang accent.
那是 Go 语言的做法吧? 那就像是用 Go 语言的口音写 Python。
Yeah, I was wondering like go, it's a very common pattern in go. What's wrong with this in Python.
是啊,我在想,比如说 Go,这在 Go 里是很常见的模式。 Python 里这么做有什么问题?
I feel like at least my issue is I hate functions that return something or none. I see. Like in any type like it doesn't it's just it adds like your abstractions should be strong enough. I think this is the worst.
我觉得至少对我来说,问题是我讨厌那种会返回某个值或者 None 的函数。 我懂。 就像任何类型里都一样,它并没有……只是说你的抽象应该足够强。 我觉得这是最糟糕的。
part about GoLang for me too.
对我来说,这也是 GoLang 最糟糕的一点。
So don't worry. The syntax of exceptions lets you bubble things up the stack without have to handle it at every layer of the call stack basically. Yeah.
所以别担心。 异常的语法让你可以把错误沿着调用栈往上抛,而不必在调用栈的每一层都处理它。 是啊。
Yeah. Cool. Yeah, I mean I just also preface that I've yeah, I've only written research code mostly. So my my tastes are like what at least my very opinionated like this is harder to understand when I'm reading someone else's code or my own code. not like what actually will work at cl.
是啊。 好。 是啊,我的意思是,我也先说明一下,我确实基本上只写过研究代码。 所以我的偏好嘛,至少我很主观地觉得,读别人或自己写的代码时,这样更难理解。 而不是说这在 cl 里实际能不能用。
but the system is awesome. i actually really like that we don't do that anymore.
不过这个系统很棒。 我其实挺喜欢我们现在不再这么做了。
that shit was so annoying. oh, i'm so glad we don't do that. that was just so frustrating when things would exit randomly or, you know.
那玩意儿烦死了。 哦,我真庆幸我们不用再那样做了。 程序随机退出的时候真让人抓狂,你懂的。
yeah, that should be illegal.
对,这应该是违法的。
yeah. but i mean, so the patterns are different, like from anthropic to OpenAI's families as well, right? obviously, the tuples one is mostly solved across them all, but. it is roughly that, you know, across the board, across all of our patterns, they're all going down. like OpenAI completely eliminated the sys. exit entirely from almost everything that they, from every model it's gone from down to zero, right? so how they've done it, slightly worse. i mean, i don't love raising all these errors in different spots, but like. It's at least more tractable. I can understand more like quick easier what's going on.
是啊。 但我是说,这些模式各不相同,比如从 Anthropic 到 OpenAI 的各个系列也是这样,对吧? 显然,元组那一项在它们之间基本都解决了,不过…… 大致就是这样,你知道,整体来看,我们所有的模式都在下降。 比如 OpenAI 已经彻底消除了 sys。 它几乎在他们所有东西里都完全不见了;每个模型都从有降到了零,对吧? 所以他们的做法稍微差一点。 我是说,我不太喜欢在不同地方抛出这些错误,不过…… 至少这样更容易处理。 我能更快、更轻松地弄明白发生了什么。
And there's also not much more you can do than that in Python. Like you kind of just have to raise except you have to catch and raise. Like there's. That is the life of Python.
而且在 Python 里,你能做的也不多。 你基本上就只能抛出异常,然后捕获再抛出。 就是…… 这就是 Python 的日常。
Yeah, that's the unfortunate truth. For GPT, it's, you know, I think. It's not great. I would prefer maybe. Yeah, a bit more of an informative uh error here than sources not tabular CSV content. Like what am I supposed to do with that when I see that? Like cool, it's not see like I don't want to have to go look through the entire CSV to figure out where it's broken. Yeah. So there is still issues um being left, I think. When we actually look at like where slop is moving, right? Like as it's moving up and down the stack, It's it's leaving the lines, it's leaving functions, and it's kind of leaving programs overall, but it's moving up like it's going to dependencies. Error handling is also becoming more and more of an issue, right? Like I as we literally just discussed, it's adding more errors, but it's also not making them informative. and it's becoming an overall, like, it's just moving up and it's becoming more, it's harder to detect, but yet way more dangerous for when we're actually, you know, building products out, right? hmm. i was like the tldr, we're changing. if we look at like new patterns that are in there, these are again.
是啊,这就是令人遗憾的事实。 至于 GPT,我觉得…… 不太理想。 我可能更希望…… 是啊,这里的报错能更有信息量一些,而不是说来源不是表格型 CSV 内容。 我看到这种情况时,到底该怎么办? 我是说,行吧,但我可不想为了弄清楚哪里出了问题,就把整个 CSV 都翻一遍。 对。 所以我觉得,还是有一些问题遗留着。 我们实际看看那些糟糕代码是怎么移动的,对吧? 随着它沿着技术栈上下移动,它不再停留在代码行、函数,甚至整个程序层面,而是往上跑,进入了依赖项。 错误处理也越来越成问题了,对吧? 就像我们刚才讨论的那样,它确实增加了更多错误,但也没让这些错误变得更容易理解。 而且总体来说,它就是在不断往上移,变得更难检测,但当我们真正构建产品时,危险性却大得多,对吧? 嗯。 我想说,简而言之,我们正在发生变化。 如果我们看看里面出现的新模式,这些又是……
i think. this is the craziest one in the whole post.
我觉得…… 这是整篇文章里最离谱的一个。
is like these models are, it almost feels like they're learning from the previous generation's slop and then inheriting all these like weird patterns.
就是这些模型好像在从上一代的糟糕代码中学习,然后继承了这些奇怪的模式。
Yeah, I don't, I have no idea why it went back to Python 2 style. I have no idea why it's like doing these very weird things. Like type of x equals the type, like why? Where did that come from specifically?
是啊,我不知道它为什么又退回到 Python 2 风格了。 我完全不知道它为什么会做这些很奇怪的事。 比如 `type(x) == type`,为什么? 这具体是从哪儿来的?
I remember being re-slapped on a PR and like the first five PRs I wrote as a professional developer to fix and like the type of x equals t instead of using is instance.
我记得自己在一次代码审查中又被批评了;作为职业开发者,我写的前五个 PR 就是要修正这种写法,比如用 `type(x) == T`,而不是用 `isinstance`。
I think there's a slight, there's a very slight difference between what type does versus instance of. In Python, and I think it's probably been burned by that. It's just one is more reliable than the other.
我觉得 type 和 isinstance 的作用之间有一点点差别,非常细微的差别。 在 Python 里,我想它大概就是被这个坑过。 只是其中一个比另一个更可靠。
That would be so odd. Oh.
那也太奇怪了。 哦。
So because is instance will traverse the like like the the inheritance tree whereas type will only check on the exact type.
所以,因为 isinstance 会沿着继承树往上检查,而 type 只会检查确切的类型。
Exactly. So it's just like bounding in that way.
没错。 所以这方面就像是有界限一样。
So like Interesting.
所以,嗯,有意思。
I suspect that's why as opposed to anything else.
我猜这就是原因,而不是别的什么。
Um, yeah, I mean honestly, that happens, I think we also see almost entirely like the handwritten library fallbacks, which is like the big, one of the other big issues, right, where it'll be like try this, otherwise the its name is none and it tries to re-implement the entire library in line. I think, like I think you're 100% right. It's becoming from, it's coming from these scenarios where it gets burned by one thing and then it just gets burned in through future.
嗯,是啊,我的意思是,老实说,这种情况确实会发生。我觉得我们还几乎总能看到手写的库回退逻辑,这也是另一个大问题之一,对吧?它会像这样:先尝试这个,否则如果它的名字是 None,就会试图在代码里重新实现整个库。 我觉得,我认为你说得完全正确。 这是由这些情况导致的:它被某件事坑过一次,之后就一直被这件事影响。
you know, planning. Yeah. And then like same with like bullet points number two and three, like if not instance, if an X is none, Like Python libraries have to do this because the language itself doesn't guard them in a safe way. So like even if you write type safe Python code. The right way to write good Python code is actually to add these guards in defensively. And there's a lot of like packages that you install that basically do type guarding for you that basically add this code in.
你知道,规划方面。 是啊。 还有第二、第三条也一样,比如 if not isinstance、if x is None。Python 库必须这么做,因为语言本身不会以安全的方式保护它们。 所以,即使你写的是类型安全的 Python 代码, 要写出好的 Python 代码,正确的做法其实是防御性地加上这些检查。 而且你安装的很多软件包基本上会替你做类型检查,也就是把这些代码加进去。
yeah, i mean, so i guess maybe i slightly disagree with that you have to do this. i disagree with that you have to write if in like all these checks everywhere. i feel like the best python code i've ever written, obviously this like it leans on say like pydantic so much, but the best python code i've ever read has been ones where by construction, if something is not a type, then something else has gone terribly wrong and you shouldn't like. it's just the entire construction of your abstractions means that the entire, like, that you implicitly you will never run into that issue, right? like it will be caught so much farther up the stack.
是啊,我的意思是,我想我可能稍微有点不同意你说的必须这么做。 我不同意这一点,你没必要在所有这些检查里到处都写 if。 我觉得我写过的最好的 Python 代码,显然,它非常依赖比如 Pydantic 这样的东西,但我读过的最好的 Python 代码,是那种从构造上就保证:如果某个东西不是某种类型,那肯定是哪里出了大问题,而且你不应该…… 关键是,你抽象的整体构造意味着,实际上你根本不会遇到那个问题,对吧? 因为它会在调用栈上游很远的地方就被捕获。
In theory, yes, but in practice, like in real practice, in like production Python code bases, you usually have like some interrupt where it doesn't match the system or you're interacting with a network service where you like made one wrong assumption in the type system and now you're going to get an exception all the way down because you passed the value by mistake. Or you wrote some threading code and there's some mistakes. But.
理论上是这样,但实际上,尤其是在真正的生产环境 Python 代码库里,你通常会遇到某种中断:代码和系统对不上,或者你在跟网络服务交互时,在类型系统里有一个假设搞错了,于是因为你不小心传错了值,异常就会一路传到底。 或者你写了一些多线程代码,里面出了些错。 但是……
listen, i didn't invite you on here for vibe off to challenge all of your slop opinions. no, no.
听着,我邀请你来可不是为了让你挑战我那些垃圾观点的。 不,不。
i think this is awesome. i think what i'm saying is like, i get why the models are doing this.
我觉得这太棒了。 我想说的是,我理解模型为什么会这么做。
but it's guaranteed to be slop.
但这注定会是垃圾代码。
yeah, yeah. i mean, so OpenAI is slightly less in terms of like the slop, but it's also, i think, just significantly more in the patterns that we see. like, we see the same exact type of x equals equals t, right? like, it's going to be the same.
对,对。 我是说,OpenAI 在垃圾代码这方面稍微好一点,但我觉得它也明显更容易出现我们常见的那些模式。 比如,我们总会看到完全一样的 x == t,对吧? 反正都是一样的。
All right. The python for some of these patterns.
好吧。 Python 里的一些这类模式。
I love this. Okay, amazing.
我喜欢这个。 好,太棒了。
I want to get into the future of slop code bench. So really cool findings. I recommend you all go read the blog post. I have, i have questions. I think, i think there's two dimensions here. One is like other languages and like, how do we make that happen? And then number two is really around just to kind of like in like transition here is like. this idea of like, okay, the default prompt, there's like two prompts i think that i looked at that ship with slop code bench. there's like just solve, which is essentially like go do the thing in the request, right? and here it is. there was another one that i think like you found didn't make a difference, which is like make a plan and then go implement it. and then i have started on my fable 5.2 run, started doing this thing that anthropic told us to do or recommended in their prompting guide, right? of like. tell fable 5.2 that it's the long-term owner of this code base. and i'm really curious to see how that plays out. i have it running on a workstation somewhere. it'll be a little while until those all come out. but the early results don't show a huge difference, although it did ace. just solve got a four out of eight. and you own this code base, like ace circuit eval, which again is one of the easy problems. Um, but I'm curious, have you thought much about like, because like this proves that like if you just ask them, if you just push stuff into a queue and say, do this, do this, do this, you do end up with like, like deteriorating results. Have you thought at all how we might evolve it to look more like what like a human design software factory might look like where you have like agentic review and like opinionated linters and like what if we took all the linters and slop code bench and at the end of every run we told the model one time, hey, here's all the things that you're gonna get judged on, like maybe fix some of them and like. Does that actually have any impact? Have you guys talked about this at all.
我想聊聊 Slop Code Bench 的未来。 所以,发现真的很棒。 我建议大家都去读读那篇博客。 我有,我有几个问题。 我觉得,我觉得这里有两个方面。 一个是其他语言之类的,我们要怎么实现? 第二个方面,过渡到这里的话,主要是…… 这个想法是,默认提示词有两种,我看了看,应该是随 Slop Code Bench 一起发布的。 一种就是“直接解决”,本质上就是按请求把事情做完,对吧? 然后结果就在这儿。 还有另一种,我觉得你发现它没什么区别,就是先制定计划,再去实现。 然后我开始跑 Fable 5.2 了,开始做 Anthropic 在提示词指南里告诉我们或建议我们做的事情,对吧? 就是…… 告诉 Fable 5.2,它是这个代码库的长期维护者。 我真的很好奇结果会怎样。 我让它在某处的一台工作站上运行。 那些结果全部出来还得等一阵子。 不过早期结果看不出太大差异,尽管它确实出色地完成了…… “直接解决”得了 8 分中的 4 分。 而“你是这个代码库的维护者”则在 Circuit Eval 上表现出色;不过这又是一道简单题。 嗯,不过我很好奇,你有没有认真想过,比如说,这证明了如果你只是问它们、把一堆任务塞进队列里,然后说“做这个、做那个、做这个”,最终结果确实会越来越差。 你有没有想过,我们该如何改进它,让它更像人类设计软件工厂的样子:有智能体式审查、有立场鲜明的代码检查器?如果我们把所有代码检查器和 Slop Code Bench 都用上,并在每次运行结束时只告诉模型一次:“嘿,以下是你会被评判的所有标准”,然后让它试着改进其中一些,诸如此类呢? 这真的会产生什么影响吗? 你们讨论过这件事吗?
so we have thought that i think when we very at the very beginning when we were doing like the whole just solve it was essentially like i wanted to go with this very clear stance that the models like again, miles should internally be able to do all this by themselves. i do care a lot more about like this, you know, agents working by themselves in this like factory with agent agentic review, then, you know, determining which issues need to be triaged, etc. I care a lot about that. I don't, you know, I don't necessarily know currently how we will, we could incorporate that into like Slop Code Bench. I feel like the cleanest way, especially because like, you know, like obviously my focus right now and with the most recent paper has been on like agents designing for agents. if there, you know, we tried this a bit for library design bench and see if there's a way we could incorporate our findings from slop code bench into our, you know, our problems that agents solve with the library. I feel the only way to really elicit the signal that actually reflects how people who are having a full agentic loop for their software development works is that we need to, one, simulate like cure issues and then having them determine what needs to be added to a library, for example. but we also need to put a lot more emphasis on, okay, we need to let the agents work completely by themselves, right? we need to let them own the entire process. and all we do is give them a bit of feedback here and there, like tell them, oh, i don't like this. or, oh, you know, maybe this could be a better way of doing it. or, oh, i want to see this. i think even like this could be a better way of doing it. is too much, right? Like my opinion, in my opinion, like our benchmarks need to fundamentally ask how far away are we from letting agents do everything, right?
我们确实想过。我想,在最开始做“只管解决问题”这件事时,我基本上是想明确坚持这样一个立场:模型——再说一次,Miles——应该能在内部独立完成所有这些事情。 我更在意的是,比如说,让这些智能体在这个工厂里自行工作,进行智能体式审查,然后判断哪些问题需要分流处理,等等。 我非常在意这一点。 不过,我目前也不确定该如何把这些纳入 Slop Code Bench。 我觉得最干净的做法,尤其是考虑到你知道的,我目前以及最近那篇论文的重点显然都是“让智能体为智能体设计”。 我们在 Library Design Bench 上稍微尝试过这一点,看看能不能把从 Slop Code Bench 得出的发现,纳入智能体利用这个库解决的问题中。 我觉得,想真正测出能反映人们如何通过完整的智能体工作流进行软件开发的信号,唯一的办法是:首先,模拟一些问题,然后让智能体判断需要向库中添加什么,比如说。 但我们也得更加重视这一点:好,我们得让智能体完全自主地工作,对吧? 得让它们负责整个过程。 而我们只是在某些时候给它们一点反馈,比如告诉它们:“哦,我不喜欢这个。” 或者:“哦,你知道,也许有更好的做法。” 或者:“哦,我想看看这个。” 我觉得,就连说“也许有更好的做法”,都已经干预太多了,对吧? 对吧? 在我看来,我们的基准测试从根本上就该问:距离让智能体包办一切还有多远,对吧?
And how far away are we from the dark factory vision of like literally I just ask it for stuff and out the other side I get really good working software forever?
距离“暗工厂”愿景还有多远——我只要提出需求,另一头就能源源不断地交付真正好用的软件?
yeah, i think even like even at a higher level, it's, you know, the question i've really been interested in working on recently has been how far away are we from agents producing useful artifacts to people, right? like i think you can imagine a like rust compiler speed up, right? how far away are we from that? how, you know, how far away are we from agents creating a piece of software that allows other agents to write less code, right? like across the, you can imagine like a rough for agents. that tells them this code is, or these tests are pinning your entire implementation to some specific thing, right? but that's, i wish we had that way to detect that type of slop and slop code bench, which is tests that are just causing agents to hyper fixate on keeping old code around, right? like that's the biggest piece of slop i've seen.
对,我觉得即使从更高的层面来看,你知道,我最近一直很感兴趣的一个问题是:距离智能体能够为人们产出有用的成果,还有多远? 比如,你可以想象一个 Rust 编译器加速工具,对吧? 我们离那一步还有多远? 你知道,距离智能体创建一款能让其他智能体少写代码的软件,还有多远? 你可以想象有一个专为智能体设计的 Rough。 它会告诉它们:这段代码,或者这些测试,把你的整个实现都限定在某个特定方案上了,对吧? 不过,我真希望我们有办法检测这类糟粕,以及代码基准测试里的糟粕——也就是那些让智能体过度执着于保留旧代码的测试,对吧? 这是我见过的最大一类糟粕。
yeah, so it actually like the agent propensity to write too many tests or write tests that are too specific to an implementation. actually inhibits the future agents from doing the centralization and refactors because the agents don't have the like, i don't know, the, the, um, what is the d&d world, the, the initiative to say like, okay, cool. yeah, we will centralize this. and i'm going to rewrite all those tests too, because that's the right thing to do. they're very set on like, you have to keep the rest of the test passing and make the change within the, the, the guardrails of what's there.
对,所以实际上,智能体很容易写太多测试,或者写出与某种实现方式过度绑定的测试。 这确实会妨碍后续智能体进行集中化处理和重构,因为智能体没有那种——我不知道,该怎么说——《龙与地下城》里的那个词,主动权,来表示:“好,没问题。” 对,我们会把这些集中起来。 而且我也会把那些测试全部重写,因为这么做才对。 它们非常执着于:你必须让其余测试继续通过,并在现有的护栏范围内做出改动。
one of the things that we do whenever we do any rewrite work is like, first thing we do is we say rip out the old code. like delete it from, delete it, that's the first commit, then re-implement it. because otherwise like it will just bias towards keeping the old shit around by accident.
我们每次进行重写时都会做的一件事是,第一步就说:把旧代码删掉。 就是把它删掉——这是第一个提交,然后再重新实现。 否则,它就会不知不觉地偏向于保留那些旧玩意儿。
interesting. delete the code and the tests and then here's what you need to do.
有意思。 把代码和测试都删掉,然后再说清楚你需要做什么。
yeah, delete all of the, and like the rust type system is fantastic. so you delete it in one place, it just propagates it everywhere. But it actually you delete it, then you make the plan, then you basically rebuild the plan from scratch and then you implement.
对,把所有这些都删掉。而且 Rust 的类型系统非常棒。 所以你在一个地方删掉它,它就会一路传递到所有地方。 但实际上,你把它删掉,然后制定计划,基本上从头重建计划,再去实现。
Are you are you deleting like a module and everything that.
你是说把一个模块以及所有……都删掉吗?
depends on the leader feature? Like i've deleted entire features from scratch and every time i want to reimplement the feature, i just delete it and then i replan i plan, i delete, i replan, i implement.
那些依赖于 leader 功能的东西? 我曾经从头删掉整个功能。每次我想重新实现这个功能时,就把它删掉,然后重新规划——我规划、删除、再规划、再实现。
Interesting.
有意思。
And that helps a lot with slot production. Because there's no, if you use, depending on what languages you use, you have like no incremental checkpoints. Kind of like exactly what software bench is checking. So like. because you can't compile rust in incremental ways, you have to have everything be right. but if you start from scratch, you can actually build incremental checkpoints and you can build it working along the way.
而且这对 slot 生产很有帮助。 因为没有……如果你用什么语言,可能就没有增量检查点。 这有点像 Software Bench 正在检查的内容。 所以…… 因为 Rust 不能以增量方式编译,所以所有东西都必须正确。 但如果从头开始,你实际上可以建立增量检查点,并在推进过程中逐步构建出能运行的东西。
okay, so how does this fit into our eval question of like, how can we build confidence? you're talking about like, here's how we work around these problems. but do you have thoughts on like what you would want to see from a benchmark that would convince you that you don't need to do that anymore?
好,那这跟我们关于评估的问题有什么关系?比如,我们怎么才能建立信心? 你说的是,我们可以这样绕过这些问题。 但你觉得,要看到基准测试呈现什么结果,才能让你相信自己不再需要这么做?
I think it's really hard without really pristine metrics that go into the software development flow. Like, I need to understand the flow of roughly some data structures that can be quantified by some numbers. And once I understand the flow of a data structure quantified by numbers, then I can suddenly ask the question of like. Did I accidentally use this? So for example, if I want to reuse a field and say I want I want this field to go from like a. I want to delete this field from the data structure in some way. That's an easy thing to verify. But if I want to say I want to use this field less. There's no way to quantify that in a really precise, I mean there kind of is, you can do search by references, but then you have to do search by references, do AC traversals to find everything that uses those references. There's no tool chain for that kind of problem, so I don't know how you actually really build a benchmark on this without humans vibe checking at the end.
我觉得这很难,除非软件开发流程中有非常完善的指标。 比如,我需要了解大致的数据结构流向,而且这些流向能用一些数字量化。 一旦我了解了数据结构的流向,并且能用数字量化,我就能突然提出这样的问题:…… 我是不是不小心用到了这个? 比如说,如果我想复用一个字段,假设我想让这个字段从…… 我想以某种方式从数据结构中删掉这个字段。 这件事很容易验证。 但如果我想说,我想少用这个字段。 要非常精确地量化这一点是不可能的。我的意思是,某种程度上可以,你可以按引用搜索,但那样你就得按引用搜索、遍历抽象语法树,找出所有使用这些引用的内容。 对于这类问题,没有一套工具链,所以我不知道怎么才能真正建立起这样的基准测试,除非最后由人来凭感觉检查。
amazing. guys, we are almost at time and i apologize this episode is shorter than i wanted it to be, but i got a hard stop in a sec. gabe, any final words? any ask for the audience? how can people get in touch with you? how can they be helpful to you?
太棒了。 各位,时间快到了。很抱歉这期节目比我希望的要短,不过我马上得去处理别的事了。 Gabe,有什么最后想说的吗? 有什么想请听众帮忙的吗? 大家怎么联系你? 他们怎样才能帮到你?
Yes. So you know, reach out on twitter at gr lansky. We have a discord for software bench. That's also the discord for library design bench. Check out the repos as well. I guess we will hopefully have some news soon on like what the future holds for both these benchmarks and what our clans are there. And then also some new a new hopefully very interesting and useful the challenges for agents.
好。 大家可以在 Twitter 上联系我,账号是 gr lansky。 我们有一个 Software Bench 的 Discord 服务器。 Library Design Bench 也用这个 Discord 服务器。 也欢迎看看我们的代码仓库。 我想,希望我们很快就会有一些消息,聊聊这两个基准测试的未来会怎样,以及我们的计划是什么。 另外,我们还会推出一些新的、希望非常有趣且有用的智能体挑战。
Awesome. Yeah. I'm super looking forward.
太棒了。 是啊。 我非常期待。
to harder challenges. It's gonna it's gonna be a lot of fun.
去迎接更难的挑战。 这会——这会很有趣。
I mean dude this benchmark is very unsaturated. I think Astro got a 16.3 dude. I don't know if we need harder challenges.
我是说,老兄,这个基准测试的竞争还很不充分。 我觉得 Astro 得了 16.3 分,老兄。 我不知道我们是否需要更难的挑战。
Uh so one of the biggest things I want to do for Slop Code is at least go through and make like do full audits because I I know we're we were very opinionated in certain parts but were those opinionated decisions just? i think so, but obviously, you know, some people point out there's a few things that we need to fix here and there. so that's at least on the top of my list is to go through both and make sure that we have. At least more clear guidelines on what it takes for a problem to be saturated or not.
呃,所以我想为 Slop Code 做的最重要的事情之一,就是至少全面审查一遍,因为我知道我们在某些方面非常坚持己见,但这些坚持己见的决定真的合理吗? 我觉得是的,但显然,你知道,有人指出我们还有一些地方需要修正。 所以这至少是我优先要做的事:把两者都过一遍,确保我们…… 至少制定更明确的指导原则,说明什么情况下一个问题算是已经饱和,什么情况下还不算。
本期围绕 Slop Code Bench 探讨 AI 编程代理能否持续构建和维护软件。基准测试通过分阶段交付功能,检验早期设计是否会妨碍后续迭代;研究发现,尽管模型生成代码中的一些可见坏习惯减少了,问题却可能转移到依赖、错误处理和系统设计中。代理还常常回避现成库,或仿照已有库却没有针对其他代理的使用方式改进接口。讨论进一步指出,过度具体的测试可能阻碍重构,而彻底删除旧实现再重新规划有助于摆脱历史设计的牵制。核心衡量标准不应只是代码是否符合人类偏好,而应看系统能否被后续代理理解、修改并持续维护。
Gabor Lansky 创建 Slop Code Bench,源于对早期编程代理破坏项目、留下低质量代码的挫败感,也因为当时缺少评估代码长期质量的方法。基准不只要求模型完成一个任务,而是把开发拆成多个检查点,观察它能否添加后续功能而不破坏早期功能。核心问题是代理在连续迭代中是否会损害代码库,以及早期代码是否考虑了未来的人或代理如何使用它。
基准任务从较简单的代码搜索、逻辑电路模拟和 ETL,到更复杂的 Dynamic Buffer。后者要求代理根据输入和输出文件构建代码生成器,为多种语言生成处理 CSV 数据的程序;合理设计可能约一万行代码,较朴素的实现可能达到两万行。难点不仅在实现功能,更在于选好代码生成抽象,并在后续检查点到来前决定何时集中或重构早期设计。研究者认为,代理理应从一开始就能构造便于适应后续变化的抽象。
研究团队通过自定义模式检测器分析代码,将过去手写代码与 AI 贡献较多的代码库进行比较,并把认为低效或不佳的模式转化为检测规则。研究者也承认,部分规则来自个人在阅读代码时的反感与经验,因此具有鲜明主观性;代码审查和质量判断在一定程度上仍依赖工程师的经验与偏好。
随着模型解决更多任务,若干已追踪的代码模式总体上呈下降趋势,冗长问题也明显减少,但代码侵蚀仍大致维持原状。更突出的发现是,代理即使可以访问互联网,也常不安装能简化任务的库,甚至在被明确要求使用库时仍从头重写。代理设计库时又常照搬现有库的名称和形状,却没有针对下游代理的实际用法改善接口。Library Design Bench 因而尝试用其他代理能否顺利使用该库来评估设计,并探索以可运行示例、模板和反复测试代替单靠文档说明。更适合代理的代码风格可能不同于人类习惯,判断“slop”的标准也应看它是否妨碍构建可维护系统,而不只是是否违背人类偏好。
讨论了 Python 中返回“None 加错误”的元组模式,以及直接退出进程等做法:研究者认为,有些写法使调用者更难理解和处理错误;模型间的具体实现有所不同,部分模式在新模型中明显减少或消失。但错误处理仍不理想,例如错误信息可能只说输入不是表格 CSV 内容,却没有指出如何定位问题。总体而言,问题正从单行代码和函数层面移向依赖及更高层的系统设计,变得更难发现,也可能对实际产品更危险。
一些新模式看起来像是模型继承了旧一代代码中的习惯,例如在 Python 中使用精确类型比较,而不是会沿继承关系判断的 isinstance;对话推测,这可能源于模型对类型判断差异的过度防范。另一类现象是手写库的兜底实现:代理尝试使用库失败后,可能直接在代码中重新实现整套功能。对于是否应到处添加类型检查,讨论呈现不同观点:有人主张用稳固抽象在上游保证类型正确,也有人指出生产环境中的网络服务、并发和类型假设仍可能带来运行时问题。
仅要求代理按队列逐项完成任务,可能导致代码随迭代逐渐恶化;但把代理评审、静态检查和反馈纳入评估,如何设计仍未确定。Gabor 认为,基准应逐步检验代理能否拥有完整开发流程:根据问题决定要添加什么、独立完成工作,并只接受少量方向性反馈。更长远的目标是衡量代理距离“提出需求后持续交付可用软件”的自主软件工厂还有多远,包括能否产出帮助其他代理减少代码量的工具和软件。
过度贴合某个实现的测试会迫使后续代理保留旧代码,限制集中逻辑和重构。代理往往把“保持现有测试通过”当作边界,不主动判断哪些测试也应随设计一并改写。测试数量过多或实现细节绑定过紧,因而可能成为阻碍后续维护的代码负担;讨论提出,理想的评估还应能识别这种把实现固定住的测试。
一种应对历史设计牵制的做法,是先删除旧功能及相关测试,再重新规划和实现,避免代理因旧代码而倾向于保留原有结构。Rust 的类型系统有助于让删除带来的影响传递到相关位置,也能支持从头构建并逐步验证实现。要证明代理不再需要这种工作方式,则需要更精确的指标:删除数据结构字段较容易验证,但衡量某个字段是否被更少使用,需要引用搜索和语法树分析等工具;缺少相应工具链时,评估仍可能需要人工审查。
讨论临近结束时,Gabor 提到可以通过 Twitter、相关 Discord 和代码仓库联系并关注研究。主持人期待更难的基准挑战,也指出当前测试结果仍有较大提升空间;Gabor 则把全面审查现有基准、检查主观规则并制定更清晰的任务饱和度标准列为优先事项。
03:23 单次任务完成情况不足以衡量代码质量;分阶段迭代能揭示早期设计对后续功能和维护的影响。
15:27 代理常回避现成库或从头重写,而代理设计的库也未必真正适合下游代理使用。
19:55 判断代码是否为“slop”,关键应看它是否妨碍构建可维护系统,而不是它是否符合人类偏好的写法。
24:11 代码质量问题并未随着部分可见模式减少而消失,而是在向依赖、错误处理和更高层设计转移。
32:21 绑定实现细节的测试可能阻碍后续代理集中代码和重构,因此测试也需要能随设计变化而调整。
33:08 先删除旧实现与测试、再重新规划和构建,有助于避免代理不自觉地延续旧设计。