12-04 更新 实时
首页/ 技术栈/ 正文

对抗 AI 低质内容:形式化验证成新武器

技术栈 来源:Latent Space 2026-11-21 05:18 2 阅读 机器翻译
对抗 AI 低质内容:形式化验证成新武器

2026 年 AI 行业的年度词汇是“slop”——意指大语言模型产出的低质量内容。如今大量代码由 AI 生成,避免 slop 已成为软件工程师每天都要操心的事。那该怎么做?方法之一是使用形式化验证系统,它借助数学证明和逻辑来验证软件或硬件的正确性。

随着 AI 在解数学题方面的能力不断增强,如今已有多家 AI 公司提供形式化验证系统,包括 Harmonic、Theorem、Axiom Math,以及一家新入局者 &Truth(读作“and truth”)。本文将介绍这些公司采用的一些方法。

为了更好地了解形式化验证系统的整体格局,我们采访了该领域的一位主要倡导者:&Truth 联合创始人兼联席 CEO Clark Barrett。他同时也是斯坦福大学计算机科学 Corbel 讲席教授(研究系列),并参与创建了 cvc5——一款在形式化验证中广泛使用的自动推理引擎。

不深入技术细节的话,cvc5 是所谓可满足性模理论(SMT)的“求解器”,Barrett 表示,这类工具在 Amazon 等公司中被广泛使用。例如,cvc5 被用于 Kiro 中的规范分析与测试生成,Kiro 是 Amazon 的智能体式开发环境。

“看着我的工具从实验室里的一个好点子,变成如今在 Amazon 的生产流水线中每天被调用数十亿次的 cvc5,这很有趣。”Barrett 告诉我们。

出自 Clark Barrett 参与合著的一篇 2022 年关于 cvc5 的论文。

当 AI 编程智能体公司谈到“验证”自己的工作时,通常指的是智能体运行测试、对自己的输出进行批判性审视,或让另一个 AI 模型来评判。于是我问 Barrett,这种做法距离真正的验证还差多远?

“主要的区别其实就在于,你怎么知道你已经完成了,”他回答道。“所以,如果你在做测试、打补丁、扫描——使用所有这些现有工具——它们相当不错。我的意思是,它们会发现大量问题。它们会提出那些问题。但你永远无法完全确定,我是不是找到了所有[这些问题],还是还有一个潜伏在那里、我的工具找不到?”

&Atlas,&Truth 的第一个工具;它是“一张世界开源代码的地图,从用 C 编程语言编写的代码开始。”

&Truth 建立在 Lean 之上,Lean 是一门开源编程语言和证明助手。该公司将 AI 与自动推理技术相结合,构建可由 Lean 检查的证明。

Lean 是一种被前沿模型用来解决各种极其困难的数学问题的语言。例如,就在本周,GPT-6.2 Astra 产生了 Vals 认为的“Smoktunowicz’s Gap Theorem 的首个 Lean 证明”。Vals 补充说,Anthropic 也使用 Lean 来形式化费马大定理,这是一个 1300 万行的项目。

最新的重大数学新闻是一则报道,称 Anthropic 数学家 Levent Alpöge 声称他使用 Claude 证明了已有 167 年历史的黎曼假设——并且他把证明发布在了 Lean 中。

Lean 代码示例;来自 Lean 项目网站

&Truth 正在 Lean 框架之上构建它所称的“验证机器”,其雄心是读取代码,“无论使用任何语言,都能证明它是否满足精确陈述的要求,并让人类无需理解每一行就能信任它”。

“Lean 所做的只是检查你没有犯错,”Barrett 解释道。“所以你可以把它看作一个非常精密的数学检查器。”

这对模型训练同样有影响。Axiom Math 使用形式化验证为其数学推理系统的训练提供正确性反馈,证明尝试有助于改进未来的模型。

在 6 月接受 Latent Space 采访时,Axiom CEO Carina Hong 指出,形式化验证——以及 Lean 所赋能的能力——不仅仅是一种防御手段。

“形式化验证,或者说经过验证的 AI,对我们来说不只是处理或剔除那些糟糕的东西、幻觉和错误。它是为了规模化地释放卓越,是为了超级智能。”

Axiom 开发了 AxiomProver,这是一个生成 Lean 证明的 AI 系统,同时还开发了 AXLE,即用于探索、验证和操作这些证明的工具包。

Harmonic 的 Aristotle 是一款“自动定理证明器”,其产品大量使用 Lean。“在 Aristotle 内部,AI 编写证明,Lean 检查每一步,因此结果从不取决于 AI 是否正确,”该公司在其网站上表示。

Harmonic 的工作流程

鉴于如今人们对网络安全的偏执程度不断升高——有人也许会说,是在 AGI 到来之前的日子里——形式化验证系统似乎比以往任何时候都更被需要。Barrett 也确认,网络安全是 &Truth 的一个关键重点。

