Principle:Sktime Pytorch forecasting KAN Architecture
| Knowledge Sources | |
|---|---|
| Domains | Time_Series, Forecasting, Deep_Learning, Approximation_Theory |
| Last Updated | 2026-02-08 09:00 GMT |
Overview
Kolmogorov-Arnold Network (KAN) architecture that replaces fixed activation functions in MLPs with learnable univariate B-spline functions on network edges, integrated into the N-BEATS framework to create the NBeatsKAN variant for time series forecasting.
Description
The KAN (Kolmogorov-Arnold Network) architecture is grounded in the Kolmogorov-Arnold representation theorem, which states that any multivariate continuous function can be represented as a superposition of continuous univariate functions. In a standard MLP, each edge carries a scalar weight and activation functions are fixed at nodes. In a KAN layer, each edge instead carries a learnable univariate function parameterized as a B-spline, while nodes perform simple summation. This design enables the network to learn complex nonlinear transformations directly on its edges.
Each KANLayer maintains a grid of B-spline knot points and a set of trainable B-spline coefficients. For an input dimension in_dim and output dimension out_dim, the layer has independent spline functions. The forward pass computes two components for each input-output pair: (1) a residual (base) function (default: SiLU activation) scaled by a learnable scale_base parameter, and (2) a spline function evaluated from the B-spline coefficients scaled by a learnable scale_sp parameter. A binary mask can enforce sparse connectivity between inputs and outputs.
The B-spline evaluation uses the recursive Cox-de Boor formula implemented in b_batch. The coef2curve function converts stored coefficients to spline curves via Einstein summation over B-spline basis functions. The curve2coef function fits coefficients to observed data via batched least squares, which is used during grid updates to adapt the knot positions to the data distribution.
Grid updating is a distinctive feature of KAN: periodically during training (controlled by the GridUpdateCallback), the B-spline grids are refined based on the actual input data distribution. The grid points are repositioned using a blend of uniform spacing and adaptive (percentile-based) spacing, controlled by the grid_eps parameter (1.0 = fully uniform, 0.0 = fully adaptive). After repositioning, the spline coefficients are re-fitted to preserve the learned function shape.
In the NBeatsKAN model, KAN layers replace the standard MLP layers in N-BEATS blocks. The model supports trend, seasonality, and generic block types, each using KAN layers for the basis function computation. The doubly-residual architecture of N-BEATS is preserved: each block produces a backcast and forecast, with residuals propagated through the stack. The KAN variant offers improved interpretability (each learned edge function can be visualized) and potential parameter efficiency.
Usage
Use the KAN Architecture (NBeatsKAN) for univariate time series forecasting when: (1) improved interpretability is desired since individual edge functions can be inspected, (2) the data contains complex nonlinear patterns that benefit from learnable activation functions, (3) parameter efficiency is important as KAN can achieve comparable accuracy with fewer parameters. The GridUpdateCallback should be added to the trainer with an appropriate update_interval to periodically refine spline grids during training. Default block configuration uses trend and seasonality stacks with B-spline order k=3 and G=5 grid intervals.
Theoretical Basis
Kolmogorov-Arnold representation theorem: Any continuous function can be written as:
where and are continuous univariate functions.
KAN layer forward pass: For input , the output is:
where is the connectivity mask, and are learnable scale parameters, is the base function (SiLU), and is the B-spline function for edge .
B-spline basis (Cox-de Boor recursion):
Spline curve evaluation:
where are the trainable B-spline coefficients and are the basis functions of order .
Grid adaptation: At update intervals, the grid knots are repositioned as a blend of uniform and adaptive grids:
where is derived from percentiles of the input samples and Failed to parse (syntax error): {\displaystyle \epsilon = \text{grid\_eps}} . After repositioning, coefficients are re-estimated via least squares: