BiLoopFormer: Reusing a Shared Transformer Stack Forward and Backward for Vision
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…
- arXiv
- 2612.03102
- Authors
- Zhuoran Zheng
- Categories
- cs.CV