SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2411.16724 · 2024

Devils in Middle Layers of Large Vision-Language Models: Interpreting, Detecting and Mitigating Object Hallucinations via Attention Lens

arXiv · PDF · Open in the Atlas

Code that ran

8 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 8 failures of our instrument; 2 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2411.16724.json · badge: /api/ran/2411.16724.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
zhangqijiang07/middle_layers_indicating_hallucinations canonical (classifier label)
classifier basis: census
8 ran · 2 no recorded run
FunctionStatusWhere it lives
combine_coco_captions Ran
ran; our contract draft was wrong, not the code
zhangqijiang07/middle_layers_indicating_hallucinations/chair.py
pointer only (licence: NONE) · get_code("25585704d77cafb4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhangqijiang07/middle_layers_indicating_hallucinations when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

combine_coco_instances Ran
ran; our contract draft was wrong, not the code
zhangqijiang07/middle_layers_indicating_hallucinations/chair.py
pointer only (licence: NONE); the stored copy get_code serves, from tsunghan-wu/reverse_vlm, is pointer only (licence: NONE) · get_code("66415dc1dd50f555")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhangqijiang07/middle_layers_indicating_hallucinations when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

expand2square Ran
ran; our contract draft was wrong, not the code
zhangqijiang07/middle_layers_indicating_hallucinations/eval_data_loader.py
pointer only (licence: NONE) · get_code("592b3c1a88f93d7c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhangqijiang07/middle_layers_indicating_hallucinations when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_chunk Ran
ran; our contract draft was wrong, not the code
zhangqijiang07/middle_layers_indicating_hallucinations/llava/eval/model_vqa.py
pointer only (licence: NONE) · get_code("42a46570620cd9fa")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhangqijiang07/middle_layers_indicating_hallucinations when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_generated_captions Ran
ran; our contract draft was wrong, not the code
zhangqijiang07/middle_layers_indicating_hallucinations/chair.py
pointer only (licence: NONE); the stored copy get_code serves, from mehrdadfazli/AssessHalVLM, is pointer only (licence: NONE) · get_code("bb7b96236ae47aaf")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhangqijiang07/middle_layers_indicating_hallucinations when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_llava_model Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zhangqijiang07/middle_layers_indicating_hallucinations/model_manager.py
pointer only (licence: NONE) · get_code("b157d20a4ca304e6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhangqijiang07/middle_layers_indicating_hallucinations when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

set_act_get_hooks Ran
ran; our contract draft was wrong, not the code
zhangqijiang07/middle_layers_indicating_hallucinations/utils.py
pointer only (licence: NONE) · get_code("a4bcce74aee1b2ac")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhangqijiang07/middle_layers_indicating_hallucinations when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

split_list Ran
ran; our contract draft was wrong, not the code
zhangqijiang07/middle_layers_indicating_hallucinations/llava/eval/model_vqa.py
pointer only (licence: NONE) · get_code("076c252c52cbb161")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhangqijiang07/middle_layers_indicating_hallucinations when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_only_attn_out_contribution Not yet run
unverified (harvested, no recorded run)
zhangqijiang07/middle_layers_indicating_hallucinations/utils.py
pointer only (licence: NONE) · get_code("0b24d3aebc841fa4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhangqijiang07/middle_layers_indicating_hallucinations when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

llama_new_forward Not yet run
unverified (harvested, no recorded run)
zhangqijiang07/middle_layers_indicating_hallucinations/modify_attention.py
pointer only (licence: NONE) · get_code("62bb863d06274810")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhangqijiang07/middle_layers_indicating_hallucinations when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 6 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 3 the same month, 6 later) and 4 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
split_list 197 other papers
125 dated earlier, 7 the same month, 58 later, 6 same year, order not determinable, 1 undated
2112.05682 (2021-12)
Self-attention Does Not Need $O(n^2)$ Memory
2306.17107 (2023-06)
LLaVAR: Enhanced Visual Instruction Tuning for Text-Rich Image Understanding
2307.10490 (2023-07)
Abusing Images and Sounds for Indirect Instruction Injection in Multi-Modal LLMs
and 194 more not named here
get_chunk 189 other papers
120 dated earlier, 7 the same month, 56 later, 6 same year, order not determinable
2112.05682 (2021-12)
Self-attention Does Not Need $O(n^2)$ Memory
2306.17107 (2023-06)
LLaVAR: Enhanced Visual Instruction Tuning for Text-Rich Image Understanding
2307.10490 (2023-07)
Abusing Images and Sounds for Indirect Instruction Injection in Multi-Modal LLMs
and 186 more not named here
expand2square 68 other papers
47 dated earlier, 2 the same month, 16 later, 3 same year, order not determinable · 1 only as an assembly brick
2112.05682 (2021-12)
Self-attention Does Not Need $O(n^2)$ Memory
2204.03541 (2022-04)
End-to-End Zero-Shot HOI Detection via Vision and Language Knowledge Distillation
2308.10253 (2023-08)
StableLLaVA: Enhanced Visual Instruction Tuning with Synthesized Image-Dialogue Data
and 65 more not named here
combine_coco_captions 10 other papers
3 dated earlier, 6 later, 1 same year, order not determinable
2110.01705 (2021-10)
Let there be a clock on the beach: Reducing Object Hallucination in Image Captioning
Huang_OPERA_Alleviating_Hallucination_in_Multi-Modal_Large_Language_Models_via_Over-Trust_CVPR_2024_paper (2024 (year only))
OPERA: Alleviating Hallucination in Multi-Modal Large Language Models via Over-Trust Penalty and Retrospection-Allocation
2402.14545 (2024-02)
Less is More: Mitigating Multimodal Hallucination from an EOS Decision Perspective
and 7 more not named here
combine_coco_instances 8 other papers
2 dated earlier, 5 later, 1 same year, order not determinable
2110.01705 (2021-10)
Let there be a clock on the beach: Reducing Object Hallucination in Image Captioning
Huang_OPERA_Alleviating_Hallucination_in_Multi-Modal_Large_Language_Models_via_Over-Trust_CVPR_2024_paper (2024 (year only))
OPERA: Alleviating Hallucination in Multi-Modal Large Language Models via Over-Trust Penalty and Retrospection-Allocation
2402.14545 (2024-02)
Less is More: Mitigating Multimodal Hallucination from an EOS Decision Perspective
and 5 more not named here
load_generated_captions 3 other papers
2 later, 1 same year, order not determinable
Huang_OPERA_Alleviating_Hallucination_in_Multi-Modal_Large_Language_Models_via_Over-Trust_CVPR_2024_paper (2024 (year only))
OPERA: Alleviating Hallucination in Multi-Modal Large Language Models via Over-Trust Penalty and Retrospection-Allocation
2502.03628 (2025-02)
The Hidden Life of Tokens: Reducing Hallucination of Large Vision-Language Models via Visual Information Steering
2609.01888 (2026-09)
Does Playing it Safe Count as Faithfulness? Reassessing LVLM Hallucination Mitigation Methods

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Hallucinations in Large Vision-Language Models (LVLMs) significantly undermine their reliability, motivating researchers to explore the causes of hallucination. However, most studies primarily focus on the language aspect rather than the visual. In this paper, we address how LVLMs process visual information and whether this process causes hallucination. Firstly, we use the attention lens to identify the stages at which LVLMs handle visual data, discovering that the middle layers are crucial. Moreover, we find that these layers can be further divided into two stages: ''visual information enrichment'' and ''semantic refinement'' which respectively propagate visual data to object tokens and interpret it through text. By analyzing attention patterns during the visual information enrichment stage, we find that real tokens consistently receive higher attention weights than hallucinated ones, serving as a strong indicator of hallucination. Further examination of multi-head attention maps reveals that hallucination tokens often result from heads interacting with inconsistent objects. Based on these insights, we propose a simple inference-time method that adjusts visual attention by integrating information across various heads. Extensive experiments demonstrate that this approach effectively mitigates hallucinations in mainstream LVLMs without additional training costs. Code is available at https://github.com/ZhangqiJiang07/middle_layers_indicating_hallucinations.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2411.16724")
get_code_for_paper("2411.16724")
have("2411.16724")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2411.16724.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2411.16724.svg)](https://syntology.ai/paper/2411.16724)

Connect an agent — have() is free.