Quantum Doubly Stochastic Transformers

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Born, Jannis, Skogh, Filip, Rhrissorrakrai, Kahn, Utro, Filippo, Wagner, Nico, Sobczyk, Aleksandros
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866914143094702080
author Born, Jannis
Skogh, Filip
Rhrissorrakrai, Kahn
Utro, Filippo
Wagner, Nico
Sobczyk, Aleksandros
author_facet Born, Jannis
Skogh, Filip
Rhrissorrakrai, Kahn
Utro, Filippo
Wagner, Nico
Sobczyk, Aleksandros
contents At the core of the Transformer, the softmax normalizes the attention matrix to be right stochastic. Previous research has shown that this often de-stabilizes training and that enforcing the attention matrix to be doubly stochastic (through Sinkhorn's algorithm) consistently improves performance across different tasks, domains and Transformer flavors. However, Sinkhorn's algorithm is iterative, approximative, non-parametric and thus inflexible w.r.t. the obtained doubly stochastic matrix (DSM). Recently, it has been proven that DSMs can be obtained with a parametric quantum circuit, yielding a novel quantum inductive bias for DSMs with no known classical analogue. Motivated by this, we demonstrate the feasibility of a hybrid classical-quantum doubly stochastic Transformer (QDSFormer) that replaces the softmax in the self-attention layer with a variational quantum circuit. We study the expressive power of the circuit and find that it yields more diverse DSMs that better preserve information than classical operators. Across multiple small-scale object recognition tasks, we find that our QDSFormer consistently surpasses both a standard ViT and other doubly stochastic Transformers. Beyond the Sinkformer, this comparison includes a novel quantum-inspired doubly stochastic Transformer (based on QR decomposition) that can be of independent interest. Our QDSFormer also shows improved training stability and lower performance variation suggesting that it may mitigate the notoriously unstable training of ViTs on small-scale data.
format Preprint
id arxiv_https___arxiv_org_abs_2504_16275
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Quantum Doubly Stochastic Transformers
Born, Jannis
Skogh, Filip
Rhrissorrakrai, Kahn
Utro, Filippo
Wagner, Nico
Sobczyk, Aleksandros
Machine Learning
Artificial Intelligence
Computational Engineering, Finance, and Science
Computer Vision and Pattern Recognition
At the core of the Transformer, the softmax normalizes the attention matrix to be right stochastic. Previous research has shown that this often de-stabilizes training and that enforcing the attention matrix to be doubly stochastic (through Sinkhorn's algorithm) consistently improves performance across different tasks, domains and Transformer flavors. However, Sinkhorn's algorithm is iterative, approximative, non-parametric and thus inflexible w.r.t. the obtained doubly stochastic matrix (DSM). Recently, it has been proven that DSMs can be obtained with a parametric quantum circuit, yielding a novel quantum inductive bias for DSMs with no known classical analogue. Motivated by this, we demonstrate the feasibility of a hybrid classical-quantum doubly stochastic Transformer (QDSFormer) that replaces the softmax in the self-attention layer with a variational quantum circuit. We study the expressive power of the circuit and find that it yields more diverse DSMs that better preserve information than classical operators. Across multiple small-scale object recognition tasks, we find that our QDSFormer consistently surpasses both a standard ViT and other doubly stochastic Transformers. Beyond the Sinkformer, this comparison includes a novel quantum-inspired doubly stochastic Transformer (based on QR decomposition) that can be of independent interest. Our QDSFormer also shows improved training stability and lower performance variation suggesting that it may mitigate the notoriously unstable training of ViTs on small-scale data.
title Quantum Doubly Stochastic Transformers
topic Machine Learning
Artificial Intelligence
Computational Engineering, Finance, and Science
Computer Vision and Pattern Recognition
url https://arxiv.org/abs/2504.16275