wikillm

Paper · 2024-04-30 · cs.LG, cond-mat.dis-nn, cs.AI, stat.ML

KAN: Kolmogorov-Arnold Networks

Kolmogorov-Arnold Networks (KANs) replace an MLP's linear weights and fixed node activations with learnable univariate B-spline functions on edges; nodes only sum. Grids can be refined without retraining, and pruning yields small, readable formulas. Authors report higher accuracy than MLPs with far fewer parameters on small function-fitting, PDE and science tasks.

Multi-layer perceptron (MLP)Learnable activation functionsNeural-symbolic integrationarchitectureinterpretabilitysymbolic-regression

arXivPDFCodeMarkdown13 min read

AI-compiled by claude-haiku-5-5 on 2026-10-19, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

A standard neural network stacks layers of weights followed by a fixed squashing function on each neuron. KANs move the learnable part. Every connection between two neurons carries its own smooth curve, and the neurons only add up what arrives. Each curve is built from small pieces joined smoothly, so it can bend to match the data.

The payoff claimed is that a small KAN can fit a function that a much larger standard network needs many more parameters for. Because each curve is simple to inspect, the network can also be trimmed down and its curves matched to familiar functions such as sine or exponential. The authors test this mostly on small mathematics and physics problems, so it is not yet shown for large models.

TL;DR

KANs use learnable spline curves on edges instead of linear weights and fixed node activations §2.2. The authors report that much smaller KANs match or beat larger MLPs on function fitting and PDE solving, with faster scaling-law exponents §3.1, §3.4. Their pruning and symbolic-fitting tools recover compact formulas in small science examples §4. All results are author-reported and on small problems §6.

Problem

MLPs are the default approximator in deep learning, but they consume most non-embedding parameters in transformers and are hard to read without extra tools §1. Splines are accurate in low dimensions and easy to refine, but suffer the curse of dimensionality because they do not exploit compositional structure. MLPs handle high dimensions better but approximate univariate functions less accurately §1.

The Kolmogorov-Arnold representation writes a multivariate continuous function as a sum of univariate functions §2.1. Taken literally, its two-layer, width-(2n+1) form can need non-smooth inner functions that are hard to learn, so the authors generalise it to arbitrary width and depth §2.1, §2.2. They assume the target has a smooth representation of this kind §2.3.

Method

Overview. A KAN has a shape [n_0, n_1, ..., n_L]. Between layers l and l+1 there is one learnable univariate function per pair of neurons, with no linear weight matrix §2.2. Each neuron outputs the sum of the post-activations of its incoming edges §2.2. The stacked form is the composition of KAN layers §2.2.

  1. Edge function. Each edge applies phi(x) = w_b * b(x) + w_s * spline(x). Here b(x) = silu(x) = x / (1 + e^(-x)) in most cases, and spline(x) is a linear combination of B-spline basis functions B_i on a grid with trainable coefficients c_i §2.2.
  2. Node. Node j in layer l+1 takes the sum over its incoming edge outputs, with no further nonlinearity §2.2.
  3. Initialisation. Each edge starts with w_s = 1 and a near-zero spline, obtained from small Gaussian coefficients (typically standard deviation 0.1, given in a footnote). w_b uses Xavier initialisation §2.2.
  4. Grid update. Each spline grid is re-set from the input activations seen during training, because activations can leave a fixed interval §2.2.
  5. Grid extension. To make a trained KAN more accurate, each spline's coarse grid is replaced by a finer one. The new coefficients come from a least-squares fit to the coarse spline over sampled inputs. This is applied to every spline independently and does not need retraining from scratch §2.4.
  6. Sparsification. The loss is the prediction loss plus a regulariser lambda * (mu_1 * sum of |Phi_l|_1 + mu_2 * sum of S(Phi_l)), where |phi|_1 is the mean absolute edge output over the inputs, and S is an entropy term over the normalised edge magnitudes of each layer. mu_1 = mu_2 = 1 is usual §2.5.1.
  7. Pruning. A node is kept only if its largest incoming and its largest outgoing edge magnitude both exceed a threshold, theta = 10^-2 by default §2.5.1.
  8. Symbolification. An edge can be fixed to a known function f. The paper fits y ≈ c f(a x + b) + d from sampled pre- and post-activations, using a grid search over a, b and linear regression for c, d §2.5.1.
  9. Human-in-the-loop workflow. The authors demonstrate training a [2,5,1] KAN with sparsity, pruning to [2,1,1], fixing the edges to symbolic functions, then training only the affine parameters §2.5.2.
