Position Aware Layer Queries for Test Time Training in Vision Language Models

Rajat Modi, Priyank Pathak, Xin Liang, Yogesh Singh RawatarXiv 2026

TL;DR

Layer Query Network (LQN) is a lightweight framework that adapts large Vision-Language Models (VLMs) to out-of-distribution data at test time using only a single forward pass of the teacher model. By distilling intermediate layer features into a small student network via coordinate-based queries, LQN achieves significant accuracy gains (e.g., +9.8% on OOD ImageNet) while being substantially faster and more compute-efficient than traditional augmentation-based adaptation methods.

What Problem Does This Paper Address?

Vision-Language Models (VLMs) like CLIP are remarkably good at zero-shot tasks, but their performance often plummets when they encounter "out-of-distribution" (OOD) data—images that look different from their training set (e.g., sketches, corrupted images, or medical scans).

To fix this, researchers use Test-Time Training (TTT), which adapts the model to a specific test sample on-the-fly. However, existing TTT methods are computationally expensive. They typically create multiple augmented versions of a single test image and perform multiple forward and backward passes through the entire massive VLM to enforce consistency. This makes real-time deployment difficult. The authors of this paper ask: Is there a way to extract enough adaptation signal from just one forward pass?

Methods

The authors introduce the Layer Query Network (LQN). Instead of updating the massive VLM, they train a tiny "student" model (like a small MLP or ResNet) to mimic the internal state of the frozen "teacher" VLM.

Comparison of LQN with existing TTT methods like TPT. LQN uses a single forward pass and coordinate-based distillation.

LQN relies on two core novel techniques:

  1. Position-Aware Distillation (PAD): The authors treat the VLM's intermediate layers as a 3D volume of features (height $\times$ width $\times$ depth). The student network is trained to "query" specific 3D coordinates $(i, j, l)$ and predict the teacher's feature at that spatial location and layer depth. This uses 3D Rotary Positional Embeddings (RoPE) to help the student navigate the teacher's internal structure.
  2. Location Consistency Regularization (LCR): To replace expensive image augmentations, LQN uses "coordinate-based" self-supervision. It forces the student to produce consistent features for a target "destination" coordinate, even when queried from different "source" coordinates. This sampling is $O(1)$ in cost, compared to $O(H \times W)$ for pixel-level augmentations.
The LQN training and inference pipeline. During training, the student mimics the teacher's internal features. At inference, the student's final layer predictions are used for the task.

Datasets

The authors evaluated LQN across a massive battery of benchmarks:

  • Natural Distribution Shifts: ImageNet (val) and its OOD variants: ImageNet-A (adversarial), ImageNet-V2, ImageNet-R (renditions), and ImageNet-Sketch.
  • Cross-Dataset Generalization: 9 diverse datasets including Flowers102, OxfordPets, UCF101 (video frames), and EuroSAT (satellite imagery).
  • Dense Prediction: COCO, ADE20K, and Cityscapes for panoptic, instance, and semantic segmentation.
  • Corruptions: ImageNet-C and CIFAR-10-C (15 types of noise/blur).
  • Specialized Domains: Kaggle Pneumothorax (chest X-rays).

Key Insights and Ideas

  • The Signal is Already Inside: The most profound insight is that a single forward pass through a VLM contains a wealth of adaptation signal in its intermediate layers. We don't need 64 augmented views if we can effectively "mine" the internal features of one view.
  • Coordinate Sampling > Image Augmentation: By varying input coordinates instead of pixels, LQN achieves a similar regularization effect to data augmentation but at a fraction of the computational cost.
  • Student as a Denoiser: The authors suggest that coordinate-conditioned small networks have a "spectral bias" toward smooth structures. This allows the student to act as a denoiser, fitting the underlying signal of the teacher's OOD features while ignoring the noise.
  • Extrapolation to Unseen Layers: Interestingly, a student trained on only the first 20 layers of a teacher can sometimes generalize and predict features for the 24th layer, showing the power of the position-conditioned approach.

Key Results

LQN sets new state-of-the-art marks for efficient test-time adaptation:

  • Accuracy Boost: It improves zero-shot CLIP ViT-B/16 by 9.8% on OOD ImageNet variants and outperforms the previous best TTT method (GS-Bias) by 3.9% on fine-grained tasks.
  • Efficiency: LQN is significantly faster. For a CLIP ResNet-50, it converges in 47 minutes on 50,000 images, compared to over 9 hours for TPT.
  • Dense Tasks: Unlike many TTT methods that only work for classification, LQN excels at segmentation. It improves the Panoptic Quality (PQ) on COCO from 58.3 to 64.5.
Wall-clock time comparison on ImageNet. LQN (red) achieves higher accuracy in significantly less time than previous TTT works.

Limitations and Future Work

  • Video Adaptation: The current work focuses on static images. The authors aim to extend LQN to streaming video, where temporal consistency could provide even more signal.
  • Memory Overhead: Storing intermediate layer features for distillation during the backward pass can be memory-intensive. Future work could explore feature compression or top-k token selection to reduce this footprint.
  • Recursive Learning: The authors note a theoretical scenario where the student and teacher could learn from each other recursively, which raises interesting questions about self-referential learning and safety that need further study.

Summary updated

BibTeX
@misc{modi2026position,
  author = {Rajat Modi and Priyank Pathak and Xin Liang and Yogesh Singh Rawat},
  title = {{Position Aware Layer Queries for Test Time Training in Vision Language Models}},
  year = {2026},
  eprint = {2609.34021},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.34021},
}
Figure