cs.LGSep 14, 2026

Same path, different: a mechanistic comparison of looped and stacked transformer encoders on 12-lead ECG

Authors: Pawel OlszowiecMichal ByraGrzegorz GruszczynskiGrzegorz StefanskiAlberto Presta

Organizations: Samsung AI Center, Warsaw, Poland · IFTR, Polish Academy of Sciences, Warsaw, Poland

Abstract

Recurrent Transformers reusing their weights rather than stacking LL distinct layers are becoming widely adopted due to their parameter efficiency [1,2,3]. However, the exact representational and dynamical differences between looped and stacked architectures remain uncharacterized. This paper presents a controlled study on the example of bViT model [1] applying one weight-tied block LL times. We train two models: bViT and standard ViT [4] on 12-lead electrocardiogram (ECG) classification tasks from the PTB-XL dataset under identical training protocols. Despite an 8.9×8.9\times parameter reduction, bViT achieves accuracy parity with ViT. Geometric similarity metrics demonstrate that both architectures construct comparable latent representations in an equivalent canonical order. Crucially, their dynamics differ: bViT exhibits smaller step sizes and inter-patient sensitivity, as well as near-neutral behavior away from the data manifold, whereas ViT exhibits collapsing dimensionality of representations and out-of-distribution feature expansion.

Explore similar work

CardsList
  1. On the role of the tokenizer in ECG transformer models

    Sep 14, 2026Jiawei Li, Fabio Bonassi, Johan Sundström +2TokenizationPhysiological Data