Pseudocode
# KAN forward pass: one learnable edge function per input-output pair  [§2.2]
# Input:  x of shape (B, n_0); layers with shapes [n_0, n_1, ..., n_L]
# Output: y of shape (B, n_L)

def kan_forward(x, layers):
    for layer in layers:
        # every edge applies its own univariate function  [§2.2]
        edge_outputs = edge_function(layer, x)    # (B, n_in, n_out)
        # nodes only sum the incoming edge outputs  [§2.2]
        x = edge_outputs.sum(axis=1)              # (B, n_out)
    return x
Pseudocode
# Learnable edge function  [§2.2]
# phi(x) = w_b * b(x) + w_s * spline(x), with b(x) = silu(x)  [§2.2]

def edge_function(edge, x):
    # residual-style basis term, similar to a skip connection  [§2.2]
    base = edge.w_b * silu(x)
    # cubic B-spline on G intervals with trainable coefficients c_i  [§2.2]
    spline = sum(c_i * B_i(x) for c_i, B_i in edge.spline_terms)
    return base + edge.w_s * spline
Pseudocode
# Grid extension: refit a finer spline to a coarse one  [§2.4]
# Coarse spline has G1 intervals with coefficients c; target grid has G2

def extend_grid(coarse_coefs, coarse_basis, fine_basis, samples):
    # values of the coarse spline on the sampled inputs  [§2.4]
    targets = coarse_basis(samples) @ coarse_coefs
    # least-squares fit of the fine spline to those values  [§2.4]
    fine_coefs = least_squares(fine_basis(samples), targets)
    return fine_coefs
Pseudocode
# Sparsity-regularised training objective  [§2.5.1]
# mu_1 = mu_2 = 1 usually; lam sets the overall strength  [§2.5.1]

def total_loss(predictions, targets, layers, lam, mu_1, mu_2):
    loss = prediction_loss(predictions, targets)
    for layer in layers:
        # L1 of a layer: sum of mean |phi| over its edges  [§2.5.1]
        l1 = layer.sum_of_mean_abs_edge_outputs()
        # entropy of the normalised edge magnitudes  [§2.5.1]
        entropy = layer.normalised_entropy()
        loss = loss + lam * (mu_1 * l1 + mu_2 * entropy)
    return loss
Pseudocode
# Node pruning after sparsification  [§2.5.1]
# theta = 10^-2 by default  [§2.5.1]

def prune_nodes(layers, theta):
    for each node i in layer l:
        # incoming score: largest mean |phi| over its incoming edges  [§2.5.1]
        incoming = max(mean_abs(edge(l - 1, i, k)) for k)
        # outgoing score: largest mean |phi| over its outgoing edges  [§2.5.1]
        outgoing = max(mean_abs(edge(l + 1, j, i)) for j)
        # keep the node only if both scores exceed theta  [§2.5.1]
        keep = incoming > theta and outgoing > theta

Parameter count. For depth L, equal width N, spline order k and G intervals, a KAN has O(N^2 L (G + k)) parameters, against O(N^2 L) for an MLP of the same depth and width. The authors argue that KANs usually need a much smaller N §2.2.

Theory. The approximation theorem gives a bound in the grid size G whose residual rate does not depend on the input dimension, provided the representation is smooth §2.3. This gives an expected scaling exponent of k + 1, which is 4 for cubic splines §2.3. Other theories predict (k+1)/d, (k+1)/2 or m/2 for comparable settings §2.3.

Hyperparameters

