# Representing Tensors as Compositions for Efficient Computation on Sparse and Structured Data

DevFeed: [Representing Tensors as Compositions for Efficient Computation on Sparse and Structured Data](<https://devfeed.tech/articles/representing-tensors-as-compositions-for-efficient-computation-on-sparse-and-structured-data-125265.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.10855>)

Author: Val\\'erian Rey, Praneth Paruchuri

Published: 2026-11-10T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Machine Learning](<https://devfeed.tech/sources/arxiv-machine-learning.md>)

Topics: [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [ggml](<https://devfeed.tech/topics/ggml.md>), [vectorization techniques](<https://devfeed.tech/topics/vectorization-techniques.md>)

Tags: [2](<https://devfeed.tech/tags/2.md>), [abstract](<https://devfeed.tech/tags/abstract.md>), [activation](<https://devfeed.tech/tags/activation.md>), [activation-function](<https://devfeed.tech/tags/activation-function.md>), [algebra](<https://devfeed.tech/tags/algebra.md>), [all](<https://devfeed.tech/tags/all.md>), [arxiv](<https://devfeed.tech/tags/arxiv.md>), [based](<https://devfeed.tech/tags/based.md>), [can](<https://devfeed.tech/tags/can.md>), [combined](<https://devfeed.tech/tags/combined.md>), [complexity](<https://devfeed.tech/tags/complexity.md>), [composition](<https://devfeed.tech/tags/composition.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [cs-ms](<https://devfeed.tech/tags/cs-ms.md>), [cs-pl](<https://devfeed.tech/tags/cs-pl.md>), [data](<https://devfeed.tech/tags/data.md>), [draft](<https://devfeed.tech/tags/draft.md>), [element](<https://devfeed.tech/tags/element.md>), [engine](<https://devfeed.tech/tags/engine.md>), [focus](<https://devfeed.tech/tags/focus.md>), [structured](<https://devfeed.tech/tags/structured.md>), [structured-data](<https://devfeed.tech/tags/structured-data.md>), [tensors](<https://devfeed.tech/tags/tensors.md>)

## AI overview

The paper proposes representing tensors as index-to-value functions and tensor operations as compositions: value functions handle element-wise operations, index functions handle re-indexing, and combined index and reduction functions handle reductions. With tensor stacking, this is intended to cover dense, jagged, sparse, and factorized tensors, plus lazy forms of operations such as einsum. Algebraic identities can rewrite computations without evaluating them; for example, the product of two sparse matrices can be rewritten to compute only products of nonzero values. The authors propose using this algebra as a computation engine's intermediate representation, shifting implementation work toward index-function algebra. They project codebase complexity changing from O(mn²) to O(m + k²), where m is the number of binary tensor operations, n the number of tensor types, and k the number of index-function types. The supplied abstract mentions a draft implementation but gives no performance evaluation.

## Source excerpt

arXiv:2611.10855v1 Announce Type: new Abstract: We propose a new mathematical formalism in which all kinds of tensors and of operations on those tensors are represented as simple function compositions. Tensors are functions from indices to values. An element-wise operation (e.g. an activation function) is a composition with a function applied to values; re-indexing (e.g. reshape, transposition) is a composition with a function applied to indices; and a reduction is a composition with both an index function, mapping each index to several indices, and a reduction operation (e.g. product, sum, max). Combined with tensor stacking, these compositions can represent most interesting kinds of tensors (e.g. dense, jagged, all kinds of sparsity patterns, matrix factorizations), as well as lazy versions of almost every operation available in modern tensor computation frameworks, including einsums between tensors of any kind. Identities between compositions can then be used to rewrite such expressions into equivalent ones, without evaluating them. For instance, the product of two sparse matrices can be rewritten so that only products between non-zero values are computed, turning a sparse problem into a dense one. Using this algebra as the intermediate representation of a tensor computation engine would shift the focus from defining operations on tensors (e.g. einsum between sparse tensors) to defining an algebra on index functions. This should reduce the codebase complexity from $\mathcal{O}(mn^2)$, with $m$ the number of binary operations between tensors and $n$ the number of tensor types, to $\mathcal{O}(m + k^2)$, with $k$ the number of types of index functions. A draft implementation of a tensor computation framework based on this algebra is publicly available.