“我们技术的一个非常强大的用例,就是遍历世界上所有的 C 代码,无论是开源还是闭源,并设法确保其内存安全。如果它内存不安全,我们可以指出:这段代码存在这个问题,你需要修复它,让它变得安全。”

安全也是 Theorem 的关注重点,它是 &Truth 的竞争对手之一。Theorem 在其主页上表示:“当对手规模扩张时,验证是唯一站得住脚的防御手段。”

Theorem 的证明效率评测:“按模型发布时间排列的、在我们的证明效率评测中每小时验证的机器代码 KB 数,附 95% 置信区间。”

Theorem 还就此话题与 Anthropic 展开合作,成果是一篇题为《LLM 正让形式化软件验证在更大规模上变得可行》的博客文章。

文章中较为令人鼓舞的一点是:形式化验证虽然目前 Token 开销高昂,但已开始变得更加 Token 高效。在一组 36 个小型验证任务上,Anthropic 报告称 Opus 5.5 达到 50% 的解决率,所用 Token 比 Opus 5 少约 40%。随着更多模型“在长验证任务上接受训练”,这一趋势预计将持续。

Theorem 与 Anthropic 将“LLM 规模化的形式化验证”描述为一种有前景的方法,可在以往不切实际的规模上提供安全保证。

Anthropic 的示意图:“从代码到机器校验的保证”;在此案例中使用的是 Rocq 而非 Lean。

最后,形式化验证如何融入开发者的工作流?&Truth 在其网站上表示,开发者将从 vibe-coding(氛围编程)转向“veri-coding(验证编程)”——这意味着验证层将成为工作流的一部分。

“如果你的验证机器与你的智能体相连,你仍然可以说,‘嘿,我想要你构建这个,’”Barrett 说。“也许还需要做一点工作,与智能体一起真正把你想构建的东西的规格确定下来。但之后智能体就能深入到内部,与形式化[验证]工具协作,基本上你会看到几乎没什么差别,只是你的代码第一次就能跑通。”

那么,这个设想是:开发者将把更多时间花在编写规格说明和审阅上,而不是编写代码或审查代码。

在我写完这篇文章的时候,我看到了 Cognition 开发者关系负责人 Nader Dabit 的这条推文:

不管“结果工程”(outcome engineering)这个说法能否流行起来,他对我们当前在编程领域所处阶段的判断是有道理的。当你只是告诉你的智能体团队你想要什么,它们就去动手构建,那么你(人类开发者)需要一种方式来检查智能体交付成果的正确性。

如果 &Truth、Harmonic、Theorem 和 Axiom Math 这类公司能够如愿以偿,形式化验证可能会成为一种越来越实用的检查这些结果的方式。

译文由英文原文机器翻译,术语按行业惯例统一,可在文末展开原文核对。

查看英文原文(The War Against Slop and an Emerging Weapon to Fight it: Formal Verification)

The word of the year in the AI industry over 2026 has been “slop” — meaning low-quality output from a large language model. And with so much code being AI-generated now, avoiding slop has become a daily concern for software engineers. So how to do that? One way is to use formal verification systems, which use mathematical proofs and logic to verify the correctness of software or hardware.

With AI’s growing prowess at solving math problems, there’s now a number of AI companies offering formal verification systems. They include Harmonic, Theorem, Axiom Math, and a new entrant called &Truth (pronounced ‘and truth’). In this article we’ll look at some of the approaches these companies are taking.

How formal verification is used in software and AI today

In order to better understand the landscape of formal verification systems, we spoke to one of its leading proponents: Clark Barrett, &Truth’s co-founder and co-CEO. He’s also Corbel Professor (Research) of Computer Science at Stanford and was the co-creator of cvc5, a popular automated reasoning engine used in formal verification.

Without getting too in the weeds, cvc5 is what’s called a “solver” for satisfiability modulo theories (SMT), which Barrett says is widely used in companies like Amazon. For instance, cvc5 is used for specification analysis and test generation in Kiro, Amazon’s agentic development environment.

“It's been fun to see my tools go from a good idea in the lab to cvc5 is now called billions of times a day in production pipelines at Amazon,” Barrett told us.

Via a 2022 paper about cvc5 co-authored by Clark Barrett.

When AI coding agent companies talk about “verifying” their work, it typically means agents running tests, critiquing their own output, or having another AI model judge it. So I asked Barrett how far short of real verification does that fall?

“The main difference is really just, how do you know when you're done,” he replied. “So if you're testing, patching, scanning — using all these existing tools — they're quite good. I mean, they find a ton of problems. They raise those issues. But you're never quite sure, did I find all of them [the issues] or is there one more lurking there that my tool can't find?”

&Atlas, the first tool of &Truth; it’s “a map of the world’s open-source code, starting with code written in the C programming language.”

