APIUp to 28% cheaper than official pricesTry the API →
Hermes
Back to News

TorchCurves Brings Learnable Differentiable Curves to PyTorch Models

TorchCurves is a new PyTorch library treating parametric curves as differentiable, learnable primitives. Supports B-spline and Legendre polynomial bases with gradients through inputs and coefficients. Targets KANs, continuous feature embeddings, shape-restricted models, and functional regression.

TorchCurves Brings Learnable Differentiable Curves to PyTorch Models
Source
AlphaSignal
Published
Author
AlphaSignal
Read
1 min read

Takeaways

  • TorchCurves is a new PyTorch library treating parametric curves as differentiable, learnable primitives.
  • Supports B-spline and Legendre polynomial bases with gradients through inputs and coefficients.
  • Targets KANs, continuous feature embeddings, shape-restricted models, and functional regression.
  • Three APIs: trainable modules, reusable basis modules, and a functional interface.
  • Benchmarked against SciPy, NumPy, and EfficientKAN with mixed but honest results.
  • Apache-2.0 licensed, pip-installable, pure PyTorch, with paper on arXiv .

Smooth, learnable curves appear throughout modern machine learning. Kolmogorov-Arnold Networks use them as learned edge functions, continuous embeddings use them to interpolate numeric features, and shape-restricted regression uses them to enforce properties such as monotonicity. Implementing these models in PyTorch has often required custom B-spline code or components adapted from specialized repositories.

TorchCurves packages vector-valued parametric curves as reusable, differentiable PyTorch components. The library maps batches of scalar inputs to points on curves represented by B-spline or Legendre polynomial bases. Autograd can differentiate with respect to both the inputs and the coefficients, allowing a model to learn coefficients directly or receive them from another network.

One abstraction for several curve jobs

B-splines are piecewise polynomials with local support, so evaluating an input touches only a small subset of the basis functions. Their smoothness and compact support make them useful for learned nonlinear functions. Legendre polynomials provide a global polynomial basis for models that need a different parameterization.

KANs have driven much of the recent interest in these functions. They place learnable one-dimensional functions on network edges, and many implementations represent those functions with B-splines.

Reporting is indexed from AlphaSignal. Rights remain with the original publisher and cited sources.

Read original report

Sources

  1. 01arxiv.org
  2. 02github.com
  3. 03discuss.pytorch.org
  4. 04news.ycombinator.com
  5. 05emergentmind.com