NameValueWhereNotes
spline order k3 (cubic), "usually"§2.2 §2.3 §4.3the paper also says too high k may oscillate §2.3
grid intervals Gstarts at 3 and is increased§2.4 §3.1 §3.2 §3.3toy sweep reaches 1000 §2.4; see Pitfalls for failures at large G
grid extension schedulenext grid level every 200 LBFGS steps§2.4 §3.1 §3.2 §3.3sweep G = {3, 5, 10, 20, 50, 100, 200} in §3.2 and §3.3; {..., 500, 1000} in §3.1
residual basis b(x)silu§2.2"in most cases"
w_s initial value1§2.2code differs, see Paper vs code
w_b initial valueXavier§2.2exact distribution not stated
spline coefficient initc_i ~ N(0, sigma^2), sigma = 0.1 typical§2.2 footnote
trainable scales w_b, w_strainable§2.2kept for magnitude control, redundant in principle
optimiserLBFGS, no switch to Adam or boosting§3.1the authors call this the vanilla setup
training steps (toy scaling)1800 total for KAN and MLP§3.1
random seeds3 per combination§3.2 §3.3
sparsification lambda10^-2 or 10^-3§3.2 §3.3
mu_1, mu_21§2.5.1"usually"
node pruning theta10^-2§2.5.1
visualisation transparencytanh(beta * A), beta = 3§2.5.1display only
toy grid-extension KAN[2,5,1], then [2,1,1]§2.41000 training samples §2.4
special-function KANswidth 5, depths {2,...,6}§3.2
special-function MLPswidth 5 or 100, depths {2,...,6}§3.2
Feynman KANswidth 5, depths {2,...,6}§3.3
Feynman MLPswidth 5, depths {2,...,6}, activation Tanh, ReLU or SiLU§3.3
PDE sample sizesn_i = 10000 interior, n_b = 800 boundary§3.4same for KAN and MLP
PDE loss weight alpha0.01§3.4
PDE optimiser and learning ratenot stated§3.4
knot-theory KAN[17,1,14], G = 3, k = 3§4.3
Anderson-localisation KANs[2,1], [4,2,1,1] and larger, per example§4.4the authors choose shapes per case

Results

Author-reported. Each setting is described in the same order as the paper. "Best" is the table entry the paper reports, not a mean over seeds.

Toy scaling (§3.1, fig. 3.1). Five smooth functions with known KAN shapes, including J_0(20x) and exp(sin(pi x) + y^2). KAN test RMSE follows the predicted exponent 4 closely, while MLPs converge more slowly and plateau. The high-dimensional exp((1/100) sum sin^2(pi x_i / 2)) example is shown with a [100,1,1] KAN as the true shape.

Special functions (§3.2, tab. 1). Fifteen special functions from scipy.special as 2-input functions. The "minimal" column is the smallest pruned KAN with test RMSE below 10^-2. The "best" column is the lowest-loss pruned KAN. MLP is the best MLP reported.

FunctionMinimal KAN shapeMinimal RMSEBest KAN shapeBest RMSEMLP RMSE
Jacobian elliptic ellipj(x,y)[2,2,1]7.29e-3[2,3,2,1,1,1]1.33e-46.48e-4
ellipkinc(x,y)[2,2,1,1]1.00e-3[2,2,1,1,1]1.24e-45.52e-4
ellipeinc(x,y)[2,2,1,1]8.36e-5[2,2,1,1]8.26e-53.04e-4
Bessel first kind jv(x,y)[2,2,1]4.93e-3[2,3,1,1,1]1.64e-35.52e-3
Bessel second kind yv(x,y)[2,3,1]1.89e-3[2,2,2,1]1.49e-53.45e-4
modified Bessel second kind kv(x,y)[2,1,1]4.89e-3[2,2,1]2.52e-51.67e-4
modified Bessel first kind iv(x,y)[2,4,3,2,1,1]9.28e-3[2,4,3,2,1,1]9.28e-31.07e-2
associated Legendre lpmv(0,x,y)[2,2,1]5.25e-5[2,2,1]5.25e-51.74e-2
associated Legendre lpmv(1,x,y)[2,4,1]6.90e-4[2,4,1]6.90e-41.50e-3
associated Legendre lpmv(2,x,y)[2,2,1]4.88e-3[2,3,2,1]2.26e-49.43e-4
spherical harmonics (m=0,n=1)[2,1,1]2.21e-7[2,1,1]2.21e-71.25e-6
spherical harmonics (m=1,n=1)[2,2,1]7.86e-4[2,3,2,1]1.22e-46.70e-4
spherical harmonics (m=0,n=2)[2,1,1]1.95e-7[2,1,1]1.95e-72.85e-6
spherical harmonics (m=1,n=2)[2,2,1]4.70e-4[2,2,1,1]1.50e-51.84e-3
spherical harmonics (m=2,n=2)[2,2,1]1.12e-3[2,2,3,2,1]9.45e-56.21e-4

