Robots Atlas>ROBOTS ATLAS
Training

Gram Anchoring

2025ResearchPublished: 2 September 2026Updated: 2 September 2026Published
Key innovation
Gram anchoring regularizes the Gram matrix of the student's patch features toward an earlier "anchor" teacher with superior dense properties, for the first time effectively halting the degradation of dense feature maps over long self-supervised training schedules.
Category
Training
Abstraction level
Pattern
Operation level
Training
Use cases
Self-supervised vision model training (SSL)Learning dense patch-level representationsSemantic segmentationDepth estimationVision foundation models

How it works

During the refinement phase, the Gram matrix of the student's normalized patch features (X_S·X_Sᵀ) is computed alongside that of the "Gram teacher" (an earlier checkpoint with better dense properties, X_G·X_Gᵀ). The loss L_Gram = ‖X_S·X_Sᵀ − X_G·X_Gᵀ‖²_F pulls the student's patch-to-patch similarity structure toward the teacher's. This loss is added to the overall refinement objective (alongside DINO, iBOT, and Koleo losses, weighted by w_Gram), computed on global crops, with the Gram teacher periodically refreshed to the current EMA teacher.

Problem solved

During long self-supervised training schedules for vision models, dense feature maps (per-patch representations) degrade even as global features keep improving. This harms dense downstream tasks such as semantic segmentation and depth estimation. Gram anchoring stabilizes the structure of local patch similarities, counteracting this degradation.

Components

Patch-feature Gram matrixRepresentation of pairwise similarity relations between patches

A P×P matrix of all pairwise dot products of L2-normalized patch features. It encodes the local similarity structure that is regularized instead of the raw feature vectors.

Gram teacherAnchoring reference model with superior dense properties

An earlier iteration of the teacher network exhibiting higher patch-level feature consistency. It provides the target Gram matrix and is periodically (every ~10k iterations) refreshed to the current EMA teacher.

Gram anchoring loss (L_Gram)Refinement regularization term

Squared Frobenius norm of the difference between the student and teacher Gram matrices: L_Gram = ‖X_S·X_Sᵀ − X_G·X_Gᵀ‖²_F. Added, weighted by w_Gram, to the overall refinement loss alongside the DINO, iBOT, and Koleo losses.

Implementation

Reference implementations
Implementation pitfalls
Poor choice of the Gram teacherHigh

The method's effectiveness depends on anchoring to a checkpoint with genuinely superior dense properties. Anchoring to a degraded or too-late teacher removes the benefit.

Fix:Select an early teacher iteration with high patch-level consistency and periodically refresh it (e.g. every ~10k iterations) to the current EMA teacher.
Quadratic cost of the Gram matrixMedium

The Gram matrix scales as O(P²) with the number of patches, sharply increasing compute and memory cost at high resolution.

Fix:Compute the loss only on global crops; in the high-resolution variant, down-sample the teacher feature maps (2×2 bicubic) to the student dimension.

Hyperparameters (configurable axes)

Gram anchoring loss weightHigh

Weighting coefficient for the L_Gram loss in the overall refinement objective. Controls the strength of anchoring the similarity structure to the Gram teacher.

Activation iterationHigh

Number of main-training iterations after which the refinement phase with Gram anchoring is enabled. ~1M iterations in DINOv3.

~1,000,000
Gram teacher refresh intervalMedium

How often the Gram teacher is refreshed to the current EMA teacher. ~10k iterations in DINOv3.

~10,000
High-resolution Gram teacherMedium

Optional variant: the Gram teacher receives 2× higher-resolution images and the feature maps are down-sampled (2×2 bicubic) to the student dimension, yielding smoother patch representations.

Computational complexity

Time complexity: O(P² · d) na obraz. Space complexity: O(P²) na obraz.

Parallelism

Parallelism level
Fully parallel

The Gram matrix computation (matrix multiplication) and Frobenius norm are fully parallel on GPUs; the technique applies only during training.

Scope
Training

Hardware requirements

Primary

The Gram matrix computation is a dense matrix multiplication that efficiently uses GPU Tensor Cores; DINOv3 was trained on large GPU clusters.