Path signatures provide a rich representation of sequential data, with strong theoretical guarantees and good performance in a variety of machine-learning tasks. While signatures have progressed from fixed feature extractors to trainable components of machine-learning models, existing libraries often lack the required scalability for large-scale, gradient-based learning. To address this gap, this paper introduces pathsig, a PyTorch-native library that computes path signatures directly in the word basis. By using CUDA kernels to update signature coefficients in parallel over prefix-closed word sets, pathsig achieves high GPU throughput and near-minimal peak memory. Compared with other libraries, pathsig achieves 10-30x speedups for computation of truncated signatures and up to 4-10x speedups in training that require backpropagation through the signature. Beyond regular truncation, pathsig supports projections of the (infinite-dimensional) signature onto user-specified sets of words and anisotropic truncation motivated by inhomogeneous path regularity, enabling more compact representations that can reduce dimensionality, redundancy, and computational cost.
Figures & tables
Figure 1: Speedup of pathsig relative to keras_sig and pySigLib , averaged over 27 signature configurations for each combination of batch size and sequence length.
Training time
Speedup of pathsig
(B,M,d)
N
Sig dim
keras_sig
pySigLib
pathsig
vs keras_sig
vs pySigLib
Effect of depth N
(32, 100, 6)
2
42
2.08 ms
3.88 ms
151.29 μ s
13.77×
25.65×
(32, 100, 6)
3
258
5.84 ms
3.83 ms
270.70 μ s
21.57×
14.16×
(32, 100, 6)
4
1.6K
4.56 ms
9.12 ms
207.52 μ s
21.97×
43.96×
(32, 100, 6)
5
9.3K
8.65 ms
23.86 ms
555.63 μ s
15.57×
42.95×
Table 1: Selected training-time speedups of pathsig relative to keras_sig and pySigLib .
(B,M,d)
N
Sig dim
Memout
keras_sig
pathsig
Reduction ( × )
Effect of depth N
(32, 50, 8)
3
584
0.1 MB
24.2 MB
0.3 MB
81×
(32, 50, 8)
4
4.7K
0.6 MB
245.5 MB
1.3 MB
189×
(32, 50, 8)
5
37.4K
4.6 MB
1.53 GB
9.3 MB
165×
(32, 50, 8)
6
299.6K
36.6 MB
11.64 GB
73.3 MB
159×
Effect of seq length M
Table 2: Selected peak VRAM allocations during training.
Figure 2: Speedup of pathsig relative to pySigLib , averaged over 27 log-signature configurations for each combination of batch size and sequence length.
(B,M,d)
N
LogSig dim
pySigLib
pathsig
Speedup ( × )
Effect of depth N
(32, 100, 6)
3
91
5.92 ms
321.22 μ s
18.43×
(32, 100, 6)
4
406
12.14 ms
554.58 μ s
21.89×
(32, 100, 6)
5
2.0K
29.24 ms
430.57 μ s
67.91×
(32, 100, 6)
6
9.7K
80.61 ms
1.38 ms
58.34×
Effect of seq length M
Table 3: Selected log-signature training-time speedups of pathsig relative to pySigLib .
Figure 3: Average training time (left) and corresponding speedup (right) for windowed signature computation.
Figure 4: Validation MSE versus epoch (mean over 5 independent runs) for Hurst parameter estimation on 5 -dimensional fBM with independent components. We train on 8,000 simulated paths of length 250 with H∼U(0.25,0.75) sampled independently per path, and evaluate on 2,000 held-out paths. We compare an FNN (Feedforward Neural Network) baseline to the Deep Signature Model using either a truncated lead–lag signature or the proposed sparse lead–lag word projection.