Lean’s role in formal verification

&Truth builds on Lean, an open-source programming language and proof assistant. The company combines AI with automated reasoning techniques to construct proofs that Lean can check.

Lean is a language used by frontier models to solve all manner of supremely difficult math problems. For instance, just this week GPT-6.2 Astra produced what Vals believes is “the first Lean proof of Smoktunowicz’s Gap Theorem.” Vals added that Anthropic also used Lean to formalize Fermat’s Last Theorem, a project of 13 million lines.

The latest big math news is a report that Anthropic mathematician Levent Alpöge claims he used Claude to prove the 167-year-old Riemann hypothesis — and he posted the proof in Lean.

Example of Lean code; via Lean project website

&Truth is building what it calls a “verification machine” on top of the Lean framework, with the ambition of reading code “in any language, proving whether it satisfies precisely stated requirements, and enabling humans to trust it without having to understand every line.”

“What Lean does is it just checks that you didn't make a mistake,” explained Barrett. “So you can think of it as a very sophisticated checker for mathematics.”

This has implications for model training too. Axiom Math uses formal verification to provide correctness feedback for training its mathematical reasoning systems, with proof attempts helping improve future models.

In an interview with Latent Space in June, Axiom CEO Carina Hong made the point that formal verification — and what Lean enables — isn’t just a defensive measure.

“Formal verification, or verified AI, to us it's not just about handling or kicking out the lousiness, the hallucinations, the mistakes. It's about scaling brilliance. It's about super-intelligence.”

Axiom develops AxiomProver, an AI system that generates Lean proofs, alongside AXLE, its toolkit for exploring, validating, and manipulating those proofs.

Harmonic’s Aristotle, an “automated theorem prover”, uses Lean heavily in its offering. “Inside Aristotle, AI writes the proofs and Lean checks every step of them, so a result never rests on the AI being right,” states the company on its website.

Harmonic’s workflow

Cybersecurity and LLM-scaled formal verification

Given the heightened level of paranoia about cybersecurity these days — some might say in the days leading up to AGI — formal verification systems seem like they’re needed more than ever. And Barrett confirmed that cybersecurity is a key focus for &Truth.

“One really powerful use case for our technology is going through all the C code in the world, whether it be open source or closed source, and trying to ensure that it's memory safe. And then if it's not memory safe, we can point to: here's a problem with this piece of code, you need to fix it so that it's safe.”

Security is also a focus of Theorem, one of &Truth’s competitors. “Verification is the only defense that holds while adversaries scale,” Theorem states on its homepage. 

Theorem’s proof-efficiency eval: “KB of machine code verified per hour on our proof-efficiency eval, by model release date, with 95% intervals.”

Theorem has also collaborated with Anthropic on this topic, resulting in a blog post entitled “LLMs are making formal software verification feasible at a much larger scale.” 

One of the more encouraging notes in the post is that formal verification, although currently token-expensive, is starting to get more token-efficient. On a set of 36 small verification tasks, Anthropic reported that Opus 5.5 reached a 50% solve rate using about 40% fewer tokens than Opus 5. This trend is expected to continue as more models are “trained on long verification tasks.”

Theorem and Anthropic describe “LLM-scaled formal verification” as a promising approach to providing security guarantees at a previously impractical scale.

Anthropic diagram: “from code to a machine-checked guarantee”; in this case using Rocq rather than Lean.

The “veri-coding” experience for developers

Lastly, how does formal verification fit into a developer’s workflow? On its website, &Truth states that developers will move from vibe-coding to “veri-coding” — meaning the verification layer is part of the workflow.

“If you've got your verification machine connected to your agent, you can still say, ‘hey, I want you to build this,’ said Barrett. “Maybe there's a little bit of work to really nail down with the agent what the specification is of what you want to build. But then the agent can go under the hood, collaborate with the formal [verification] tool, and essentially what you'll see is almost no difference except your code will work the first time.”

The idea, then, is that more of the developer’s time will be spent on spec writing and reviewing than on coding or reviewing code.

Verify all the outcomes

While I was finishing up this article, I came across this tweet by Cognition dev rel Nader Dabit:

Whether the term “outcome engineering” sticks or not, he’s onto something in terms of where we are with coding. When you just tell your team of agents what you want and they go ahead and build it, you (the human developer) need a way to check the correctness of what your agents deliver. 

If companies like &Truth, Harmonic, Theorem and Axiom Math have their way, formal verification could become an increasingly practical way to check those outcomes.

正文保留英文原文,标题与摘要由机器翻译。

本文由采集器自动同步

原文发布于 Latent Space(The War Against Slop and an Emerging Weapon to Fight it: Formal Verification),标题、摘要与正文由机器翻译,术语按行业惯例统一,未经人工逐句校订。

阅读原文 ↗