Exploiting Dynamic Sparsity in Einsum
Christoph Staudt, Mark Blacher, Tim Hoffmann, Lea Kasche, Olaf Beyersdorff, Joachim Giesen
Abstract
Einsum expressions specify an output tensor in terms of several input tensors. They offer a simple yet expressive abstraction for many computational tasks in artificial intelligence and beyond. However, evaluating einsum expressions poses hard algorithmic problems that depend on the representation of the tensors. Two popular representations are multidimensional arrays and coordinate lists. The latter is a more compact representation for sparse tensors, that is, tensors where a significant proportion of the entries are zero. So far, however, most of the popular einsum implementations use the multidimensional array representation for tensors. Here, we show on a non-trivial example that, when evaluating einsum expressions, coordinate lists can be exponentially more efficient than multidimensional arrays. In practice, however, coordinate lists can also be significantly less efficient than multidimensional arrays, but it is hard to decide from the input tensors whether this will be the case. Sparsity evolves dynamically in intermediate tensors during the evaluation of an einsum expression. Therefore, we introduce a hybrid solution where the representation is switched on the fly from multidimensional arrays to co-ordinate lists depending on the sparsity of the remaining tensors. In our experiments on established benchmark einsum expressions, the hybrid solution is consistently competitive with or outperforms the better of the two static representations.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext fba4b091-a9a6-4cc7-82a7-5be11c95f4faCited by top-tier papers2
- Proof Systems for Tensor-based Model CountingOlaf Beyersdorff, Joachim Giesen, Andreas Goral, Tim Hoffmann et al.AAAI 2026 · 1 citation
- Automated Tensor-Relational Decomposition for Large-Scale Sparse Tensor ComputationYuxin Tang, Zhiyuan Xin, Zhimin Ding, Xinyu Yao et al.VLDB 2026
Builds on10
- A Compositional Atlas of Tractable Circuit Operations for Probabilistic InferenceAntonio Vergari, YooJung Choi, Anji Liu, Stefano Teso et al.NeurIPS 2021 · 112 citations
- Deep Ensembling with No Overhead for either Training or Testing: The All-Round Blessings of Dynamic SparsityShiwei Liu, Tianlong Chen, Zahra Atashgahi, Xiaohan Chen et al.ICLR 2022 · 62 citations
- Check before You Change: Preventing Correlated Failures in Service UpdatesEnnan Zhai, Ang Chen, Ruzica Piskac, Mahesh Balakrishnan et al.NSDI 2020 · 46 citations
- Scalable Quantitative Verification For Deep Neural NetworksTeodora Baluta, Zheng Leong Chua, Kuldeep S. Meel, Prateek SaxenaICSE 2021 · 39 citations
- Non-asymptotic Approximation Error Bounds of Parameterized Quantum CircuitsZhan Yu, Qiuhao Chen, Yuling Jiao, Yinan Li et al.NeurIPS 2024 · 35 citations
Related papers
- Einsum Trees: An Abstraction for Optimizing the Execution of Tensor ExpressionsAlexander Breuer, Mark Blacher, Max Engel, Joachim Giesen et al.ASPLOS 2025
- Insum: Sparse GPU Kernels Simplified and Optimized with Indirect EinsumsJaeyeon Won, Willow Ahrens, Saman P. Amarasinghe, Joel S. EmerASPLOS 2026
- Efficient and Portable Einstein Summation in SQLMark Blacher, Julien Klaus, Christoph Staudt, Sören Laue et al.SIGMOD 2023 · 15 citations
- Automatic generation of efficient sparse tensor format conversion routinesStephen Chou, Fredrik Kjolstad, Saman P. AmarasinghePLDI 2020 · 26 citations
- EinDecomp: Decomposition of Declaratively-Specified Machine Learning and Numerical Computations for Parallel ExecutionDaniel Bourgeois, Zhimin Ding, Dimitrije Jankov, Jiehui Li et al.VLDB 2025 · 4 citations
