If you’ve been following the meteoric rise of Large Vision-Language Models (LVLMs), you know the drill: take a powerful visual encoder, hook it up to a Large Language Model (LLM) via a "projector," and suddenly your AI can describe a sunset or count the number of cats in a room.
But here’s the catch: most researchers just grab the features from the very last layer of the visual encoder, assuming that "deeper is better." This paper asks a simple but provocative question: Is the final layer actually the best choice for spotting anomalies?
TL;DR
When it comes to anomaly detection, the "final layer" of a vision model isn't always the MVP. This study reveals that the best features for spotting weirdness often hide in intermediate visual layers or even deep inside the language model, and that "fusing" multiple layers can sometimes do more harm than good depending on how much training data you have.
What Problem Does This Paper Address?
Anomaly Detection (AD) is the art of finding the "needle in the haystack"—the scratch on a smartphone screen, the person running the wrong way in a crowd, or the sensor reading that just looks off.
In the world of LVLMs, the standard practice is to use the final-layer features because they carry high-level semantic meaning. However, anomalies are often subtle and "vision-centric"—they depend on local textures, fine-grained shapes, or specific layouts that might get "washed out" by the time the data reaches the final semantic layer.
The authors tackle the lack of a systematic guide for layer selection. They investigate whether we should be looking at shallow layers (good for textures), deep layers (good for concepts), or even the internal thoughts of the LLM itself to find these anomalies.
Methods
The researchers put a state-of-the-art model, Qwen2.5-VL-7B, under the microscope. They didn't just look at the output; they tapped into the internal "wiring" of the model at three main points:
- The Visual Encoder: From shallow (Layer 7) to deep (Layer 31).
- The Projector: The bridge between vision and language.
- The LLM: The internal layers of the language model itself.
They tested these features across different "supervision granularities":
- Supervised: You have labels for what is "normal" and "anomaly."
- Weakly Supervised: You know a video contains an anomaly somewhere, but not exactly when.
- One-Class: You only train on "normal" data and try to spot anything that deviates from it.
Datasets
The study covers both video and image domains using four heavy-hitter benchmarks:
- Video AD: UBnormal (complex, diverse scenes) and UCSD Ped2 (simpler, static camera scenes).
- Image AD: MVTec AD (industrial inspection like cracks and stains) and MVTec LOCO AD (logical anomalies, like a box missing a required item).
Key Insights and Ideas
- The LLM is a surprisingly good detective: For complex video scenes (UBnormal), features from deep inside the LLM (like Layer 20) actually outperformed the visual encoder. Why? The LLM layers are better at abstracting the "normal context," making deviations stand out more clearly.
- Fusion is a double-edged sword: While combining features from all layers (V-All) works great when you have plenty of labels (Supervised), it can actually confuse the model in "One-Class" settings. In those cases, a single, stable layer often represents the "normal" distribution more reliably.
- Logical vs. Structural: For simple physical defects (MVTec AD), intermediate visual layers are king. But for "logical" anomalies (MVTec LOCO)—where the parts look fine but the arrangement is wrong—multi-layer fusion is necessary to capture that global consistency.
Key Results
The results show a clear "it depends" pattern, proving there is no one-size-fits-all layer.
- On UCSD Ped2 (Video): Using all visual layers (V-All) in a one-class reconstruction setting achieved a massive 96.45 AUROC.
- On UBnormal (Video): In the supervised setting, V-All won with 70.92, but in the one-class setting, the LLM layer L-20 took the lead with 60.10.
- On MVTec AD (Image): The intermediate visual layer V-15 was the best for the popular PatchCore method, hitting 94.01.
Limitations and Future Work
The authors acknowledge that their findings are tied to the architecture of Qwen2.5-VL. While the trends are likely to hold for other LVLMs, the specific "best" layer might shift.
The most exciting path forward? Adaptive selection. Instead of humans picking Layer 15 or Layer 20, future models could potentially learn to dynamically weight and fuse different layers based on the specific type of anomaly they are looking for.
Summary updated