All models

Tensor Product Attention

T6, a language model whose Tensor Product Attention factorizes queries, keys and values to shrink the KV cache.

Language · 1,637 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (9 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
354M
Operations
1,637
Framework
PyTorch
Recurrent
No
Published
NeurIPS 2025
Cited by
4 (as of 29 October 2026)
Authors
Yifan Zhang, Yifeng Liu, Huizhuo Yuan and others
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m20931
Graph hash
86803c481631db9652adaab86c8312081149de092bd891b98202aab5ab313e5b
Skeleton hash
d89d87d16f85ec01cae364a7f70c5ee69c121f96991bde0506bbfe745e86fffb
Architecture hash
2736811c2bab09d0d3f71715edee6d2f8ddb79c244dcd303545edef57c86912f
Diagram SHA-256
68634b202808e5e2e6ec274d24e778c6d2f61e419346e4e32d508c1ba166aaf3
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

T6, the Tensor ProducT ATTenTion Transformer, is a sequence modeling architecture built on Tensor Product Attention (TPA). The problem it addresses is memory: scaling language models to longer input sequences typically requires large key-value (KV) caches, which add substantial memory overhead during inference.

TPA uses tensor decompositions to represent queries, keys and values compactly, which shrinks the KV cache at inference time. The representations are factorized into contextual low-rank components, and the mechanism integrates with Rotary Position Embedding (RoPE). On language modeling tasks, the paper reports that T6 surpasses or matches Transformer baselines built on Multi-Head Attention (MHA), Multi-Query Attention (MQA), Grouped-Query Attention (GQA) and Multi-Head Latent Attention (MLA), on perplexity and a range of evaluation benchmarks.

The official code is built on Karpathy's nanoGPT codebase and supports pretraining on Fineweb-Edu-100B and OpenWebText. The repository also carries Python and Triton implementations of the FlashTPA decoding algorithms described in the paper.

Key idea. Tensor Product Attention represents queries, keys and values with tensor decompositions, shrinking the KV cache at inference time, and the T6 architecture is built on it.

  • Tensor Product Attention
  • TPA
  • T6
  • Tensor ProducT ATTenTion Transformer
  • KV cache
  • language model
  • low-rank attention
  • FlashTPA

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{zhang2026tensorproductattentionneed,
      title={Tensor Product Attention Is All You Need}, 
      author={Yifan Zhang and Yifeng Liu and Huizhuo Yuan and Zhen Qin and Yang Yuan and Quanquan Gu and Andrew Chi-Chih Yao},
      year={2026},
      eprint={2501.06425},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2501.06425}, 
}