arXiv:2608.29113cs.CVAug 2026

Manuscript Offprint

arXiv:2608.29113

GramLoop: Training-Free Gram-Gated Replay for Robust Dense Prediction

Yang Chen, Canyu Shen, Xinzhe Rao, Yuanyi Yan, Yunlu Chen, Meng Tang, Teng Long, Vincent Tao Hu

Abstract

We aim to improve frozen DINOv3 dense-prediction models under distribution shift by adding inference computation inside the visual backbone, without changing model weights, task adapters, or prediction heads. The challenge is that repeated transformer-block computation must refine dense features without disrupting the pairwise patch relations that DINOv3 uses to preserve spatial structure. We introduce GRAMLOOP, a training-free framework that replays a short transformer window and controls each replay through final-layer cosine-Gram consistency. Each proposal is propagated through the frozen suffix, measured against the standard DINOv3 trajectory, and accepted through a patchwise gate at the replay-window endpoint. Across object detection and semantic segmentation under corruptions, perturbations, and natural shifts, GRAMLOOP improves all five shifted benchmarks over the paired DINOv3 baseline. On COCO-O, it improves mAP by +0.252 and Effective Robustness by +0.250, while preserving clean ADE20K performance. Code will be released at this https URL.

Introduction

Built on the patch-token architecture introduced by ViT (Dosovitskiy et al. 2021), self-supervised vision transformers have become general-purpose feature extractors for both image-level recognition and dense prediction. DINO (Caron et al. 2021) showed that self-distillation can produce semantically organized patch representations without manual labels, while DINOv2 (Oquab et al. 2024) and DINOv3 (Siméoni et al. 2026) substantially scaled this paradigm in model capacity and pretraining data. In particular, DINOv3 scales self-supervised pretraining to models with up to 7B parameters and 1.7B unlabeled images, producing frozen features that support segmentation, object detection, and depth estimation (Siméoni et al. 2026). This combination of scalability and dense spatial structure makes DINOv3 an attractive backbone for downstream visual prediction.

Nevertheless, strong performance on clean benchmarks does not guarantee robustness under challenging acquisition conditions. Common corruptions degrade semantic-segmentation systems (Kamann and Rother 2021) and object detectors (Michaelis et al. 2019). Real-world-inspired perturbations expose similar weaknesses in foundation-model segmentation (Schiappa et al. 2024), while natural distribution shifts reduce detector performance (Mao et al. 2023). This limitation motivates a complementary question: can the representation trajectory of a frozen visual backbone be refined at inference time, without updating either the backbone or its task-specific head?

Looped and recurrent-depth transformers provide a natural mechanism for allocating additional computation by repeatedly applying shared transformer blocks. Universal Transformers introduced recurrent self-attention with adaptive halting (Dehghani et al. 2019). Subsequent work studied looped transformers as programmable computers (Giannou et al. 2023), iterative in-context learners (Yang et al. 2024), and latent-reasoning models (Saunshi et al. 2025). More recently, training-free looped transformers retrofit damped block replay onto frozen language models and show that naive block reapplication can be harmful (Chen et al. 2026). However, it remains unclear how such replay should be controlled spatially when applied to frozen visual features for dense prediction under distribution shifts: replay proposes changes to every token, although only some may preserve the spatial structure of the frozen backbone.

DINOv3 provides a useful structural signal through its Gram-anchoring objective, which preserves pairwise relations among patch features during large-scale pretraining (Siméoni et al. 2026). We hypothesize that replay proposals causing less downstream Gram drift are more reliable. Based on this hypothesis, we introduce GRAMLOOP, which propagates each proposal through the frozen suffix, measures its patchwise final-layer cosine-Gram drift from the standard DINOv3 trajectory, and uses this drift to scale the update at the replay-window endpoint. High-drift updates are attenuated, while the task adapter and prediction head remain unchanged. A matched-strength diagnostic confirms lower replay-induced Gram discrepancy than uniform replay across all 17 COCO-P perturbations and all 85 severity-specific conditions.

Our contributions are threefold:

• We introduce GRAMLOOP, a training-free replay framework for frozen DINOv3 dense-prediction models. It uses patchwise final-layer cosine-Gram drift to selectively control feature updates at an earlier replay-window endpoint, without updating the backbone, task adapter, or prediction head.

• We establish the effectiveness of GRAMLoop across semantic segmentation and object detection under controlled corruptions, real-world-inspired perturbations, and natural distribution shifts. GRAMLoop improves COCO-O, COCO-P, COCO-C, ADE20K-C, and ADE20K-P while preserving clean performance.

• We provide controlled diagnostics and ablations explaining these gains. At matched mean update strength, patchwise Gram gating reduces final-layer relation error relative to uniform replay across all 17 COCO-P perturbations and 85 severity-specific conditions. A placement ablation further identifies final-layer Gram measurement with loop-end updates as the strongest evaluated configuration.

References (33)