SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2409.11919 · ICLR · 2025

LLM-wrapper: Black-Box Semantic-Aware Adaptation of Vision-Language Models for Referring Expression Comprehension

Valeo Ai, Éloi Zablocki, Matthieu Cord, Oriane Siméoni, Amaia Cardiel, Elias Ramzi

arXiv · PDF · Open in the Atlas

Code that ran

9 of 18 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 8 failures of our instrument; 9 no recorded run), measured 2026-11-22; 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.11919.json · badge: /api/ran/2409.11919.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
valeoai/llm_wrapper canonical (classifier label)
classifier basis: classifier_2025
4 ran · 0 no recorded run
valeoai/LLM_wrapper marked official in Papers with Code
Papers with Code archive
5 ran · 9 no recorded run
FunctionStatusWhere it lives
convert_box_coord_list Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
valeoai/LLM_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("496f36883982907e")
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) and returned list, ndim 1, dtype family float; 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 numpy as np

# Set seed for reproducibility
np.random.seed(0)

# Create a simple box in cxcywh format: [center_x, center_y, width, height]
one_box_list = [100.0, 150.0, 50.0, 60.0]

# Test with different output formats
out_format = 'xyxy'

# Test with and without coordinate noise
coord_noise = False

ARGS = {
    'one_box_list': one_box_list,
    'out_format': out_format,
    'coord_noise': coord_noise
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — 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
create_my_prompt Ran
ran; our contract draft was wrong, not the code
valeoai/llm_wrapper/llm_wrapper/LLM_finetuning_script.py
code served (permissive licence) · get_code("b62369eaf6443bf1")
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) and returned str. 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

torch.manual_seed(0)

sample = {
    'prompt': '<s> This is a test prompt',
    'best_subject_index': ' subject_123'
}

ARGS = {
    'sample': sample
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
define_modules_to_FT Ran
ran; our contract draft was wrong, not the code
valeoai/llm_wrapper/llm_wrapper/LLM_finetuning_script.py
code served (permissive licence) · get_code("f96ceeee851477a5")
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) and returned list, ndim 1, dtype family float; 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 torch
import torch.nn as nn

class MyArgs:
    def __init__(self, modules_to_FT=None):
        self.modules_to_FT = modules_to_FT

# Test case 1: modules_to_FT is None
args_case1 = MyArgs(modules_to_FT=None)

# Test case 2: modules_to_FT is 'lm_head_only'
args_case2 = MyArgs(modules_to_FT='lm_head_only')

# Test case 3: modules_to_FT is 'last_4_only'
args_case3 = MyArgs(modules_to_FT='last_4_only')

ARGS = {
    'my_args': args_case1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — 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
define_short_LLM_folder_name Ran
ran; our contract draft was wrong, not the code
valeoai/LLM_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("d1d34bdea6597b80")
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) and returned str. 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 numpy as np

# The function takes a single parameter: HF_LLM_name (a string)
# It checks if the string contains certain LLM model names and returns a short name