The paper reports the KAN as lower than the MLP in every row §3.2. Whether the table row is the best over seeds and depths, or a fixed choice, is not stated.

Feynman equations (§3.3, tab. 2). Two-or-more-variable equations from the Feynman dataset §3.3. The paper's example equation draws its inputs from (-1, 1) §3.3. Human-constructed KAN shapes are the paper's hand-written representations. Pruned columns come from the auto-pruning pipeline, and the MLP column is the best MLP. Bold marks the lowest loss of the four per row, as in the paper. Losses are test RMSE.

EquationHuman shapePruned, RMSE < 1e-2Pruned, lowest lossHuman lossPruned lossUnpruned lossMLP loss
I.6.2[2,2,1,1][2,2,1][2,2,1,1]7.66e-52.86e-54.60e-51.45e-4
I.6.2b[3,2,2,1,1][3,4,1][3,2,2,1,1]1.22e-34.45e-41.25e-37.40e-4
I.9.18[6,4,2,1,1][6,4,1,1][6,4,1,1]1.48e-38.62e-36.56e-31.59e-3
I.12.11[2,2,2,1][2,2,1][2,2,1]2.07e-31.39e-39.13e-46.71e-4
I.13.12[2,2,1][2,2,1][2,2,1]7.22e-34.81e-32.72e-31.42e-3
I.15.3x[2,2,1,1][2,1,1][2,2,1,1,1]7.35e-31.58e-31.14e-38.54e-4
I.16.6[2,2,2,2,2,1][2,2,1][2,2,1]1.06e-31.19e-31.53e-36.20e-4
I.18.4[2,2,2,1,1][2,2,1][2,2,1]3.92e-41.50e-41.32e-33.68e-4
I.26.2[2,2,2,1,1][2,2,1][2,2,2,1,1]1.22e-17.90e-48.63e-41.24e-3
I.27.6[2,2,1,1][2,1,1][2,1,1]2.22e-41.94e-42.14e-42.46e-4
I.29.16[3,2,2,3,2,1,1][3,2,2,1][3,2,3,1]2.36e-13.99e-33.20e-34.64e-3
I.30.3[2,3,2,2,1,1][2,4,3,1][2,3,2,3,1,1]3.85e-11.03e-31.11e-21.50e-2
I.30.5[2,1,1][2,1,1][2,1,1,1,1,1]2.23e-43.49e-56.92e-59.45e-5
I.37.4[2,3,2,1][2,2,1][2,2,1]7.57e-54.91e-63.41e-45.67e-4
I.40.1[2,1,1][2,2,1][2,2,1,1,1,2,1]3.45e-35.01e-43.12e-43.99e-4
I.44.4[2,2,1][2,2,1][2,2,1]2.30e-52.43e-51.10e-43.99e-4
I.50.26[2,2,3,1][2,3,1][2,3,2,1]1.52e-45.82e-44.90e-41.53e-3
II.2.42[2,2,1][2,2,1][2,2,2,1]8.54e-47.22e-41.22e-31.81e-4
II.6.15a[3,2,2,2,1][3,2,1,1][3,2,1,1]2.61e-33.28e-31.35e-35.92e-4
II.11.7[3,3,3,2,2,1][3,3,1,1][3,3,1,1]7.10e-38.52e-35.03e-35.92e-4
II.11.27[2,2,1,2,1][2,1,1][2,2,1]2.67e-54.40e-51.43e-57.18e-5
II.35.18[2,1,1][2,1,1][2,1,1,1]4.13e-41.58e-47.71e-57.92e-5
II.36.38[3,3,1][3,2,1][3,2,1]2.85e-31.15e-33.03e-32.15e-3
II.38.3[2,1,1][2,1,1][2,2,1,1,1]1.47e-48.78e-56.43e-45.26e-4
III.9.52[3,2,3,1,1][3,3,2,1][3,3,2,1,1,1]4.43e-23.90e-32.11e-29.07e-4
III.10.19[2,1,1][2,1,1][2,1,2,1]2.54e-31.18e-38.16e-41.67e-4
III.17.37[3,3,3,2,2,1][3,3,1][3,3,1]1.10e-35.03e-44.12e-46.80e-4

