Changelog#
All notable changes to kanx are documented in this file. The format follows Keep a Changelog, and the project adheres to Semantic Versioning.
Unreleased#
[0.2.2] - 2026-11-21#
Added#
- Tesla T4 order sweep of the Python-loop MatrixKAN basis (
benchmarks/results/matrixkan_t4_sweep_0.2.0.json). Orders 3, 5, and 7, copied weights, forward and backward. The loop stays slower. At batch 16,384 the forward ratio is about 3.3×, 4.0×, and 4.6× to 4.9×. This does not replace the forward-only order-3 table. tests/test_param_counts.pychecks the trainable parameter counts quoted in the README, docs, andpaper.md.
Changed#
- Wording and metadata only. No library behavior changes. The package summary, README, docs,
CITATION.cff, andpaper.mddescribe kanx as a library for Kolmogorov-Arnold Networks in TensorFlow and PyTorch. The headline benchmark states its ratios, seeds, and the UCI diabetes result. The DOI points at 10.5281/zenodo.20615396. The comparison table records the versions it was checked against.paper.mdTable 3 lists trainable parameter counts (432 and 1,728). - Package version is 0.2.2 in
pyproject.toml,kanx.__version__,CITATION.cff, and the Helm chartappVersion.
Removed#
notebooks/LAUNCH_POST.md.
0.2.1 - 2026-10-23#
Fixed#
MatrixKANis marked experimental. In 0.2.0 the class does not evaluate B-splines with a batched GEMM.b_spline_basis_matrixis the Cox–de Boor recursion with a Python loop over each basis index, andbuild_recurrence_matrix_batchis unused. A constant matrix cannot represent that recursion because the weights depend onx. The 0.2.0 docstring and README described the GEMM anyway. 0.2.0 stays on PyPI. This release corrects the description. It does not change the forward pass.- A Tesla T4 sweep of that loop (torch 2.11.0+cu130, kanx 0.2.0, shape
[2, width, 1], width 32–512, batch 1,024–16,384) is slower than vectorizedKAN. The ratio falls from about 6.4× to about 3.3× and stays there. At width 32 and batch 4,096 the calls are 2.10 ms and 13.37 ms. The JSON isbenchmarks/results/matrixkan_t4_0.2.0.json. - The published CPU table is a warmed three-seed run on an Intel Core i9-9900, TensorFlow 2.21.0. The 0.2.0 single-call columns are not averaged in.
- The static
fit_grid_to_datasnippet callsmodel.build((None, n_features))first. An unbuiltKANhas no layer weights, andfit_grid_to_dataraises. - Docs no longer say the spline is zero outside
[-1, 1], or that knot differences underflow in float16. The basis stays float32 because(x - t_i)cancels near a knot. Float16's largest finite value is 65504. That is a format limit, not an overflow measured in this contraction. bfloat16 is the practical training dtype because float16 gradients underflow without loss scaling. - Docs say
prune()zeros coefficients and leaves the tensor shape unchanged.
Changed#
- Package version is 0.2.1 in
pyproject.toml,kanx.__version__,CITATION.cff, and the Helm chartappVersion.
0.2.0 - 2026-10-14#
Added#
- Distributed smoke tests.
tests/test_distributed_smoke.pytrains a tiny TensorFlow KAN for one epoch undertf.distribute.MirroredStrategyand a tiny PyTorch KAN for one step undertorch.distributed. With no GPU, TensorFlow uses two logical CPUs and PyTorch uses two gloo processes. Two or more GPUs use those devices. The pytest CI job runs both. - Helm chart.
charts/kanxparameterizes the serving image, replica count, resources, probes, CPU HPA, model PVC, and Ingress fromk8s/.kubectl apply -f k8s/still works. Do not install releasekanx-apiinto a namespace that already has those manifests. The chart claim is named<release>-models. - Mixed precision and XLA on the TensorFlow spline path.
KANandKANLineartakeprecision(float32,float16,bfloat16) andjit_compile. Reduced precision applies to the SiLU matmul and the spline einsum. The B-spline basis, the stored weights, and the layer output stay float32.jit_compile=Truewraps the forward pass in an XLAtf.function. - PyTorch benchmark subprocess.
benchmarks/real_world.pytrains the PyTorch KAN and MLP inbenchmarks/torch_worker.pywhen--device cudais selected, so TensorFlow and PyTorch do not initialize CUDA in one process. CPU runs and--smokestay TensorFlow-only. - Edge visualisation.
kanx.vizreads the learned 1-D function on each edge (SiLU residual times the base weight, plus the B-spline).edge_curvesreturns the samples,plot_edgesdraws one panel per edge (pip install "kanx[viz]"for matplotlib), andwrite_edge_viewerwrites a self-contained HTML page with a layer picker and hover readout. TensorFlowKAN, PyTorchKAN, andMatrixKANare covered. Seeexamples/visualize_edges.pyandnotebooks/visualize_edges.ipynb. - Edge pruning.
KAN.prune()andKANLinear.prune()on the TensorFlow, PyTorch, and MatrixKAN layers zero an edge when its score is at or below an absolutethresholdand/or arelativefraction of the strongest edge in that layer. Passsamplesto score each edge by the RMS of its contribution. Pruned spline coefficients and base weights are set to zero. - The quickstart notebook shows edge pruning,
kanx.vizedge plots, and a short TensorFlow mixed-precision + XLA fit. The install cell includeskanx[viz]. - CPU benchmark smoke gate.
python benchmarks/compare_mlp.py --smokeandpython benchmarks/real_world.py --smoketrain a tiny CPU configuration and exit non-zero when metrics are missing or non-finite. Thebenchmark-smokeGitHub Actions job runs both commands. Smoke mode writes only to--outputand leaves the committed baseline artifacts in place. load_california_housing()now loads NumPy arrays directly, so the real-world smoke gate needs scikit-learn and does not need pandas.
Changed#
- Package version is 0.2.0 in
pyproject.toml,kanx.__version__,CITATION.cff, and the Helm chartappVersion.kanx[viz](matplotlib) stays in thekanx[all]extra. - Corrected the README, roadmap, and testing notes. A CPU run that skips
tests/test_e2e_live.pypasses 162 tests and skips 4 when Helm and CUDA are absent. Branch coverage ofsrc/kanxis 77% (layers.py95%,model.py91%). The older 94% and 113-test figures described a smaller suite. The README shows the published benchmark chart beside that table and akanx.vizplot of a learned sine and quadratic edge. - Synced
roadmap.mdandREADME.mdwith the features already shipped in 0.1.8 and 0.1.9: MatrixKAN, adaptive grids, HuggingFace Hub, symbolic regression, TensorBoard, and Prometheus. - Recorded the 0.1.9 release in this changelog.
docs/changelog.mdanddocs/roadmap.mdnow include these files so the site cannot drift. - CI installs the
hubextra for the test job, because importingkanxloads the Hub helpers. - Docker image install already includes that extra (landed after the 0.1.9 notes above).
0.1.9 - 2026-06-19#
Fixed#
- Corrected
update_grid_from_samplesin both TensorFlow and PyTorch backends so each layer keeps the incoming feature width. - Resolved failing grid-update improvement tests by propagating activations through
KANLinearlayers in order. - Fixed the Dockerfile build by aligning the
README.mdcopy path with the repository layout. - Addressed MkDocs path warnings for
roadmap.md,CONTRIBUTING.md, andreference/README.md.
Changed#
- Simplified the grid-update implementation for lint compliance.
- Docs CI no longer aborts the MkDocs build on non-critical warnings.
Added#
- MatrixKAN grid-update and ONNX export tests.
0.1.8 - 2026-06-03#
Added#
kanx.datasetsmini-module — UCI/Feynman dataset loaders, cached downloads, and dataset utilities for real-world tabular experiments.- HuggingFace Hub integration —
KAN.from_pretrained()plusmodel.push_to_hub()support for both TensorFlow and PyTorch models. - Prometheus
/metricsscrape endpoint in the FastAPI service viaprometheus-fastapi-instrumentator. - Symbolic regression hooks —
kanx.torch.SymbolicFitterextracts closed-form edge functions from trained models. - TensorBoard logging for both TF and PyTorch training paths, with event files written to the configured log directory.
- Docs and examples updated to reflect the implemented extras and production-ready serving features.
Changed#
- Bumped package version metadata to 0.1.8 in
pyproject.toml,src/kanx/__init__.py, andCITATION.cff. - Aligned docs, release notes, and README with the actual shipped feature set.
Fixed#
- Final audit of README badges, PyPI metadata, and root documentation references.
0.1.7 - 2026-06-02#
Added#
- README cosmetic and metadata fixes including correct LICENSE badge link and peppy total-downloads badge.
CITATION.cffandSECURITY.mdfor academic citation and security disclosures.- Docs consolidation — merged legacy
documentations/intodocs/and aligned MkDocs navigation. - Real-world benchmark suite with
benchmarks/real_world.pyand committed baseline results artifact. - GPU timing path in
benchmarks/compare_mlp.pyfor CPU/GPU inference comparisons. - MatrixKAN GPU-optimized PyTorch kernel using batched GEMM for B-spline evaluation.
.gitignorecleanup rules for temporary root artifacts created by pip/installers.
Changed#
- Updated
docs/benchmarks.md,docs/quickstart.md, andREADME.mdto reflect new benchmark and MatrixKAN support. - Removed stale
documentations/references from deployment comments and docs copy.
Fixed#
- Cross-link and doc path issues caused by the old dual-documentation layout.
0.1.6 - 2026-05-30#
This release closes a FAANG-grade audit. Six concrete corrections:
Added#
kanx.fit_grid_to_data(model, X, pad=0.05)— calibrates everyKANLinearlayer's B-spline grid to the observed input range. Fixes the #1 KAN production bug where inputs outside the default[-1, 1]grid silently zero out the spline path. Works on both TF and PyTorch backends.kanx.check_input_range(model, X)— logs aWARNINGwhen input exceeds the model's grid range. Use as an inference-time sanity check.- Prominent README warning about the grid-range gotcha with copy-paste fix.
- Four new example scripts in
examples/:tabular_regression.py(8-D, non-unit range, the correct training pattern),classification.py(moons, SparseCategoricalCrossentropy),time_series.py(sliding-window autoregressive forecast),visualize_edges.py(plot the learned 1-D edge functions),onnx_pipeline.py(train → save → ONNX export → ONNXRuntime). - Optional API hardening (env-controlled, off by default for backwards-compat):
KANX_API_KEYenablesX-API-Key-header auth on/api/predict,/api/load,/api/reset.KANX_RATE_LIMIT_RPMenables per-IP token-bucket rate limiting (returns429). Health/info remain open for k8s probes. - Branch coverage enabled (
[tool.coverage.run] branch = true) — line coverage alone is no longer the only signal.
Fixed#
- Honest, multi-baseline benchmark.
benchmarks/compare_mlp.pynow trains for 100 epochs (not 30) and compares against three MLP baselines including parameter-matched ones (MLP[2,32,1] / 129 params and MLP[2,16,16,1] / 337 params), not just an overparameterised MLP[2,64,64,1]. The deceptive "265× MSE win" headline is gone; the new fair number is ~75× vs param-matched MLP and ~25× vs an MLP 10× larger — on a best-case smooth separable target.results.mdnow documents caveats prominently and--longmode adds 1000-epoch + early-stopping convergence runs. - Repo hygiene. Added
.gitignoreentries for.coverage,.coverage.*,htmlcov/,coverage.xml,.benchmarks/,.hypothesis/,test_reports/,site/,.emergent/,memory/,checkpoints/,*.keras,*.pt,*.onnx. These files must never be committed to source control. requirements.txtis now core-only (tensorflow / numpy / pyyaml). FastAPI / uvicorn / pydantic come exclusively via the[api]extra.pip install kanxno longer pulls a web server into your environment.- Dockerfile runs as a non-root user (
kanx, UID 1000),readOnlyRootFilesystem-compatible, withtmpand~/.cachemounted asemptyDirin the K8s deployment. - K8s
Deploymentnow sets BOTHrequestsandlimitsfor cpu & memory (without limits, HPA is meaningless). Drops all Linux capabilities, setsrunAsNonRoot,allowPrivilegeEscalation: false,seccompProfile: RuntimeDefault. - K8s
PersistentVolumeClaimdocuments the need to setstorageClassNamefor the user's environment (default-class behaviour is not portable across EKS/GKE/AKS). - K8s HPA annotates itself as a
cpu-starterstrategy and points operators to the deployment doc for the correct latency-based metric.
Tests#
- New
tests/test_grid_range_guard.py(7 tests) — guard rails, monkey-patch verification of the runtime warning, and a regression test proving calibrated training reaches lower loss than uncalibrated. - New
tests/test_api_hardening.py(5 tests) — API-key acceptance/refusal, health/info bypass auth, rate-limit returns 429 after burst. - Total suite: 113 tests (up from 101), all green.
0.1.4 - 2026-05-27#
Fixed#
- Repository URLs corrected across
README.md,pyproject.toml,CHANGELOG.md,CONTRIBUTING.md,mkdocs.yml, all docs, the Colab notebook, and the launch post:Mattral/Kolmogorov-Arnold-Networks→Mattral/KANX, andmattral.github.io/Kolmogorov-Arnold-Networks/→mattral.github.io/KANX/. Affects all PyPI project_urls (Homepage, Documentation, Repository, Issues, Changelog, Source Code, Colab Notebook), the badges in the README, all hyperlinks in the docs site, and the "Open in Colab" badge in the notebook.
0.1.3 - 2026-05-27#
Added#
- Zero-friction API.
kanx.quickstart()— build, train, return a working KAN in one call. Designed to be the first thing a new user types afterpip install kanx. model.fit(X, y)on TF KAN — auto-compiles with Adam(1e-3) + MSE if the user hasn't calledmodel.compile()first. No morecompile()dance.model.fit(X, y)on PyTorch KAN — wrapsTrainer.fit()so PyTorch users get the same one-line semantics as the TF backend.CONTRIBUTING.mdwith high-leverage tasks and "good first issues" pointers.- GitHub Pages auto-deploy workflow (
docs.yml) — docs site rebuilds on every push tomain(not just on tag). - Comparison table vs other KAN libraries in
README.md(pykan, efficient-kan, mlx-kan). - Citations + BibTeX for both
kanxand the original Liu et al. (2024) paper. - Extra project URLs on PyPI: Documentation, Repository, Issues, Changelog, Colab Notebook, Source Code.
Fixed#
- PyPI "Documentation" link previously redirected to a non-existent page inside the PyPI project namespace. Now points to the live MkDocs Material site at https://mattral.github.io/KANX/.
Tests#
- New
tests/test_quickstart_api.py(5 tests) coveringkanx.quickstart(), TF auto-compile.fit(), Torch one-liner.fit(), and version metadata.
0.1.2 - 2026-05-27#
Initial production release.
Added#
- Library (TensorFlow backend, primary).
kanx.{KAN, KANLinear, train, predict, load_model, save_model, load_config, validate_config, set_global_seed}. Vectorized Cox-de Boor B-spline basis (no Python loops), SiLU residual, per-feature grids,@register_keras_serializablefor custom-layer-safesave_model/load_model. - PyTorch backend.
kanx.torch.{KAN, KANLinear, Trainer, export_onnx, build_kan}. Parallel surface to the TF backend — same maths, same configuration semantics, nativetorch.nn.Moduleintegration. - ONNX export.
kanx.export_onnx_tf(via tf2onnx) andkanx.torch.export_onnx(native torch.onnx). Dynamic batch axis; numerical parity within 1e-5 of the eager model. - REST API.
api/app.pyFastAPI service with thread-safeModelRegistry,/api/{health,info,predict,load,reset}, lifespan-based startup, checkpoint-with-fallback contract, boundary validation. - CLI.
python -m kanx {info,train,predict}with YAML configs. - Deployment. Dockerfile + docker-compose; Kubernetes manifests (Deployment with rolling updates, Service, Ingress, HPA, PVC).
- CI. GitHub Actions workflow (
ci.yml): lint + pytest matrix (py3.10/3.11/3.12) + Docker smoke test. - Release pipeline.
release.yml— tag-triggered PyPI publish (OIDC trusted publisher), GHCR Docker push, GitHub Release, MkDocs gh-deploy. - Documentation. Eight long-form docs under
documentations/: philosophy, architecture, system design, build, security, API, testing, deployment. MkDocs Material site config (mkdocs.yml). - Tests. 95 tests across unit, integration, end-to-end (live API), property-based (Hypothesis), and performance regression alarms. 94% library coverage, numerical contracts (partition of unity, non-negativity, save/load roundtrip, ONNX parity) asserted by tests.
- Benchmarks.
benchmarks/compare_mlp.py+ populatedresults.md. KAN[2,32,1] hits 1.7×10⁻⁵ MSE vs MLP[2,64,64,1] at 4.5×10⁻³ with 5× fewer parameters. - Examples.
quickstart.py,function_fit.py,mnist_train.py. - Notebooks. Colab-ready
notebooks/quickstart.ipynb("Train KAN in 2 minutes").
Engineering decisions#
- TensorFlow remains the primary backend (matches the upstream repo's framework). PyTorch is a first-class secondary surface; both are tested in CI.
- Single-threaded BLAS in the test suite to avoid TF+Torch OpenMP segfaults.
- Hand-rolled YAML validator (no pydantic dep in the core library).
- API uses pydantic only at the request-boundary edge.