Skip to content
AI360Xpert
Beta

Kolmogorov-Arnold Networks

Kolmogorov-Arnold Networks replace static node activations with learnable univariate spline functions on every network edge, making deep models mathematically transparent and accurate.

Kolmogorov-Arnold Networks place learnable 1D spline functions on network edges with summation on nodes, unlocking symbolic interpretability
Kolmogorov-Arnold Networks place learnable 1D spline functions on network edges with summation on nodes, unlocking symbolic interpretability

Why Does This Exist?

For nearly four decades, the Multi-Layer Perceptron (multi-layer-perceptron) has served as the foundational bedrock of deep learning, mathematically justified by the universal-approximation theorem. In an MLP, every incoming signal is multiplied by a static linear weight matrix WW along an edge, summed at the node (neuron), and passed through a fixed, non-linear activation function σ\sigma (such as ReLU, GELU, or SiLU).

Despite their dominance, MLPs suffer from two fundamental weaknesses in scientific modeling and interpretability:

  1. The Curse of Dimensionality in Approximation: To approximate high-frequency, complex multi-dimensional functions f(x1,…,xd)f(x_1, \dots, x_d), standard MLPs require exponentially growing parameter counts (O(ϵ−d)O(\epsilon^{-d})). They struggle to capture intricate local non-linearities without ballooning in size.
  2. Total Black-Box Opacity: The weights in an MLP are uninterpretable matrix entries. Once trained, an MLP cannot tell an astrophysicist, fluid dynamicist, or pharmacologist what algebraic relationship it learned. It is nearly impossible to extract closed-form symbolic laws from an MLP's entangled weight space.

Kolmogorov-Arnold Networks (KANs) flip this architecture completely. Inspired by the Kolmogorov-Arnold representation theorem, KANs have no linear weights on edges and no fixed activation functions on nodes. Instead, the nodes simply compute addition (∑\sum), while the edges carry learnable, univariate B-spline curves.

By placing the non-linear learning mechanism directly on the 1D connections, KANs achieve orders of magnitude lower approximation error on scientific equations, resist catastrophic forgetting, and allow researchers to convert trained neural networks directly into transparent mathematical formulas.

Think of It Like This

A sound mixing console with dynamic analog tone curves

Imagine a recording studio mixing console receiving inputs from a drum kit and a bass guitar.

In a standard MLP mixing board:

  • Every incoming cable has a simple volume slider that scales the signal up or down by a linear multiplier (w⋅xw \cdot x).
  • All cables plug into a single summing junction inside the channel strip.
  • The junction feeds the combined sum through a single, fixed distortion pedal—like an on/off clipping diode (ReLU)—that applies the exact same blunt threshold to the mixed audio.
  • If you want nuanced equalization, you must stack dozens of these slider-plus-pedal boards in series.

In a KAN mixing board:

  • The volume sliders and distortion pedals are removed completely.
  • Instead, every single connecting cable passes through its own independent graphic equalizer with 10 movable frequency faders (a learnable 1D B-spline curve).
  • The drum cable can be sculpted into a customized scooped curve, while the bass cable is simultaneously sculpted into a warm sinusoidal curve.
  • The channel junction simply adds the sculpted audio streams together.

Because each cable sculpts its own sound curve independently, you need far fewer channels, and an engineer can look directly at the fader curve on the cable to see exactly what transformation occurred.

How It Actually Works

Splines on Edges, Grid Refinement, and Symbolic Distillation

1. The Kolmogorov-Arnold Representation Theorem

In 1957, mathematicians Andrey Kolmogorov and Vladimir Arnold proved that any multivariate continuous function f:[0,1]n→Rf: [0, 1]^n \to \mathbb{R} can be expressed as a finite composition of continuous 1D functions and addition:

f(x1,…,xn)=∑q=12n+1Φq(∑p=1nϕq,p(xp))f(x_1, \dots, x_n) = \sum_{q=1}^{2n+1} \Phi_q \left( \sum_{p=1}^n \phi_{q,p}(x_p) \right)

While Kolmogorov's original theorem established that 2 layers of functions suffice, the original functions ϕq,p\phi_{q,p} could be non-smooth or fractal. Modern KANs generalize this concept into deep arbitrary-depth networks with smooth, differentiable parameterizations.

2. KAN Layer Formulation

A KAN layer with ninn_{\text{in}} inputs and noutn_{\text{out}} outputs is defined by a matrix of 1D functions Φ={ϕq,p}\mathbf{\Phi} = \{\phi_{q,p}\}, where p∈{1,…,nin}p \in \{1, \dots, n_{\text{in}}\} and q∈{1,…,nout}q \in \{1, \dots, n_{\text{out}}\}:

yq=∑p=1ninϕq,p(xp)y_q = \sum_{p=1}^{n_{\text{in}}} \phi_{q,p}(x_p)

