Transformers with Signatures: Towards Universal In-Context Learning in Path Space
Abstract
In-context learning (ICL) enables transformers to adapt to new tasks from demonstrations without updating their parameters. However, theoretical guarantees for transformers remain limited in general, and elusive in particular when target responses depend nonlinearly on the evolution of observed paths. We establish an ICL framework for path space, using path signature features. Building on the universal linear approximation property of signatures, we construct explicitly a causal softmax transformer with two attention heads per layer that emulates in-context Lasso. Under sparse signature approximation and suitable moment and concentration conditions, we establish finite-sample prediction error bounds. Our analysis goes beyond the IID data setting in the existing ICL theory, allowing dependence among demonstrations and the query. Experiments on in-context sparse recovery, nonlinear path regression, execution-cost prediction, and financial payoff inference demonstrate robustness to changes in observation grids and adaptation to unseen market environments. Across these prediction tasks, transformers with signatures match or outperform vanilla transformer baselines with substantially fewer trainable parameters, highlighting the effectiveness and efficiency of signature-based ICL.
Related
- Transformers Provably Implement In-Context Reinforcement Learning with Policy Improvement
- Nonparametric In-Context Learning under Growing Geometric Complexity: Minimax Optimality and Local Geometry-Adaptivity of Transformers
- Transformers as Adaptive Kernel Learners across Tasks for In-Context Learning
- Transformers as Cross-Task Learners: Shared Structure Drives Sample Efficiency in In-Context Learning
- Adversarially Trained Linear Transformers Are Optimal Robust In-Context Learners for Gaussian Mixtures
BibTeX
@misc{cheng2026transformers,
title = {{Transformers with Signatures: Towards Universal In-Context Learning in Path Space}},
author = {Ziheng Cheng and Xin Guo and Ben Hambly},
howpublished = {arXiv},
year = {2026},
month = nov,
doi = {10.48550/arxiv.2611.31439},
eprint = {2611.31439},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2611.31439},
note = {CC BY 4.0},
}
RIS
TY - UNPB
TI - Transformers with Signatures: Towards Universal In-Context Learning in Path Space
AU - Ziheng Cheng
AU - Xin Guo
AU - Ben Hambly
PY - 2026
DA - 2026/11/23
PB - arXiv
DO - 10.48550/arxiv.2611.31439
UR - https://arxiv.org/abs/2611.31439
AB - In-context learning (ICL) enables transformers to adapt to new tasks from demonstrations without updating their parameters. However, theoretical guarantees for transformers remain limited in general, and elusive in particular when target responses depend nonlinearly on the evolution of observed paths. We establish an ICL framework for path space, using path signature features. Building on the universal linear approximation property of signatures, we construct explicitly a causal softmax transformer with two attention heads per layer that emulates in-context Lasso. Under sparse signature approximation and suitable moment and concentration conditions, we establish finite-sample prediction error bounds. Our analysis goes beyond the IID data setting in the existing ICL theory, allowing dependence among demonstrations and the query. Experiments on in-context sparse recovery, nonlinear path regression, execution-cost prediction, and financial payoff inference demonstrate robustness to changes in observation grids and adaptation to unseen market environments. Across these prediction tasks, transformers with signatures match or outperform vanilla transformer baselines with substantially fewer trainable parameters, highlighting the effectiveness and efficiency of signature-based ICL.
ER -