paperbot · PL 论文追踪

全部论文 待读 收藏

P1 Correctness Meets Performance: From Agda to Futhark

正确性与性能兼顾:从 Agda 到 Futhark
ICFP 9(ICFP)2025匹配度 5/10 · 论文将定理证明/程序抽取用于机器学习系统(自动微分与 CNN)的正确性保证,属于 PL 与 AI 的交叉,与“PL→AI”方向有部分关联;但它不涉及静态分析、Agent/LLM、浮点程序分析或贝叶斯程序分析,未命中画像中的核心问题。引用 1 inbox
Artjoms Šinkarovs, Troels Henriksen
crossref: 2026-09-10

AI 速览

一句话:用 Agda 形式化并抽取到 Futhark,使自动微分与 CNN 代码兼具正确性保证和接近 TensorFlow 的性能。

本文提出一种在定理证明器中开发高性能应用并保证正确性的技术。作者用 Agda 形式化一个面向索引安全张量的反向模式自动微分框架,该框架包含张量表达式优化器,并能将表达式翻译为高性能数组语言 Futhark。随后在 Agda 中指定一个典型卷积神经网络,计算训练所需的导数,并抽取生成 Futhark 代码。评估在 GPU 上运行生成的代码,并与 TensorFlow 实现比较;结果显示生成代码的性能接近 TensorFlow,表明形式化规范与抽取可在不牺牲性能的前提下提供强正确性保证。

问题
如何在使用定理证明器开发高性能应用时,既保持强正确性保证,又获得接近主流框架(如 TensorFlow)的 GPU 性能。
方法
用 Agda 指定一个面向索引安全张量的反向模式自动微分框架,内含张量表达式优化器并支持翻译到 Futhark;再在该框架内指定 CNN 并计算训练所需导数,抽取生成 Futhark 代码。
评估
在 GPU 上运行生成的 Futhark 代码,并与 TensorFlow 实现进行性能比较,结果表明生成代码的性能接近 TensorFlow。
原文摘要(Abstract)

In this paper we demonstrate a technique for developing high performance applications with strong correctness guarantees. Using a theorem prover, we derive a high-level specification of the application that includes correctness invariants of our choice. After that, within the same theorem prover, we implement an extraction of the specified application into a high-performance language of our choice. Concretely, we are using Agda to specify a framework for automatic differentiation (reverse mode) that is focused on index-safe tensors. This framework comes with an optimiser for tensor expressions and the ability to translate these expressions into Futhark. We specify a canonical convolutional neural network within the proposed framework, compute the derivatives needed for the training phase and then demonstrate that the generated code approaches the performance of TensorFlow code when running on a GPU.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot3035,
  title = {Correctness Meets Performance: From Agda to Futhark},
  author = {Artjoms Šinkarovs and Troels Henriksen},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {ICFP},
  year = {2025},
  doi = {10.1145/3747524}
}