SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.11490 · ICLR · 2024

LLM-CXR: Instruction-Finetuned LLM for CXR Image Understanding and Generation

Jong Ye, Suhyeon Lee, Won Kim, Jinho Chang

arXiv · PDF · Open in the Atlas

Code that ran

7 of 12 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 4 have no contract verdict; 3 failures of our instrument; 5 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/2305.11490.json · badge: /api/ran/2305.11490.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
hyn2028/llm-cxr canonical (classifier label)
classifier basis: census
7 ran · 5 no recorded run
FunctionStatusWhere it lives
dicom_id_to_report_path Ran
ran on a synthesized input
hyn2028/llm-cxr/generate_eval.py
code served (permissive licence) · get_code("c9c680550106172a")
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 PosixPath. 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 pathlib import Path
import pandas as pd

# Create a minimal DataFrame that the function will use with .loc[]
db = pd.DataFrame({
    'subject_id': ['001234'],
    'study_id': ['5678']
}, index=['dicom_12345'])

# Create a pathlib Path object for report_path
report_path = Path('/tmp/medical_reports')

# The dicom_id that will be looked up in the dataframe
dicom_id = 'dicom_12345'

ARGS = {
    'db': db,
    'report_path': report_path,
    'dicom_id': dicom_id
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PosixPath — a PosixPath output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PosixPath 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
get_inject_vq_fun Ran
ran on a synthesized input
hyn2028/llm-cxr/training/mimiccxr_vq_dataset.py
code served (permissive licence) · get_code("a046345fa6ca4654")
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 function. 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 typing import List

class MockTokenizer:
    """Mock tokenizer that returns token IDs for the replace template."""
    def __call__(self, text: str):
        # Return a dict with 'input_ids' key
        # The replace template '<image>' tokenizes to 3 tokens
        # These need to be tokens that don't appear in the main input_ids
        return {'input_ids': [50278, 50279, 50280]}

def setup_tokenizer():
    """Create a mock tokenizer for testing."""
    return MockTokenizer()

# Create the tokenizer
tokenizer = setup_tokenizer()

# Define ARGS dictionary with the tokenizer
ARGS = {
    'tokenizer': tokenizer
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
get_special_token_id Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
hyn2028/llm-cxr/training/generate.py
code served (permissive licence) · get_code("5ac6edd1d97f00b5")
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 int, ndim 0, dtype family int, shape () 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.

from transformers import AutoTokenizer

torch_manual_seed = __import__('torch').manual_seed(0)

class MockTokenizer:
    def encode(self, text):
        if text == "### Instruction:":
            return [1000]
        elif text == "### End":
            return [1001]
        else:
            return [1002]

tokenizer = MockTokenizer()

ARGS = {
    "tokenizer": tokenizer,
    "key": "### Instruction:"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () 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
is_contain_none Ran
ran on a synthesized input
hyn2028/llm-cxr/decode_cxr_all.py
code served (permissive licence) · get_code("dc20a4a36d758c8a")
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 bool, ndim 0, dtype family float, shape () 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

def is_contain_none(x: dict):
    for k, v in x.items():
        if v is None:
            return True
    return False

torch.manual_seed(0)

ARGS = {
    "x": {
        "key1": torch.randn(2, 4),
        "key2": "some_value",
        "key3": 42
    }
}
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 bool, ndim 0, dtype family float, shape () — shape () 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
load_config Ran
ran; our contract draft was wrong, not the code
hyn2028/llm-cxr/encode_cxr_all.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from lianqi1008/Control-GIC, is pointer only (licence: NONE) · get_code("4b147e0a54c3fa04")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from lianqi1008/Control-GIC, and GitHub detected no licence in that repository 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_config Ran
ran; our contract draft was wrong, not the code
hyn2028/llm-cxr/decode_cxr_all.py
code served (permissive licence) · get_code("0222cdbcd972e8d5")
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 DictConfig. 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
import os
from omegaconf import OmegaConf

# Create a temporary config file
temp_dir = tempfile.mkdtemp()
config_file = os.path.join(temp_dir, "test_config.yaml")

# Write a simple config to the temporary file
config_content = """
model:
  name: test_model
  layers: 3
  hidden_dim: 128
training:
  batch_size: 32
  learning_rate: 0.001
  epochs: 10
"""

with open(config_file, 'w') as f:
    f.write(config_content)

ARGS = {
    "config_path": config_file,
    "display": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
omegaconf, yaml — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DictConfig — a DictConfig output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DictConfig output the recorded ndim 1 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_report Ran
ran on a synthesized input
hyn2028/llm-cxr/generate_eval.py
code served (permissive licence) · get_code("231c74d79d27f5c7")
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 pandas as pd
from pathlib import Path
import tempfile
import os

# Create a temporary directory for the report files
temp_dir = tempfile.mkdtemp()
report_base = Path(temp_dir)

# Create the directory structure needed
subject_id = 'p000001'
study_id = 's123456'
subject_id_prefix = subject_id[:3]
report_dir = report_base / 'reports' / 'files' / subject_id_prefix / subject_id
report_dir.mkdir(parents=True, exist_ok=True)

# Create a sample report file
report_file = report_dir / f'{study_id}.txt'
with open(report_file, 'w') as f:
    f.write("Line 1 of report\n")
    f.write("Line 2 of report\n")
    f.write("Line 3 of report\n")

# Create a minimal dataframe for the db parameter
db = pd.DataFrame({
    'subject_id': ['000001'],
    'study_id': ['123456']
}, index=['dicom_001'])

# Define a simple parse function
def parse_fun(txt):
    return ''.join(txt).strip()

# Define ARGS
ARGS = {
    'db': db,
    'report_path': report_base,
    'dicom_id': 'dicom_001',
    'parse_fun': parse_fun
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — 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
generate_response Not yet run
unverified (harvested, no recorded run)
hyn2028/llm-cxr/training/generate.py
code served (permissive licence) · get_code("4ccce24e2e7398f3")
How it ran

no invocation recorded.

get_extract_vq_fun Not yet run
unverified (harvested, no recorded run)
hyn2028/llm-cxr/training/mimiccxr_vq_dataset.py
code served (permissive licence) · get_code("dc4f9e2e74c110e6")
How it ran

no invocation recorded.

load_model_tokenizer_for_generate Not yet run
unverified (harvested, no recorded run)
hyn2028/llm-cxr/training/generate.py
code served (permissive licence) · get_code("2361a7cb0adc20ba")
How it ran

no invocation recorded.

load_training_dataset Not yet run
unverified (harvested, no recorded run)
hyn2028/llm-cxr/training/trainer.py
code served (permissive licence) · get_code("43e5f30e3d4b5947")
How it ran

no invocation recorded.

parse_report_fi Not yet run
unverified (harvested, no recorded run)
hyn2028/llm-cxr/generate_eval.py
code served (permissive licence) · get_code("4e8d51a19a596de2")
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 11 distinct functions with an identity, 3 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 3 later) and 8 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_config 4 other papers
4 later
2403.07874 (2024-03)
Beyond Text: Frozen Large Language Models in Visual Signal Comprehension
2406.00758 (2024-06)
ONCE-FOR-ALL: CONTROLLABLE GENERATIVE IMAGE COMPRESSION WITH DYNAMIC GRANULARITY ADAPTATION
2406.11837 (2024-06)
Scaling the Codebook Size of VQGAN to 100,000 with a Utilization Rate of 99%
and 1 more not named here
get_special_token_id 1 other paper
1 later
2605.08842 (2026-05)
XPERT: Expert Knowledge Transfer for Effective Training of Language Models
load_model_tokenizer_for_generate 1 other paper
1 later
2605.08842 (2026-05)
XPERT: Expert Knowledge Transfer for Effective Training of Language Models

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

Following the impressive development of LLMs, vision-language alignment in LLMs is actively being researched to enable multimodal reasoning and visual input/output. This direction of research is particularly relevant to medical imaging because accurate medical image analysis and generation consist of reasoning based on a combination of visual features and prior knowledge. Many recent works have focused on training adapter networks that serve as an information bridge between image processing (encoding or generating) networks and LLMs; but presumably, in order to achieve maximum reasoning potential of LLMs on visual information as well as language, image and text features should be allowed to interact more freely. This is especially important in the medical domain because understanding and generating medical images such as chest X-rays (CXR) require not only accurate visual and language-based reasoning but also a more intimate mapping between the two modalities. Thus, taking inspiration from previous work on the transformer and VQ-GAN combination for bidirectional image and text generation, we build upon this approach and develop a method for instruction-tuning an LLM pre-trained only on text to gain vision-language capabilities for medical images. Specifically, we leverage a pretrained LLM's existing questionanswering and instruction-following abilities to teach it to understand visual inputs by instructing it to answer questions about image inputs and, symmetrically, output both text and image responses appropriate to a given query by tuning the LLM with diverse tasks that encompass image-based text-generation and text-based image-generation. We show that our model, LLM-CXR, trained in this approach shows better image-text alignment in both CXR understanding and generation tasks while being smaller in size compared to previously developed models that perform a narrower range of tasks. * These authors contributed equally to this work. † In order to comply with the MIMIC-CXR data usage license (Johnson et al., 2019a), all CXR images presented in the Figures 2,3, 4, 8 are replaced with similar CXR's from the Indiana University chest X-ray dataset (Demner-Fushman et al., 2016); and the presented MIMIC text reports are paraphrased.

For agents

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

get_harvested_code_for_paper("2305.11490")
get_code_for_paper("2305.11490")
have("2305.11490")

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

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

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

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

Connect an agent — have() is free.