arXiv:2604.22032cs.LGcs.PL2026-04被引 2

为跨芯片的机器学习算子正确性定义可验证的规范语言

Kernel Contracts: A Specification Language for ML Kernel Correctness Across Heterogeneous Silicon

  • 提出八部分组成的算子契约语言,明确计算行为边界
  • 验证三起真实故障,均对应可量化的契约违规模式
  • 适合芯片厂商、框架开发者用于统一正确性评估标准

每个机器学习算子都隐含着关于其计算结果的契约,但人们很少明文书写。当不同芯片平台的算子出现分歧——如AMD与NVIDIA的矩阵乘法梯度不一致、融合注意力算子悄悄进行精度降级、越界访问在不同平台上返回零或垃圾值——缺乏正式文档来仲裁争议。本文提出一种算子契约的规范语言,包含标识符、作用域、先决条件、后置条件、容差、参考真值、测量协议和违规签名八个部分。基于已有实证研究,我们定义了十二类覆盖精度、顺序、编译器影响和异常值等失效模式的契约。要求每条契约需通过三态校准:至少存在一个符合契约的实现,至少存在一个通过基本功能测试但违反契约的实现。我们将该框架应用于三个已知问题:华为昇腾的静默精度转换、Sakana AI CUDA工程师奖励欺骗、AMD越界访问静默接受,并证明每个非正式诊断均可映射到具体契约违规及其可测量特征。算子契约集合可作为一致性评估的规范参照,如同ISASecure对工业控制系统按IEC 62443标准评级。

原文摘要 · Abstract (English)

Every ML kernel ships with an implicit contract about what it computes. People rarely write the contract down. When two kernels disagree -- when a matmul on AMD produces a different gradient than the same matmul on NVIDIA, when a fused attention kernel silently downcasts an accumulator, when an out-of-bounds access returns zero on one stack and garbage on another -- there is no formal artifact to arbitrate the dispute. Recent empirical work has measured the gap across silicon platforms, but none of it specifies the contract being violated. We present a specification language for kernel contracts. A contract has eight parts: identifier, scope, precondition, postcondition, tolerance, reference oracle, measurement protocol, and violation signature. We use it to state twelve contract classes covering precision, ordering, compiler-induced, and exceptional-value failure modes, each grounded in published empirical evidence. We require a three-state calibration: every contract must admit at least one reference-conforming implementation and at least one contract-violating implementation that passes basic functional tests. We apply the framework to three documented incidents -- Huawei Ascend silent precision coercion, Sakana AI CUDA Engineer reward hacking, AMD out-of-bounds silent acceptance -- and show that each informal diagnosis maps to a specific contract violation with a measurable signature. A kernel contract suite is a normative reference against which conformance can be graded, in the way that ISASecure grades industrial control systems against IEC 62443.

算子契约芯片兼容性模型正确性形式化验证

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。