Official implementation of MetaCluster: Enabling Deep Compression of Kolmogorov-Arnold Network.
MetaCluster makes Kolmogorov-Arnold Networks (KANs) more compact by learning coefficient vectors that can be clustered into a shared codebook. The repository includes direct and meta-learned KAN workflows, clustering and packed-checkpoint utilities, and fully-connected and convolutional image classifiers.
MetaKAN_Clustering/
├── base_model/ # Base KAN and MetaKAN implementations
├── compressed_image_classification/ # Fully-connected experiments
│ ├── models/ # KAN, FastKAN, GramKAN, and meta variants
│ ├── CompressedModels/ # Clustered and trainable-clustered models
│ ├── cli.py # Fully-connected command-line parsers
│ ├── training.py # Shared training and evaluation loops
│ ├── clustered_models.py # Clustered-model construction helpers
│ ├── clustering_kmeans.py # K-means clustering and packing helpers
│ ├── train.py # Direct-model runner
│ └── train_meta.py # Meta-model runner
├── compressed_image_classification_CONV/ # Convolutional experiments
│ ├── models/ # ConvKAN and meta-convolutional models
│ ├── kan_convs/ # Convolutional KAN layers
│ ├── CompressedModels/ # Clustered convolutional models
│ ├── conv_cli.py # Convolutional command-line parsers
│ ├── conv_direct_components.py # Direct workflow components
│ ├── conv_meta_components.py # Meta workflow components
│ ├── convkan_clustering_kmeans.py # Convolutional clustering and packing
│ ├── train.py # Direct-model runner
│ └── train_meta.py # Meta-model runner
├── dataset/ # Downloaded datasets
├── requirements.txt
└── setup.py
Create an environment with a PyTorch build appropriate for the target CPU or CUDA system, then install the project dependencies.
python -m venv .venv
# Windows PowerShell
.venv\Scripts\Activate.ps1
# Linux/macOS
# source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -e .Run commands from the experiment directory named in each section. The current workflow scripts use local imports and write outputs relative to that directory.
The fully-connected runners support direct KAN-family models and meta-learned variants. The exact supported --model values are defined in utils.py.
cd compressed_image_classification
# Direct KAN
python train.py \
--model KAN \
--dataset MNIST \
--batch-size 128 \
--epochs 50
# MetaKAN
python train_meta.py \
--model MetaKAN \
--dataset MNIST \
--batch-size 128 \
--epochs 50 \
--optim_set double \
--lr_h 1e-4 \
--lr_e 1e-3 \
--embedding_dim 1 \
--hidden_dim 32The convolutional runners provide direct and meta-model workflows for image datasets such as CIFAR-10.
cd compressed_image_classification_CONV
# Direct convolutional KAN
python train.py \
--model KAN \
--dataset CIFAR10 \
--batch-size 64 \
--epochs 150
# Meta convolutional KAN
python train_meta.py \
--model MetaKAN \
--dataset CIFAR10 \
--batch_size 64 \
--epochs 150 \
--optim_set double \
--lr_h 1e-3 \
--lr_e 1e-2 \
--embedding_dim 1 \
--hidden_dim 64All image-classification runners expose flags for model saving, clustering, packed cluster IDs, loading, evaluation, and fine-tuning. A typical clustered fine-tuning run uses:
python train_meta.py \
--model MetaKAN \
--dataset CIFAR10 \
--save_model \
--save_packed_clustered_model \
--compress_to_clusters 16 16 16 16 \
--train_clustered_model \
--Clustered_training_epochs 5 \
--save_trained_clustered_model \
--save_packed_clustered_trained_model \
--save_filename metacluster_cifar10Use python train.py --help or python train_meta.py --help from the relevant experiment directory to inspect all available options and defaults.
- Logs: task-specific
logs/<dataset>/<model>/...directories. - Datasets:
dataset/. - Checkpoints:
saved_models/, optionally withinsaved_models/<saving_subfolder>/. - Clustered checkpoints: SafeTensors files containing cluster centers, cluster IDs, and required model state.
This repository extends the MetaKAN codebase and implements the MetaCluster compression workflow.
MetaCluster
@article{raffel2025metacluster,
title={MetaCluster: Enabling Deep Compression of Kolmogorov-Arnold Network},
author={Raffel, Matthew and Renjith, Adwaith and Chen, Lizhong},
journal={arXiv preprint arXiv:2510.19105},
year={2025}
}