SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.15232 · 2024

DEEM: Diffusion Models Serve as the Eyes of Large Language Models for Image Perception

arXiv · PDF · Open in the Atlas

Code that ran

7 of 15 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 8 no recorded run), measured 2026-11-22; 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/2405.15232.json · badge: /api/ran/2405.15232.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
rainbowluocs/deem canonical (classifier label)
classifier basis: census
7 ran · 8 no recorded run
FunctionStatusWhere it lives
box_iou Ran
ran, honoured the contract we drafted
rainbowluocs/deem/uni_interleaved/utils/grounding_score.py
code served (permissive licence) · get_code("ce749f837424dd8c")
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 3, 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.boxes import box_area

torch.manual_seed(0)

# Create two sets of bounding boxes in format [x1, y1, x2, y2]
# boxes1: 2 boxes
# boxes2: 3 boxes
boxes1 = torch.tensor([
    [0.0, 0.0, 2.0, 2.0],
    [1.0, 1.0, 3.0, 3.0]
], dtype=torch.float32)

boxes2 = torch.tensor([
    [0.0, 0.0, 1.0, 1.0],
    [1.5, 1.5, 2.5, 2.5],
    [2.0, 2.0, 4.0, 4.0]
], dtype=torch.float32)

ARGS = {
    "boxes1": boxes1,
    "boxes2": boxes2
}
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 3, 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_answer Ran
ran; our contract draft was wrong, not the code
rainbowluocs/deem/uni_interleaved/utils/vqa_score.py
code served (permissive licence) · get_code("c1b06375bdb265f4")
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 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

ARGS = {
    "response": "The answer is a cat."
}
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 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
grounding_eval Ran
ran; our contract draft was wrong, not the code
rainbowluocs/deem/uni_interleaved/utils/grounding_score.py
code served (permissive licence) · get_code("218b45d457ba5f5b")
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 dict. 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 json
import tempfile
import os

torch.manual_seed(0)

# Create a temporary JSON file with test results
test_results = [
    {
        "gt_box": [100.0, 150.0, 300.0, 400.0],
        "pred_box": "(100,150)(300,400)",
        "height": 600,
        "width": 800
    },
    {
        "gt_box": [200.0, 250.0, 500.0, 550.0],
        "pred_box": "(200,250)(500,550)",
        "height": 600,
        "width": 800
    }
]

# Write to a temporary file
temp_file = tempfile.NamedTemporaryFile(mode='w', suffix='.json', delete=False)
json.dump(test_results, temp_file)
temp_file.close()

