Skip to main content

tensor-spline

Compressed neural network layers — Eisenstein lattice splines and low-rank factorization.

What's Novel

SplineLinear: Weights parameterized by control points on an Eisenstein (hexagonal) lattice, interpolated to create the full weight matrix. Built-in compression, regularization, and constraint-native structure.

Key result: drift-detect task hits 100% accuracy at 20× compression with SplineLinear.

Install

pip install tensor-spline

Requires PyTorch ≥ 2.0.

Quick Start

import torch.nn as nn
from tensor_spline import SplineLinear, inject_spline, LowRankLinear, recommend_variant

# Option 1: Direct construction
layer = SplineLinear(512, 512, n_control_points=16)
# 262,144 params → 16 params (16,384:1 compression)

# Option 2: Inject into any model
model = nn.Sequential(nn.Linear(256, 128), nn.ReLU(), nn.Linear(128, 10))
inject_spline(model, n_control_points=16)

# Option 3: Low-rank for sharp classification tasks
layer = LowRankLinear(256, 128, rank=16)
# 32,768 params → 6,144 params (5.3× compression, 80% accuracy retention)

# Auto-select the right compression for your task
variant = recommend_variant("detect drift in sensor data")  # → "spline"
variant = recommend_variant("classify documents by topic")   # → "lowrank"

Compression Strategies

Method Best For Compression Accuracy
SplineLinear Smooth/continuous tasks 20-40× 95-100% retention
LowRankLinear Classification, sharp boundaries 5-16× 80% retention
HierarchicalSpline Multi-scale continuous 10-20× Experimental

Honest Findings

SplineLinear achieves 100% accuracy at 20× compression on drift-detect (smooth task). But only 31% on topic-classify (sharp boundaries) — IDW interpolation is too smooth for classification. Use LowRankLinear for classification tasks instead.

Use the right tool for the right task.

3 Basis Functions (SplineLinear)

  • eisenstein — Inverse distance weighting (default, best for smooth)
  • gaussian — Gaussian RBF
  • bspline — Cubic B-spline kernel

Related

  • plato-training — Micro model training (primary consumer of SplineLinear)
  • eisenstein-embed — 5-layer semantic matching cascade (uses SplineLinear for 20× embedding quantization)
  • eisenstein — Eisenstein integer arithmetic (mathematical foundation)
  • plato-types — Tile lifecycle and provenance
  • ASSEMBLY-GUIDE — Full ecosystem assembly guide

Mesh Protocol

tensor-spline supports the SuperInstance mesh protocol. When co-installed with plato-core, compression capabilities auto-register with the shared registry.

pip install tensor-spline[mesh]

This enables:

  • spline-linear and low-rank compressors discoverable via the mesh registry
  • inject, measure, and recommend utilities available to other mesh services
  • Entry-point based plugin loading (superinstance.plugins)

Works standalone without plato-core — graceful degradation via try/except.

License

MIT

Metadata

Release files for tensor-spline 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tensor-spline 1.0.0
File Size Uploaded Provenance Actions
tensor_spline-1.0.0.tar.gz 28.1 kB Without provenance Details for tensor_spline-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tensor-spline 1.0.0
File Interpreter ABI Platform Actions
tensor_spline-1.0.0-py3-none-any.whl Python 3 none any Details for tensor_spline-1.0.0-py3-none-any.whl

Total release size: 57.7 kB

Release files / tensor_spline-1.0.0.tar.gz

Download URL tensor_spline-1.0.0.tar.gz
Size 28.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0d7d2973b935abb03d189c861742319bb624f72f314c412c9804b894d5828e78
BLAKE2b-256 checksum
How to use checksums
5f2d39791541dac279913d7322cdf62b64596e80e6e40f3695587f49195a93b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / tensor_spline-1.0.0-py3-none-any.whl

Download URL tensor_spline-1.0.0-py3-none-any.whl
Size 29.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a8d2bcbdf87491355ee5a91c7998179caf08ce42778333d94f5503062d781d6
BLAKE2b-256 checksum
How to use checksums
f9977e721f88e613953d512016168cb9b8f467c7aa058692bec9beda1f458cc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for tensor-spline 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page