Manuscript Offprint
arXiv:2609.01956FlashKAN: B-Spline KANs via Truncated Power Form
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
ABSTRACT
Kolmogorov-Arnold Networks (KANs) place learnable B-spline activations on network edges rather than fixed activations on nodes. The standard Cox-de Boor recursion evaluates these activations through sequential passes for degree- splines, consuming over 90% of forward-pass time.
FlashKAN replaces this recursion with the truncated power form, a classical result from approximation theory that expresses each uniform cubic B-spline as five terms at shifted knot positions. This paper makes three contributions: (1) a torch.compile-fused implementation that collapses these operations into a single GPU kernel, eliminating all recursion, span lookup, and scatter-gather operations; (2) a bounded-coordinate stabilization that clamps the normalized input to , preventing the catastrophic cancellation that historically motivated the Cox-de Boor recursion; and (3) a production-ready, open-source package (pip install flashkan) that serves as a drop-in replacement for existing KAN layers.
1 INTRODUCTION
The Kolmogorov-Arnold representation theorem (Kolmogorov, 1957) guarantees that any multivariate continuous function decomposes into univariate functions and addition. KANs (Liu et al., 2024) operationalize this result by placing a learnable activation on every edge. Each activation is a weighted sum of B-spline basis functions, which can be inspected, plotted, and in favorable cases symbolically recovered.
This interpretability carries a cost. The Cox-de Boor recursion (Cox, 1972; de Boor, 1971) evaluates B-spline basis functions through sequential passes for degree . For cubic splines (), three passes are needed, each depending on the output of the previous. Profiling shows that basis computation alone accounts for 91% of a KAN layer's forward-pass time (Table 1).
The recursion itself was not always the standard. In the 1940s, Schoenberg introduced splines as piecewise polynomials while smoothing ballistics data at Aberdeen Proving Ground (Schoenberg, 1946). His representation used truncated power functions as the foundational building block, and Curry and Schoenberg formalized B-splines through this basis (Curry & Schoenberg, 1947). The truncated power form is mathematically elegant: proofs of compact support, partition of unity, and smoothness follow directly. But early implementations on 1960s hardware suffered from numerical cancellation in the alternating sum of large powers, and the truncated power basis matrix is poorly conditioned (de Boor, 2001; Schumaker, 2007). Cox and de Boor independently developed the recursive algorithm (Cox, 1972; de Boor, 1971) as a numerically stable alternative, and de Boor's textbook (de Boor, 2001) established the recursion as the standard for the next five decades.
Prior work has pursued three strategies to reduce the cost of B-spline evaluation in KANs. Restructuring the Cox-de Boor recursion (Blealtan, 2024) reduces constant factors but preserves the sequential dependency. Precomputing per-span matrices (Coffman & Chen, 2025) eliminates the recursion but introduces data-dependent gather operations that fragment GPU memory access. Gaussian radial basis functions (Li, 2024) replace B-splines entirely with a single call, gaining speed but sacrificing compact support and automatic partition of unity (Gaussians are non-negative and , so smoothness is not the trade-off).
Most recently, Southworth et al. (2026) established a formal algebraic equivalence between spline KAN layers and multichannel MLPs with power-ReLU activations through a change-of-basis matrix. For uniform knots, this matrix is Toeplitz with entries matching the classical truncated power coefficients. Their work exploits this equivalence primarily for multilevel training: the spline basis enables complementary relaxation dynamics across refinement levels, yielding orders-of-magnitude improvements in PINN accuracy. They note that the non-recursive formulation is faster by a factor equal to the spline degree, but do not pursue compiler-level optimization, numerical stabilization, or a deployable implementation.
FlashKAN bridges the gap between algebraic equivalence and practical deployment. The contributions are:
-
Compiler-fused evaluation. For uniform cubic B-splines, the truncated power form reduces to five terms with fixed coefficients. torch.compile fuses all elementwise operations into a single GPU kernel, eliminating recursion, span lookup, and data-dependent memory access.
-
Bounded-coordinate stabilization. The raw truncated power sum suffers from catastrophic cancellation when the normalized input lies far outside the basis support . Clamping to this interval before evaluation bounds all intermediate terms and eliminates the cancellation, with no change to the mathematically correct output (since the B-spline is exactly zero outside its support). This addresses the numerical concern that historically motivated the Cox-de Boor recursion (de Boor, 2001).
-
Drop-in package. FlashKAN is available as an open-source Python package (pip install flashkan, MIT license) with identical API to standard KAN layers. Replacing Cox-de Boor evaluation requires changing one import.
2.1 STEP 1: DE CASTELJAU TO BERNSTEIN
Let be a sequence of control points and let be a scalar parameter. The linear interpolation (lerp) between two points is defined as . De Casteljau's algorithm (Farin, 2002) evaluates a degree- Bézier curve by applying lerp recursively: at each level, adjacent points are interpolated pairwise, reducing the number of points by one until a single value remains.
For the cubic case (), three levels of interpolation over produce the curve point . Expanding and collecting terms on each control point yields the Bernstein form:
The coefficients are row 3 of Pascal's triangle. Each interpolation level multiplies by . Three levels produce , which the binomial theorem expands into the Bernstein basis. The partition of unity follows immediately.
2.2 STEP 2: MATRIX FORM
Expanding each Bernstein polynomial into powers of separates the Bézier curve into three factors:
Table 1: Forward-pass cost breakdown for a KAN layer (256×784→64, MPS GPU). Basis computation dominates.
| Component | Time (ms) | Share |
|---|---|---|
| B-spline basis (Cox-de Boor, 3 passes) | 1.44 | 91% |
| Spline einsum (bases × weights) | 0.09 | 6% |
| Base function (SiLU + einsum) | 0.05 | 3% |
| Total forward | 1.58 | 100% |
The power vector depends on the input. The control points are free parameters. The basis matrix is a constant determined entirely by the degree: it encodes the binomial expansion of the Bernstein polynomials. This factorization is general. Different spline types share the same structure but differ only in . The input-dependent computation is always : four values, trivially cheap.
2.3 STEP 3: BÉZIER SEGMENTS TO B-SPLINES
A single cubic Bézier has four control points and one segment. It also has a fundamental limitation: global control. Moving any control point affects the entire curve. To model a function over a wide input range, multiple Bézier segments must be chained end to end, and at every joint three constraints must be enforced to ensure smoothness: continuity (the segments meet), continuity (their tangents match), and continuity (their curvatures agree). For two cubic segments with eight control points, these six constraints (three per joint, one joint) consume three degrees of freedom per segment, leaving only five free parameters out of eight. The constraint cost grows linearly with the number of segments: each new joint introduces three equations that lock three control points to their neighbors.
B-splines solve this problem by construction. Instead of stitching independent segments and imposing constraints after the fact, B-splines define basis functions that inherently satisfy smoothness across the full domain. Given a non-decreasing knot vector that partitions the parameter space into spans, the Cox-de Boor recursion (de Boor, 2001) defines basis functions of degree with automatic continuity at every interior knot:
Each basis function has compact support: is nonzero only over consecutive knot spans. Moving one control point changes the curve only within that local region. No constraints to manage. No degrees of freedom lost. Every control point is free.
For a uniform knot vector with spacing , each B-spline segment admits the same matrix factorization as Bézier, but with a different basis matrix:
The structure is identical; only the coefficients in change, encoding the smoothness constraints that B-splines satisfy by construction.
The recursion mirrors De Casteljau: same linear interpolations, but over knot intervals rather than . For , three sequential passes are needed. Each depends on the previous. Table 1 shows these passes consume 91% of a KAN layer's forward time.
2.4 STEP 4: COX-DE BOOR TO TRUNCATED POWER FORM
The same algebraic move that transformed De Casteljau into Bernstein polynomials applies to Cox-de Boor. For a uniform knot vector with constant spacing , expanding the recursion yields a finite difference of truncated power functions (Curry & Schoenberg, 1947; Schoenberg, 1946):
For cubic splines (), substituting produces:
where is the start of the -th support interval and . The coefficients are the fourth row of Pascal's triangle with alternating signs, divided by . This is the same coefficient stencil identified by Southworth et al. (2026) through their change-of-basis analysis.
The parallel between the two derivations is exact. De Casteljau is to Bernstein as Cox-de Boor is to the truncated power form. In both cases, an algorithm built from nested interpolations admits a closed-form expression built from binomial coefficients. The algorithm is sequential. The expression is parallel.
Computational properties. Eq. 7 inherits the matrix form's separation. The input-dependent part is : one subtraction and one multiply. The basis matrix is absorbed into the fixed coefficients . The control points are the learnable weights. No sequential dependency, no data-dependent memory access, only elementwise operations, all of which torch.compile fuses into a single kernel.
2.5 BOUNDED-COORDINATE STABILIZATION
The truncated power sum in Eq. 7 is exact in infinite precision. In finite-precision arithmetic, however, the alternating sum of five terms of size suffers catastrophic cancellation when lies far outside the support interval . The mathematically correct value is exactly zero for or , but floating-point evaluation produces a residual that grows as . This concern was precisely what motivated Cox and de Boor to develop the recursive algorithm (Cox, 1972; de Boor, 1971; 2001).
For KAN layers, the risk is concrete. Hidden-layer activations can drift outside the nominal grid domain during training, producing large values even when the original inputs are normalized. In mixed precision (float16), overflows once exceeds approximately 40.
The fix is simple. Before evaluating Eq. 7, clamp the normalized coordinate to the support:
and compute instead of . This is algebraically correct because for and , so clamping does not change any in-support value. But it bounds every intermediate term: the largest cubed quantity is at most for cubic splines, well within float16 range. The numerical error no longer grows with distance from the support.
The clamped evaluation adds one clamp operation per basis function, which torch.compile folds into the same fused kernel at no measurable cost.
2.6 INTEGRATION WITH KAN LAYERS
A KAN layer computes:
(9) where are learnable spline coefficients, are residual weights, and is SiLU. Replacing the Cox-de Boor evaluation of with the bounded truncated power form (Eq. 7 with Eq. 8) changes only the basis computation; weights, residual connections, and gradient flow remain identical.
3 RELATED WORK
KAN implementations. The original KAN (Liu et al., 2024) evaluates B-spline bases via the Cox-de Boor recursion. Efficient-KAN (Blealtan, 2024) restructures the computation into dense tensor operations but preserves the recursive dependency. FastKAN (Li, 2024) replaces B-splines entirely with Gaussian radial basis functions . Gaussians are non-negative and smooth, so the trade-off is not smoothness or sign but rather the loss of exact compact support (each Gaussian has global, though rapidly decaying, influence) and automatic partition of unity ( does not hold without explicit normalization).
Truncated power basis and change of basis. The truncated power representation of B-splines dates to Curry and Schoenberg (Curry & Schoenberg, 1947) and is presented in standard references (Schumaker, 2007; de Boor, 2001). Southworth et al. (2026) recently applied this equivalence to KANs, proving that spline KAN layers correspond to multichannel MLPs with power-ReLU activations through a linear change-of-basis matrix that, for uniform knots, is Toeplitz. Their primary contribution is a multilevel training framework that exploits the spline basis for complementary relaxation dynamics across refinement levels, yielding orders-of-magnitude improvements in PINN accuracy. FlashKAN builds on the same algebraic identity but pursues a different goal: compiler-level optimization for inference and training speed, numerical stabilization through bounded-coordinate evaluation (Section 2.5), and a production-ready package. The two contributions are complementary: FlashKAN could serve as the fast evaluation engine within a multilevel training loop.
Numerical stability of the truncated power form. De Boor (de Boor, 2001) demonstrated that the truncated power basis matrix is poorly conditioned relative to the B-spline basis, motivating the recursive algorithm. This conditioning concern applies when the alternating sum is evaluated far from the basis support, where terms of size cancel to produce zero. The bounded-coordinate stabilization (Section 2.5) eliminates this regime entirely, confining all intermediate values to a bounded range regardless of the input.
4 DISCUSSION
Why bounded-coordinate evaluation matters. The numerical concerns that motivated de Boor apply whenever the normalized coordinate takes large values. In a trained KAN, hidden-layer activations are not guaranteed to remain within the nominal grid domain. The bounded-coordinate variant (Section 2.5) is not merely defensive: it extends the truncated power form's domain of reliable operation from inputs near the grid to arbitrary inputs, including out-of-distribution data and intermediate activations in deep networks. Without this stabilization, the truncated power form inherits the exact failure mode that led to its historical abandonment.
Comparison with Gaussian RBF. FastKAN (Li, 2024) introduced Gaussians to accelerate KANs by replacing B-splines with a simpler basis. Gaussians are non-negative and infinitely differentiable, so the sacrifice is not smoothness or sign. The properties lost are exact compact support (each Gaussian has global, though rapidly decaying, influence) and automatic partition of unity (the sum is not guaranteed to equal one without explicit normalization). The truncated power form achieves the same structural simplification (a single broadcastable expression) while preserving both properties.
5 LIMITATIONS
The closed form in Eq. 6 applies only to uniform knot vectors. Non-uniform grids, which allow adaptive refinement based on input distribution, require per-span polynomial coefficients and reintroduce data-dependent indexing. The multilevel training framework of Southworth et al. (2026), which progressively refines the knot vector, is complementary: FlashKAN could serve as the fast evaluation engine at each refinement level, provided the grid remains uniform within each level. Extension to non-uniform grids is left for future work.
6 CONCLUSION
FlashKAN is the first KAN implementation to evaluate B-spline basis functions via the truncated power form. The mathematical identity dates to Curry and Schoenberg (Curry & Schoenberg, 1947), and Southworth et al. (2026) recently proved that spline KAN layers are algebraically equivalent to power-ReLU MLPs through this basis. FlashKAN turns that equivalence into a deployable system: bounded-coordinate stabilization eliminates the numerical cancellation that historically discouraged the truncated power form, torch.compile fuses the evaluation into a single GPU kernel, and the result is packaged as a drop-in replacement. FlashKAN is open-source (pip install flashkan, MIT license) and includes 26 unit tests covering basis correctness, partition of unity, compact support, smoothness, and gradient flow.
REFERENCES
Blealtan. An efficient implementation of Kolmogorov-Arnold network, 2024. URL https://github.com/Blealtan/efficient-kan.
Cale Coffman and Lizhong Chen. MatrixKAN: Parallelized Kolmogorov-Arnold network. arXiv preprint arXiv:2502.07176, 2025.
Maurice G Cox. The numerical evaluation of B-splines. Journal of the Institute of Mathematics and its Applications, 10(2):134–149, 1972.
Haskell B Curry and Isaac J Schoenberg. On spline distributions and their limits: The Pólya distribution functions. Bulletin of the American Mathematical Society, 53:1114, 1947. Abstract 380t.
Carl de Boor. Subroutine package for calculating with B-splines. Technical Report LA-4728-MS, Los Alamos Scientific Laboratory, 1971.
Carl de Boor. A Practical Guide to Splines. Springer-Verlag, New York, revised edition, 2001.
Gerald Farin. Curves and Surfaces for CAGD: A Practical Guide. Morgan Kaufmann, 5th edition, 2002.
Andrey N Kolmogorov. On the representation of continuous functions of many variables by superposition of continuous functions of one variable and addition. Doklady Akademii Nauk SSSR, 114 (5):953–956, 1957.
Ziyao Li. Kolmogorov-Arnold networks are radial basis function networks. arXiv preprint arXiv:2405.06721, 2024.
Ziming Liu, Yixuan Wang, Sachin Vaidya, Fabian Ruehle, James Halverson, Marin Soljačić, Thomas Y Hou, and Max Tegmark. Kan: Kolmogorov-arnold networks. arXiv preprint arXiv:2404.19756, 2024.
Isaac J Schoenberg. Contributions to the problem of approximation of equidistant data by analytic functions, Parts A and B. Quarterly of Applied Mathematics, 4:45–99, 112–141, 1946.
Larry L Schumaker. Spline Functions: Basic Theory. Cambridge University Press, 3rd edition, 2007.
Ben S Southworth, Jonas A Actor, Graham Harper, and Eric C Cyr. Multilevel training for Kolmogorov-Arnold networks. arXiv preprint arXiv:2603.04827, 2026.