Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Logo

Fast path signatures, log signatures, and signature kernels on CPU and GPU

PyPI - Version PyPI - Downloads Python Versions CI - Test codecov CodSpeed Read the Docs License

pySigLib is a Python library for fast computation of path signatures, log signatures, branched signatures, and signature kernels on CPU and GPU, with NumPy, PyTorch, and JAX support. Its PyTorch and JAX integrations keep these operations differentiable, jittable, and on the device your data already lives on.

Features

Every operation is available from NumPy, PyTorch (with full autograd), and JAX (with jit, vmap, and grad), running on CPU via a multi-threaded C++ backend or on GPU via CUDA. Additional utilities cover path transforms (time augmentation, lead-lag) and words / Lyndon words.

Installation

pip install pysiglib              # CPU only
pip install pysiglib[cuda]        # with CUDA GPU support

The JAX integration is built into the wheel - install JAX separately (pip install jax) if you want to use it.

For detailed and up-to-date installation instructions, including how to build from source, see the installation guide.

Quick start

import numpy as np
import pysiglib

path = np.random.randn(32, 1000, 10)  # (batch, length, dimension)
sig  = pysiglib.sig(path, degree=5)

Documentation

Full documentation is available at https://pysiglib.readthedocs.io

Examples

Throughout the examples below, paths are arrays of shape (path length, dimension) or (batch size, path length, dimension). Inputs can be NumPy arrays, PyTorch tensors, or JAX arrays; the computation runs on whichever device the input lives on.

Signatures

import numpy as np
import pysiglib

X = np.random.uniform(size=(32, 1000, 10))
s = pysiglib.sig(X, degree=5)

Signature coefficients

path  = np.random.uniform(size=(32, 1000, 5))
words = [(0,), (1, 0), (1, 2, 4)]
coefs = pysiglib.sig_coef(path, words)

Log-signatures

pysiglib.prepare_log_sig(dimension=10, degree=5, method=1)

X  = np.random.uniform(size=(32, 1000, 10))
ls = pysiglib.log_sig(X, degree=5, method=1)

Branched signatures

pysiglib.prepare_branched_sig(dimension=5, degree=4)

X    = np.random.randn(32, 1000, 5)
bsig = pysiglib.branched_sig(X, degree=4)

Signature kernels

X = np.random.uniform(size=(32, 1000, 10))
Y = np.random.uniform(size=(32, 1000, 10))
k = pysiglib.sig_kernel(X, Y, dyadic_order=1)

# Different dyadic refinement per input when the paths have very different lengths:
X = np.random.uniform(size=(32,  100, 10))
Y = np.random.uniform(size=(32, 5000, 10))
k = pysiglib.sig_kernel(X, Y, dyadic_order=(3, 0))

PyTorch autograd

Every forward op has a backward implementation, so signatures compose cleanly with the rest of your PyTorch model.

import torch
from pysiglib.torch_api import sig

X = torch.randn(32, 1000, 10, requires_grad=True, device="cuda")
s = sig(X, degree=5)
loss = s.sum()
loss.backward()  # X.grad populated

JAX

The JAX API integrates via the XLA FFI, so every op works under jit, vmap, and grad.

import jax
import jax.numpy as jnp
from pysiglib.jax_api import sig

@jax.jit
def signature_norm(path):
    return jnp.sum(sig(path, degree=5) ** 2)

X    = jnp.array(np.random.randn(32, 1000, 10))
grad = jax.grad(signature_norm)(X)

Online signature streams

Incrementally update a signature as new points arrive, and query any interval in O(1) via Chen's identity - useful for real-time data or sliding-window features.

stream = pysiglib.SigStream(dimension=10, degree=5)
for point in incoming_points:
    stream.push(point)

full     = stream.sig_all()      # signature of the entire path so far
interval = stream.sig(100, 200)  # signature on [t=100, t=200]

Citation

If you found this library useful in your research, please consider citing the paper:

@article{shmelev2025pysiglib,
  title={pySigLib-Fast Signature-Based Computations on CPU and GPU},
  author={Shmelev, Daniil and Salvi, Cristopher},
  journal={arXiv preprint arXiv:2509.10613},
  year={2025}
}

Contributing

Contributions are welcome! Please open an issue first to discuss what you'd like to change, then submit a pull request.

Sponsors

If you'd like to support development, please consider sponsoring the project.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pysiglib-4.0.0rc1-py3-none-win_amd64.whl (1.2 MB view details)

Uploaded Python 3Windows x86-64

pysiglib-4.0.0rc1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.5 MB view details)

Uploaded Python 3manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pysiglib-4.0.0rc1-py3-none-macosx_11_0_arm64.whl (909.1 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file pysiglib-4.0.0rc1-py3-none-win_amd64.whl.

File metadata

  • Download URL: pysiglib-4.0.0rc1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pysiglib-4.0.0rc1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 6f5c678b26446a4d0cf5ca706a3bcd0c41273d9a6894fee3a72ba862149aa470
MD5 7a5b445d9d02c974ffa6b2774d504fe0
BLAKE2b-256 81457e3029875de5cd182980b415e4b29e4418134de7d3b58c3664aefb2606c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysiglib-4.0.0rc1-py3-none-win_amd64.whl:

Publisher: release.yml on daniil-shmelev/pySigLib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pysiglib-4.0.0rc1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pysiglib-4.0.0rc1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5aa0a27ce13381684ef09bac5188ed840c915b1d63fe7b14976494a225251958
MD5 31115c74d3849f07ed3ec86e9c383aa1
BLAKE2b-256 1fd868b5e85cb1ec6897f16fb7f233f37d3ec4d1f882818b25a325991ab54368

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysiglib-4.0.0rc1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on daniil-shmelev/pySigLib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pysiglib-4.0.0rc1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pysiglib-4.0.0rc1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6b033392e9425be70429f151215cf9570085cdbe50dadef78680f1f89c253c6a
MD5 12b5f20a1ee76e2051ef7f60e8a4ce4d
BLAKE2b-256 2a6ca62929b5fcf7f0647760d98c61e11f3e1b0d133f996085f314a2bde0033d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysiglib-4.0.0rc1-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on daniil-shmelev/pySigLib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

4.0.0rc1 This release

3 files

3.1.0

3 files

3.0.3

3 files

3.0.2

3 files

3.0.1

3 files

3.0.0

3 files

2.3.0

1 file

2.2.0

1 file

2.1.0

1 file

2.0.1

1 file

2.0.0

1 file

1.1.1

1 file

1.1.0

1 file

1.0.0

1 file

0.2.3

1 file

0.2.2

1 file

0.2.1

1 file

0.2.0

1 file

0.1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page