The paper's summary is that KANs and MLPs behave comparably on average here, and that auto-discovered KANs are often smaller than the hand-built ones §3.3.

PDE (§3.4, fig. 3.3). Poisson equation on [-1,1]^2 with a known solution, solved with a physics-informed loss. The paper reports that a 2-layer width-10 KAN reaches about 10^-7 MSE with about 10^2 parameters, against 10^-5 MSE and 10^4 parameters for a 4-layer width-100 MLP. The authors also say KAN training is about 10 times slower than MLP training in their implementation §3.4.

Continual learning (§3.5, fig. 3.4). A one-dimensional regression with five peaks, presented sequentially. The paper reports that KANs update only the regions with current data, while MLPs forget earlier peaks. This is a single toy example, which the authors call preliminary §3.5.

Knot theory (§4.3, tab. 3). Predicting the signature of knots from 17 invariants.

MethodArchitectureParametersAccuracy
Deepmind MLP (quoted from its source)4 layers, width 300about 3e578.0%
KAN2 layers, [17,1,14], G=3, k=3about 2e281.6%

The paper also reports a symbolic formula that uses only two of the three mu and lambda inputs and reaches 77.8% accuracy §4.3, tab. 4.

Anderson localisation (§4.4, tab. 5). For two one-dimensional models the paper reports KAN-discovered mobility-edge formulas. For GAAM the auto-discovered formula reaches 99.0% against 99.2% for the analytic theory; for MAAM it reaches 97.1% against 98.6%. Manual steps raise the MAAM figure to 97.7% for one variant §4.4, tab. 5.

Paper vs code

Code: kan/MultKAN.py and kan/KANLayer.py at commit ecde4ec (2025-01-19), the default branch HEAD when the repository was cloned. The paper is version v5 (2025-02-09). Discrepancies:

  • Noise on spline coefficients. Paper: Gaussian, sigma = 0.1 typical §2.2 footnote. Code: uniform (rand - 1/2) * noise_scale / G, with noise_scale defaulting to 0.3 in KAN and 0.5 in KANLayer KANLayer.py MultKAN.py.
  • Initial scales. Paper: w_s = 1 and Xavier-initialised w_b §2.2. Code: scale_sp = 1/sqrt(n_in) and scale_base uniform in ±1/sqrt(n_in), which is not Xavier KANLayer.py.
  • L1 penalty. Paper: mean |phi| over the N_p inputs §2.5.1. Code: the default reg_metric is edge_forward_spline_n, which uses the standard deviation of spline outputs divided by the standard deviation of inputs plus 0.1 MultKAN.py MultKAN.py.
  • Entropy term. Paper: S over the normalised |phi|_1 of the whole layer, with mu_1 = mu_2 = 1 §2.5.1. Code: row and column entropies with log2, normalised by row or column sum plus 1, and a 1e-4 floor; default weights are lamb_l1 = 1 and lamb_entropy = 2 MultKAN.py MultKAN.py.
  • Grid update. Paper: grids are re-set from the input activations §2.2. Code: new grid points mix sample quantiles with a uniform grid, with grid_eps = 0.02 by default KANLayer.py. In fit, grid updates stop at step 50 by default MultKAN.py MultKAN.py. The paper does not mention either detail.
  • Edge pruning. Paper gives node pruning with theta = 10^-2 §2.5.1. Code also has edge pruning with default threshold 3e-2, which the paper does not mention MultKAN.py.

