Skip to content

pykan

A Python library for Kolmogorov-Arnold Networks, a neural network alternative to MLPs.

Stars
16.3k
Forks
1.5k
Licence
MIT
Language
Jupyter Notebook
Last update
1.8 years ago
Type
Library

No commits in over a year — check for forks or alternatives before adopting.

What it is

pykan is the official code repository for the Kolmogorov-Arnold Network (KAN) papers. KANs are a type of neural network that place learnable activation functions on the edges between nodes, instead of fixed activation functions on the nodes as in standard MLPs. The README says this makes KANs sometimes much better than MLPs in accuracy and interpretability, and the authors aim it especially at scientific and math-oriented problems.

  • Fit a small function with a KAN using the tutorials as a starting point
  • Train a sparse KAN with model.train(lamb=0.01) and visualize which edges matter
  • Prune an unneeded parts of a trained model with model.prune() and retrain it
  • Run symbolic regression on a trained KAN to look for closed-form expressions

Great for

  • Researchers exploring KANs as an alternative to MLPs on small, science-oriented problems
  • Users who want to inspect and interpret a learned model, such as with model.plot() or pruning
  • Students learning how KANs differ from standard neural networks
  • Anyone following the KAN 2.0 paper and its scientific-discovery workflow

Not ideal for

  • Large-scale machine learning tasks: the README says problem scales are smaller than typical ML tasks and that KANs are likely not a plug-in out-of-the-box solution for ML focus yet
  • Users who need heavily optimized training code: the author notes limited work on efficiency or reusability, and suggests efficientkan or FourierKAN for better efficiency
  • Users who need a drop-in replacement for MLPs without tuning hyperparameters
Step-by-step guide: how to use pykanInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python 3.9.7 or higher · pip

    Install from PyPI

    pip install pykan

    Install from GitHub

    pip install git+https://github.com/KindXiaoming/pykan.git
  2. 2

    Run it

    • Install pykan with pip
    • Open hellokan.ipynb from the repository as a quickstart
    • Work through the notebooks in the tutorials folder for more examples
    • Call model.speed() before training if you write your own training loop and do not use the symbolic branch
  3. 3

    Get the most out of it

    • Use model.speed() when writing your own training loop without symbolic computations, since the README says the symbolic branch is slow otherwise
    • Start with a small KAN shape and grow it gradually, following the README's hyperparameter advice
    • Use sparsification with model.train(lamb=...) and model.prune() when interpretability matters
    • Try the grid extension technique described in the documentation for better accuracy, while watching for overfitting

Downloads

Strengths

  • Open source under the MIT license with a quickstart notebook, tutorials, and documentation
  • Designed to be interpretable, with plotting and pruning tools described in the README
  • Backed by two papers and a clear hyperparameter-tuning guide written by the author

Trade-offs

  • The author states the code was not optimized for efficiency or reusability and the repo will mostly stay for scientific use without significant updates
  • Symbolic branch is slow unless model.speed() is called when writing your own training loop
  • Hyperparameters need tuning and many MLP intuitions may not transfer

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.