Hacker News Show7/2 23:4080 分
zkGolf:基于LLM的形式化验证电路优化竞赛
Show HN: zkGolf – Competitive optimization of formally verified circuits
中文摘要
zkGolf项目通过形式化验证与大型语言模型(LLM)结合,探索零知识证明(ZKP)电路的自动化优化。团队首先在Lean中为SHA-256压缩编写形式化规范,引导LLM生成并优化R1CS算术化电路,以降低约束数量为目标。LLM在优化过程中能自主提出方案、验证正确性,并在无法证明时回溯调整,最终得到了超越当前人工优化水平的SHA-256压缩电路。该项目现已开放为竞赛平台zk.golf,旨在推动形式化验证电路的发展,降低ZKP应用门槛并提升效率。
原文内容
Zero-Knowledge Proofs (ZKPs) let an untrusted proved show that computation was executed correctly without revealing the inputs to the verifier.
However to prove anything, the computation first has to be expressed as a circuit: a system of polynomial equations (constraints) over a finite field.
Circuits are the assembly language of zk and every constraint costs prover (and sometimes verifier) time, so production circuits are aggressively hand-optimized.
Over the last months, we have been experimenting with writing formal specifications instead and letting LLMs produce the circuits: as long as they could prove that their implementation was correct.
It started with SHA-256: we hand wrote a specification in Lean for SHA-256 compression, and then we asked LLMs to write the circuit, targeting R1CS arithmetization and large fields.
It took a few hours of work for Opus 4.7, and some light steering into the right direction, but in the end the model came up with a reasonable implementation. We then asked the LLM to aggressively optimize the circuits, by driving down a cost metric of the circuit (number of constraints). We immediately got very promising results, just by asking to come up with optimization ideas, implement them and prove that the new circuit still satisfies soundness and completeness. Sometimes, it came up with unsound optimizations, however, since it could not prove them, it backtracked and got itself back on to the right approach.
The result was a (non-deterministic) circuit beating the current, human optimized, state of the art for SHA256 compression. This experience lead us to create "zk.golf" which is an open competition to produce optimized, formally verified circuits to lower the bar for the use of ZKPs and make their application more efficient.
Come play (https://zk.golf/llms.txt) and learn about formal verification.
Comments URL: https://news.ycombinator.com/item?id=48763246
Points: 56
# Comments: 6