Beyond Logit Lens: Contextual Embeddings for Robust Hallucination Detection & Grounding in VLM s (2025)

Abstract: The rapid development of Large Multimodal Models (LMMs) has significantly advanced multimodal understanding by harnessing the language abilities of Large Language Models (LLMs) and integrating modality-specific encoders. However, LMMs are plagued by hallucinations that limit their reliability and adoption. While traditional methods to detect and mitigate these hallucinations often involve costly training or rely heavily on external models, recent approaches utilizing internal model features present a promising alternative. In this paper, we critically assess the limitations of the state-of-the-art training-free technique, the logit lens, in handling generalized visual hallucinations. We introduce *ContextualLens*, a refined method that leverages contextual token embeddings from middle layers of LMMs. This approach significantly improves hallucination detection and grounding across diverse categories, including actions and OCR, while also excelling in tasks requiring contextual understanding, such as spatial relations and attribute comparison. Our novel grounding technique yields highly precise bounding boxes, facilitating a transition from Zero-Shot Object Segmentation to Grounded Visual Question Answering. Our contributions pave the way for more reliable and interpretable multimodal models.

## introduction recent advancements in multimodal understanding have been significantly driven by large multimodal models (lmms), which capitalize on the language capabilities of large language models (llms) and integrate modality-specific understanding by training adapters that connect llms to pretrained modality-specific encoders @xcite . however, critical issues inherent to llms, such as the tendency to produce highly confident incorrect answers-known as hallucinations-are also authors marked with * were interns at adobe research when this work was done. figure 1 : visual hallucination detection. logit lens, which only verifies the presence of the token "green" in the image, mistakenly considers the answer correct. in contrast, contextuallens assigns a low score to "green" as it correctly contextualizes the color to the jacket rather than the hair. transferred to lmms @xcite . moreover, lmms introduce additional hallucinations specific to the integrated modalities @xcite . addressing these hallucinations, both by detecting their occurrence and mitigating their effects, as well as by providing evidence to support the generated responses, is crucial for fostering user trust and facilitating the widespread adoption of these technologies @xcite . detecting and mitigating hallucinations has been extensively explored in both language @xcite and vision domains @xcite . in the context of language, attribution and citation have been proposed as approaches for providing evidence to support model output @xcite . in computer vision, similar methods are typically studied under grounded visual question answering @xcite . however, many existing techniques necessitate either training from scratch or fine-tuning @xcite , and frequently rely on external models such as retrievers or object detectors. these requirements impose significant training costs or result in increased latency during inference, posing challenges to their practical deployment in real-world scenarios. recent studies have increasingly leveraged internal model features, such as latent representations, logits, and attention weights, to tackle the objectives of detecting hallucinations @xcite and ensuring the grounding of generated outputs in llms @xcite . notably, one such study demonstrates the efficacy of a trainingfree interpretability technique, known as the logit lens, in identifying and mitigating object hallucinations within visual-language models (vlms) @xcite . the logit lens technique, originally introduced in the context of language models, involves directly mapping intermediate activations to the vocabulary space using the unembedding layer, allowing for an interpretable view of token predictions at different layers (nostalgebraist, 2020). by applying this technique to vlms, the authors probe each image patch to determine the presence of objects. however, we identify several fundamental limitations with the application of the logit lens in this context, which hinder its effectiveness in addressing more general forms of visual hallucinations as categorized by @xcite . we contend that the reliance on token embeddings from the unembedding layer-which are neither contextual nor easily combinable to form multi-token con-cepts-results in its failure to handle more generalized hallucination scenarios. consequently, we propose leveraging token embeddings from the middle layers, which have been shown to be contextual @xcite and effective in representing concepts @xcite . by employing contextual answer token embeddings, we are able to detect hallucinations in categories that were previously near random performance and improve detection accuracy in other categories. additionally, this method enables a transition from zero-shot object segmentation using the logit lens technique to performing the more general grounded visual question answering task. this advancement underscores the potential of our approach in enhancing the reliability and interpretability of multimodal models while operating in the training-free paradigm. our contributions are threefold: ## results and analysis we perform experiments for our approach with the following vlms: qwen2-vl-7b @xcite and internlm-xcomposer2-vl-7b @xcite . all of our experiments were run on a a100 machine with 4 80gb gpus. ## discussion & conclusion in this paper, we presented contextuallens, an approach for detecting hallucinations in lmms by leveraging contextual token embeddings from intermediate layers. we identified limitations in the state-of-the-art training-free technique, the logit lens, notably its poor handling of complex visual hallucinations involving attributes, comparisons, and spatial relations due to its reliance on noncontextual embeddings. our proposed method employs contextual embeddings known to capture richer semantic information, improving hallucination detection across diverse categories. our experimental results on the hqh benchmark showed that contextuallens enables detection in categories that previously performed near random and improves detection for multi-token concept representation. furthermore, by introducing a novel grounding technique with highly precise bounding boxes, we advanced zero-shot object segmentation to a more general gvqa task, validating our approach's effectiveness on textvqa-x and vizwiz-g datasets. our method's precision and training-free paradigm circumvent the computational costs of re-training or fine-tuning, promoting its practical applicability in real-world multimodal attribution tasks. our contributions pave the way for more reliable and user-trustworthy lmms.