SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2409.17143 · ECCV · 2024

Attention Prompting on Image for Large Vision-Language Models

arXiv · PDF · Open in the Atlas

Code that ran

8 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 3 failures of our instrument; 4 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/2409.17143.json · badge: /api/ran/2409.17143.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
yu-rp/apiprompting marked official in Papers with Code
Papers with Code archive
6 ran · 4 no recorded run
copy not recorded community
not in the paper's declared repositories
2 ran · 0 no recorded run
FunctionStatusWhere it lives
Conversation Ran
ran on a synthesized input · constructed an object; no result was computed
yu-rp/apiprompting/API/API_LLaVA/functions.py
code served (permissive licence) · get_code("8992e3094a2ca1d1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Conversation: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from PIL import Image
from io import BytesIO
import dataclasses
from enum import auto, Enum
from typing import List, Tuple
import base64

class SeparatorStyle(Enum):
    """Different separator style."""
    SINGLE = auto()
    TWO = auto()
    MPT = auto()
    PLAIN = auto()
    LLAMA_2 = auto()

@dataclasses.dataclass
class Conversation:
    """A class that keeps all conversation history."""
    system: str
    roles: List[str]
    messages: List[List[str]]
    offset: int
    sep_style: SeparatorStyle = SeparatorStyle.SINGLE
    sep: str = '###'
    sep2: str = None
    version: str = 'Unknown'
    skip_next: bool = False

# Create a small PIL Image for testing
pil_img = Image.new('RGB', (64, 64), color=(255, 0, 0))
buffered = BytesIO()
pil_img.save(buffered, format="PNG")
img_base64 = base64.b64encode(buffered.getvalue()).decode()

# Construct valid arguments
ARGS = {
    'system': 'You are a helpful assistant.',
    'roles': ['User', 'Assistant'],
    'messages': [
        ['User', 'Hello'],
        ['Assistant', 'Hi there!']
    ],
    'offset': 0,
    'sep_style': SeparatorStyle.SINGLE,
    'sep': '###',
    'sep2': None,
    'version': 'v1.0',
    'skip_next': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, packaging — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Conversation — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Conversation output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
KeywordsStoppingCriteria Ran
ran on a synthesized input · constructed an object; no result was computed
yu-rp/apiprompting/API/API_LLaVA/functions.py
code served (permissive licence) · get_code("2fe03dcbac95b31f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, KeywordsStoppingCriteria: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from unittest.mock import Mock

torch.manual_seed(0)

# Create a minimal tokenizer mock that has the required attributes and methods
class MinimalTokenizer:
    def __init__(self):
        self.bos_token_id = 101
        # Create a simple mapping for tokenization
        self.vocab = {
            "hello": [1000],
            "world": [1001],
            "stop": [1002],
            "<s>": [101],
        }
    
    def __call__(self, text):
        # Return a mock that has input_ids attribute
        result = Mock()
        # For keywords, return simple token ids
        if text in self.vocab:
            result.input_ids = self.vocab[text]
        else:
            # Default tokenization
            result.input_ids = [1000 + hash(text) % 100]
        return result
    
    def batch_decode(self, token_ids, skip_special_tokens=True):
        # Simple decoding: map token ids back to words
        decoded = []
        for seq in token_ids:
            words = []
            for token_id in seq:
                if token_id == 1000:
                    words.append("hello")
                elif token_id == 1001:
                    words.append("world")
                elif token_id == 1002:
                    words.append("stop")
                else:
                    words.append(f"token_{token_id}")
            decoded.append(" ".join(words))
        return decoded

# Create minimal tokenizer
tokenizer = MinimalTokenizer()

# Create input_ids tensor (batch_size=2, sequence_length=5)
input_ids = torch.tensor([
    [101, 1000, 1001, 102, 103],
    [101, 1000, 1001, 102, 103]
], dtype=torch.long)

# Create keywords list
keywords = ["stop", "end"]

ARGS = {
    "keywords": keywords,
    "tokenizer": tokenizer,
    "input_ids": input_ids,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type KeywordsStoppingCriteria — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a KeywordsStoppingCriteria output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MaxNewTokensCriteria Ran
ran on a synthesized input · constructed an object; no result was computed
yu-rp/apiprompting/API/API_LLaVA/functions.py
code served (permissive licence) · get_code("e1119b92480f0cdc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, MaxNewTokensCriteria: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import warnings

torch.manual_seed(0)

ARGS = {
    'start_length': 10,
    'max_new_tokens': 5,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MaxNewTokensCriteria — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MaxNewTokensCriteria output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
expand2square Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from foundationvision/liquid
pointer only · get_code("592b3c1a88f93d7c")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

image_parser Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from ictnlp/LLaVA-Mini
pointer only · get_code("a7bee88c1c7fd6a3")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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_image Ran
ran, honoured the contract we drafted
yu-rp/apiprompting/API/API_LLaVA/functions.py
code served (permissive licence) · get_code("9b3c1cb391672ccb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Image. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
from PIL import Image
import os

# Create a temporary image file for testing
temp_dir = tempfile.mkdtemp()
temp_image_path = os.path.join(temp_dir, "test_image.jpg")

# Create a simple test image
test_image = Image.new('RGB', (100, 100), color=(73, 109, 137))
test_image.save(temp_image_path)

# Define ARGS with a local file path
ARGS = {
    'image_file': temp_image_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, requests — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_images Ran
ran, honoured the contract we drafted
yu-rp/apiprompting/API/API_LLaVA/functions.py
code served (permissive licence) · get_code("d5044bdde33c54c2")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 4, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
from PIL import Image
import os

# Create temporary image files to use as test data
temp_dir = tempfile.mkdtemp()

# Create a simple test image and save it
test_image = Image.new('RGB', (100, 100), color='red')
image_path_1 = os.path.join(temp_dir, 'test_image_1.png')
test_image.save(image_path_1)

# Create another test image
test_image_2 = Image.new('RGB', (100, 100), color='blue')
image_path_2 = os.path.join(temp_dir, 'test_image_2.png')
test_image_2.save(image_path_2)

# Define ARGS with a list of local image file paths
ARGS = {
    'image_files': [image_path_1, image_path_2]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, requests — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 4, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
process_images Ran
ran; our contract draft was wrong, not the code
yu-rp/apiprompting/API/API_LLaVA/functions.py
code served (permissive licence) · get_code("e8f3a2a1be36a4d7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (2, 3, 64, 64) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from PIL import Image
import numpy as np

torch.manual_seed(0)

# Create a minimal image processor mock
class MockImageProcessor:
    def __init__(self):
        self.image_mean = [0.5, 0.5, 0.5]
    
    def preprocess(self, image, return_tensors=None):
        # Convert PIL image to tensor
        img_array = np.array(image).astype(np.float32) / 255.0
        if len(img_array.shape) == 2:
            img_array = np.stack([img_array] * 3, axis=-1)
        img_tensor = torch.from_numpy(img_array).permute(2, 0, 1)
        if return_tensors == 'pt':
            return {'pixel_values': img_tensor.unsqueeze(0)}
        return img_tensor
    
    def __call__(self, images, return_tensors=None):
        # Process multiple images
        processed = []
        for img in images:
            img_array = np.array(img).astype(np.float32) / 255.0
            if len(img_array.shape) == 2:
                img_array = np.stack([img_array] * 3, axis=-1)
            img_tensor = torch.from_numpy(img_array).permute(2, 0, 1)
            processed.append(img_tensor)
        
        if return_tensors == 'pt':
            stacked = torch.stack(processed, dim=0)
            return {'pixel_values': stacked}
        return processed

# Create a minimal model config mock
class MockModelConfig:
    def __init__(self):
        self.image_aspect_ratio = 'pad'

# Create test images with different dimensions
images = [
    Image.new('RGB', (64, 48), color=(100, 100, 100)),
    Image.new('RGB', (64, 48), color=(150, 150, 150))
]

image_processor = MockImageProcessor()
model_cfg = MockModelConfig()

ARGS = {
    'images': images,
    'image_processor': image_processor,
    'model_cfg': model_cfg
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 64, 64) — shape (2, 3, 64, 64) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
SeparatorStyle Not yet run
unverified (harvested, no recorded run)
yu-rp/apiprompting/API/API_LLaVA/functions.py
code served (permissive licence) · get_code("0c4ff52904c9e0e7")
How it ran

no invocation recorded.

StoppingCriteria Not yet run
unverified (harvested, no recorded run)
yu-rp/apiprompting/API/API_LLaVA/functions.py
code served (permissive licence) · get_code("724da83b5bf10219")
How it ran

no invocation recorded.

disable_torch_init Not yet run
unverified (harvested, no recorded run)
yu-rp/apiprompting/API/API_LLaVA/functions.py
code served (permissive licence) · get_code("62a88066e939d2c5")
How it ran

no invocation recorded.

getmask Not yet run
unverified (harvested, no recorded run)
yu-rp/apiprompting/API/API_LLaVA/functions.py
code served (permissive licence) · get_code("6565708bd99b9f3b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 7 are also present in other papers whose code we hold (7 with at least one paper dated earlier, 5 the same month, 7 later) and 5 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
load_image
brick of this paper's assembly: helper
85 other papers
43 dated earlier, 5 the same month, 33 later, 4 same year, order not determinable
2112.05682 (2021-12)
Self-attention Does Not Need $O(n^2)$ Memory
2305.10973 (2023-05)
Drag Your GAN: Interactive Point-based Manipulation on the Generative Image Manifold
2307.10490 (2023-07)
Abusing Images and Sounds for Indirect Instruction Injection in Multi-Modal LLMs
and 82 more not named here
expand2square
brick of this paper's assembly: helper
68 other papers
41 dated earlier, 4 the same month, 20 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
process_images
brick of this paper's assembly: helper
44 other papers
31 dated earlier, 2 the same month, 8 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
2308.10253 (2023-08)
StableLLaVA: Enhanced Visual Instruction Tuning with Synthesized Image-Dialogue Data
2310.01779 (2023-10)
HallE-Control: Controlling Object Hallucination in Large Multimodal Models
and 41 more not named here
load_images
brick of this paper's assembly: data_transform
20 other papers
9 dated earlier, 1 the same month, 9 later, 1 same year, order not determinable
2312.14867 (2023-12)
VIEScore: Towards Explainable Metrics for Conditional Image Synthesis Evaluation
2024.findings-emnlp.268 (2024 (year only))
Math-LLaVA: Bootstrapping Mathematical Reasoning for Multimodal Large Language Models
2403.13805 (2024-03)
RAR: Retrieving And Ranking Augmented MLLMs for Visual Recognition
and 17 more not named here
image_parser
brick of this paper's assembly: helper
16 other papers
8 dated earlier, 1 the same month, 6 later, 1 same year, order not determinable
2304.08485 (2023-04)
Visual Instruction Tuning
2311.05437 (2023-11)
LLaVA-Plus: Learning to Use Tools for Creating Multimodal Agents
2024.findings-emnlp.268 (2024 (year only))
Math-LLaVA: Bootstrapping Mathematical Reasoning for Multimodal Large Language Models
and 13 more not named here
MaxNewTokensCriteria
brick of this paper's assembly: helper
2 other papers
1 dated earlier, 1 later
2309.03883 (2023-09)
DoLa: Decoding by Contrasting Layers Improves Factuality in Large Language Models
2606.27596 (2026-06)
Dismantling Pathological Shortcuts: A Causal Framework for Faithful LVLM Decoding
StoppingCriteria
brick of this paper's assembly: helper
2 other papers
1 dated earlier, 1 later · 1 only as an assembly brick
2309.03883 (2023-09)
DoLa: Decoding by Contrasting Layers Improves Factuality in Large Language Models
2606.27596 (2026-06)
Dismantling Pathological Shortcuts: A Causal Framework for Faithful LVLM Decoding

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

Compared with Large Language Models (LLMs), Large Vision-Language Models (LVLMs) can also accept images as input, thus showcasing more interesting emergent capabilities and demonstrating impressive performance on various vision-language tasks. Motivated by text prompting in LLMs, visual prompting has been explored to enhance LVLMs' capabilities of perceiving visual information. However, previous visual prompting techniques solely process visual inputs without considering text queries, limiting the models' ability to follow text instructions to complete tasks. To fill this gap, in this work, we propose a new prompting technique named Attention Prompting on Image (API), which just simply overlays a text-query-guided attention heatmap on the original input image and effectively enhances LVLM on various tasks. Specifically, we generate an attention heatmap for the input image dependent on the text query with an auxiliary model like CLIP. Then the heatmap simply multiplies the pixel values of the original image to obtain the actual input image for the LVLM. Extensive experiments on various vison-language benchmarks verify the effectiveness of our technique. For example, API improves LLaVA-1.5 by 3.8% and 2.9% on MM-Vet and LLaVA-Wild benchmarks, respectively.

For agents

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

get_harvested_code_for_paper("2409.17143")
get_code_for_paper("2409.17143")
have("2409.17143")

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

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

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

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

Connect an agent — have() is free.