GRAFT: Graph-Regularized Prototype Fields for Realistic Test-Time Adaptation of VLMs

Maxx Richard Rahman, Wolfgang MaassarXiv 2026

TL;DR

GRAFT is a new test-time adaptation method for vision-language models (VLMs) that prevents performance collapse when test data contains only a few classes. By modeling adaptation as a "displacement field" regularized by a semantic class graph, it allows rare or absent classes to learn from their more common neighbors, ensuring robust performance across realistic, sparse data streams.

What Problem Does This Paper Address?

Vision-Language Models like CLIP are powerful zero-shot classifiers, but they can often be improved by adapting to the specific distribution of test data (Test-Time Adaptation, or TTA). However, most TTA methods suffer from a major flaw: they assume that every class in the vocabulary will appear in every batch of test data.

In the real world, this is rarely true. A photo album might only contain "dogs" and "cats," yet the model's vocabulary might include 1,000 ImageNet categories. When classes are absent or rare, existing TTA methods tend to "collapse." Either the absent classes "capture" samples that don't belong to them, or they are left at biased starting points while other classes move away. This often results in adapted models performing significantly worse than the original zero-shot baseline.

Figure 1. Per-class adaptation on a realistic batch (conceptual il- lustration). Classes A and B are present, C is absent, and all im- ages are shifted from their anchors. (a) Per-class fitting lets C cap- ture samples of B. (b) Anchor-only shrinkage leaves C at its biased anchor. (c) GRAFT lets C inherit B’s displacement and removes it through the presence model.

Methods

The authors propose GRAFT (Graph-Regularized Anchor-displacement Field Transduction). Instead of treating each class as an independent entity to be tuned, GRAFT models the adaptation as a displacement field applied to the original text embeddings (anchors).

Key technical components include:

  • Semantic Class Graph: A graph built from the text embeddings themselves. If "Golden Retriever" and "Labrador" are close in embedding space, they are connected in the graph.
  • Graph Regularization (GMRF): GRAFT uses a Gaussian Markov Random Field prior. This forces the displacements of semantically similar classes to be similar. If the model learns that "Golden Retriever" images are shifted in a certain direction in feature space, it propagates that shift to the "Labrador" prototype, even if no Labradors are present in the batch.
  • Class-Presence Model: An explicit model (using a Dirichlet prior) that estimates which classes are actually present. This effectively "mutes" absent classes so they don't compete for samples.
  • Closed-Form Inference: Unlike many TTA methods that require backpropagation, GRAFT's updates are closed-form and gradient-free, making it fast and stable.
Figure 2. Overview of GRAFT. Frozen encoders give features X and anchors T, which define the zero-shot prior ˆy, the sample graph Ws (from X, images to images) and the semantic class graph LT (from T, classes to classes). Closed-form updates alternate the E-step over z, using ˆy and Ws, with M-steps for the presence π, the displacement field D pooled over LT and the shared covariance; µ = T + D are the adapted prototypes and z the prediction.

Datasets

The method was evaluated on a comprehensive suite of benchmarks:

  • 11 Standard Datasets: Including ImageNet, SUN397, EuroSAT, Oxford Pets, and Flowers102.
  • 4 ImageNet Distribution Shifts: ImageNet-V2, Sketch, Adversarial (A), and Rendition (R).
  • Realistic Protocols: The authors tested across various "effective class" counts, ranging from "very low" (1-4 classes per batch) to "all" (the entire vocabulary).

Key Insights and Ideas

  • The Modality Gap is Shared: A significant portion of the "error" in zero-shot VLMs comes from a global shift between image and text distributions (the modality gap). Because this shift is often shared across classes, information from one class should help adapt another.
  • Harmonic Extension: For absent classes, the displacement field becomes a "harmonic extension" of the present ones. They essentially "borrow" the shift from their nearest neighbors in the semantic graph.
  • Label Shift is the Enemy: Simply adjusting prototypes isn't enough; you must also account for the fact that most classes aren't there. The presence model is crucial for preventing "absent class capture."
  • Hyperparameter-Free: By using an empirical Bayes approach, GRAFT can automatically tune its own pooling strength based on the data, removing the need for per-dataset manual tuning.

Key Results

GRAFT consistently outperforms both the zero-shot baseline and state-of-the-art TTA methods like StatA and MOON, particularly in the most challenging "low-class" settings.

  • Robustness to Sparsity: In "very low" class settings (B=64 images, ~2 classes), GRAFT achieves 72.1% accuracy on the 11-dataset mean, compared to 65.2% for zero-shot CLIP and 70.4% for the previous best anchored method (StatA).
  • No Collapse: While unanchored methods like TransCLIP drop to ~39% accuracy when few classes are present, GRAFT remains stable and improves over the baseline in every single tested setting.
  • Distribution Shifts: On shifted ImageNet datasets (like Sketch or Rendition), the gain over existing methods grows even larger (up to 2.5 points over StatA), as the semantic graph effectively propagates the domain-specific shift.
Figure 4. Top-1 accuracy versus the number of effective classes per batch (eleven-dataset mean, error bars: standard deviation over tasks); the dotted line is the zero-shot model.

Limitations and Future Work

  • Semantic Graph Quality: GRAFT relies on the quality of the text encoder to build its semantic graph. If the text embeddings don't capture the true relationships between classes for a specific task, the regularization might be less effective.
  • Computational Overhead: While gradient-free, solving the linear systems for the displacement field adds some overhead compared to simple per-class updates, though the authors mitigate this using conjugate gradients.
  • Future Directions: The authors suggest that incorporating hierarchical class information (like WordNet hierarchies) could further refine the semantic graph beyond simple embedding similarity.

Summary updated

BibTeX
@misc{rahman2026graft,
  author = {Maxx Richard Rahman and Wolfgang Maass},
  title = {{GRAFT: Graph-Regularized Prototype Fields for Realistic Test-Time Adaptation of VLMs}},
  year = {2026},
  eprint = {2611.23591},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.23591},
}

Loading related content...

Figure