In matrix form: y=Φ(x)\mathbf{y} = \mathbf{\Phi}(\mathbf{x}). A deep KAN network is simply the composition of LL such functional layers:

KAN(x)=(ΦL−1∘ΦL−2∘⋯∘Φ0)(x)\text{KAN}(\mathbf{x}) = (\mathbf{\Phi}_{L-1} \circ \mathbf{\Phi}_{L-2} \circ \dots \circ \mathbf{\Phi}_0)(\mathbf{x})

3. B-Spline Parameterization

Each 1D activation function ϕ(x)\phi(x) on an edge is parameterized as the sum of a smooth residual base function and a flexible linear combination of B-splines:

ϕ(x)=wb b(x)+ws spline(x)\phi(x) = w_b \, b(x) + w_s \, \text{spline}(x)

where:

  • The base function b(x)=SiLU(x)=x1+e−xb(x) = \text{SiLU}(x) = \frac{x}{1 + e^{-x}} ensures stable gradient flow during early training.
  • The spline term is expanded over GG local B-spline basis functions of order kk (typically cubic, k=3k=3) defined across a uniform knot grid (t0,t1,…,tG+k)(t_0, t_1, \dots, t_{G+k}): spline(x)=∑i=1G+kciBi(x)\text{spline}(x) = \sum_{i=1}^{G+k} c_i B_i(x)
  • The spline coefficients cic_i and scaling parameters wb,wsw_b, w_s are optimized directly via backpropagation.

4. Grid Extension and Symbolic Discovery

KANs introduce two features impossible in MLPs:

  • Grid Extension (Coarse-to-Fine Training): One can train a KAN on a coarse knot grid (e.g., G=5G = 5 knots) until convergence, and then interpolate the learned splines onto a finer grid (G=20G = 20 knots) with zero loss of accuracy. This prevents catastrophic forgetting and allows continuous accuracy scaling without restarting training.
  • Symbolic Distillation: By applying L1L_1 regularization to the spline amplitudes, unimportant edges are pruned. The remaining active 1D spline curves are fitted against a library of mathematical primitives (such as sin⁡(x),x2,exp⁡(x),x,log⁡(x)\sin(x), x^2, \exp(x), \sqrt{x}, \log(x)). A complex deep KAN collapses into an exact, human-readable scientific formula.

Worked Example

Consider a 1-layer KAN taking 2 inputs (x1,x2)(x_1, x_2) to produce 1 output yy:

y=ϕ1(x1)+ϕ2(x2)y = \phi_1(x_1) + \phi_2(x_2)

Let the knot grid for both edges be defined on [−1.0,0.0,1.0][-1.0, 0.0, 1.0] with 3 linear B-spline hat basis functions (k=1k=1):

  • B1(x)=max⁡(0,1−∣x−(−1.0)∣/1.0)B_1(x) = \max(0, 1 - |x - (-1.0)| / 1.0) (centered at −1.0-1.0)
  • B2(x)=max⁡(0,1−∣x−0.0∣/1.0)B_2(x) = \max(0, 1 - |x - 0.0| / 1.0) (centered at 0.00.0)
  • B3(x)=max⁡(0,1−∣x−1.0∣/1.0)B_3(x) = \max(0, 1 - |x - 1.0| / 1.0) (centered at 1.01.0)

Suppose optimization yields the following spline coefficients (wb=0,ws=1w_b = 0, w_s = 1):

  • Edge 1 coefficients: c(1)=[1.0,0.0,1.0]\mathbf{c}^{(1)} = [1.0, 0.0, 1.0] (approximating a parabolic curve x2x^2)
  • Edge 2 coefficients: c(2)=[−1.0,0.0,1.0]\mathbf{c}^{(2)} = [-1.0, 0.0, 1.0] (approximating an identity line xx)

Now evaluate input x=(0.5,−0.4)\mathbf{x} = (0.5, -0.4):

Evaluate Edge 1 at x1=0.5x_1 = 0.5:

x1x_1 lies in the interval [0.0,1.0][0.0, 1.0]:

B1(0.5)=0.0B_1(0.5) = 0.0 B2(0.5)=1.0−∣0.5−0.0∣=0.50B_2(0.5) = 1.0 - |0.5 - 0.0| = 0.50 B3(0.5)=1.0−∣0.5−1.0∣=0.50B_3(0.5) = 1.0 - |0.5 - 1.0| = 0.50

Spline output:

ϕ1(0.5)=c1B1+c2B2+c3B3=(1.0×0.0)+(0.0×0.50)+(1.0×0.50)=0.500\phi_1(0.5) = c_1 B_1 + c_2 B_2 + c_3 B_3 = (1.0 \times 0.0) + (0.0 \times 0.50) + (1.0 \times 0.50) = 0.500

Evaluate Edge 2 at x2=−0.4x_2 = -0.4:

x2x_2 lies in the interval [−1.0,0.0][-1.0, 0.0]:

B1(−0.4)=1.0−∣−0.4−(−1.0)∣=1.0−0.6=0.40B_1(-0.4) = 1.0 - |-0.4 - (-1.0)| = 1.0 - 0.6 = 0.40 B2(−0.4)=1.0−∣−0.4−0.0∣=1.0−0.4=0.60B_2(-0.4) = 1.0 - |-0.4 - 0.0| = 1.0 - 0.4 = 0.60 B3(−0.4)=0.0B_3(-0.4) = 0.0

Spline output:

ϕ2(−0.4)=c1B1+c2B2+c3B3=(−1.0×0.40)+(0.0×0.60)+(1.0×0.0)=−0.400\phi_2(-0.4) = c_1 B_1 + c_2 B_2 + c_3 B_3 = (-1.0 \times 0.40) + (0.0 \times 0.60) + (1.0 \times 0.0) = -0.400

Summation at Node:

y=ϕ1(x1)+ϕ2(x2)=0.500+(−0.400)=0.100y = \phi_1(x_1) + \phi_2(x_2) = 0.500 + (-0.400) = 0.100

The network computed the combined non-linear transformation directly through piecewise spline interpolation on each edge.

Code

The following script implements a standalone, vectorized 1D B-spline basis expansion and a single KAN functional layer in PyTorch:

import torchimport torch.nn as nn

class LinearBSplineBasis(nn.Module):    """Linear B-spline basis expansion over a uniform 1D grid."""
    def __init__(self, num_knots: int = 5, v_min: float = -1.0, v_max: float = 1.0):        super().__init__()        self.knots = torch.linspace(v_min, v_max, num_knots)        self.step = (v_max - v_min) / (num_knots - 1)
    def forward(self, x: torch.Tensor) -> torch.Tensor:        # x: (Batch, In_Dim) -> returns: (Batch, In_Dim, Num_Knots)        x_exp = x.unsqueeze(-1)        # Triangular hat basis: max(0, 1 - |x - knot| / step)        basis = torch.clamp(1.0 - torch.abs(x_exp - self.knots) / self.step, min=0.0)        return basis

class KANLayer(nn.Module):    """Single KAN layer with learnable spline coefficients on edges."""
    def __init__(self, in_features: int, out_features: int, num_knots: int = 5):        super().__init__()        self.in_features = in_features        self.out_features = out_features        self.spline_basis = LinearBSplineBasis(num_knots=num_knots)        # Learnable spline coefficients: (out, in, knots)        self.coefficients = nn.Parameter(            torch.randn(out_features, in_features, num_knots) * 0.1        )
    def forward(self, x: torch.Tensor) -> torch.Tensor:        # basis: (Batch, In_Dim, Num_Knots)        basis = self.spline_basis(x)        # Evaluate each edge spline: sum over knots        # output: (Batch, Out_Dim)        spline_vals = torch.einsum("bik,oik->bo", basis, self.coefficients)        return spline_vals

# Seed and test with 2 inputs, 1 outputtorch.manual_seed(42)kan = KANLayer(in_features=2, out_features=1, num_knots=5)
test_input = torch.tensor([[0.5, -0.4], [0.0, 0.0]], dtype=torch.float32)output = kan(test_input)
print(f"Input coordinates:\n{test_input.numpy()}")print(f"KAN outputs: {output.detach().numpy().round(4).flatten()}")# -> Input coordinates:# -> [[ 0.5 -0.4]# ->  [ 0.   0. ]]# -> KAN outputs: [-0.0157  0.0354]

Watch Out For

Extreme memory footprint and low GPU utilization on large datasets

The primary engineering trap when evaluating KANs is attempting to drop them as direct 1-to-1 replacements for dense MLPs in giant language models. While an MLP layer is a single GEMM (General Matrix Multiply) instruction that hits 90%+ of hardware Tensor Core peak FLOPs, evaluating B-splines across GG knots per edge requires materializing high-dimensional intermediate spline tensors (B,L,Din,G)(B, L, D_{\text{in}}, G). This incurs massive memory bandwidth pressure and slow CUDA kernel dispatch. KANs excel in scientific ML, symbolic equation discovery, and low-dimensional physical modeling, but remain orders of magnitude slower than MLPs for large-scale NLP pretraining.

The Quick Version

  • Kolmogorov-Arnold Networks replace linear weights on edges with learnable 1D B-spline curves.
  • Network nodes compute simple addition, eliminating fixed node activation functions (like ReLU or GELU).
  • KANs scale favorably on scientific function approximation, avoiding the curse of dimensionality seen in MLPs.
  • Coarse-to-fine grid extension allows increasing spline resolution without retraining from scratch.
  • Pruned KANs can be fitted directly to closed-form symbolic formulas, rendering the model fully interpretable.