# Valid test cases based on the function logic:
ARGS = {
    "HF_LLM_name": "Meta-Llama-3-8B-Instruct"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
eval_post_step_3 Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
valeoai/LLM_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("6921e7c0cacc7dc8")
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 tuple, ndim 1, dtype family float; 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 torch
from torchvision.ops import box_convert, box_iou

torch.manual_seed(0)

# Create sample bounding boxes in different formats
# infer_bbox: predicted bounding boxes, shape [N, 4]
infer_bbox = torch.tensor([
    [10.0, 20.0, 50.0, 60.0],
    [100.0, 120.0, 150.0, 180.0]
], dtype=torch.float32)

# one_result_from_step_2: dict containing GT_bbox
# GT_bbox should be in 'xyxy' format for box_iou
GT_bbox = torch.tensor([
    [10.0, 20.0, 55.0, 65.0],
], dtype=torch.float32)

one_result_from_step_2 = {
    'GT_bbox': GT_bbox
}

# bbox_format: format of infer_bbox ('xyxy', 'xywh', 'cxcywh')
bbox_format = 'xyxy'

# verbose flag
verbose = False

ARGS = {
    'infer_bbox': infer_bbox,
    'one_result_from_step_2': one_result_from_step_2,
    'bbox_format': bbox_format,
    'verbose': verbose
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
extract_int_result_from_LLM_gen Ran
ran; our contract draft was wrong, not the code
valeoai/LLM_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("ff499b564cc9cdab")
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 tuple, ndim 1, dtype family float; 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 random

ARGS = {
    'result': 'The answer is 3. The model detected the object.',
    'HF_LLM_name': 'gemma-2-2b-it',
    'return_error_type': True,
    'nb_detected_boxes': 5,
    'fixed_seed': 42
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
get_HF_model_id Ran
ran; our contract draft was wrong, not the code
valeoai/LLM_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("0262028d2a06ec2b")
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) and returned tuple, ndim 1, dtype family float; 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 torch
import numpy as np

# The function get_HF_model_id takes a single parameter: HF_LLM_name
# It's a string that gets checked against various patterns to determine
# which model ID and base model name to return.

# We'll test with one of the supported model names
HF_LLM_name = "Mixtral_8x7"

ARGS = {
    "HF_LLM_name": HF_LLM_name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
get_all_rec_and_thres_boxes_concat Ran
ran, honoured the contract we drafted
valeoai/llm_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("8e0fab2c4512a48c")
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) and returned Tensor, ndim 2, dtype family float, shape (3, 4) 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

torch.manual_seed(0)

class Args:
    def __init__(self):
        self.detector_name = 'Florence-2-large-v2'
        self.prompt_context = 18
        self.max_nb_of_box_proposal = None

one_result_from_step_2 = {
    'ORI_QUERY_REC_like': [
        {
            'nb_box_found': torch.tensor(2),
            'found_boxes': torch.randn(1, 2, 4)
        }
    ],
    'ORI_QUERY_GROUNDING': [
        {
            'nb_box_found': torch.tensor(1),
            'found_boxes': torch.randn(1, 1, 4)
        }
    ]
}

ARGS = {
    'args': Args(),
    'one_result_from_step_2': one_result_from_step_2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (3, 4) — shape (3, 4) 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
get_box_key_list Ran
ran; our contract draft was wrong, not the code
valeoai/llm_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("d4ea0c52a00729fd")
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) and returned list, ndim 1, dtype family float; 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 torch

torch.manual_seed(0)

# Test case 1: KOSMOS detector
ARGS_1 = {
    'detector_name': 'KOSMOS',
    'prompt_context': None
}

# Test case 2: Florence-2-large-v2 with prompt_context 18
ARGS_2 = {
    'detector_name': 'Florence-2-large-v2',
    'prompt_context': 18
}

# Test case 3: Florence-2-large-v2 with prompt_context 20
ARGS_3 = {
    'detector_name': 'Florence-2-large-v2',
    'prompt_context': 20
}

# Test case 4: GDINO_SwinT_original
ARGS_4 = {
    'detector_name': 'GDINO_SwinT_original',
    'prompt_context': None
}

# Test case 5: GDINO_SwinT
ARGS_5 = {
    'detector_name': 'GDINO_SwinT',
    'prompt_context': None
}

# Use the first valid test case as the main ARGS
ARGS = ARGS_1
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — 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
REC_eval_step Not yet run
unverified (harvested, no recorded run)
valeoai/LLM_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("9b28e2f8ef578805")
How it ran

no invocation recorded.

compute_and_save_infer_info Not yet run
unverified (harvested, no recorded run)
valeoai/LLM_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("d8cd5bf64f19e875")
How it ran

no invocation recorded.

define_model_result_name Not yet run
unverified (harvested, no recorded run)
valeoai/LLM_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("9c81b8cf59bd8a8f")
How it ran

no invocation recorded.

design_prompt_for_step_3 Not yet run
unverified (harvested, no recorded run)
valeoai/LLM_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("b2acae0f31bbf97f")
How it ran

no invocation recorded.

gen_step_3_with_HF Not yet run
unverified (harvested, no recorded run)
valeoai/LLM_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("1ee6940816fb4c9c")
How it ran

no invocation recorded.

get_all_rec_and_thres_dict_info_concat Not yet run
unverified (harvested, no recorded run)
valeoai/LLM_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("14a0b26b9f4d5f93")
How it ran

no invocation recorded.

load_FT_model_via_base_model Not yet run
unverified (harvested, no recorded run)
valeoai/LLM_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("60c7a23e50408bb4")
How it ran

no invocation recorded.

load_HF_model_tok Not yet run
unverified (harvested, no recorded run)
valeoai/LLM_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("69336c48b701b32e")
How it ran

no invocation recorded.

unify_output_step_3 Not yet run
unverified (harvested, no recorded run)
valeoai/LLM_wrapper/llm_wrapper/LLM_inference_script.py
code served (permissive licence) · get_code("10a0bb17e5386ba9")
How it ran

no invocation recorded.

Also present in other papers' code

Of 18 samples lifted from this paper's linked repositories, 18 carry a function identity and 0 do not. Of the 18 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 18 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.

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-22.

Repositories linked to this paper

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

Abstract

Vision Language Models (VLMs) have demonstrated remarkable capabilities in various open-vocabulary tasks, yet their zero-shot performance lags behind task-specific finetuned models, particularly in complex tasks like Referring Expression Comprehension (REC). Fine-tuning usually requires 'white-box' access to the model's architecture and weights, which is not always feasible due to proprietary or privacy concerns. In this work, we propose LLM-wrapper, a method for 'black-box' adaptation of VLMs for the REC task using Large Language Models (LLMs). LLM-wrapper capitalizes on the reasoning abilities of LLMs, improved with a light fine-tuning, to select the most relevant bounding box matching the referring expression, from candidates generated by a zero-shot black-box VLM. Our approach offers several advantages: it enables the adaptation of closed-source models without needing access to their internal workings, it is versatile as it works with any VLM, it transfers to new VLMs and datasets, and it allows for the adaptation of an ensemble of VLMs. We evaluate LLM-wrapper on multiple datasets using different VLMs and LLMs, demonstrating significant performance improvements and highlighting the versatility of our method. While LLMwrapper is not meant to directly compete with standard white-box fine-tuning, it offers a practical and effective alternative for black-box VLM adaptation. The code and the checkpoints are available at https://github.com/valeoai/LLM_wrapper.

For agents

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

get_harvested_code_for_paper("2409.11919")
get_code_for_paper("2409.11919")
have("2409.11919")

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

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

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

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

Connect an agent — have() is free.