TL;DR
Hawkeye is a novel framework that reverse-engineers the hidden, hardware-specific arithmetic behavior of NVIDIA Tensor Cores to enable bit-exact reproduction of GPU matrix multiplications on a CPU. By achieving 100% bitwise replication across multiple architectures (Ampere, Hopper, Lovelace), it removes a major roadblock for trustworthy, zero-overhead third-party auditing of machine learning workflows.
What Problem Does This Paper Address?
As machine learning moves to the cloud via ML-as-a-Service (MLaaS) platforms, users must blindly trust that providers are executing workloads correctly without cutting corners, altering models, or introducing backdoors. Verifying these computations cryptographically or via re-execution is notoriously difficult due to hardware-induced non-determinism.
Floating-point operations are non-associative, meaning $(a+b)+c \neq a+(b+c)$. Proprietary hardware accelerators like NVIDIA Tensor Cores use hidden internal precision, custom accumulation orders, and specific rounding strategies. As a result, running identical models with identical inputs can yield different bitwise outputs across different GPU architectures or when compared to a standard CPU. Hawkeye tackles this gap by pulling back the curtain on Tensor Core arithmetic to make GPU matrix multiplications perfectly reproducible on a standard CPU.
Methods
The authors developed a systematic testing methodology to probe the black-box behavior of NVIDIA Tensor Cores. They wrote custom CUDA kernels using inline PTX assembly (wmma.mma_sync) to isolate and analyze individual $16 \times 16$ matrix multiply-accumulate (MMA) operations. Hawkeye runs a suite of five targeted tests:
- Summation Dependency and Order Test: Finds independent computational subgroups to map the exact order of additions.
- Internal Precision Detection Test: Determines the bit-width of the internal accumulator significand.
- Rounding Mode Detection Test: Identifies how bits are handled during internal alignment shifts.
- Normalization Stage Detection Test: Locates exactly when intermediate states are normalized into standard floating-point forms.
- Subnormal Behavior Detection Test: Probes how ultra-small numbers are handled throughout the pipeline.
The insights from these tests were compiled into a software-based CPU simulator that mirrors the exact bit-level pipelines of NVIDIA's Ampere, Hopper, and Lovelace architectures across FP16, BF16, and FP8 precisions.
Datasets
The paper does not use standard machine learning datasets (like ImageNet or GLUE). Instead, the framework was evaluated using synthetic benchmarks: a dataset of 100,000 randomly generated $16 \times 16$ matrix multiplication tiles, alongside larger $4096 \times 4096$ matrix multiplications to evaluate correctness and CPU execution baselines.
Key Insights and Ideas
- Pyramid vs. Unified Accumulation: On Ampere and Lovelace architectures, Tensor Cores do not sum all 16 products at once. Instead, they use a two-stage pyramid structure where the initial accumulator and the first 8 products are summed into an intermediate result before adding the remaining 8 products (see Figure 1). Hopper, by contrast, uses a single-stage unified accumulation.
- Unexpected Rounding Behavior: While standard IEEE 754 operations typically default to round-to-nearest-even, Tensor Cores utilize round-towards-zero (truncation) during internal alignment shifts and final precision reduction.
- Hidden Bit Precision: The internal accumulator mantissa varies by architecture; Ampere uses a 24-bit significand (matching standard FP32), while Hopper expands this to 25 bits.
- Delayed Normalization: Intermediate products are not normalized immediately after multiplication; raw product significands are passed directly to the accumulator, allowing values to temporarily exceed standard normalized ranges.
Key Results
- 100% Bit-Exact Replication: Across 100,000 randomly generated $16 \times 16$ matrix multiplications, Hawkeye achieved a perfect 100% success rate in matching the exact bitwise outputs of actual GPU hardware on a CPU.
- Multi-Architecture & Multi-Precision Support: The perfect replication holds true across three major GPU generations (Ampere, Hopper, Lovelace) and multiple precision formats (FP16, BF16, and FP8).
- Auditing Performance Baseline: For a large $4096 \times 4096$ matrix multiplication executed on an Apple M4 Pro CPU, average execution times ranged from 40.6 seconds (Hopper FP8 simulation) to 52.5 seconds (Ampere BF16 simulation). While slower than a GPU, this speed is perfectly acceptable for offline, single-run auditing workflows.
Limitations and Future Work
- Vendor Lock-in: Hawkeye currently only supports NVIDIA Tensor Core architectures. Extending this reverse-engineering framework to other hardware accelerators, such as AMD GPUs or Google TPUs, remains an open challenge.
- Scope of Operations: The framework focuses strictly on low-level matrix multiplication (MatMul). Modern ML pipelines rely on higher-level operations like convolutions, layer normalization, and attention mechanisms, which will require additional reverse-engineering to achieve full end-to-end pipeline reproducibility.
- CPU Performance: The current CPU-side simulator serves as a performance baseline. Future work could optimize this via integer-based GPU implementations to speed up verification times.
Summary updated