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

📅 2026-04-23
📈 Citations: 0
Influential: 0
📄 PDF

career value

231K/year
🤖 AI Summary
This work addresses the inconsistent behavior of machine learning kernels across heterogeneous hardware and the absence of formal specifications defining their correctness boundaries. We propose the first contract-based specification language tailored for ML kernels, which employs an eight-component structure to precisely articulate behavioral expectations and encompasses twelve failure modes—including numerical precision errors, ordering violations, compiler-induced discrepancies, and outlier handling. Our framework integrates reference oracles, tolerance definitions, measurement protocols, and violation signatures into a cohesive kernel contract architecture, augmented by a three-state calibration mechanism to ensure contract validity. The approach has been successfully applied to real-world cases such as Huawei Ascend inconsistencies, Sakana AI’s CUDA engineer reward attacks, and AMD out-of-bounds memory accesses, enabling precise mapping of informal diagnostic observations to testable contract violations.

Technology Category

Application Category

📝 Abstract
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.
Problem

Research questions and friction points this paper is trying to address.

kernel contracts
ML kernel correctness
heterogeneous silicon
specification language
contract violation
Innovation

Methods, ideas, or system contributions that make the work stand out.

kernel contracts
specification language
ML kernel correctness
heterogeneous silicon
formal verification
🔎 Similar Papers
2024-05-31arXiv.orgCitations: 0