Anthropic 用 Claude 自动生成约 1.8 亿行数学证明,验证开源代码安全性
Anthropic's Claude now writes code and proves it safe automatically
- 1Anthropic 让 Claude 对 Google OSS-Fuzz 的 123 个开源库做形式化验证,数周生成约 1.8 亿行证明代码
- 2官方称验证一个广泛使用的 PDF 阅读器时,一周发现的安全漏洞相当于该软件全年报告量
- 3官方承认证明仅在特定处理器架构、单线程和输入小于 64 MB 时成立,单条证明耗数亿 token
- 4团队还发现一个隐藏十余年的逻辑错误,许多漏洞只在特定条件下触发,常规测试难以覆盖
形式化验证的成本从专家数人年降到模型数周,AI 生成代码的可信度问题开始有自动化解法,边界条件仍然严格。
- 影响:AI 代码的审查成本有望下降,验证环节可部分交给模型;结论只在特定架构、单线程和输入小于 64 MB 时成立,实际部署环境差异会留出风险敞口;单条验证耗数亿 token,算力支出需要单独核算。
- 参考:可考虑在文件解析、网络库这类输入敏感组件上评估形式化验证试点;值得先按单条高达数亿 token 的口径算清验证成本,再与现有测试人力投入对比。
- 依据:1.8 亿行形式化验证代码、PDF 阅读器一周漏洞相当于全年报告量均为 Anthropic 口径,暂无独立验证;限制条件与 token 成本为官方披露,工具与形式化基础由 Theorem 构建。
Anthropic used Claude to mathematically prove that existing code is correct. The approach tackles a core problem with AI-generated software but comes with strict practical limits.
Proving that software runs error-free under all circumstances has always been prohibitively expensive. A team of specialists needed 20 person-years just to formally verify the small operating system kernel seL4, so the method was reserved for extreme cases like Airbus avionics software.
Anthropic's Frontier Red Team, working with partner Theorem, let Claude take over the proof work instead. The model produced roughly 180 million lines of mathematical proof code in just a few weeks, drawing on test programs from 123 open-source libraries in Google's OSS-Fuzz security project.
Rather than writing new code, Claude verified existing software by translating crash tests into mathematical problems, analyzing the compiled machine code, and producing extensive proofs. An independent verification program called Rocq automatically checks those proofs, and according to Anthropic, the process needs almost no human reviewers. The researchers call it "fully autonomous" proof generation, though the tools and formal foundations were built by humans at Theorem.
Claude catches bugs that years of testing missed
While generating proofs, Claude ran into hundreds of bugs and was allowed to fix them itself. Many would have slipped past conventional testing because they only show up under very specific conditions, like unusually large input files or a particular sequence of accesses, the researchers say.
During an effort to verify a widely used PDF reader, for example, the team found as many security bugs in one week as are typically reported for that software in an entire year. In another application, Claude caught a logical error that had gone undetected for over a decade. Even when a complete proof ultimately fails, Anthropic says, the attempt still surfaces real bugs.
What formal verification can and can't do
Anthropic acknowledges that "formally verified" doesn't mean "error-free." The proofs only hold under strict conditions: a specific processor architecture, single-threaded programs, and inputs under 64 MB. In practice, these libraries run on different hardware and in different configurations.
The compute cost is steep, with individual proofs running up hundreds of millions of tokens. Anthropic doesn't report total project costs. But if AI can verify its own code, developers can trust AI-generated software more and spend less time reviewing it. That saves costs not just on verification but on the entire coding process. A smaller test run also showed that proofs are reusable, and newer models are getting more efficient: Opus 5.5 solves half the proofs with about 40 percent fewer tokens than Opus 5.
The project strengthens the case for software automation. If AI can write code and guarantee its correctness under defined conditions, the question shifts from "Can AI program?" to "Can AI prove that the code it writes is safe?" If the answer is yes, the consequences could go well beyond today's coding tools.
Case in point: Anthropic expects formal verification with AI will soon become as practical as standard testing, and Theorem's roadmap already targets critical infrastructure like glibc, OpenSSL, and cURL.
AI News Without the Hype – Curated by Humans
Subscribe to THE DECODER for ad-free reading, a weekly AI newsletter, our exclusive "AI Radar" frontier report six times a year, full archive access, and access to our comment section.
来源:The Decoder:AI News · the-decoder.com