The repository has a Feynman dataset loader feynman.py but I found no script under kan/ that reproduces the experiments of §3.2, §3.3 or §3.4. Their settings are therefore checked only against the paper, not the code.

Pitfalls

  • Shape must be chosen. The accuracy and scaling results assume the true KAN shape is known §3.1. The special-function table uses the pruning pipeline to find shapes, but the paper notes that these shapes depend on random seed, lambda, G and k [App. C] §3.2.
  • Pruning is not reliable on its own. Some runs end with larger networks than needed due to unlucky seeds. An entropy penalty is needed to avoid duplicated active edges [App. C].
  • Grid refinement can break training. Loss drops in steps at each grid extension. At G = 1000 on the toy problem optimisation stops working, which the authors attribute to a poor loss landscape §2.4. On PDE and regression tasks with uniform grids, training loss jumps up at large grid sizes, cause unknown [App. E].
  • Scaling exponents are not as predicted. For [2,1,1] the paper measures roughly G^-3, against G^-4 predicted. The median squared error, rather than the mean, comes closer to G^-4 because a few boundary samples dominate the mean §2.4. Reporting the mean would understate the exponent.
  • Cost per parameter. Each edge carries a spline, so a KAN has O(N^2 L G) parameters against O(N^2 L) for an MLP §2.2. The paper reports about 10 times slower training than MLPs in its PDE setup §3.4. The authors put this down to activation functions that cannot share one batched computation §6.
  • Optimiser choice. Results use vanilla LBFGS with no switch to Adam and no boosting §3.1. The paper leaves comparisons with these advanced setups for future work, so results may not carry over to Adam-trained pipelines.
  • Baselines are narrow. MLP baselines use fixed widths (5 or 100) and depths 2 to 6 §3.2 §3.3. The PDE MLP architecture is not stated beyond the comparison in §3.4.
  • Symbolic fitting is manual. Snapping an edge to f needs a human to name f. The fit is c f(a x + b) + d, found by grid search over a and b and linear regression §2.5.1. The suggest_symbolic helper is only a suggestion. The authors' interpretability examples depend on this human step §2.5.2 §4.4.
  • Feynman result. KANs do not beat MLPs on average in the Feynman table §3.3. The paper's interpretability claims rest on small examples §6.
  • Knot baseline. The 78% MLP baseline is quoted from another group's work and not reproduced here §4.3.
  • PDE loss. The loss uses alpha = 0.01 for the interior term §3.4. The paper does not state how the second derivatives are computed, nor the optimiser for this experiment.
  • Continual learning is shown on one toy problem, and the authors say it is unclear whether it generalises to high dimensions §3.5.
  • Affine parameters are redundant in principle, because w_b and w_s can be absorbed into the spline and base function. The paper keeps them for control over magnitude §2.2.

Lineage

  • Builds on: the Kolmogorov-Arnold representation theorem §2.1. Earlier neural-network work on the same theorem is surveyed in §5. The authors link MLPs with ReLU-k activations to splines §1. No arXiv ids are given in the paper for these prior works, so none are linked here.
  • Scaling-law theories compared: Sharma and Kaplan; Michaud et al. (2023); Poggio et al. (2020) §2.3.
  • Compared against: MLPs of matched shape §3.1 §3.2 §3.3; a published MLP for knot signatures §4.3; physics-informed neural networks for the Poisson problem §3.4.
  • Related methods: learnable activations §5; symbolic regression methods such as AI Feynman, PySR, Eureqa, EQL and OccamNet §5.
  • Superseded by: not stated in this card.

Source and license

Adapted from “KAN: Kolmogorov-Arnold Networks” by Ziming Liu, Yixuan Wang, Sachin Vaidya, Fabian Ruehle, James Halverson, Marin Soljačić, Thomas Y. Hou, Max Tegmark (arXiv:2404.19756), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/KindXiaoming/pykan at commit ecde4ec3274d (MIT). Any quoted code is shown under that license.