BiLoopFormer: Reusing a Shared Transformer Stack Forward and Backward for Vision
Authors
Abstract
Looped transformers reuse one block across depth, but they still traverse it in one direction. Making such a model bidirectional is harder than it looks: reversing the token order between passes, the way a bi-LSTM does, is close to a no-op, because self-attention is permutation-equivariant and both passes then compute the same function. What breaks the symmetry is masking. We run the shared stack forward under a prefix mask and backward, in reverse block order, under a suffix mask, so that every token receives a prefix summary and a suffix summary, and concatenate the two pooled states in a bi-LSTM read-out. At matched FLOPs this model carries $3.6\times$ fewer parameters than a ViT and reaches \mainCifarOurs\% on CIFAR-10, against \mainCifarVit\% for the ViT and \mainCifarCnn\% for a compute-matched ResNet. The masked second sweep is worth \ablUniGap\ points over unidirectional looping, while transposed weights and swapped query/value roles both fall short of plain weight tying. On a synthetic underwater-restoration probe it lands within 0.5\,dB of a compute-matched UNet; on polyp segmentation and two MedMNIST datasets the same pattern holds, with BLF the most parameter-efficient encoder and never the most accurate. We make no claim of state-of-the-art accuracy: at this compute scale the convolutional prior still wins on every dataset, and what bidirectionality buys is parameter efficiency rather than accuracy. The contribution is a cheap way to give a looped transformer two directions, plus an explanation of why the obvious version of it fails.
Paper Information
- arXiv ID:
- 2612.03102v1
- Published: