Overview
Field: Machine Learning Author: Alex Shtoff Published: 2026-11-10 arXiv: 2611.14516
Abstract
We present TorchCurves, a PyTorch library that treats vector-valued parametric curves as learnable primitives. Its central operation maps batches of scalar inputs to points on curves represented in B-spline or Legendre polynomial bases, with differentiation through both inputs and coefficients. Curve coefficients can be optimized jointly with the surrounding model or produced by another network. The library provides trainable modules, reusable basis modules, and a functional interface, supporting applications ranging from continuous feature embeddings to Kolmogorov-Arnold networks and functional regression. Its implementation combines classical evaluation algorithms with vectorized PyTorch operations, emphasizing readability and maintainability without custom hardware kernels. Timing experiments compare curve evaluation with NumPy/SciPy and KAN training with EfficientKAN, demonstrating in which scenarios this generality is computationally feasible and where the overhead is significant.
Key Takeaways
- Curves as learnable primitives: B-spline and Legendre polynomial bases with end-to-end differentiability through inputs and coefficients.
- Flexible integration: coefficients can be trained directly or generated by another neural network.
- Multiple APIs: trainable modules, reusable basis modules, and a functional interface.
- Applications: continuous feature embeddings, Kolmogorov-Arnold networks (KANs), functional regression.
- Pure PyTorch implementation: classical algorithms + vectorized ops, no custom hardware kernels; benchmarks quantify the computational trade-offs.