ARGS = {
    "results_file": temp_file.name
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
load_annt_data Ran
ran; our contract draft was wrong, not the code
rainbowluocs/deem/inference.py
code served (permissive licence) · get_code("983c68ab9faa901c")
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 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
from PIL import Image
from io import BytesIO

torch.manual_seed(0)

# Create a minimal tokenizer stand-in
class MockTokenizer:
    def __init__(self):
        self.padding_side = 'right'
    
    def __call__(self, text, max_length=2048, truncation=True, padding='do_not_pad', return_tensors='np', return_attention_mask=True):
        # Return minimal tokenized output
        tokens = np.array([[101, 2054, 2003, 102]], dtype=np.int64)  # Simple mock tokens
        attention = np.array([[1, 1, 1, 1]], dtype=np.int64)
        return {
            'input_ids': tokens,
            'attention_mask': attention
        }

# Create a minimal transform that returns a tuple of two tensors
def mock_transform(image):
    # Return tuple of (tensor, tensor_dec) as expected by the function
    tensor = torch.randn(3, 8, 8)  # Small RGB image
    tensor_dec = torch.randn(3, 4, 4)  # Smaller decoded version
    return (tensor, tensor_dec)

# Create a minimal image file
def create_dummy_image():
    img = Image.new('RGB', (8, 8), color='red')
    img_bytes = BytesIO()
    img.save(img_bytes, format='PNG')
    img_bytes.seek(0)
    return img_bytes

# Create temporary image files (in-memory via PIL)
dummy_img1 = Image.new('RGB', (8, 8), color='red')
dummy_img2 = Image.new('RGB', (8, 8), color='blue')

# Create annotation data structure
annotation_data = [
    {
        'sentences': ['This is a test sentence.', 'Another test sentence.'],
        'sentence_ixs': [0, 1],
        'images': [dummy_img1, dummy_img2],
        'image_first': [True, False]
    }
]

# Create a temporary annotation file (we'll write it to a string-based approach)
import json
import tempfile
import os

annt_dict = {
    'sentences': ['This is a test sentence.', 'Another test sentence.'],
    'sentence_ixs': [0, 1],
    'images': ['/tmp/dummy1.png', '/tmp/dummy2.png'],
    'image_first': [True, False]
}

# Create dummy image files
dummy_img1 = Image.new('RGB', (8, 8), color='red')
dummy_img2 = Image.new('RGB', (8, 8), color='blue')
dummy_img1.save('/tmp/dummy1.png')
dummy_img2.save('/tmp/dummy2.png')

annt_path = '/tmp/test_annt.json'
with open(annt_path, 'w') as f:
    json.dump([annt_dict], f)

ARGS = {
    'transform': mock_transform,
    'tokenizer': MockTokenizer(),
    'num_total_token': 2048,
    'truncation': True,
    'num_img_token': 64,
    'generation_kwargs': {'sample_param': 0.9},
    'annt_path': annt_path
}
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 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
parse_box Ran
ran, honoured the contract we drafted
rainbowluocs/deem/uni_interleaved/utils/grounding_score.py
code served (permissive licence) · get_code("13e859c753057e62")
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 re

def parse_box(box_str):
    PATTERN = re.compile('\\((.*?)\\)\\((.*?)\\)')
    predict_bbox = re.findall(PATTERN, box_str)
    try:
        if ',' not in predict_bbox[0][0] or ',' not in predict_bbox[0][1]:
            predict_bbox = (0.0, 0.0, 0.0, 0.0)
        else:
            x1, y1 = [float(tmp) for tmp in predict_bbox[0][0].split(',')]
            x2, y2 = [float(tmp) for tmp in predict_bbox[0][1].split(',')]
            predict_bbox = (x1, y1, x2, y2)
    except:
        predict_bbox = (0.0, 0.0, 0.0, 0.0)
    return predict_bbox

# Valid box string with coordinates
valid_box_str = "(1.5,2.3)(4.7,5.1)"

ARGS = {
    "box_str": valid_box_str
}
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
tensor_to_pil Ran
ran; our contract draft was wrong, not the code
rainbowluocs/deem/uni_interleaved/utils/clip_sim_score.py
code served (permissive licence) · get_code("1af97eee0d5e9a78")
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 torch
from PIL import Image

torch.manual_seed(0)

# Create a small batch of images as tensors
# Shape: (batch_size, channels, height, width)
# Values in range [0, 1] as expected by the function
batch_size = 2
channels = 3
height = 4
width = 5

images = torch.rand(batch_size, channels, height, width)

ARGS = {
    "images": images
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, torch — 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
update_texts Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
rainbowluocs/deem/inference.py
code served (permissive licence) · get_code("6aae1c40e557fe64")
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 torch.nn as nn

torch.manual_seed(0)

# Create a minimal tokenizer stand-in
class MinimalTokenizer:
    def __call__(self, text, max_length=2048, truncation=False, padding=False, return_tensors=None, return_attention_mask=False):
        # Return a dict with input_ids tensor
        input_ids = torch.tensor([[1, 100, 101, 2]], dtype=torch.long)
        result = {'input_ids': input_ids}
        if return_attention_mask:
            result['attention_mask'] = torch.ones_like(input_ids)
        return result

# Create inputs dict with required structure
inputs = {
    'text_ids': torch.tensor([[1, 100, 101, 2]], dtype=torch.long),
    'attention_mask': torch.ones((1, 4), dtype=torch.long),
    'image_tensors': torch.randn(1, 3, 8, 8),
    'target_image_idxs': torch.tensor([0]),
    'num_image_per_seq': torch.tensor([1]),
    'meta': {
        'multiround_context': ['Hello world', 'How are you']
    }
}

# Create text_ids tensor (batch_size=1, seq_len=5)
text_ids = torch.tensor([[1, 100, 101, 102, 2]], dtype=torch.long)

# Create special_token_dict
special_token_dict = {
    'bos_token_id': 1,
    'eos_token_id': 2,
    'pad_token_id': 31999,
    'soi_token_id': 32000,
    'image_token_id': 32001
}

# Create pad_image_tensor
pad_image_tensor = torch.randn(1, 3, 8, 8)

# Create tokenizer
tokenizer = MinimalTokenizer()

ARGS = {
    'inputs': inputs,
    'text_ids': text_ids,
    'special_token_dict': special_token_dict,
    'num_img_token': 64,
    'pad_image_tensor': pad_image_tensor,
    'force_gen_image_next': False,
    'force_replace_gen_text': False,
    'tokenizer': tokenizer,
    'cur_iter': -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 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
calculate_activation_statistics Not yet run
unverified (harvested, no recorded run)
rainbowluocs/deem/uni_interleaved/utils/fid_score.py
code served (permissive licence) · get_code("58f3cb144de3c6f9")
How it ran

no invocation recorded.

calculate_clip_sim_i2i Not yet run
unverified (harvested, no recorded run)
rainbowluocs/deem/uni_interleaved/utils/clip_sim_score.py
code served (permissive licence) · get_code("a2cc9c29fefca146")
How it ran

no invocation recorded.

calculate_frechet_distance Not yet run
unverified (harvested, no recorded run)
rainbowluocs/deem/uni_interleaved/utils/fid_score.py
code served (permissive licence) · get_code("0def50a351111624")
How it ran

no invocation recorded. this sample carries JSON test cases instead of a setup block; get_reference_implementation serves them with the level they back.

clip_rerank_generated_images Not yet run
unverified (harvested, no recorded run)
rainbowluocs/deem/uni_interleaved/utils/clip_sim_score.py
code served (permissive licence) · get_code("b6d159b5ffc47aa4")
How it ran

no invocation recorded.

get_activations Not yet run
unverified (harvested, no recorded run)
rainbowluocs/deem/uni_interleaved/utils/fid_score.py
code served (permissive licence) · get_code("696501a9b5a48e4b")
How it ran

no invocation recorded.

imagenet_eval Not yet run
unverified (harvested, no recorded run)
rainbowluocs/deem/uni_interleaved/utils/imagenet_score.py
code served (permissive licence) · get_code("716ae138c69cc76e")
How it ran

no invocation recorded.

vizwiz_vqa_eval Not yet run
unverified (harvested, no recorded run)
rainbowluocs/deem/uni_interleaved/utils/vqa_score.py
code served (permissive licence) · get_code("521448a8a9392444")
How it ran

no invocation recorded.

vqa_eval Not yet run
unverified (harvested, no recorded run)
rainbowluocs/deem/uni_interleaved/utils/vqa_score.py
code served (permissive licence) · get_code("2de01f2d390090d6")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 12 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 1 the same month, 12 later) and 3 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
calculate_frechet_distance 74 other papers
58 dated earlier, 2 the same month, 13 later, 1 same year, order not determinable
1610.09585 (2016-10)
Conditional Image Synthesis With Auxiliary Classifier GANs
1706.08500 (2017-06)
GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium
1807.11458 (2018-07)
To learn image super-resolution, use a GAN to learn how to do image degradation first
and 71 more not named here
box_iou 24 other papers
16 dated earlier, 7 later, 1 undated · 5 only as an assembly brick
2103.12115 (2021-03)
End-to-End Trainable Multi-Instance Pose Estimation with Transformers
2104.00969 (2021-04)
TubeR: Tubelet Transformer for Video Action Detection
2112.05375 (2021-12)
Rethinking the Two-Stage Framework for Grounded Situation Recognition
and 21 more not named here
calculate_activation_statistics 2 other papers
1 dated earlier, 1 later
2306.04675 (2023-06)
Exposing flaws of generative model evaluation metrics and their unfair treatment of diffusion models
2407.16364 (2024-07)
Harmonizing Visual Text Comprehension and Generation
update_texts 2 other papers
1 dated earlier, 1 later
2401.10208 (2024-01)
MM-Interleaved: Interleaved Image-Text Generative Modeling via Multi-modal Feature Synchronizer
2407.16364 (2024-07)
Harmonizing Visual Text Comprehension and Generation
calculate_clip_sim_i2i 1 other paper
1 later
2407.16364 (2024-07)
Harmonizing Visual Text Comprehension and Generation
clip_rerank_generated_images 1 other paper
1 later
2407.16364 (2024-07)
Harmonizing Visual Text Comprehension and Generation
extract_answer 1 other paper
1 later
2407.16364 (2024-07)
Harmonizing Visual Text Comprehension and Generation
get_activations 1 other paper
1 later
2407.16364 (2024-07)
Harmonizing Visual Text Comprehension and Generation
grounding_eval 1 other paper
1 later
2407.16364 (2024-07)
Harmonizing Visual Text Comprehension and Generation
parse_box 1 other paper
1 later
2407.16364 (2024-07)
Harmonizing Visual Text Comprehension and Generation
tensor_to_pil 1 other paper
1 later
2407.16364 (2024-07)
Harmonizing Visual Text Comprehension and Generation
vizwiz_vqa_eval 1 other paper
1 later
2407.16364 (2024-07)
Harmonizing Visual Text Comprehension and Generation

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

The development of large language models (LLMs) has significantly advanced the emergence of large multimodal models (LMMs). While LMMs have achieved tremendous success by promoting the synergy between multimodal comprehension and creation, they often face challenges when confronted with out-of-distribution data, such as which can hardly distinguish orientation, quantity, color, structure, etc. This is primarily due to their reliance on image encoders trained to encode images into task-relevant features, which may lead them to disregard irrelevant details. Delving into the modeling capabilities of diffusion models for images naturally prompts the question: Can diffusion models serve as the eyes of large language models for image perception? In this paper, we propose DEEM, a simple but effective approach that utilizes the generative feedback of diffusion models to align the semantic distributions of the image encoder. This addresses the drawbacks of previous methods that solely relied on image encoders like CLIP-ViT, thereby enhancing the model's resilience against out-of-distribution samples and reducing visual hallucinations. Importantly, this is achieved without requiring additional training modules and with fewer training parameters. We extensively evaluated DEEM on both our newly constructed RobustVQA benchmark and other well-known benchmarks, POPE and MMVP, for visual hallucination and perception. In particular, DEEM improves LMM's visual perception performance to a large extent (e.g., 4% higher on RobustVQA, 6.5% higher on MMVP and 12.8 % higher on POPE ). Compared to the state-of-the-art interleaved content generation models, DEEM exhibits enhanced robustness and a superior capacity to alleviate model hallucinations while utilizing fewer trainable parameters, less pre-training data (10%), and a smaller base model size.

For agents

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

get_harvested_code_for_paper("2405.15232")
get_code_for_paper("2405.15232")
have("2405.15232")

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

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

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

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

Connect an agent — have() is free.