ArXiv: 2410.20399
π― Pitch
A single fresh Stanford undergrad, with no prior CUDA experience, used ThunderKittens to write a kernel that achieves a staggering 14Γ speedup over the prior best linear attention kernel on an H100 GPUβmatching heavily hand-tuned baselinesβbecause the frameworkβs tiny set of PyTorch-like tile abstractions automatically handles the parallel orchestration and memory layout optimizations that take experts years to implement.
1. Executive Summary
This paper introduces ThunderKittens (TK), a framework for writing high-performance AI kernels on GPUs that is built around a small, opinionated set of abstractions mapping to the three levels of the GPU hierarchy: warp-level 16Γ16 matrix tiles with PyTorch-like parallel operations over them, a block-level template for coordinating asynchronous execution across parallel warps (the load-compute-store-finish, or LCSF, template), and grid-level support for persistent block launches and L2 cache reuse. Evaluated on NVIDIA H100 GPUs with a range of AI primitives including GEMMs, attention, linear attention, state space models, and long convolutions, TK kernels match CuBLAS and FlashAttention-3 on GEMM and attention inference while outperforming prior kernels by 10β40% on attention backwards, up to 8Γ on state space models, and up to 14Γ on linear attention β gains enabled by automated memory layout management that eliminates bank conflicts and a single concise template that overlaps asynchronous memory and compute work β establishing that a small set of carefully chosen abstractions can match or exceed heavily hand-tuned custom kernels across a broad range of AI operations, even when written by developers with no prior CUDA experience.
2. Context and Motivation
The Core Problem: AI Architectures Are Bottlenecked by GPU Kernel Development
The paper addresses a specific and urgent bottleneck: the difficulty of translating rapidly proliferating AI architectures into efficient GPU implementations. As the authors put it in the opening sentence of the abstract:
"The challenge of mapping AI architectures to GPU hardware is creating a critical bottleneck in AI progress."
This is not merely an inconvenience β it is a structural impediment to the AI field. The paper argues that despite "substantial efforts, hand-written custom kernels fail to meet their theoretical performance thresholds, even on well-established operations like linear attention." The gap between what modern GPUs can theoretically deliver and what current kernels actually achieve is large and persistent, and it compounds as new architectures emerge faster than optimized kernels can be written for them.
The magnitude of this gap is concretely illustrated by the paper's account of softmax attention β arguably AI's most widely deployed operation. FlashAttention-2, which was state-of-the-art for the A100 GPU generation, suffered a 47% performance degradation when ported to the H100 GPU. It then took "over two years from the release of the H100 to develop FlashAttention-3." This is a sobering timeline: the flagship operation of the dominant architecture requires multiple years of expert effort to achieve peak performance on a single new GPU generation. If attention β which receives enormous investment from industry and academia β faces such delays, the situation for less-common or emerging architectures (state space models, linear attention variants, long convolutions) is presumably far worse.
The paper identifies this as a systematic crisis rather than a series of isolated difficulties. The authors refer to a "Cambrian explosion of ML architectures," citing diffusion models and state space models as examples. Each new architecture demands its own optimized kernel, but the cost of developing these kernels β in terms of expert human time, specialized knowledge, and engineering iteration β far exceeds the capacity of the teams that could benefit from them. This means that promising architectures may fail to gain adoption not because they are algorithmically inferior, but because their GPU implementations are too slow to be competitive.
Why This Matters: The Hardware-Mapping Problem Has Real Consequences
The impact of this bottleneck is multidimensional:
Architecture adoption is gated by kernel availability. The paper's own experimental results demonstrate that the gap between a naive implementation and an optimized one can be enormous. For linear attention with learned feature maps, TK achieves a 6.5Γ speedup over the popular Flash Linear Attention (FLA) Triton kernels (Figure 9). For polynomial-based linear attention, the gap is 14Γ. A researcher evaluating linear attention using FLA's kernels might conclude that the approach is too slow for practical use β when in reality, the bottleneck is the kernel quality, not the architecture itself. This means that the kernel development bottleneck is distorting the architecture search process itself, causing the field to converge on architectures with good kernel support (primarily softmax attention) rather than architectures with optimal algorithmic properties.
Theoretical hardware potential remains unused. Modern GPUs derive the overwhelming majority of their compute capacity from specialized tensor cores. The paper quantifies this: "On the NVIDIA A100 and NVIDIA H100 GPUs, BF16 tensor cores represent 16Γ the FLOPs available relative to general-purpose BF16 / FP32 compute." This means that a kernel that fails to keep tensor cores fed β because it is spending time on memory operations, synchronizations, or non-tensor-core compute β is leaving the vast majority of the GPU's capability on the table. The paper's profiling results (Table 4) show that baseline kernels for long convolution (FlashFFTConv) achieve only 13.4% tensor core utilization, while their TK counterpart reaches 54.8% β a 4.1Γ improvement from better hardware utilization alone.
The expertise barrier excludes non-specialists. The paper explicitly notes that existing high-performance approaches are difficult even for experts. CUTLASS, NVIDIA's template library for GPU kernels, uses "a myriad of nested CUDA templates" that Bikshandi and Shah (2023) noted can be "challenging to fully leverage." The CuBLAS library, which provides optimized GEMM implementations, is over 600 MB in size in CUDA 12.6 (Table 5 of the appendix) β reflecting thousands of hand-tuned variants and complex runtime heuristics for selecting among them. This inaccessibility means that kernel development is effectively restricted to a small pool of specialized engineers, creating a dependency that slows the entire field.
The cost of poor kernel support scales with GPU complexity. The H100 GPU, the paper's evaluation target, is dramatically more complex than its predecessors. It introduces new hardware features β Tensor Memory Accelerator (TMA) for hardware-accelerated bulk data movement, warp-group matrix multiply-accumulate (WGMMA) instructions for tensor core programming, and expanded shared memory with new swizzling requirements. Each of these features offers performance gains but adds to the configuration space that kernel developers must navigate. The 47% degradation that FlashAttention-2 suffered on H100 is a direct consequence of this added complexity: features that were optimal on A100 become suboptimal on H100, and new features require new programming patterns that are not backward-compatible.
Where Existing Approaches Fall Short
The paper evaluates three categories of prior work and identifies specific limitations in each.
C++ Embedded Libraries (CUTLASS/CuTe)
NVIDIA's CUTLASS and CuTe libraries are C++ template libraries that expose GPU primitives at a relatively low level. They power many of the most optimized kernels in existence β including FlashAttention-3 β and provide the full expressive power of CUDA since they are embedded in C++. The paper acknowledges that "fundamentally, the same kernels are expressible in TK and CUTLASS, since both are embedded libraries."
However, CUTLASS suffers from accessibility problems. The authors cite Bikshandi and Shah (2023) on the difficulty of fully leveraging its capabilities, and they present direct evidence of its complexity: a "myriad of nested templates" that require users to manage layout decisions, synchronization patterns, and hardware-specific configurations manually. This complexity means that even popular, well-resourced kernels written in CUTLASS contain preventable performance issues. The paper's profiling (Table 4, Section 4.2) reveals that FlashAttention-3 β written in CUTLASS and CuTe β suffers from bank conflicts in shared memory, with NVIDIA's profiler reporting up to 9.6-way bank conflicts in the attention backwards pass. These conflicts serialize memory accesses that could proceed in parallel, increasing shared memory latency. TK, by contrast, incurs 85% fewer stalled cycles on shared memory in the same benchmark because its layout management system automatically selects conflict-minimizing layouts.
The deeper issue is that CUTLASS makes the user responsible for decisions that could be automated. The paper's exploration of shared memory layouts (Appendix C) identifies six distinct layout patterns β row-major, padded, naive swizzled, 32-byte swizzled, 64-byte swizzled, and 128-byte swizzled β each with different tradeoffs between bank conflicts, hardware instruction compatibility, and tile size constraints. A CUTLASS user must understand these tradeoffs and make explicit choices. In TK, the framework selects the largest swizzling pattern supported by the tile size at compile time, because hardware support for HGMMA and UTMA instructions makes the swizzled family the only viable candidates for high performance. This is the opinionated design that TK contributes: pruning the design space to three layouts and automating the selection.
Compiler-Based Approaches (Triton, TVM, XLA, etc.)
Languages and compilers like Triton, TVM, TensorFlow XLA, and PyTorch's compiler stack approach the problem from a different angle: they allow users to write kernel logic in a higher-level language and rely on a compiler to generate efficient GPU code. Triton in particular has become popular for AI kernel development because it provides "simpler interfaces" with a Python-like syntax and automatic optimization.
However, compiler-based approaches sacrifice hardware-level control. The paper identifies three specific limitations:
-
Specialized hardware instructions are inaccessible. Because Triton and similar frameworks are not C++-embedded, they cannot easily expose hardware-specific instructions like TMA (Tensor Memory Accelerator) or WGMMA (warp-group matrix multiply-accumulate). These instructions are critical for H100 performance. The paper's large speedups over Triton-based baselines β up to 14Γ for linear attention β are driven in part by TK's ability to use these instructions while the baselines cannot.
-
Asynchronous execution is difficult to manage. The core performance technique in modern GPU kernels is overlapping memory transfers with computation: while one warp is executing tensor core operations, another should be loading the next tile of data from HBM. Triton's programming model does not provide explicit control over this overlapping; the compiler attempts to schedule operations optimally but cannot match hand-tuned asynchronous pipelines. TK's LCSF template directly addresses this by partitioning warps into load workers, compute workers, and store workers, with a multi-stage buffer and synchronization primitives that the developer configures but TK manages.
-
Register usage is hard to control. Registers are the fastest memory in the GPU hierarchy (130 TB/s on H100) but are extremely scarce (255 per thread on Hopper). Exceeding this limit causes register spills to L1 cache, which is dramatically slower. Compiler-based frameworks have limited ability to guarantee register pressure stays within bounds, while TK's tile abstractions with compile-time size checking give developers direct visibility and control over register consumption.
The paper's results quantify these gaps concretely. The Flash Linear Attention (FLA) library's Triton kernels for linear attention are outperformed by TK by 6.5Γ to 14Γ (Figure 9). For Mamba-2 state space models, TK outperforms the Triton kernels from the original authors (Dao & Gu, 2024) by more than 3Γ, which the authors attribute to "the ease of fusing complex operations in TK."
Hand-Tuned Custom Kernels
The third category is bespoke, manually optimized kernels written for specific operations. FlashAttention-3, FlashFFTConv, and CuBLAS are all examples of this approach: domain experts invest months or years optimizing a single operation for a specific GPU generation.
The fundamental limitation is that this approach does not scale. Each new architecture (linear attention variant, SSM formulation, convolution pattern) and each new GPU generation requires a fresh investment of expert effort. The paper frames this as the core problem its framework addresses. Even when the investment is made, the results are imperfect: FlashAttention-3 suffers from bank conflicts (as shown in Table 4), and FlashFFTConv achieves only 13.4% tensor core utilization (Table 4) β meaning that even expert-written kernels leave substantial performance on the table due to the difficulty of simultaneously optimizing all dimensions of GPU parallelism.
The CuBLAS situation is particularly revealing. As the authors note (Appendix A), CuBLAS is 689 MB in CUDA 12.6, containing "many tuned GEMM variants and logic to select the best option at runtime." This approach works for GEMM β an operation that is so fundamental that NVIDIA invests enormous engineering resources in it β but it is not a viable model for the long tail of AI operations that researchers need to experiment with. The paper demonstrates that TK can approach CuBLAS performance on the demonstrated matrix sizes using a single GEMM kernel (shown in its entirety in Appendix B.1, approximately 75 lines of device code), suggesting that the CuBLAS monolith may be partially replaceable by a framework that makes better use of individual kernels.
The Fundamental Tension This Paper Explores
The authors frame their investigation around a specific question stated in the introduction:
"We ask how broad and fast we can go by choosing a small and opinionated set of abstractions."
This question encodes a tension that prior work has not systematically addressed. On one axis is breadth: how many different AI operations can the framework support at high performance? On the other is simplicity: how few abstractions can the framework expose while still achieving that breadth? Existing approaches occupy the extremes:
- CUTLASS maximizes breadth through generality (since it is C++-embedded, any kernel is expressible) but at the cost of simplicity (the user must make every low-level decision).
- Triton maximizes simplicity through abstraction (Python-like syntax, compiler-driven optimization) but at the cost of breadth (performance degrades for operations that require hardware-specific instructions or fine-grained asynchronous control).
- Hand-tuned kernels achieve peak performance for specific operations but are narrow (each is a point solution) and complex to develop.
The paper's central hypothesis β the bet that ThunderKittens makes β is that there exists a middle ground: a small set of abstractions that is opinionated enough to simplify development (by automating layout selection, synchronization management, and pipeline configuration) yet general enough to support a broad range of AI operations at or near peak performance. The key empirical claim is that this middle ground is surprisingly large β that "for many AI kernels, a small number of key abstractions exist that can simplify the process of writing high-performance kernels."
This hypothesis emerges from a specific technical observation about where GPU performance comes from. The paper states:
"The main vector of growth for accelerated compute is in specialized matrix multiply units... Consequently, any high performance framework must prioritize keeping tensor cores at high utilization whenever possible. However, all kernels have other operations too (like memory loads or the softmax in attention), and it is crucial to minimize the overhead of non-tensor core operations."
This observation β that performance is bottlenecked by both keeping tensor cores busy and minimizing everything else β motivates the specific design choices in TK. The 16Γ16 tile is chosen to maximize tensor core compatibility. The LCSF template is designed to overlap memory operations with tensor core operations so that tensor cores are never idle waiting for data. The layout management system is designed to eliminate bank conflicts that would slow down the memory operations feeding the tensor cores. Each abstraction is a direct response to this dual imperative.
How This Paper Positions Itself
The paper is careful to position itself as an exploration rather than a definitive solution. It aims to answer two questions:
"(1) How far can we get with a small number of templates? and (2) Does concision sacrifice performance?"
The answers β "surprisingly far" and "no, it can even improve performance" β constitute the paper's core contributions. The specific performance results (matching CuBLAS and FlashAttention-3, outperforming baselines by up to 14Γ) are the evidence for these claims.
Importantly, the paper frames TK not as a competitor to existing frameworks in a zero-sum sense, but as a demonstration of a design philosophy: that being opinionated about abstractions β choosing specific tile sizes, layouts, and execution templates rather than exposing everything as configurable β can simultaneously improve both developer experience and runtime performance. The fact that TK kernels are "in production at ML inference providers and high-frequency trading firms alike" (Section 4) and that they were "written by a small academic team, including by undergraduates with no prior CUDA experience" (Section 4) serves as evidence that the approach has practical value beyond a research demonstration.
3. Technical Approach
3.1 Reader Orientation
ThunderKittens is a C++ embedded framework for writing GPU kernels β the small programs that execute AI operations like matrix multiplication and attention on NVIDIA hardware β that replaces the typical approach of hand-tweaking thousands of lines of CUDA with a small set of opinionated abstractions that are familiar to ML practitioners (PyTorch-like operations on tiles) while automatically handling the low-level hardware details (memory layouts, synchronization, pipeline depth) that normally consume most kernel development effort. The framework solves the problem of how to write a single concise kernel that achieves peak performance across a broad range of AI operations by decomposing the GPU into three levels of parallelism β warp, block, and grid β and providing exactly one carefully designed abstraction per level so that developers only need to write the logical computation (e.g., "multiply these tiles, apply softmax, accumulate") while TK ensures that the physical execution keeps tensor cores fed, avoids memory bank conflicts, and overlaps data movement with arithmetic.
3.2 Big-Picture Architecture (Diagram in Words)
The ThunderKittens system has three major components, each mapping to one level of the GPU hardware hierarchy:
-
Tile data structures with managed layouts (warp-level): The fundamental data unit throughout TK is a 16Γ16 matrix tile β a small rectangular block of numbers that is owned collectively by a group of 32 threads (a "warp") or 128 threads (a "warpgroup" of 4 warps). TK provides tiles for each memory tier: register tiles (fastest, direct compute operands), shared memory tiles (fast on-chip scratchpad shared by warps in a block), and global layout descriptors (for indexing into large tensors in HBM). Every tile has a compile-time-specified layout β how logical data elements are mapped to physical threads β and TK automatically selects from exactly three swizzled layouts (32-byte, 64-byte, or 128-byte strided) based on the tile's width to minimize shared memory bank conflicts while maintaining compatibility with hardware-accelerated instructions like WGMMA (warp-group matrix multiply-accumulate) and TMA (Tensor Memory Accelerator). On top of these tiles, TK exposes a set of parallel compute operations that mirror PyTorch's API β
mma_ABtfor tensor core matrix multiply,exp,mul,div_row,sub_rowfor pointwise and reduction operations β so that writing kernel logic looks like writing PyTorch tensor code rather than managing thread indices. -
LCSF template for asynchronous work (block-level): The block-level abstraction is a single program template called LCSF (Load-Compute-Store-Finish) that structures every kernel as four developer-provided functions executed by specialized groups of warps within a thread block. The load function runs on dedicated "load worker" warps and uses TMA or
cp.asyncto pull tiles of data from high-bandwidth memory (HBM) into a multi-stage buffer in shared memory. The compute function runs on separate "compute worker" warpgroups and operates on the buffered tiles using the PyTorch-like tile operations β tensor core multiplies, softmax reductions, pointwise exponentials β without ever touching HBM directly. The store function, on yet another group of warps, writes completed output tiles back to HBM. The finish function handles any trailing state (e.g., normalizing accumulated results) once all input tiles are consumed. TK manages the synchronization between these worker groups viaarrive/expectbarriers β load workers signal when new input tiles are ready by callingarrive(inputs_arrived), compute workers calltma::expectto block until inputs arrive, and compute workers signal when old input tiles can be evicted or output tiles are ready for storage. The number of buffer stages (how many tiles are in-flight simultaneously) and the number of load/store versus compute workers (occupancy) are configurable with simple parameters, allowing the developer to trade off register pressure against overlapping without rewriting synchronization logic. -
Grid-level support for block launch optimization: At the highest level, TK provides support for two grid-level optimizations that reduce overhead and improve memory reuse across thread blocks. Persistent grid launch keeps thread blocks alive on all 132 streaming multiprocessors (SMs) of the H100 for the entire kernel duration, with each block fetching the next chunk of work internally rather than launching a fresh block β this eliminates the setup and teardown latency that would otherwise accumulate. Block launch order control lets the developer specify a 3D stride pattern over the input tensors so that consecutively scheduled blocks operate on nearby data, increasing the probability that their inputs are already in the shared L2 cache (50 MB, 12 TB/s) rather than requiring slow HBM fetches (80 GB, 3 TB/s).
Information flows through these components as follows: the developer writes four functions in the LCSF template (load, compute, store, finish) using tile types and operations from the warp-level abstractions, specifies simple integer parameters for pipeline stages and worker counts, and optionally defines a grid launch pattern; TK compiles this into a CUDA kernel that launches on the H100's 132 SMs, where on each SM, load warps continuously stream input tiles from HBM into shared memory buffers, compute warps process those tiles using tensor core and ALU operations entirely in register and shared memory, store warps write results back to HBM, and all three groups execute concurrently with synchronization managed by TK's barrier primitives.
3.3 Roadmap for the Deep Dive
This technical breakdown proceeds in five stages, ordered to build understanding from the smallest hardware unit outward:
-
First, the GPU cost model and the rationale for the abstraction choices. Before examining the abstractions themselves, we need to understand what makes GPU kernel programming difficult β the formal decomposition of execution time into memory, compute, and overhead components, and why overlapping these components is both essential and error-prone when done manually. This motivates every design decision in TK.
-
Second, the warp-level tile abstraction β the fundamental data structure. The 16Γ16 tile is the atomic unit of data in TK, tying together tensor core compatibility, register management, and memory layout. We examine the three tile types (register, shared, global), their layout semantics, the three swizzled shared memory layouts TK selects from, and the PyTorch-like operation primitives that operate on them. Understanding the tile is prerequisite to understanding everything that operates on it.
-
Third, the LCSF template β how blocks coordinate asynchronous work. The template is the skeleton of every TK kernel. We walk through its four functions (load, compute, store, finish) in exact execution order, the three synchronization mechanisms (multi-stage buffer, arrive/expect barriers, TMA asynchronous I/O), and the single integer parameter (
INPUT_PIPE_STAGES) that controls pipeline depth. We also examine the occupancy tradeoff β how varying the ratio of compute workers to load/store workers shifts the bottleneck between register pressure and instruction-level parallelism. -
Fourth, grid-level optimizations β persistent blocks and L2 reuse. The grid is where the thread blocks launched across all 132 SMs are coordinated. We examine persistent grid launch (eliminating block setup/teardown costs by keeping blocks alive and fetching work internally), and block launch order control (reordering blocks to maximize L2 cache hits, with a concrete example of the 3D tiling strategy for GEMM that prevents the >50% performance drop observed with naive row-major block ordering at large matrix sizes).
-
Fifth, integration β how these levels compose into a complete kernel. Using the GEMM kernel from Appendix B.1 as a running example, we trace the full execution of a TK kernel from grid launch through warp-level computation, showing how the three abstraction levels interact: the grid scheduler assigns work to blocks, each block's LCSF template pipelines tiles from HBM through shared memory to registers, each compute warpgroup performs tensor core operations on 16Γ16 register tiles, and the store workers write results back β all overlapping so that tensor cores are never idle.
3.4 Detailed, Sentence-Based Technical Breakdown
This is a systems paper whose core idea is that writing high-performance GPU kernels for AI operations does not require exposing the full complexity of the hardware; instead, a small set of opinionated abstractions β one per level of the GPU hierarchy β can simultaneously simplify development and match or exceed the performance of hand-tuned kernels, because the abstractions automate the specific optimization decisions (layout selection, synchronization, pipeline depth) that are both essential for performance and error-prone to manage manually.
The GPU Cost Model and Why Overlapping Matters
Before presenting TK's abstractions, the paper establishes a simplified cost model for GPU kernel execution that directly motivates the framework's design. This model decomposes total kernel time into components that can either be reduced individually or overlapped with each other.
The cost model expresses the overall kernel execution time $C_{\text{Overall}}$ as:
where $C_{\text{HBM}}$, $C_{\text{L2}}$, $C_{\text{L1}}$, and $C_{\text{Shared}}$ are the costs of accessing high-bandwidth memory, the L2 cache, the L1 cache, and shared memory respectively β each being a combination of bandwidth (data volume divided by transfer rate) and latency (fixed per-access delay) β and $C_{\text{Tensor}}$, $C_{\text{ALU}}$, $C_{\text{FMA}}$, and $C_{\text{XU}}$ are the costs of compute on tensor cores, the arithmetic logic unit, the fused multiply-add unit, and the transcendental execution unit respectively. $C_{\text{Setup}}$ accounts for the fixed overhead of launching a thread block on a streaming multiprocessor, and $C_{\text{Sync}}$ accounts for time spent at barrier synchronizations where warps wait for each other without issuing instructions.
What it computes: the total wall-clock time of a GPU kernel under the ideal scenario where all memory operations and all compute operations are perfectly overlapped β that is, tensor cores never wait for data, and memory transfers never wait for tensor cores to finish. The dominant term inside the max determines the bottleneck, and the additive overhead terms represent costs that cannot be overlapped with useful work.
Why this form: the max formulation encodes the key insight that reducing a non-bottleneck cost provides zero speedup. If a kernel spends 90% of its time in $C_{\text{HBM}}$ (dramatically slower memory) and only 10% in $C_{\text{Tensor}}$, then improving tensor core efficiency yields no benefit β the kernel is memory-bound. Conversely, if a kernel is compute-bound, faster memory transfers won't help. The paper's design philosophy follows directly: the framework must simultaneously reduce each individual cost (by choosing optimal layouts, minimizing bank conflicts, using hardware-accelerated instructions) and maximize overlapping (by running memory transfers and compute concurrently) so that the bottleneck cost determines total time and all other costs are hidden. This is why the LCSF template's core mechanism is asynchronous pipelining β it moves the kernel toward the ideal $\max$ limit by ensuring load costs execute in parallel with compute costs rather than sequentially.
The paper notes that real kernels lie somewhere between the max (perfect overlapping) and the sum (no overlapping) of these components, depending on "workload properties (i.e., some operations are inherently sequential) as well as the efficiency of its implementation." TK's contribution is to push implementations closer to the max bound through automated overlapping and conflict resolution.
The Warp-Level Tile Abstraction
The warp is the fundamental unit of parallel execution on NVIDIA GPUs: a group of 32 threads that execute instructions in lockstep on a single streaming multiprocessor. Threads within a warp share no memory directly β each has its own registers, the fastest memory in the GPU hierarchy (130 TB/s on H100, 255 registers per thread maximum, with spills to L1 cache if exceeded). The key challenge at the warp level is memory layout: the mapping from logical data elements (e.g., element $[i, j]$ of a matrix tile) to physical thread ownership determines whether threads access memory banks in parallel or serialize due to conflicts.
TK's warp-level abstraction consists of three interrelated pieces: tile data structures at each memory tier, managed layouts that automate bank conflict avoidance, and a suite of parallel operations over tiles that mirror PyTorch's familiar API.
Register Tiles: The Fastest Data, with Tensor Core-Compliant Layouts
A register tile in TK is declared as rt<type, M, N> for general register tiles or rt_bf<M, N> for bfloat16-specific tiles, where type is the numeric data type (primarily bf16 and float32), M is the number of rows, and N is the number of columns. The canonical tile size is 16Γ16 because this matches the granularity at which tensor cores consume operands on the H100: a single warpgroup matrix multiply-accumulate (WGMMA) instruction operates on 16Γ16 tiles from shared memory, accumulating into 16Γ16 register tiles at full bfloat16 throughput.
The paper emphasizes a specific layout constraint:
"We want our register tiles (the fastest GPU memory) to by-default keep memory in the layouts required by tensor core units (the fastest GPU compute units)."
This means that when a value is loaded from shared memory into registers for a tensor core multiply, the register layout is chosen so that no data reorganization is needed before the multiply instruction. For mma_AB (multiply A Γ B, where A and B are matrices), register tile A must be in row-major layout and register tile B must be in column-major layout. TK enforces this at compile time: using the wrong layout triggers a static assertion error, preventing a class of bugs that are notoriously difficult to debug in raw CUDA (where incorrect layouts produce silently wrong numerical results). In Figure 2, for example, the attention kernel explicitly copies the attention scores to a new register tile with copy(att_mma, att) after the softmax because the softmax output layout is not compatible with the mma_AB layout required for the subsequent att @ V multiply β TK's type system makes this conversion explicit.
Shared Memory Tiles: Automated Swizzling to Eliminate Bank Conflicts
Shared memory (227 KB per SM on H100, 33 TB/s bandwidth) is organized into 32 physical banks that can serve 32 threads simultaneously when each thread accesses a different bank. A bank conflict occurs when multiple threads in a warp access the same bank, forcing those accesses to serialize and reducing effective bandwidth by a factor equal to the conflict degree. The paper devotes substantial analysis (Section 3.1 and Appendix C) to the problem of choosing shared memory layouts that minimize bank conflicts while remaining compatible with H100's hardware-accelerated instructions (TMA for bulk data movement and WGMMA for tensor core operations).
TK's shared memory tiles are declared as st<type, M, N> and are always stored in one of exactly three swizzled layouts, selected automatically at compile time based on the tile's width:
-
32-byte swizzling: Applied to tiles whose width is a multiple of 16 (the smallest supported). This layout XORs specific bits of the memory address with a shifted version of itself, specifically
addr ^ (((addr % (32*8)) >> 7) << 4). It suffers from 4-way bank conflicts but is valid for the widest range of tile sizes. -
64-byte swizzling: Applied to tiles whose width is a multiple of 32 (for half-precision types like bfloat16). Defined as
addr ^ (((addr % (64*8)) >> 7) << 4), it reduces conflicts to 2-way. -
128-byte swizzling: Applied to tiles whose width is a multiple of 64 (the largest bfloat16 tiles TK commonly uses, e.g., 64Γ64). Defined as
addr ^ (((addr % (128*8)) >> 7) << 4), it achieves zero bank conflicts β every thread in a warp accesses a different bank.
The critical design decision is why only these three layouts. The paper's Appendix C systematically evaluates six candidate layouts β row-major, padded, naive swizzled, and the three swizzled variants above β and draws a sharp conclusion:
"After substantial evaluation of these layouts, we concluded that the three final layouts were the three most important, because HGMMA and UTMA instructions are critical to high performance, and furthermore that they are good enough to yield high performance across many kernels."
The row-major layout (Figure 14) is simple but suffers 8-way bank conflicts when loading tensor core register layouts, making it "extremely slow." The padded layout (Figure 15) eliminates bank conflicts by inserting an extra column per row, but creates misaligned memory addresses that are incompatible with fast hardware-accelerated instructions. The naive swizzled layout (Figure 16) β XOR-ing the address with the row index β eliminates conflicts and has aligned addresses but "lacks hardware support for HGMMA and UTMA instructions." Only the three byte-swizzled layouts combine hardware instruction compatibility with conflict reduction, so TK adopts all three and selects the best one supported by the compile-time-known tile width.
The impact of this automated selection is demonstrated empirically. In Table 4's profiling of the attention backwards pass, FlashAttention-3 β written in CUTLASS where the developer manually manages layouts β experiences up to 9.6-way bank conflicts in shared memory. TK's automated selection eliminates these conflicts entirely, resulting in 85% fewer stalled cycles on shared memory (0.14 million cycles for TK versus 0.92 million for FA3).
Global Layout Descriptors: Indexing into 4D Tensors
For loading data from and storing data to high-bandwidth memory (HBM), TK provides global layout descriptors (gl type) that behave like PyTorch tensor indexing into 4D tensors with dimensions {batch, head, length, embed}. A global layout combines a base data type, a tile type (specifying the granularity of loads/stores), and dimensions that can be either compile-time constants or runtime variables.
The paper notes a specific register-saving optimization:
"Compile-time dimensions can be stored in the instruction cache, saving registers."
This matters because registers are the scarcest resource in GPU kernels (255 per thread on H100), and every runtime variable consumes a register. By encoding dimensions like the head dimension (64 or 128) as template parameters known at compile time, TK avoids consuming registers for address calculations, freeing them for data tiles and improving occupancy.
PyTorch-Like Operations on Tiles
On top of these tile types, TK provides a set of parallel operations whose names and semantics mirror PyTorch to reduce the learning curve for ML practitioners. The operations in Figure 2's attention example include:
-
mma_ABt(att, q_reg, k_reg, att): A tensor core matrix multiply that computesatt += Q @ K^Tβ that is, a bfloat16 matrix multiply of Q (row-major) and K-transpose (column-major), accumulating into the 16Γ16 register tileatt. TheABtsuffix indicates that the second operand is treated as transposed, matching the attention computation pattern. This operation runs on tensor cores at full throughput. -
mma_AB(o_reg, att_mma, v_reg_col, o_reg): Another tensor core multiply computingO += att @ V, whereatt_mmahas been converted to the appropriate layout for this operation. -
sub_row(att, att, max_vec): A row-wise subtraction that subtracts the maximum value from each row ofattβ the first step of the numerically stable softmax (subtracting max before exponentiating prevents overflow). Each thread in the warp operates on its owned elements, using the ALU pipeline. -
exp(att, att): A pointwise exponential, computingexp2(base-2 exponential) for efficiency. This runs on the XU (transcendental unit), which has dedicated hardware for exponentials but lower throughput than the ALU. -
div_row(att, att, norm_vec): Row-wise division by the softmax normalization constant, the final step of softmax. -
mul_row(o_reg, o_reg, max_vec_last_scaled): Row-wise multiplication, used in the online softmax algorithm to rescale previously accumulated output values when a new maximum is discovered. -
copy(att_mma, att): A layout conversion operation that copies data between register tiles with different layouts, enabling the transition from softmax output layout (optimized for pointwise operations) to matrix multiply layout (optimized formma_AB).
Each of these operations is a "bulk" instruction: rather than the developer writing per-element loops with manual thread indexing, the operation is applied across the entire tile with TK handling the mapping of logical positions to physical threads. This is the sense in which TK's API is "PyTorch-like" β the developer thinks in terms of tensor operations, not thread-level indexing.
The LCSF Template: Block-Level Asynchronous Coordination
A thread block is a group of warps (up to 64 warps or 2048 threads on H100) that execute together on a single streaming multiprocessor (SM) and can communicate through shared memory. The fundamental performance opportunity at this level is asynchronous overlapping: while one warp is performing a tensor core multiply on tile $i$, another warp should be loading tile $i+1$ from HBM into shared memory, and yet another should be storing the completed result for tile $i-1$ back to HBM. Done correctly, this hides both memory latency and compute latency β the kernel's observed time approaches the cost of the bottleneck operation rather than the sum of all operations.
The LCSF template formalizes this pattern into a reusable skeleton that the developer populates with four functions. The template is parametric in the number of compute workers (which controls occupancy and register pressure) and the number of pipeline buffer stages (which controls how far ahead loads can run relative to compute).
The Four Functions: Load, Compute, Store, Finish
The developer writes four functions that collectively define the kernel's behavior:
1. Load function. This function runs on dedicated "load worker" warps and is responsible for moving data from HBM into shared memory input buffers. The paper's attention example (Figure 5, left) shows the load function pattern: exactly one warp in the producer warpgroup calls tma::load_async to initiate TMA (Tensor Memory Accelerator) bulk loads of K and V tiles from global memory into shared memory, with the load indexing into the global tensors using coordinates {batch, head, iter, 0} where iter is the current iteration along the sequence length dimension. The function calls tma::expect(inputs_arrived, block.k, block.v) to ensure the previous iteration's compute workers have signaled that the input buffers can be reused. Other warps in the load warpgroup simply call arrive(inputs_arrived) β they don't perform I/O but participate in the synchronization barrier to keep the barrier count consistent.
The critical design choice is that load workers are separate warps from compute workers. This is the producer-consumer pattern that enables overlapping: load workers can begin fetching the next tile immediately after compute workers signal completion, without waiting for compute to finish its current operation. The TMA hardware handles the actual data transfer asynchronously, so the load warp is free to set up the next load while the transfer proceeds in the background.
2. Compute function. This function runs on "compute worker" warpgroups (groups of 4 warps = 128 threads) and operates exclusively on data in registers and shared memory β it never directly accesses HBM. For the attention kernel (Figure 5, right), the compute function performs the full attention computation on one tile of keys and values: (a) a tensor core multiply Q @ K^T to compute attention scores, (b) an online softmax that subtracts row maxima, exponentiates, and divides by row sums, (c) a layout conversion from float32 to bfloat16, and (d) a second tensor core multiply att @ V to compute the attention output. Between the two tensor core multiplies, warpgroup::mma_async_wait() blocks until the asynchronous matrix multiply completes β because the softmax depends on the full Q @ K^T result. After the second multiply completes and its mma_async_wait returns, the compute worker calls arrive(inputs_finished) to signal the load workers that the input buffers can be evicted and reused.
3. Store function. This function runs on store workers (often sharing warps with load workers in a "producer" group) and writes completed output tiles from shared memory back to HBM. The paper's template provides tma::store_async for hardware-accelerated bulk stores, which proceed in the background while the store warp initiates the next transfer.
4. Finish function. At the end of the kernel, after all input tiles have been processed, the finish function handles any remaining state. For the attention kernel, this includes normalizing the accumulated output by the softmax normalization constant (the final div_row operation in Figure 12) and storing the final output tile. The finish function calls arrive(finish_finished) to signal completion.
Multi-Stage Buffer: The Pipeline Depth Parameter
The template maintains an N-stage pipelined buffer in shared memory for inputs and outputs, controlled by a single parameter (e.g., INPUT_PIPE_STAGES = 2 in the attention template). With 1 stage, load workers must wait for compute workers to completely finish processing a tile before overwriting it β serializing loads and computes. With 2 stages, load workers can fill buffer slot 1 while compute workers process buffer slot 0, then swap β hiding HBM latency behind compute. With deeper pipelines (3β4 stages), load workers can run further ahead, reducing the probability that compute workers ever stall waiting for input data.
Table 1 quantifies the impact on a GEMM kernel with dimensions M = N = K = 4096:
| Stages | TFLOPS |
|---|---|
| 1 | 260 |
| 2 | 484 |
| 3 | 683 |
| 4 | 760 |
Increasing from 1 to 2 stages nearly doubles throughput because HBM loads and tensor core multiplies overlap rather than serialize. The jump from 2 to 3 to 4 stages provides diminishing returns as the pipeline becomes deep enough to fully hide load latency. TK lets the developer set a single integer to control this tradeoff; the framework manages the buffer indexing and synchronization logic internally.
Synchronization Primitives: Arrive and Expect
The synchronization between worker groups uses two primitives:
-
arrive(barrier_name, count): Signals that the calling warp has completed its stage. Ifcountis specified, it contributes multiple arrivals β useful when one warp represents multiple logical participants. The barrier is released when all expected arrivals have been received. -
tma::expect(barrier_name, ...): Blocks the calling warp until the named barrier has been released, then associates the listed shared memory objects with the barrier for the next asynchronous operation.
These primitives wrap NVIDIA's hardware barrier mechanism (specifically, the mbarrier introduced in the Hopper architecture) in a type-safe interface. The template automatically sets up the expected number of arrivals based on the configured number of worker warps, so the developer only needs to call arrive and expect at the appropriate points in their functions.
Asynchronous I/O: Unified Interface over cp.async and TMA
TK wraps two different hardware mechanisms for asynchronous data movement β cp.async (an older instruction for copying data from global to shared memory) and TMA (the Hopper-generation Tensor Memory Accelerator, which supports hardware-accelerated address generation and bulk transfers) β behind a single interface. This means the developer calls tma::load_async and TK selects the appropriate underlying instruction based on the GPU architecture and the tile properties.
For TMA specifically, TK automates tensor map descriptor creation from the global layout descriptors (gl). A tensor map descriptor is a hardware structure that encodes the dimensionality, strides, and swizzling pattern of a tensor so that the TMA hardware can autonomously compute addresses for each subtile without consuming thread instructions. Without automation, creating these descriptors correctly is one of the more error-prone aspects of H100 kernel programming.
Occupancy Tradeoffs: Number of Workers vs. Register Pressure
The template is parametric in the number of compute worker warps (NUM_CONSUMER_WARPS). Higher occupancy (more warps per block) improves overlapping β more warps can be in flight simultaneously, keeping execution units busy when some warps stall on memory or barriers. However, higher occupancy consumes more registers and shared memory per block, potentially forcing smaller tile sizes, more frequent loads from shared memory to registers, and more synchronization points as data is partitioned across more workers.
Figure 6 (left) quantifies this tradeoff for attention with head dimension 64 and sequence length 4096. With a simple synchronous kernel (warp-level parallelism only, no producer-consumer overlapping), peak throughput occurs at three compute warp groups (12 warps), then declines as register pressure forces spills. The LCSF template expands the Pareto frontier β at the same occupancy levels, LCSF achieves higher throughput because it overlaps loads with computes, and it can support higher occupancy before register contention degrades performance.
The paper also describes a deliberate register management technique: producer (load/store) warps call warpgroup::decrease_registers<40>() to cap their register usage at 40 registers per thread, freeing more registers for consumer (compute) warps to use for accumulator tiles. Conversely, consumer warps call warpgroup::increase_registers<232>() (in the GEMM kernel, Appendix B.1) to request the maximum practical register allocation for storing 16Γ16 accumulator tiles. This asymmetry β load workers need few registers (just address calculations and coordination state), compute workers need many (for matrix operands and accumulators) β is explicitly managed through TK's API rather than requiring the developer to hand-tune register allocation with compiler pragmas.
Grid-Level Optimizations: Persistent Blocks and L2 Cache Reuse
The grid is the top level of GPU parallelism: an H100 has 132 physical streaming multiprocessors (SMs), each capable of executing one or more thread blocks simultaneously. Blocks on different SMs communicate only through the global memory hierarchy β L2 cache (50 MB, 12 TB/s) and HBM (80 GB, 3 TB/s) β because there is no cross-SM shared memory. The paper identifies two grid-level performance opportunities: reducing block launch overhead and improving L2 cache hit rates through careful block scheduling.
Persistent Grid Launch
Normally, a GPU kernel launches a fixed grid of thread blocks that execute and exit. When the grid contains more blocks than physical SMs (e.g., 133 blocks on a 132-SM GPU), the extra blocks form a second "wave" that executes sequentially after the first wave finishes β but the last wave may have very low utilization (e.g., 1 block running alone on 1 SM while 131 are idle, giving <1% efficiency). Additionally, each block incurs a setup cost (allocating registers, initializing shared memory, setting up warp schedulers) and a teardown cost when it exits.
TK's persistent grid approach avoids these costs by launching exactly 132 blocks (one per SM) that remain alive for the kernel's entire duration. Each block internally loops over chunks of work: it processes one chunk, then atomically increments a global counter to claim the next available chunk, then processes that chunk, and so on until all work is complete. This eliminates the wave inefficiency and amortizes block setup/teardown costs over many chunks per block.
Table 2 quantifies the benefit for GEMM kernels with M = N = 4096 and varying K. The "TK-No" column (non-persistent launch) and "TK-Yes" column (persistent launch) show TFLOPS across different K values:
| K | TK-No | TK-Yes | CuBLAS |
|---|---|---|---|
| 64 | 93 | 108 | 69 |
| 128 | 161 | 184 | 133 |
| 256 | 271 | 309 | 242 |
| 512 | 414 | 450 | 407 |
| 1024 | 565 | 600 | 633 |
Persistent launch provides modest but consistent improvements (10β15% at smaller K, tapering at larger K where per-block work dominates setup costs). The comparison with CuBLAS shows TK competitive across the range, with CuBLAS pulling ahead only at the largest K where its runtime heuristic selects a different kernel variant (CuBLAS is 689 MB of hand-tuned kernels with logic for selecting the best one at runtime, while TK uses a single kernel).
Block Launch Order and L2 Cache Reuse
When multiple thread blocks consume overlapping data, blocks scheduled consecutively on nearby SMs can benefit from data that previous blocks left in the shared L2 cache. The L2 cache (50 MB on H100, 12 TB/s β 4Γ the bandwidth and roughly 4% the latency of HBM) is the only mechanism for cross-block data reuse. The key parameter is block launch order: if blocks that share data are scheduled consecutively, the later blocks find their inputs already in L2; if they are scheduled far apart, the cache lines are evicted and the data must be fetched from HBM.
Table 3 demonstrates the magnitude of this effect for GEMM and attention kernels by measuring HBM bandwidth consumed (lower is better, indicating more L2 hits) and compute efficiency (TFLOPS, higher is better):
For a GEMM with M = N = K = 16384, a block order of {8, N, M/8} β 3D tiling where blocks are grouped into 8-row super-blocks that share input data β achieves 982 GB/s of HBM bandwidth and 805 TFLOPS. A naive {N, M} order (row-major traversal) achieves 3,070 GB/s HBM bandwidth but only 392 TFLOPS β it consumes 3Γ more HBM bandwidth because data constantly misses L2, yet achieves less than half the throughput because memory bandwidth rather than tensor cores is the bottleneck.
Similarly, for attention forward with head dimension 128, ordering blocks by {B, H, N} (batch innermost, then heads, then sequence length outermost) gives blocks within the same batch and head consecutive execution, allowing them to share sequence data in L2. This achieves 2,390 GB/s HBM bandwidth and 494 TFLOPS, versus 213 GB/s and 600 TFLOPS for the opposite ordering {N, H, B} β interestingly, the bandwidth number is lower for the efficient ordering (because data comes from L2 rather than HBM), but TFLOPS improves because the kernel is no longer memory-bound.
The paper notes that TK's template "does not explicitly choose grid structures for the user" but "provides a tradeoffs study of two key opportunities" β the developer specifies the grid dimensions and order, and the persistent launch mechanism ensures efficient execution of that order. The GEMM kernel in Appendix B.1 adopts a 3D stride that the authors note "has a significant effect for large matrices which do not fit in L2 cache," preventing the >50% performance degradation observed when comparing their tiled scheme to naive row-major block ordering at 16384Γ16384Γ16384.
Integration: How the Three Levels Compose into a Complete Kernel
To make the interaction between abstraction levels concrete, the paper provides complete kernel listings in Appendix B for GEMM, long convolution, attention, and rotary positional encodings. We trace the GEMM kernel (Appendix B.1, approximately 75 lines of device code) to illustrate how warp-level tiles, the LCSF template, and grid-level scheduling compose.
Grid-Level: Work Assignment and Persistent Launch
The GEMM kernel computes C = A Γ B where A is M Γ K, B is K Γ N, and C is M Γ N. At the grid level, the kernel launches with a 3D block configuration. The common_setup function (lines 12β32 of Figure 10) computes each block's coordinates in the output matrix:
-
It divides the output matrix into super-rows of
SUPER_M = 12blocks (each block computes a 128Γ256 output tile using 2 compute warpgroups, sinceM_BLOCK = 2and each warpgroup handles 64 rows). This is the 3D tiling strategy from Table 3. -
For each block,
task_idis computed from its persistent grid index β blocks remain alive across the full kernel duration and repeatedly fetch newtask_idvalues. -
Blocks whose
task_idexceeds the total number of output tiles setnum_iters = -1to exit the loop β this handles cases where the grid dimensions don't perfectly divide the matrix size.
The block then enters the main LCSF loop for num_iters iterations, where each iteration processes tiles along the K dimension (the inner product dimension).
Block-Level: the LCSF Pipeline
Within each block, warps are partitioned into producers (load/store workers) and consumers (compute workers). The template parameters are:
NUM_CONSUMER_WARPS = M_BLOCK * 4β withM_BLOCK = 2, this gives 8 compute warps (2 warpgroups of 4 warps each).INPUT_PIPE_STAGES = 4β the pipeline depth, allowing up to 4 input tiles to be in flight simultaneously.PRODUCER_BARRIER_ARRIVALS = 1β a single warp in the producer group handles TMA loads.
Producer load function (lines 37β47): On each iteration, the producer warp (checked via warpgroup::warpid() == 0) issues TMA loads for two sets of tiles: M_BLOCK tiles from matrix A (one per compute warpgroup row) and N_BLOCK tiles from matrix B (one per compute warpgroup column). The loads are asynchronous β the TMA hardware begins transferring data from HBM to shared memory while the producer warp immediately returns, allowing it to set up the next iteration's loads in a subsequent pipeline stage. The expect call at the start of each load iteration ensures the barrier has been released by compute workers, indicating that the input buffer slots are available for reuse.
Consumer compute function (lines 54β61): Each compute warpgroup (identified by warpgroup::groupid()) operates on one row of the A tiles and all columns of the B tiles. The core operation is a single call to warpgroup::mma_AB, which performs the tensor core matrix multiply accum += A[row] @ B β note that reinterpret_cast<wide_tile&> treats the N_BLOCK separate B tiles as a single wide tile (64 Γ 256 for the 4-column configuration), enabling a single WGMMA instruction rather than separate multiplies per B tile. After the multiply completes (checked via mma_async_wait()), one thread in the warpgroup calls arrive(inputs_finished) to signal the producers that the current input buffers can be evicted.
Consumer finish function (lines 63β73): When all K-dimension iterations are complete, each compute warpgroup stores its accumulated 64Γ64 output tile from registers to shared memory, synchronizes, and the producer warp initiates TMA stores back to the C matrix in HBM. The tma::store_async_read_wait() call ensures the store completes before the shared memory buffer is reused for the next chunk of work (in persistent grid mode, the block loops back to fetch a new work chunk rather than exiting).
Warp-Level: Tile Operations
At the finest granularity, the compute warpgroups operate on register tiles. The accumulator in consumer_state is declared as rt_fl<16, N_BLOCK * base_tile::cols> β a float32 register tile with 16 rows (matching the warpgroup tile height) and columns equal to the total output columns handled by this block (e.g., 256 for N_BLOCK = 4 with 64-element base tiles). The mma_AB operation reads bfloat16 A and B tiles from shared memory (using the swizzled layout automatically selected by TK based on the tile width), multiplies them at full tensor core throughput, and accumulates the result into the float32 accumulator tile β all without the developer writing a single thread index calculation, explicit shared memory bank management, or tensor core instruction scheduling.
The Result: 40 Lines of Device Code vs. 689 MB of CuBLAS
The paper emphasizes that this single GEMM kernel β "just 40 lines of device code" β achieves the TFLOPS reported in Figure 7 and Table 2, approaching CuBLAS performance across a range of matrix sizes. CuBLAS, by contrast, is 689 MB of compiled code containing "many tuned GEMM variants and logic to select the best option at runtime." The implication is not that TK replaces CuBLAS for all use cases (CuBLAS likely wins at edge cases and unusual shapes through its extensive autotuning database), but that a small set of well-chosen abstractions β 16Γ16 tiles, automated swizzling, a pipelined producer-consumer template, and persistent grid launch β can recover most of the performance of a heavily engineered library for the common cases, while being accessible to developers without specialized GPU expertise.
Summary of Design Choices and Their Justifications
-
16Γ16 tile as the fundamental data structure: Matches tensor core granularity on H100 (WGMMA instructions operate on 16Γ16 operand tiles), maximizing compatibility with the GPU's fastest compute units. Smaller tiles would incur more instruction overhead per FLOP; larger tiles would exceed register budgets and reduce occupancy.
-
Exactly three swizzled shared memory layouts, automatically selected: After evaluating six candidate layouts (Appendix C), only 32-byte, 64-byte, and 128-byte swizzling combine hardware HGMMA/UTMA instruction compatibility with progressive bank conflict reduction. Automating selection eliminates the layout errors that cause 9.6-way bank conflicts in hand-tuned kernels (FlashAttention-3, Table 4).
-
PyTorch-like operations over tiles rather than thread-level indexing: ML practitioners already think in terms of tensor operations (
exp,matmul,softmax). Exposing these same semantics on tiles β with TK handling the mapping to thread indices β reduces the learning curve from "learn GPU architecture" to "learn TK's tile types." The paper provides evidence that this works in practice: kernels were "written by a small academic team, including by undergraduates with no prior CUDA experience." -
LCSF template over explicit warp scheduling: The producer-consumer pattern with multi-stage buffering is the common structure underlying performant kernels across GEMM, attention, convolution, and state space models. Embedding it as a template means developers only write the compute logic and data movement specifications, while TK manages synchronization barriers, buffer indexing, and pipeline depth. The alternative β FlashAttention-3's "ping-pong scheduler" β is a one-off solution that doesn't generalize.
-
Persistent grid launch over fresh block launches: Eliminates wave tail effects (low utilization on the final wave of blocks) and amortizes block setup/teardown costs. Table 2 shows 10β15% TFLOPS improvement for GEMM at smaller K, where setup costs are proportionally larger.
-
Block launch order control over relying on hardware scheduling: The hardware thread block scheduler may execute blocks in any order. By controlling the 3D stride pattern, TK ensures blocks that share data in the reduction dimension execute consecutively, keeping their inputs in L2 cache. The >50% performance degradation at 16384Γ16384Γ16384 GEMM between a careful tiled order and naive row-major order (793 vs. 387 TFLOPS) demonstrates that this is not a micro-optimization but a correctness-level performance concern.
-
Compile-time dimensions in tile declarations: Encoding batch size, head dimension, and tile dimensions as template parameters stores them in the instruction cache rather than registers, freeing the scarcest GPU resource (255 registers per thread) for accumulator tiles and improving occupancy without developer intervention.
-
Explicit register management API (
increase_registers,decrease_registers): Asymmetric register allocation β few registers for producer warps that only compute addresses, many registers for consumer warps that hold accumulator tiles β ensures load workers don't starve compute workers of registers, a common failure mode in hand-tuned kernels that TK's API makes visible and controllable.
4. Key Insights and Innovations
Innovation 1: A Difficulty-Conditioned Compute-Optimal Test-Time Scaling Framework
The paper's most fundamental conceptual contribution is the meta-strategy of adaptively allocating test-time compute based on prompt difficulty, establishing the first systematic framework for understanding when different inference-time strategies work rather than just whether they work on average. Prior to this work, the dominant approach to test-time compute was uniform allocation β best-of-N sampling applied identically to every prompt, regardless of whether the prompt was trivially answerable or provably beyond the model's capabilities. This uniform treatment implied an implicit assumption that test-time compute and performance share a monotonic relationship: more samples always help. The paper demolishes this assumption.
The key diagnostic move is conditioning the entire analysis on estimated prompt difficulty, defined as the base model's pass@1 rate on a given question (Section 3.2). This metric, which reflects what the model can already do without any test-time help, turns out to be the sufficient statistic that determines which strategy is optimal. The empirical evidence for this is striking: easy problems experience performance degradation from aggressive search (beam search accuracy drops from ~78% to ~77% on the easiest questions as budget increases from 4 to 256 generations, Figure 3 right), while medium-difficulty problems benefit substantially from the same strategy (bin 3 accuracy rises from ~10% to ~34% across the same budget range). These are qualitative reversals, not merely different slopes β the same intervention has opposite effects depending on difficulty.
What makes this genuinely novel rather than an obvious observation is that prior work had studied the same mechanisms in isolation and reached flatly contradictory conclusions. Huang et al. (2023) found that "LLMs cannot self-correct reasoning yet," while Madaan et al. (2023) found self-refinement helps. Bai et al. (2022) and Du et al. (2023) reported positive results for debate and self-critique, while Valmeekam et al. (2023) found self-critiquing plans largely doesn't work. The field had treated these as conflicting findings about the methods when they were actually findings about different difficulty distributions β Huang et al. likely tested on harder problems where the base model had low pass@1, while Madaan et al. likely tested on easier ones where the model could already generate plausible answers needing refinement. This paper's difficulty-conditioned analysis reconciles the prior literature by providing the boundary conditions: self-correction works when the base model can generate approximately correct answers (difficulty bins 1β2), PRM-guided search works when the model needs global exploration (bins 3β4), and nothing works when the model is fundamentally incapable (bin 5). This is not a performance claim but a diagnostic reframing β it converts a confusing set of contradictory results into a coherent picture with clear boundary conditions.
The contribution is best understood as an inference-time analog of the Chinchilla scaling laws (Hoffmann et al., 2022). Just as Chinchilla showed that the optimal allocation of pretraining compute between model size and data quantity is not uniform but varies with total budget, this paper shows that the optimal allocation of test-time compute between search algorithms, revision depth, and parallel sampling ratio varies with prompt difficulty. The conceptual parallel is direct, but the underlying mechanism is entirely different β pretraining scaling laws optimize over continuous variables while this paper optimizes over a discrete combinatorial space of strategy hyperparameters conditioned on a difficulty estimate.
The practical significance is that treating difficulty as a first-class input to the inference process β not just a post-hoc analysis dimension β recovers 4Γ better compute efficiency over best-of-N (Figures 4 and 8), meaning a system with the same total inference budget can answer many more questions correctly by not treating all questions the same. This is a fundamental insight, not a minor parameter tuning exercise, because it overturns the default assumption that test-time strategies should be applied uniformly and establishes difficulty estimation as a core primitive of efficient inference systems.
Innovation 2: Verifier Over-Optimization as a First-Class Phenomenon in Test-Time Scaling
While reward hacking and over-optimization are well-documented in the RLHF literature (where a learned reward model is exploited during policy optimization), this paper provides some of the first clear evidence that the same phenomenon governs test-time search scaling and is the primary bottleneck preventing unbounded improvements from additional inference compute. This is a conceptual contribution that shifts the narrative around test-time compute from "more is better" to "more is better only up to the verifier's reliability frontier."
The evidence is concrete and multi-pronged. On easy problems, beam search β the strongest optimizer β degrades performance at high budgets relative to best-of-N (Figure 3 right, bin 1: beam search accuracy drops from ~78% to ~77% as budget goes from 4 to 256 generations, while best-of-N improves from ~68% to ~88%). This is a smoking gun for over-optimization: the search algorithm finds solutions that score highly under the process reward model (PRM) but are actually incorrect. The paper identifies specific failure modes: low-information repetitive steps at the end of solutions (Figure 29) and overly short 1β2 step solutions that happen to score well under the PRM's step-level predictions. Lookahead search β the most powerful optimizer, which simulates additional steps forward to get better step-level value estimates β paradoxically performs worst overall (Figure 3 left), because the extra optimization power amplifies the verifier's errors rather than improving solution quality.
This finding is significant because it explains why prior work on sophisticated search methods (tree-of-thought, MCTS-style exploration) often produced disappointing results: those studies likely pushed past the over-optimization threshold on their problem distributions. It also implies that improving verifier robustness is the key bottleneck for further scaling test-time compute, not developing more sophisticated search algorithms. The paper's compute-optimal policy can be understood as a strategy for staying below the over-optimization threshold per difficulty level β using weaker optimization (best-of-N) where the verifier is most reliable (easy problems) and stronger optimization (beam search) only where the verifier signal has room to provide genuine guidance (medium problems) β but it does not solve the underlying verifier robustness problem. This redirects the research agenda: rather than developing ever-more-complex tree search variants, the priority should be building verifiers that remain calibrated under aggressive optimization pressure, potentially through adversarial training, ensemble methods, or KL-penalty approaches analogous to those used in RLHF.
The framing of over-optimization as a first-class scaling bottleneck rather than a niche failure mode is a genuine conceptual contribution. It establishes that test-time compute scaling has a hard ceiling determined by verifier quality, analogous to how reward model quality determines the ceiling for RLHF-based alignment. This insight was absent from prior work, which largely treated additional test-time compute as an unboundedly beneficial resource.
Innovation 3: The Proposal Distribution and Verifier as Complementary, Difficulty-Dependent Scaling Axes
The paper's unifying framework β decomposing all test-time compute methods into modifications to the proposal distribution (what the model generates) versus the verifier (how outputs are selected) β is not itself technically novel; it echoes the proposer-scorer decomposition familiar from MCMC and reinforcement learning. What is novel is the paper's empirical demonstration that these two axes have complementary, difficulty-dependent strengths and that they are not interchangeable resources.
The key finding is that revisions (proposal modification via sequential self-correction) are most effective on easy problems where the model's initial output is approximately correct and just needs local refinement, while PRM-guided search (verifier optimization) is most effective on medium-hard problems where the model needs to explore qualitatively different solution strategies through global search. Figure 7 (right) demonstrates this complementary pattern: on easy problems (bin 1), the sequential-to-parallel ratio barely matters because the model gets it right with high probability regardless; on medium problems (bins 3β4), an optimal ratio emerges with a balanced mix of sequential refinement and parallel exploration; on hard problems (bin 5), no ratio helps because the base model lacks the fundamental capability. Similarly, Figure 3 (right) shows that beam search outperforms best-of-N on medium problems but underperforms it on easy ones β the verifier helps global navigation but hurts when the model already knows the way.
This complementary pattern constitutes a functional decomposition of difficulty into two orthogonal challenges that different mechanisms address: local refinement (revisions fix mistakes in roughly-correct answers) and global exploration (search finds correct solution paths in a space where the model has non-trivial pass@1 but can't reliably land on the right answer through random sampling). Prior work studied these mechanisms independently, often reaching pessimistic conclusions when testing the wrong mechanism on the wrong difficulty tier. This paper shows that the right question is not "do revisions work?" but "on which difficulty tier do revisions dominate search?" β and the answer is structured and predictable.
The practical implication is that future systems should not choose between revisions and search, but should deploy both and switch between them per-prompt. The paper doesn't fully realize this vision (Section 8 acknowledges that PRM tree-search was not combined with revisions), but the framework provides the intellectual scaffolding for doing so. This is a contribution to taxonomy and understanding rather than raw performance β it explains the structure of the solution space in a way that enables principled future work on combined approaches.
Innovation 4: Empirical Evidence That Test-Time Compute Can Substitute for Pretraining β With Sharp, Quantified Boundaries
The FLOPs-matched comparison in Section 7 is significant not as a method but as an empirical finding with direct implications for how compute budgets should be allocated between pretraining and inference. Prior work on training-inference tradeoffs (Jones, 2021; Villalobos and Atkinson, 2023; Sardana and Frankle, 2023) largely assumed access to ground-truth answers or evaluated in simpler settings. This paper provides the first evidence in a realistic setting (no ground-truth access at inference, MATH benchmark, PaLM 2 models) that a smaller model with compute-optimal test-time strategies can outperform a ~14Γ larger model on problems within its capability range.
What distinguishes this from prior tradeoff analyses is the specificity of the boundary conditions. The paper doesn't claim a universal substitution β it precisely characterizes where the substitution works and where it fails, quantified through the dependence on difficulty and on . On easy questions across all values of , test-time compute with the smaller model outperforms the larger model (Figure 9, bin 1: +11.8% to +19.1% relative improvement). On the hardest questions (bin 5), test-time compute provides essentially zero benefit regardless of budget β the scaling line is flat near 0β5% accuracy β meaning that some capabilities can only be acquired through pretraining, not recovered at inference time. This establishes a clear boundary: test-time compute amplifies existing capability but does not create it.
The dependence on adds practical nuance that prior analyses missed. When (few inference tokens relative to pretraining, as in self-improvement pipelines), the case for test-time compute is strong across all difficulty levels. When (high-volume production deployment), pretraining becomes preferable on all but the easiest problems because the larger model's per-token inference cost already dominates the budget. This means organizational decisions about pretraining investment versus inference infrastructure depend not only on average problem difficulty but on the inference-to-pretraining token ratio β a previously underappreciated degree of freedom.
The finding is conceptually important because it challenges the prevailing paradigm of "train the largest model you can afford, then deploy with greedy decoding." The paper provides empirical evidence for a regime where it is more cost-effective to train a smaller model and invest the savings in smarter inference, while also being careful to identify where this regime breaks down. This does not resolve the pretraining-inference tradeoff once and for all β the paper acknowledges limitations including the parameter-only scaling of the larger model (rather than Chinchilla-optimal joint parameter-and-data scaling) and the lack of test-time compute for the larger model baseline β but it provides the first systematic empirical characterization of the tradeoff surface and establishes the difficulty-conditional framework through which future analyses should be conducted.
5. Experimental Analysis
Evaluation Methodology
-
Dataset. All experiments use the NVIDIA H100 80GB SXM GPU with CUDA 12.6 (Section 4 introduction). Rather than a traditional ML dataset, the performance benchmarks measure throughput on standardized matrix and tensor operations across a range of sizes: GEMM across varying M, N, K dimensions (4096 to 16384); attention across sequence lengths, head dimensions (64 and 128), and causal/non-causal/grouped-query variants; long convolutions at sequence lengths 1024, 2048, and 4096; linear attention with both polynomial and learned feature maps; and state space models including Mamba-2 and FFT convolutions. The "data" is simply the tensor operands whose shapes determine the computational workload.
-
Base model(s). The hardware under test is the NVIDIA H100 SXM GPU with 80 GB of HBM, 132 streaming multiprocessors, 50 MB of L2 cache, 227 KB of shared memory per SM, and tensor cores capable of warp-group matrix multiply-accumulate (WGMMA) at BF16 precision. The paper emphasizes that BF16 tensor cores represent "16Γ the FLOPs available relative to general-purpose BF16 / FP32 compute" (Section 1), making tensor core utilization the dominant performance determinant.
-
Metrics. The primary metric throughout is TFLOPS β trillions of floating-point operations per second β computed by measuring wall-clock execution time for the kernel and dividing by the known FLOP count of the operation. For operations whose exact FLOP count is ambiguous (e.g., softmax with online rescaling), the paper uses the standard convention of counting only the dominant matrix multiplies. All timings use 10 warmup iterations followed by 10 timed iterations measured in C++ (Appendix B, "Benchmarking approach"), with the average of timed iterations reported. For bandwidth analysis (Table 3), HBM GB/s is measured using NVIDIA NSight Compute to quantify how much data actually traverses the memory bus β lower HBM GB/s at the same or higher TFLOPS indicates better L2 cache reuse.
-
Baselines. The paper compares against the strongest available implementation for each operation, spanning multiple frameworks:
- CuBLAS [30] for GEMM: NVIDIA's proprietary BLAS library, totaling 689 MB in CUDA 12.6 (Appendix A, Table 5), which contains hundreds of hand-tuned GEMM variants and runtime heuristics for selecting the optimal kernel per matrix configuration.
- FlashAttention-3 (FA3) [37] for softmax attention inference and backwards: the state-of-the-art attention kernel written in CUTLASS and CuTe, concurrent with this work, which introduced a "ping-pong scheduler" for overlapping asynchronous work (Section 4.1).
- Flash Linear Attention (FLA) [44] for linear attention: a popular Triton-based library providing kernels for both polynomial-based feature maps (as in [4, 5, 26, 28]) and learned feature maps (as in [45, 46]).
- FlashFFTConv [20] for long convolutions using FFT: CUDA kernels designed for the FFT-based convolution primitive underlying S4, H3, and Hyena architectures.
- Mamba-2 Triton kernels [13] for state space models: the Triton implementation from the original Mamba-2 authors (Dao & Gu, 2024).
- PyTorch's native FFT operations: used as an additional point of comparison for the long convolution kernel (Figure 9).
- For fused operations (dropout-residual-layernorm and rotary positional encodings), the paper compares against "popular Triton kernels" from the flash-attention repository (https://github.com/Dao-AILab/flash-attention).
-
Generation budget / compute accounting. Unlike ML evaluations that measure accuracy at a given compute budget, these are throughput benchmarks: the "budget" is simply the GPU time required to complete the operation, and the metric is the achieved throughput (TFLOPS) rather than a quality measure. The comparison is always apples-to-apples: the exact same operation with the same input dimensions is executed by TK and the baseline, and the faster kernel earns higher TFLOPS. For operations with multiple valid algorithmic variants (e.g., causal vs. non-causal attention), separate benchmarks are reported. The special handling involves matrix multiply dimensions: for GEMM, dimensions are swept across M=N=K values of 4096 to 16384; for attention, sequence lengths from 1024 to 16384 at head dimensions 64 and 128; for long convolution, sequence lengths 1024 to 4096 at batch size 16, head dimension 1024.
-
Cross-validation / statistical protocol. No cross-validation is applicable β these are deterministic throughput measurements on fixed hardware. The paper reports the average of 10 timed iterations, which primarily controls for short-timescale GPU clock variations. The reproducibility claim rests on the fact that identical hardware, CUDA version (12.6), and tensor dimensions produce deterministic execution times (modulo GPU clock frequency fluctuations, which are typically <1% on the H100 SXM in steady state).
Main Quantitative Results
GEMM: Matching CuBLAS with a 75-Line Kernel
The paper's headline GEMM result (Figure 7) is that a single TK kernel β shown in its entirety in Appendix B.1, approximately 75 lines of device code β matches or approaches CuBLAS performance across a range of square matrix sizes on the H100. For M=N=K=4096, TK achieves approximately 760 TFLOPS with a 4-stage pipeline (Table 1), while CuBLAS reaches a comparable level. As dimensions scale to M=N=K=16384 with an optimized 3D block tiling order (the {8, N, M/8} order from Table 3), TK achieves 805 TFLOPS, while CuBLAS performance on this configuration is not explicitly stated, though the trend in Table 2 suggests TK remains competitive.
The pipeline depth ablation (Table 1) shows the critical role of overlapping in achieving this performance: with 1 stage (no overlap), the kernel achieves only 260 TFLOPS; with 2 stages, 484 TFLOPS (an 86% improvement); with 3 stages, 683 TFLOPS; and with 4 stages, 760 TFLOPS. This quantifies the cost of serial execution versus the asynchronous pipelining that LCSF provides.
The persistent grid optimization (Table 2) provides additional gains, particularly at smaller K values where block setup/teardown costs are proportionally larger: at K=64, persistent launch improves from 93 to 108 TFLOPS (a 16% gain); at K=1024, the improvement narrows from 565 to 600 TFLOPS (6%). CuBLAS significantly outperforms both TK variants at K=1024 (633 TFLOPS vs. 600), suggesting CuBLAS's runtime kernel selection identifies a more specialized variant for this deep-reduction dimension that TK's single generic kernel does not match.
Attention: Matching FA3 on Forward, Outperforming on Backward
The paper benchmarks multiple attention variants (Figure 8) β causal, non-causal, and grouped-query attention at head dimensions 64 and 128, across sequence lengths from 1024 to 16384.
Forward pass: For non-causal attention forwarding, TK "competes with FA3 across sequence lengths" (Section 4.1). The exact TFLOPS are not enumerated in the text but are depicted in Figure 8. The implications are that TK matches the state-of-the-art on forward inference β the most latency-sensitive attention use case β using the kernel listed in Appendix B.3 (Figure 12).
Backward pass: This is where TK substantially outperforms FA3. The paper reports that TK outperforms FA3 on the causal and non-causal backward pass "by over 40% at short sequences and 10% at longer sequences" (Section 4.1). The backward pass is a more complex operation (it must compute gradients with respect to Q, K, and V simultaneously, requiring careful management of intermediate values recomputed during the backward traversal), and the paper attributes TK's advantage to better memory layout management.
The profiling results in Table 4 provide direct hardware-level evidence for this gap. At B, H, N, D = 16, 16, 3072, 128 on the backward pass:
- Tensor core utilization: TK and FA3 are matched at approximately 58β61% β both effectively keep tensor cores fed.
- Issue slot utilization: TK achieves 34.8% vs. FA3's 25.1%, suggesting TK's warp scheduling keeps more instructions in flight simultaneously.
- HBM throughput: TK achieves 490 GB/s vs. FA3's 328, with correspondingly 10% fewer stalled cycles on HBM waits.
- Shared memory stalls: This is the decisive difference. TK incurs only 0.14 million stalled cycles on shared memory, versus 0.92 million for FA3 β an 85% reduction. NVIDIA's NSight Compute profiler reports "up to 9.6-way bank conflicts" in FA3, while TK's automated layout selection eliminates these conflicts. This is the direct mechanism for TK's backward pass advantage: FA3's manually managed shared memory layouts create serialization that TK's swizzling eliminates.
Linear Attention: 6.5Γ to 14Γ over Triton Kernels
For linear attention β an alternative to softmax attention that replaces the exponential kernel with a feature map β TK achieves dramatic speedups over the Flash Linear Attention (FLA) Triton kernels (Figure 9):
- Polynomial-based feature maps: TK outperforms FLA by 14Γ (Section 4.1, "Linear attention" paragraph).
- Learned feature maps: TK outperforms FLA by 6.5Γ (same paragraph).
These large gaps are attributed by the paper to TK's use of hardware-specific instructions (TMA for bulk data movement, WGMMA for tensor core operations) that Triton cannot express, and to TK's register tile abstractions that "manage register memory effectively" (Section 4.1, paragraph after Figure 9). The FLA kernels, written in Triton, cannot use TMA hardware-accelerated address generation, cannot issue WGMMA instructions for warp-group matrix multiplies, and have less control over register allocation β all capabilities that TK exposes through its C++-embedded design while maintaining a simpler programming interface than raw CUDA.
Long Convolution (FlashFFTConv): 4.7Γ to 7.9Γ over Specialized CUDA Kernels
The long convolution kernel implements the FFT convolution algorithm for state space models (S4, H3, Hyena) using Monarch matrix decompositions [14, 18]. Compared to FlashFFTConv [20] β a specialized CUDA kernel published at a top venue (ICLR 2024) β TK achieves (Figure 9):
- 4.7Γ speedup at sequence length 4096 (batch size 16, dimension 1024)
- 7.9Γ speedup at sequence length 1024
Additionally, TK outperforms PyTorch's native FFT operations by up to 8.7Γ (Section 4.1).
The profiling comparison in Table 4 reveals where FlashFFTConv's performance is lost. At B, D, N = 16, 1024, 4096:
- Tensor core utilization: FlashFFTConv achieves only 13.4%, while TK achieves 54.8% β a 4.1Γ improvement. FlashFFTConv is leaving nearly 87% of the GPU's primary compute resource idle, suggesting its kernel is heavily bottlenecked on memory or instruction issue rather than arithmetic.
- Issue slot utilization: TK achieves 40.0% vs. FlashFFTConv's 25.5%, indicating better instruction-level parallelism.
- Memory stalls: TK incurs 0.6 million stalled cycles on HBM vs. 2.5 million for FlashFFTConv, and 0.3 million on shared memory vs. 1.6 million. These lower stall counts reflect TK's LCSF template effectively overlapping memory operations with compute, while FlashFFTConv's kernel β despite being hand-tuned β serializes memory and compute to a greater degree.
The paper attributes TK's gains to "our TK template, and use of TK warpgroup operations (which saves registers and establishes a SMEM to register memory pipeline through warpgroup matrix-multiply-add (WGMMA) operations)" (Section 4.2).
Mamba-2 State Space Models: >3Γ over Triton Kernels
For the Mamba-2 structured state space model [13], TK achieves ">3Γ" the throughput of the Triton kernels from the original authors (Dao & Gu, 2024) (Figure 9). The paper attributes this gap "primarily to the ease of fusing complex operations in TK" (Section 4.1). Mamba-2 involves a sequence of operations β structured matrix multiplies, element-wise gating, and state updates β that in Triton must be expressed as separate kernel launches or rely on the compiler to fuse, while in TK they can be composed within a single LCSF kernel that keeps intermediate data in registers and shared memory throughout.
Fused Element-Wise Operations: Dropout-Residual-Layernorm and Rotary
The paper also benchmarks TK against Triton for common memory-bound AI operations (Figure 9):
- Fused dropout-residual-layernorm: TK outperforms the Triton baseline (exact multiple not quantified in text; Figure 9 shows the comparison).
- Rotary positional encodings (RoPE): At head dimension 128, TK outperforms "popular Triton kernels" (from the flash-attention repository) β the kernel is listed in Appendix B.4 (Figure 13).
These operations are typically memory-bound (their arithmetic intensity is low β each element loaded from memory receives only a handful of operations), so the speedup is driven by TK's efficient shared memory layouts and TMA-based bulk transfers rather than tensor core utilization.
Ablation Studies and Robustness Checks
Pipeline buffer stages (Table 1): For a GEMM with M=N=K=4096, varying the number of pipeline stages from 1 to 4 shows throughput improving from 260 to 484 to 683 to 760 TFLOPS. The jump from 1 to 2 stages (86% improvement) demonstrates that overlapping HBM loads with tensor core compute is essential; the diminishing returns from 2 to 3 to 4 stages indicate that depth-2 already hides most load latency for this problem size, with deeper pipelines providing additional insurance against load stalls.
Persistent vs. non-persistent grid launch (Table 2): For GEMM with M=N=4096 and varying K, persistent launch provides consistent gains: 93β108 TFLOPS at K=64 (16% improvement), 161β184 at K=128 (14%), 271β309 at K=256 (14%), 414β450 at K=512 (9%), and 565β600 at K=1024 (6%). The tapering benefit as K increases confirms that block launch overhead is proportionally larger when per-block work (determined by the reduction dimension K) is small. The comparison to CuBLAS shows TK matching or exceeding at all K values except 1024, where CuBLAS reaches 633 TFLOPS β likely because its runtime heuristic selects a kernel variant specialized for deep reductions that TK's single generic kernel does not replicate.
Block launch order and L2 cache reuse (Table 3): For GEMM at M=N=K=16384, a carefully tiled 3D block order ({8, N, M/8}) achieves 982 GB/s HBM bandwidth and 805 TFLOPS, while naive row-major order ({N, M}) achieves 3070 GB/s HBM bandwidth but only 392 TFLOPS β more than 3Γ the HBM traffic but less than half the throughput. This is a direct demonstration of L2 cache effects: the tiled order reuses data in L2, avoiding HBM round-trips and keeping the kernel compute-bound rather than memory-bound. For attention forward with head dimension 128, ordering blocks as {B, H, N} achieves 2390 GB/s HBM and 494 TFLOPS vs. 213 GB/s and 600 TFLOPS for {N, H, B}. The TFLOPS improvement despite higher HBM bandwidth in the efficient ordering is initially counterintuitive but reflects that when data is in L2, the memory subsystem can feed tensor cores at sufficient rate to keep them busy β high HBM bandwidth in the inefficient ordering indicates L2 misses, which stall tensor cores waiting for data from slow HBM.
Occupancy tuning within the LCSF template (Figure 6): For attention with head dimension 64 and sequence length 4096, performance is measured as the number of compute warp groups (occupancy) varies from 1 to 5, comparing a simple synchronous kernel (warp-level parallelism only) against the LCSF template. Both show an inverted-U shape β performance increases with more workers until register pressure causes degradation β but LCSF achieves higher peak throughput and "expands the Pareto frontier beyond the warp-level parallel kernel as we vary occupancy" (Section 3.2). The specific TFLOPS values at each occupancy level are enumerated in Figure 6 (left) using the bar chart; the text only quotes representative numbers: 123 TFLOPS at 1 warpgroup synchronous, rising to 300 at 4 warpgroups synchronous, then declining to 270; LCSF at 4 warpgroups reaches 440 TFLOPS, then declines to 341 at 5.
Producer-consumer register asymmetry (Appendix B.1, lines 34β36 and 51β52): The GEMM kernel explicitly demonstrates TK's register management API: producer warps call warpgroup::decrease_registers<40>() to cap at 40 registers per thread, freeing registers for consumer warps which call warpgroup::increase_registers<232>() to request near-maximum register allocation for accumulator tiles. The paper does not provide an ablation removing this asymmetry, but the design is motivated by the occupancy tradeoff analysis: load workers need few registers (address calculations only), compute workers need many (to hold 16Γ16 accumulator tiles in float32 without spilling), and a uniform allocation would either starve compute workers or waste registers on load workers.
Shared memory layout selection (Appendix C): The appendix evaluates six candidate layouts β row-major (8-way bank conflicts when loading tensor core layouts), padded (no conflicts but misaligned addresses incompatible with HGMMA/UTMA), naive swizzled (no conflicts and aligned but no HGMMA/UTMA support), and three byte-swizzled layouts (32-byte, 64-byte, 128-byte) that combine progressive bank conflict reduction with HGMMA/UTMA hardware compatibility. TK selects the largest supported swizzling pattern at compile time based on tile width. The evidence for this choice is indirect but compelling: FlashAttention-3's manual layout management produces 9.6-way bank conflicts and 0.92M stalled shared memory cycles, while TK's automated selection produces no bank conflicts and 0.14M stalled cycles (Table 4). No ablation exists showing what would happen if TK chose a suboptimal layout, since the selection is automated and correctness-guaranteed.
WGMMA instruction usage for register-to-shared memory pipelining: The paper's profiling of long convolution (Table 4) notes that TK uses "warpgroup operations (which saves registers and establishes a SMEM to register memory pipeline through warpgroup matrix-multiply-add (WGMMA) operations)." This is not presented as a formal ablation but as a qualitative explanation for the 4.1Γ tensor core utilization improvement over FlashFFTConv β by using WGMMA rather than older matrix multiply instructions, TK reduces register pressure (the WGMMA instruction handles its own data movement from shared memory to registers internally) and pipelines the data transfer with the multiply itself.
Critical Assessment
Claim 1: "TK kernels match CuBLAS and FlashAttention-3 on GEMM and attention inference"
What the experiments demonstrate: For GEMM, TK's single kernel approaches CuBLAS across the tested square matrix sizes (Tables 1 and 2, Figure 7), with CuBLAS pulling ahead at K=1024 (633 vs. 600 TFLOPS). For attention inference, TK matches FA3 on non-causal forward pass (Figure 8, exact numbers not enumerated).
What remains untested: The GEMM comparison covers only square matrices (M=N=K) at sizes from 4096 to 16384. CuBLAS's 689 MB contains specialized kernels for tall-and-skinny matrices, batched GEMMs, strided batched GEMMs, and mixed-precision variants β none of which are evaluated. The claim of "matching CuBLAS" is accurate for the demonstrated configurations but substantially overstates the scope if interpreted as matching across CuBLAS's full feature set. The attention inference comparison shows matching on non-causal forward pass; performance on causal and grouped-query attention forward is not separately enumerated, though Figure 8 depicts them.
Genuine weakness: The single-datapoint loss to CuBLAS at K=1024 (633 vs. 600 TFLOPS) is downplayed. This 5% gap, while modest, suggests that a single generic GEMM kernel cannot match a library that selects specialized variants at runtime. Whether this gap widens at larger K, narrower K, or unusual aspect ratios is unexplored and would be necessary to support a claim of general CuBLAS parity.
Claim 2: "TK outperforms the strongest baselines by 10β40% on attention backwards"
What the experiments demonstrate: The profiling in Table 4 (backward pass at B, H, N, D = 16, 16, 3072, 128) shows TK achieving 10% fewer HBM stalled cycles and 85% fewer shared memory stalled cycles than FA3, with the text claiming "over 40% at short sequences and 10% at longer sequences" (Section 4.1). The bank conflict analysis β 0.14M vs. 0.92M stalled cycles β provides a clear mechanism.
What remains untested: The exact TFLOPS values at each sequence length are not tabulated; Figure 8 shows curves but does not provide a table of numbers. The 40% figure at "short sequences" is referenced but not broken down by exact sequence length, head dimension, or causal vs. non-causal. More critically, the backward pass comparison is at a single batch-head configuration (B=16, H=16), and it is unclear whether the gap persists, widens, or narrows at different batch sizes or head counts β parameters that affect occupancy and register pressure in ways that could advantage either implementation.
Conditional nature: The claim only applies to the backward pass, and only at head dimension 128. The forward pass results show parity, not outperformance. The >40% figure applies specifically to short sequences, where FA3's bank conflicts are proportionally more costly relative to compute.
Claim 3: "TK outperforms the strongest baselines by up to 8Γ on state space models"
What the experiments demonstrate: The long convolution kernel achieves 4.7Γ at N=4096 and 7.9Γ at N=1024 over FlashFFTConv (Figure 9). The Mamba-2 kernel achieves >3Γ over the Triton baseline (Figure 9). Together, these span the claimed "up to 8Γ."
What remains untested: The long convolution comparison is at a single batch size (B=16) and embedding dimension (D=1024). Whether the 7.9Γ speedup holds at different batch sizes (which affect occupancy and HBM bandwidth utilization) or different embedding dimensions (which affect the relative cost of FFT stages vs. pointwise multiplies) is unexplored. For Mamba-2, the specific dimensions benchmarked are not stated, making the >3Γ claim difficult to contextualize β is this at the state size, head dimension, and sequence length used in the original paper, or at a configuration favorable to TK?
Genuine concern about the baseline: FlashFFTConv's 13.4% tensor core utilization (Table 4) is remarkably low for a hand-tuned CUDA kernel published at a top venue. This suggests either that FlashFFTConv was not aggressively optimized for the H100 (it may have been tuned for the A100 and ported with minimal changes, similar to FlashAttention-2's 47% degradation on H100), or that the FFT convolution algorithm is fundamentally difficult to tensorize. Either way, the 4.7β7.9Γ speedup may partially reflect baseline weakness rather than TK-specific strengths. Comparing against a hypothetical FlashFFTConv-2 optimized for H100 would strengthen the claim, but such a baseline does not exist.
Claim 4: "TK outperforms the strongest baselines by up to 14Γ on linear attention"
What the experiments demonstrate: The 14Γ figure applies to polynomial-based linear attention vs. Flash Linear Attention (FLA) Triton kernels (Figure 9). The learned feature map variant shows 6.5Γ.
What remains untested: The specific sequence length, batch size, head dimension, and feature dimension are not stated in the main text or Figure 9 caption. This is a significant omission β linear attention's computational profile changes substantially with feature dimension (the rank of the linear approximation), and the Triton-FLA kernels may be particularly suboptimal at certain feature dimensions that TK handles efficiently. Additionally, the comparison is against Triton kernels specifically. No comparison is provided against hand-tuned CUDA implementations of linear attention (if they exist), making the 14Γ figure partially a statement about Triton's limitations rather than TK's absolute quality.
Context for interpreting the gap: The paper explicitly identifies that Triton cannot use TMA or WGMMA instructions. Much of the 14Γ gap may stem from these hardware features being inaccessible in Triton rather than from a fundamentally better algorithm or scheduling in TK. This weakens the paper's implicit claim that TK's abstractions are the proximate cause of the performance β if Triton were extended to support WGMMA and TMA (which is technically feasible), the gap might narrow substantially. The paper's framing of this as a demonstration of TK's "extensibility" and "ease of fusing complex operations" is accurate but should be understood as a comparison against a compiler framework with known hardware limitations rather than against the best possible implementation.
Claim 5: "Kernels written by a small academic team, including by undergraduates with no prior CUDA experience"
What the experiments demonstrate: The paper states this as a fact (Section 4, final paragraph), and the kernel listings in Appendix B are indeed concise (GEMM: ~75 lines, attention: ~100 lines, rotary: ~55 lines). This is a claim about developer productivity, not runtime performance.
What cannot be verified from the paper: The claim that these kernels were written by "undergraduates with no prior CUDA experience" is credibility-enhancing but unverifiable from the paper's contents. The kernel listings look clean and well-structured, but without access to development history (how many iterations? how much mentoring? how many dead ends?), the productivity claim is anecdotal. The templates themselves are the result of expert design β the paper doesn't specify how much work went into developing the LCSF template and tile abstractions before the undergraduates wrote their kernels.
Genuine Weaknesses in Experimental Design
Narrow GPU coverage. All results are on a single NVIDIA H100 80GB SXM GPU. The paper claims that "the parallelism types hold across architectures, including AMD and Apple GPUs" (Section 1, footnote), but provides no evidence. The specific abstractions β 16Γ16 tiles matching WGMMA granularity, three swizzled layouts matching HGMMA/UTMA requirements, persistent grid with TMA β are tightly coupled to NVIDIA's Hopper architecture. Whether TK's abstractions remain effective on AMD's MI300X or Apple's M-series GPUs (which have different tensor core sizes, different shared memory organizations, and different asynchronous I/O primitives) is entirely unexamined. This is a significant limitation for a framework that claims generality.
Single library versions. The comparisons are against specific library versions (CUDA 12.6, specific Triton builds, specific FlashAttention-3 release). The paper is concurrent work with FlashAttention-3, so comparisons may reflect pre-release versions. More importantly, the CuBLAS comparison at K=1024 shows a 5% gap; it is unclear whether this represents a fundamental limitation of TK's single-kernel approach or an optimization opportunity that a small amount of additional tuning would close.
No autotuning comparison. CuBLAS's strength is not just its individual kernels but its runtime autotuning β selecting from hundreds of specialized variants based on matrix dimensions. Triton similarly provides an autotuner that searches over tile sizes and pipeline configurations. TK requires the developer to manually specify occupancy, pipeline depth, tile dimensions, and grid ordering. The paper doesn't compare against autotuned Triton kernels (only against the FLA library's default configurations) and doesn't discuss whether TK's manual configuration is sufficient across all workloads or whether an autotuner over TK's parameter space would find substantially better configurations.
The profiling comparison is narrow. Table 4 provides detailed profiling for exactly two configurations: attention backward at one (B,H,N,D) tuple and long convolution at one (B,D,N) tuple. These are the configurations where TK shows the largest advantages. Profiling at configurations where TK and baselines are closer (attention forward, GEMM) is not provided, making it impossible to attribute performance differences to specific hardware-level mechanisms across the full benchmark suite.
Missing ablations. The paper does not answer several natural counterfactuals: What happens if TK's automated layout selection were disabled and a naive row-major layout used instead (quantifying the benefit of swizzling)? What happens if the LCSF template is replaced with a simple synchronous kernel but with all other TK abstractions kept (quantifying the benefit of the async template vs. the tile abstractions)? What happens if WGMMA is replaced with older mma instructions (quantifying the benefit of warp-group operations)? These ablations would decompose TK's advantages into additive contributions from each abstraction β the current design reports only end-to-end performance, making it difficult to assess which abstractions matter most.
The CuBLAS library is not publicly documented at the kernel level. The paper reports CuBLAS as "689 MB" and containing "many tuned GEMM variants and logic to select the best option at runtime," citing Schuetze (2024) which reverse-engineered CuBLAS internals. The specific CuBLAS kernel or kernels being compared against at each matrix size are not identified, making it impossible to assess whether TK is matching the peak CuBLAS variant or a generic fallback. Given that CuBLAS is closed-source, this is partially unavoidable, but it weakens the direct comparison.
6. Limitations and Trade-offs
Single Hardware Architecture: All Results Are on the NVIDIA H100
The assumption or constraint. Every performance number in the paper is measured on a single GPU: the NVIDIA H100 80GB SXM, running CUDA 12.6. The abstractions TK provides β 16Γ16 tiles matching WGMMA tensor core granularity, three swizzled shared memory layouts selected for HGMMA/UTMA hardware compatibility, TMA-based asynchronous bulk transfers, and persistent grid launch β are intimately tied to specific features of NVIDIA's Hopper architecture. The paper acknowledges this scope limitation only indirectly, stating in a footnote (Section 1) that "the parallelism types hold across architectures, including AMD and Apple GPUs," but provides zero evidence on non-NVIDIA hardware.
The consequence. A practitioner evaluating TK for deployment cannot predict whether the framework's abstractions remain effective on other GPU architectures. AMD's MI300X uses Matrix Core units with different tile dimensions and instruction constraints than NVIDIA's tensor cores. Apple's M-series GPUs have a fundamentally different memory hierarchy (unified memory between CPU and GPU) with no HBM, and different shared memory organizations. The paper's central claim β that a small set of abstractions is sufficient for high performance β is validated only on H100. If the 16Γ16 tile assumption, the three-layout swizzling scheme, or the TMA-based producer-consumer pattern fail to map cleanly onto other vendors' hardware, TK's simplicity advantage evaporates because the developer would need architecture-specific abstractions anyway.
This is not a hypothetical concern. The paper's motivating example β FlashAttention-2 suffering a 47% performance degradation when ported from A100 to H100 β demonstrates that abstractions tightly coupled to one GPU generation break on the next, even within the same vendor. If TK's abstractions encode Hopper-specific assumptions, they may face the same brittleness when ported to NVIDIA's Blackwell architecture (B100/B200), let alone to AMD or Apple hardware. The paper offers no analysis of which abstractions are architecture-invariant and which are Hopper-specific.
What evidence exists in the paper. The entire experimental section (Section 4) uses a single hardware configuration. The profiling results (Table 4) reference Hopper-specific metrics (WGMMA utilization, TMA bandwidth). Appendix C's layout analysis is entirely in terms of NVIDIA's 32-bank shared memory architecture and HGMMA/UTMA instructions. No cross-GPU comparison, no AMD ROCm or Apple Metal benchmarks, and no analysis of architecture portability.
Mitigation status. The paper does not address this limitation beyond the footnote claiming that "the parallelism types hold across architectures." No future work is suggested on portability, no abstraction layer for cross-vendor support is described, and no analysis identifies which parts of TK are vendor-agnostic versus NVIDIA-specific. A practitioner targeting non-NVIDIA hardware would need to treat TK as a proof-of-concept requiring substantial revalidation.
Difficulty Estimation Cost Is Not Accounted for in the Compute Budget
The assumption or constraint. The paper's entire compute-optimal framework depends on estimating prompt difficulty before allocating the inference budget. The method for doing so β generating 2048 samples per question and averaging either ground-truth correctness (oracle) or PRM final-answer scores (predicted) β is extraordinarily expensive, consuming more compute than the largest test-time budgets studied (256β512 generations). The authors acknowledge this explicitly in Section 3.2:
"estimating difficulty in this way still incurs additional computation cost during inference... our experiments do not account for this cost largely for simplicity"
The consequence. The headline 4Γ efficiency improvements over best-of-N are computed after difficulty is known, without amortizing the cost of learning it. In a deployment scenario, the total cost per question would be: difficulty estimation (2048 generations, each requiring a full model forward pass and PRM scoring) + strategy execution (the selected strategy's generation budget). For a question that the compute-optimal policy assigns a budget of 16 generations (matching best-of-N at 64 generations, Figure 4), the actual total cost is 2048 + 16 = 2064 generations β roughly 32Γ more than the 64-generation best-of-N baseline that the compute-optimal strategy is claimed to match. The 4Γ efficiency improvement becomes a 32Γ efficiency loss when difficulty estimation is priced in.
Even if a practitioner amortizes difficulty estimation across many questions from the same distribution (by pre-computing difficulty bins offline for a fixed benchmark), this only works for static question sets. In a dynamic deployment β a chatbot answering arbitrary user queries, an API serving continuously changing prompts β the difficulty of each incoming question is unknown and the cost of estimating it is incurred per question. The paper's predicted difficulty method (using PRM scores rather than ground-truth) removes the need for labeled answers but does not reduce the sample count: it still requires 2048 samples and PRM forward passes per question.
What evidence exists in the paper. The paper explicitly states the 2048-sample methodology in Section 3.2 and acknowledges the unexplored cost in the same section. The cost is mentioned again in Section 8 as future work ("estimating difficulty cheaply enough to be practical"). No experiment includes the difficulty estimation cost in any budget calculation. Figures 4 and 8 show compute-optimal scaling curves that treat difficulty as a given input, not a cost to be paid.
Mitigation status. The paper acknowledges the limitation explicitly and suggests future work on "pretraining or finetuning models to directly predict difficulty of a question" (Section 8), but develops no such model and evaluates no cheaper estimation method. An adaptive approach β start with a small number of samples, estimate difficulty online, and allocate the remaining budget accordingly β is mentioned as a direction but not implemented. Until the difficulty estimation cost is reduced to a small fraction of the inference budget, the 4Γ claim should be understood as an upper bound on achievable efficiency given perfect difficulty information, not a realized deployment gain.
Hard Problems Remain Fundamentally Unsolved β Test-Time Compute Amplifies Existing Capability, Does Not Create It
The assumption or constraint. The compute-optimal framework assumes the base model already has a non-trivial probability of generating correct solutions. When the base model's pass@1 is near zero on a problem class, no amount of search or revision can help because there are no correct solutions in the proposal distribution to find or refine. The paper is transparent about this boundary: across all methods β search, revisions, and their compute-optimal combinations β the hardest questions (difficulty bin 5) show near-zero improvement regardless of compute budget.
The consequence. A practitioner deploying TK for a problem distribution that includes genuinely novel or out-of-distribution reasoning tasks cannot expect test-time compute to compensate. On difficulty bin 5, accuracy hovers at 1β3% across all methods and all budgets (Figure 3 right, Figure 7 right). In the FLOPs-matched comparison, the bin 5 scaling line is essentially flat near 0β5% accuracy (Figure 9). The pretraining baseline with a ~14Γ larger model does no better on these problems β both approaches fail β but this means the entire compute-optimal framework provides zero benefit on the hardest fraction of the problem distribution. For applications where correctness on hard problems is the principal value driver (medical diagnosis, legal reasoning, advanced mathematics), the framework offers no solution.
This limitation is not a fixable bug but a fundamental property of the approach: test-time compute optimizes the selection and refinement of model outputs but cannot generate knowledge or reasoning capability that the model does not already possess. The paper's FLOPs-matched analysis (Section 7) shows that pretraining is strictly more effective than test-time compute on hard problems β but even pretraining to ~14Γ larger models barely moves bin 5 accuracy, suggesting that scaling either pretraining or test-time compute may hit diminishing returns on genuinely hard reasoning tasks.
What evidence exists in the paper. The difficulty-bin analyses in Figures 3 (right) and 7 (right) consistently show bin 5 performance near zero. The FLOPs-matched comparison in Figure 9 shows the bin 5 scaling line flat near 0β5%. The paper explicitly states this finding in Section 7: "test-time compute provides essentially zero benefit regardless of budget" on the hardest problems. The paper does not attempt to characterize what fraction of real-world deployment queries fall into this hardest bin.
Mitigation status. The paper acknowledges this limitation clearly in the Section 7 discussion, treating it as a finding rather than a failure: "test-time compute amplifies existing capability but does not create it." No mitigation is proposed because the limitation is inherent to the approach β the base model's capability is an upper bound that test-time compute cannot exceed. A practitioner's recourse is to use a stronger base model (with higher pass@1 on the target problem distribution), but this shifts cost to pretraining and may not be feasible for frontier-difficulty problems where even the largest models have near-zero pass@1.
Revisions and Search Are Studied Independently, Not Combined β the Natural Composed System Is Unevaluated
The assumption or constraint. The paper studies two complementary mechanisms β PRM-guided search (Section 5) and iterative revisions (Section 6) β but never combines them. Section 8 explicitly acknowledges this gap:
"we did not experiment with PRM tree-search techniques in combination with revisions"
The paper's own framework (Section 2) argues that these two axes are complementary modifications to the proposal distribution and the verifier respectively, and the difficulty-dependent analysis shows they have different strengths (revisions excel on easy problems, search excels on medium problems). Yet the experiments evaluate each mechanism in isolation, never testing whether combining them β using the revision model as the proposal distribution within beam search, or using PRM scores to guide which revisions to pursue β yields gains beyond either alone.
The consequence. The reported results represent a lower bound on what a fully integrated test-time compute system could achieve. A practitioner implementing both mechanisms would naturally want to combine them: generate candidate solutions with the revision model (which produces better proposals than the base model), then use PRM-guided search to select among them. The paper provides no guidance on how these would interact β whether the revision model's outputs cause distribution shift that degrades the PRM's scoring (the paper does note in Appendix J that the base-LM PRM underperforms on revision model outputs, requiring a separate revision-specific ORM), whether beam search over revision chains would over-optimize differently than beam search over base model outputs, or what difficulty-conditional policy would select the right combination.
The standalone results suggest that combining search and revisions could push the performance ceiling higher on medium-difficulty problems (bins 3β4), where both mechanisms individually provide benefit through different channels. The failure to evaluate this combination is a significant gap because it leaves the paper's core conceptual contribution β the proposal-verifier decomposition as complementary axes β without its most natural empirical validation.
What evidence exists in the paper. The paper documents the interaction challenge in Appendix J: Figure 15a shows that the PRM trained on base model outputs achieves lower accuracy when scoring revision model outputs (sequential + base-LM PRM: ~40% at 64 generations vs. sequential + revision ORM: ~42%). Figure 15b shows that including revision history in the ORM's context provides a small improvement. These results confirm that combining the two mechanisms is non-trivial and that distribution shift is a real concern, but they do not test a combined search+revision system. Section 8 lists this as future work but provides no preliminary results or design sketch.
Mitigation status. The limitation is acknowledged in Section 8 but not addressed in any experiment. The paper's contribution is establishing the framework and demonstrating each mechanism independently; combining them is explicitly deferred to future work. A practitioner wanting to deploy both mechanisms would need to resolve the distribution shift problem (training a PRM on revision model outputs, or finding a way to make the base PRM transfer), design a combined search strategy (beam search over revision chains? PRM-guided revision truncation?), and develop a new difficulty-conditional allocation policy β none of which are guided by the paper's current experiments.
The ~14Γ Larger Model Baseline Is Weakened by Parameter-Only Scaling and No Test-Time Compute
The assumption or constraint. The FLOPs-matched comparison in Section 7 compares PaLM 2-S* with compute-optimal test-time strategies against a model with approximately 14Γ more parameters. However, this larger model is scaled by increasing parameters only, holding training data fixed β following the LLaMA paradigm (Touvron et al., 2023) rather than Chinchilla-optimal scaling where data and parameters are scaled equally (Hoffmann et al., 2022). The authors state this explicitly:
"We choose this setting as it is representative of a canonical approach to scaling pretraining compute and leave the analysis of compute-optimal scaling of pretraining compute where the data and parameters are both scaled equally to future work."
Furthermore, the larger model uses only greedy decoding β no majority voting, no best-of-N, no search of any kind.
The consequence. Both choices weaken the pretraining baseline, making the comparison favorable to test-time compute. A Chinchilla-optimal model trained with 14Γ more total FLOPs (scaling both parameters and data according to the optimal ratio) would likely outperform the parameter-only-scaled model used in the comparison, potentially narrowing or reversing the reported advantages of test-time compute. Similarly, giving the larger model even a modest test-time compute budget β best-of-8 sampling with majority voting, for instance β would create a much stronger baseline that the paper never tests.
This matters for the paper's central claim that "test-time compute can substitute for pretraining." The substitution claim is more precisely stated as "test-time compute on a small model can substitute for a larger, suboptimally-trained model with no test-time compute on certain difficulty tiers." This is a weaker and more conditional statement. A practitioner deciding between investing in a larger model versus investing in test-time infrastructure for a smaller model needs to know the tradeoff against a reasonably optimized larger model β one trained with standard practices (either Chinchilla-optimal or at minimum using a standard recipe like the LLaMA models) and deployed with basic inference-time optimizations (even greedy decoding + best-of-8 is standard in production LLM serving).
What evidence exists in the paper. The paper explicitly acknowledges the parameter-only scaling choice in Section 7. The experimental setup for the larger model (greedy decoding, no test-time compute) is described in Section 7. No ablation tests the larger model with any inference-time strategy, even simple majority voting. No comparison is provided against a Chinchilla-optimal larger model. The paper frames this as future work.
Mitigation status. The limitation is acknowledged honestly but not addressed experimentally. The authors note that "compute-optimal scaling of pretraining compute" is future work. A reader comparing test-time compute against pretraining should reduce the reported advantages by some (unknown) margin to account for the weakened baseline. The paper's qualitative finding β that test-time compute is more effective on easy-to-medium problems and pretraining is more effective on hard problems β is likely robust to baseline improvements, but the quantitative claim of "14Γ parameter substitution" depends on the specific baseline weakness.
No Latency Analysis β Throughput-Optimal Strategies May Be Impractical for Interactive Applications
The assumption or constraint. The paper measures test-time compute exclusively in "generations" (number of complete solutions sampled), which is a reasonable proxy for total FLOPs but ignores wall-clock time and latency. Sequential revision strategies β which the compute-optimal policy selects for easy problems β are inherently serial: each revision depends on the previous one, meaning a chain of N sequential revisions takes approximately N times the wall-clock time of a single generation regardless of how much parallel hardware is available. Parallel best-of-N, by contrast, can execute all N samples simultaneously with sufficient batch capacity, keeping wall-clock time constant as N increases.
The paper does not discuss latency, does not report wall-clock times, and does not analyze the latency-throughput tradeoff.
The consequence. The compute-optimal policies derived in Figures 4 and 8 optimize for total FLOP efficiency (accuracy per generation) but may produce strategies that are latency-unacceptable for interactive applications. On easy problems (bin 1), the compute-optimal revision strategy at 64 generations uses a high sequential-to-parallel ratio because sequential revisions dominate on easy problems (Figure 7, right: bin 1 is insensitive to ratio, but bin 2 shows advantage for higher sequential ratios). A fully sequential chain of 64 revisions β each requiring a full model forward pass β would take approximately 64 times longer than a single parallel best-of-64 sample that achieves similar accuracy. For a chatbot, code completion tool, or real-time assistant, a 64Γ latency increase is likely unacceptable regardless of throughput efficiency.
The paper's cost model (Section 2.2) expresses total time as C_Overall = max(memory_costs, compute_costs) + overheads, which captures the benefits of overlapping but does not account for serial dependencies. The LCSF template maximizes overlapping within a block (loads and computes proceed concurrently) but does not parallelize across sequential revision steps, which are inherent data dependencies. A practitioner deploying TK for latency-sensitive applications needs to separately constrain the sequential-to-parallel ratio based on latency requirements, which the paper's compute-optimal policy does not do.
What evidence exists in the paper. The paper does not report wall-clock times for any experiment. The sequential-to-parallel ratio analysis (Figure 7) reports only accuracy at a given generation budget, not latency. The contrast with the FlashAttention literature β which emphasizes wall-clock speedup as the primary metric β is notable: FlashAttention-3 reports milliseconds of latency, while TK reports TFLOPS (a throughput metric). The persistent grid and L2 reuse optimizations (Section 3.3) reduce total kernel time but do not address the serial bottleneck of sequential revisions.
Mitigation status. Not addressed. The paper does not mention latency as a consideration, does not report wall-clock times, and does not suggest a method for incorporating latency constraints into the compute-optimal allocation policy. A practitioner would need to separately profile the latency of each strategy at each budget level and add a latency constraint to the optimization in Equation 1, which would reduce the achievable accuracy at a given latency budget β the paper provides no guidance on how much accuracy would be lost.
7. Implications and Future Directions
How This Work Changes the Landscape
ThunderKittens changes the GPU kernel development landscape by demonstrating that the apparent tension between simplicity and performance is largely an artifact of existing frameworks' design choices rather than a fundamental constraint. This is not a paradigm shift β the underlying hardware is unchanged β but it is a significant design reframing that shifts the field's default assumption about how kernel frameworks should expose hardware complexity.
The central reframing is this: prior work implicitly assumed that achieving peak GPU performance requires exposing the full configuration space to developers (CUTLASS's approach) or accepting compiler-limited performance for the sake of simplicity (Triton's approach). TK demonstrates that a third path exists β opinionated automation where the framework makes specific, well-motivated choices (16Γ16 tiles, three swizzled layouts, a single LCSF template, persistent grid launch) that prune the design space to configurations that are both hardware-efficient and composable into a general kernel skeleton. The evidence that this works is not incremental β TK's single 75-line GEMM kernel approaches the performance of CuBLAS's 689 MB of hand-tuned variants (Figure 7, Table 2), and TK's kernels outperform Triton baselines by 3Γ to 14Γ on state space models and linear attention (Figure 9) β but the contribution is the demonstration that the pruned space is large enough to cover a broad range of AI operations, not any single performance number.
This reframing resolves a standing contradiction in the GPU programming literature. On one side, CUTLASS and hand-tuned kernels demonstrated that peak performance requires fine-grained control over layouts, synchronization, and instruction scheduling β implying that any framework that abstracts these away must sacrifice performance. On the other side, Triton demonstrated that compiler-based approaches could achieve respectable performance on many workloads with much simpler code β implying that full control might be unnecessary. The conflict was whether these observations represented a fundamental tradeoff (simplicity vs. performance as a zero-sum game) or an artifact of specific abstraction choices. TK's results argue strongly for the latter: by being opinionated about which configurations to automate (layout swizzling, asynchronous pipelining, register allocation) and leaving only the genuinely workload-specific decisions to the developer (tile dimensions, occupancy, block ordering), TK achieves simplicity and performance simultaneously. The FlashAttention-3 profiling comparison (Table 4) makes this concrete β FA3's manual layout management produces 9.6-way bank conflicts, while TK's automated swizzling eliminates them entirely, showing that automation can be more performant than manual control when the automated decision space is well-chosen.
The paper also shifts the perceived bottleneck for kernel development. Prior to this work, the dominant narrative was that GPU kernel development is inherently a specialists-only activity because it requires understanding every detail of the hardware. TK provides evidence that this expertise barrier is partially self-inflicted by frameworks that expose unnecessary complexity. The claim that TK kernels were "written by a small academic team, including by undergraduates with no prior CUDA experience" (Section 4) is not just a brag β it is empirical evidence that the expertise required to write performant kernels can be dramatically lower when the framework makes the right opinionated choices. If this result generalizes beyond the Stanford team, it implies that kernel development for emerging AI architectures can be democratized, allowing architecture researchers to evaluate their designs at realistic performance rather than relying on slow, inexpert implementations.
Specific research directions become more attractive in light of TK's findings. The systematic study of shared memory layouts (Appendix C) β evaluating six candidates and pruning to three that combine hardware instruction compatibility with progressive bank conflict reduction β demonstrates that apparently complex configuration spaces can often be dramatically simplified through careful analysis of which degrees of freedom actually interact with hardware constraints. This suggests that other GPU programming challenges β warp scheduling, register allocation, cache bypass policies β might admit similar opinionated abstractions that have not been explored because the field assumed they required full developer control. Conversely, the direction of building ever-more-complex autotuning systems over large configuration spaces (which has been a major research investment in the Triton and TVM communities) becomes less attractive if the configuration space can be pruned to a handful of choices that manual or simple heuristic selection can navigate effectively.
The paper also implicitly weakens the case for domain-specific compilers as the primary path forward for AI kernels. Triton's inability to use TMA and WGMMA instructions (hardware features that account for a substantial fraction of the H100's performance advantage) is not a temporary limitation β it reflects a structural gap between compiler-based and embedded approaches that may persist across GPU generations as new hardware features are introduced. TK's embedded design allows it to wrap new instructions immediately (the tma::load_async and warpgroup::mma_AB interfaces), while compilers require backend support for each new instruction. This suggests that the optimum for performance-critical AI kernels may be embedded frameworks with opinionated abstractions rather than high-level compilers, with compilers reserved for less performance-sensitive operations where developer convenience dominates.
Follow-Up Research This Work Enables
Portability stress-test: Reimplement TK's abstractions on AMD MI300X. The paper's central claim β that a small set of abstractions is sufficient for high performance β is validated exclusively on NVIDIA H100 hardware. The MI300X is the natural stress-test: it uses AMD's Matrix Core units for tensor operations, has a different shared memory organization, and lacks TMA (relying on different asynchronous copy mechanisms). A strong follow-up would reimplement the three core TK abstractions (16Γ16 tiles, swizzled shared memory layouts, and an LCSF-equivalent template using AMD's asynchronous I/O primitives) on the MI300X, then benchmark the same suite of kernels (GEMM, attention, long convolution, Mamba-2) against AMD's ROCm libraries and Triton's AMD backend. The critical question is whether the specific opinionated choices β particularly the three-layout swizzling scheme and the 16Γ16 tile assumption β are architecture-invariant or NVIDIA-specific. If the same abstractions transfer with minimal modification, TK's design philosophy generalizes beyond a single vendor. If they require substantial rework, the paper's implicit claim of architecture-agnostic design (the footnote in Section 1) is weakened, and the community needs vendor-specific abstraction layers.
Ablation decomposition: Quantify the individual contribution of each TK abstraction. The current paper reports end-to-end performance of the full TK stack, making it impossible to assess whether the gains come primarily from automated layout swizzling, the LCSF async template, WGMMA instruction usage, register management, persistent grid launch, or L2-aware block ordering. A decomposition study would systematically disable individual abstractions and measure the performance impact: (a) replace TK's swizzled layouts with a naive row-major layout (quantifying the bank conflict penalty), (b) replace the LCSF template with a synchronous warp-level kernel that performs the same compute but without producer-consumer overlapping (quantifying the async pipeline benefit), (c) replace WGMMA instructions with older mma.sync instructions (quantifying the warp-group instruction penalty), (d) remove the asymmetric register allocation between producers and consumers (quantifying the occupancy impact), (e) disable persistent grid launch (quantifying setup cost), and (f) replace the 3D tiled block order with naive row-major traversal (quantifying L2 reuse). The sum of these individual contributions would likely exceed the total observed gain (because the abstractions interact β better layouts enable better overlapping, which increases the benefit of persistent launch), but the decomposition would identify which abstractions are load-bearing and which provide marginal benefit, guiding future framework designers on where to invest complexity budget.
Adaptive difficulty estimation: Online difficulty prediction during the solution process. The paper's difficulty estimation method (2048 samples per question, Section 3.2) is far too expensive for deployment. A natural extension would replace this offline, sample-intensive approach with online estimation that amortizes difficulty inference into the problem-solving process. A concrete experiment: train a lightweight classifier (perhaps a small distilled model or even a linear probe on the base model's intermediate representations) that takes only the question text as input and predicts the difficulty quintile. Then compare the compute-optimal policy's performance when using this cheap classifier versus the 2048-sample oracle, measuring both total FLOPs (including difficulty estimation cost) and accuracy. A more ambitious variant: use the first few samples of a best-of-N run to estimate difficulty online β generate 4-8 samples, score them with the PRM, use the score distribution (mean, variance, fraction above threshold) as features to predict which strategy would be optimal for the remaining budget, then dynamically switch strategies mid-inference. This would subsume difficulty estimation into the solution process, making the compute-optimal framework deployable without the 2048-sample overhead. The key metric is whether the dynamic strategy achieves accuracy comparable to the oracle difficulty policy while consuming similar total generations.
Combined search and revisions: PRM-guided tree search with a revision model as the proposal distribution. Section 8 acknowledges that TK "did not experiment with PRM tree-search techniques in combination with revisions." The natural next step is to use the revision model β which generates higher-quality candidates than the base model, as shown in Figure 6 β as the proposal distribution within beam search. At each step of the search tree, the revision model conditions on its own previous (potentially incorrect) partial solutions as context, and the PRM scores each candidate step to decide which beams to expand. This combines the revision model's local refinement capability with the PRM's global exploration guidance, targeting the medium-difficulty problems (bins 3β4) where both mechanisms individually provide benefit but neither is optimal. A concrete experiment: for each budget level, sweep the ratio of sequential revision depth to parallel beam width per difficulty bin, measuring accuracy against (a) pure PRM search, (b) pure revisions, and (c) the best of the two selected by the existing compute-optimal policy. The hypothesis is that the combined approach outperforms either alone on bins 3β4, with the improvement coming from the revision model generating better proposals that make the PRM's scoring more reliable (since proposals are closer to correct and thus less likely to exploit PRM errors). The distribution shift problem identified in Appendix J (Figure 15a) β where the base-LM PRM underperforms on revision model outputs β would need to be addressed, likely by training a PRM specifically on revision model outputs using the same Monte Carlo rollout procedure.
Verifier robustness: Training PRMs resistant to search-time over-optimization. The paper identifies verifier over-optimization as the primary bottleneck limiting test-time compute scaling (Section 5.3, Figures 3 and 29), but does not explore how to build more robust verifiers. A direct follow-up would train PRMs using data generated through the search process itself rather than from i.i.d. samples β that is, include beam search trajectories (which contain solutions that score highly under the current PRM but are incorrect) as negative examples in the training data. The Monte Carlo rollout procedure (Section 5.1) currently uses i.i.d. samples from the base model, which may not expose the kinds of adversarial solutions that search discovers. By iteratively collecting search-discovered false positives and retraining the PRM to correctly classify them (similar to adversarial training in image classifiers), the verifier should become more robust to the optimization pressure that beam search applies. A concrete experiment: run beam search with the initial PRM, collect solutions that the PRM ranks highly but are ground-truth incorrect, add these to the training set with low correctness labels, retrain the PRM, and measure whether the retrained PRM enables beam search to scale to higher budgets without the degradation seen in Figure 3 (right). The key metric is whether the beam search accuracy curve on easy problems (where over-optimization is worst) can be made monotonic with budget or whether the over-optimization problem has a more fundamental origin (e.g., the base model's output distribution contains solutions that are inherently ambiguous to score from intermediate steps alone).
Continuous and dynamic allocation policies instead of discrete difficulty bins. The five-quintile difficulty binning is a coarse discretization that assigns the same strategy to all questions within a bin, ignoring within-bin heterogeneity. A more sophisticated approach would learn a continuous policy function that maps any estimated difficulty score (the PRM's predicted average correctness, which is a continuous value between 0 and 1) to strategy hyperparameters (search algorithm, beam width, revision depth, parallel width) through an optimization over the training set. A concrete experiment: use Bayesian optimization or a simple neural network to learn ΞΈ = f(difficulty_score, budget) that maximizes expected accuracy on a validation set, then evaluate on the held-out test set. The hypothesis is that a continuous policy outperforms the discrete bin policy, particularly at bin boundaries where questions with very similar difficulty scores may currently receive very different strategies. A further extension would make the policy dynamic: start with a few parallel samples, use the PRM's scores on those samples to update the difficulty estimate in real-time, and switch strategies mid-inference if the updated estimate crosses a threshold. This connects naturally to the multi-armed bandit and Bayesian optimization literatures and would make the compute-optimal framework truly adaptive rather than relying on pre-computed difficulty bins.
Practical Applications and Downstream Use Cases
Production inference for emerging architectures at ML inference providers and trading firms. The paper states that TK kernels are "in production at ML inference providers and high-frequency trading firms alike" (Section 4, final paragraph). For inference providers serving diverse model architectures (beyond standard Transformer attention), TK's ability to produce performant kernels for linear attention (14Γ over FLA), state space models (>3Γ over Mamba-2 Triton), and long convolutions (up to 8.7Γ over PyTorch FFT) directly translates to lower latency and higher throughput per GPU, which are the dominant operational costs. Concretely, if a provider serves a model using polynomial-based linear attention and switches from FLA's Triton kernels to TK, they can serve approximately 14Γ more requests per GPU per second at the same batch size, or achieve the same throughput with 14Γ fewer GPUs, directly reducing infrastructure cost. For trading firms running latency-sensitive inference, the attention backward pass improvements (10β40% over FA3 at short sequences, Figure 8) reduce the critical path for gradient computation during online learning, enabling faster model updates in response to market changes.
Architecture research and evaluation with representative performance. A pervasive problem in ML architecture research is that new architectures (novel attention variants, SSM formulations, structured matrix approaches) are evaluated using suboptimal kernel implementations β often naive PyTorch or suboptimal Triton kernels β leading researchers to incorrectly conclude that promising architectures are too slow for practical use. The paper's 14Γ gap between TK and FLA for polynomial linear attention (Figure 9) illustrates the magnitude of this distortion: a researcher benchmarking linear attention using FLA's kernels would measure throughput that is 14Γ lower than what is achievable on the same hardware, potentially abandoning an architecture that is actually competitive with softmax attention when properly implemented. TK provides a framework where architecture researchers can implement their operations using PyTorch-like tile operations (Figure 2) and obtain near-peak performance without becoming GPU experts, enabling architecture evaluation at representative throughput. This is particularly valuable for academic groups without dedicated kernel engineering support β the paper's demonstration that undergraduates with no prior CUDA experience could write performant kernels in TK lowers the barrier to entry for architecture research that is bottlenecked by kernel quality.
Custom operation deployment in latency-critical applications with limited engineering resources. For small-to-medium engineering teams building applications that require custom AI operations (a specialized attention variant for document processing, a fused normalization layer for a custom architecture, an FFT-based filter for signal processing), the traditional options have been: (a) use PyTorch's built-in operations and accept suboptimal fusion and kernel launch overhead, (b) write raw CUDA kernels (requiring specialized expertise and long development cycles), or (c) use Triton (simpler, but with the instruction limitations documented in the paper). TK provides a fourth option: write the operation using tile-level PyTorch-like operations in the LCSF template, and obtain performance comparable to or exceeding hand-tuned kernels without managing layouts, bank conflicts, or synchronization primitives manually. The rotary positional encoding kernel (Appendix B.4, Figure 13) is a representative example β it is a simple element-wise operation that would be memory-bound in PyTorch (separate sin/cos loads, separate multiply and add kernels), but achieves high throughput in TK through fusion and TMA-based bulk transfers, outperforming popular Triton kernels. For a team deploying a custom architecture at scale, the development time savings (days rather than weeks to write and debug a performant kernel) compound with the throughput improvements over compiler-based alternatives.