SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2411.10440 · 2024

LLaVA-CoT: Let Vision Language Models Reason Step-by-Step

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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, 1 violated it and 0 have no contract verdict; 4 failures of our instrument; 0 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2411.10440.json · badge: /api/ran/2411.10440.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
PKU-YuanGroup/LLaVA-CoT canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
build_string_from_input Ran
ran; our contract draft was wrong, not the code
PKU-YuanGroup/LLaVA-CoT/inference/processing_mllama.py
code served (permissive licence) · get_code("49d0089638819bbb")
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

# Construct valid arguments for build_string_from_input
ARGS = {
    "prompt": "Hello world",
    "bos_token": "<begin_of_text>",
    "image_token": "<|image|>"
}
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
check_header Ran
ran, violated the contract we drafted
PKU-YuanGroup/LLaVA-CoT/train/datasets/cot_dataset.py
code served (permissive licence) · get_code("279dba8c60a251a9")
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

torch.manual_seed(0)

# The function checks if any 3-character substring of seq is in targets
# targets: a container (set, list, etc.) of 3-character strings to search for
# seq: a string or sequence to search through

targets = {'abc', 'def', 'xyz'}
seq = 'abcdefghij'

ARGS = {
    'targets': targets,
    'seq': seq
}
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
convert_sparse_cross_attention_mask_to_dense Ran
ran, honoured the contract we drafted
PKU-YuanGroup/LLaVA-CoT/inference/processing_mllama.py
code served (permissive licence) · get_code("c5cf7473e80cd8b9")
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 ndarray, ndim 4, dtype family int, shape (2, 10, 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 numpy as np

# Construct arguments for convert_sparse_cross_attention_mask_to_dense

# batch_size = 2
# length = 10 (sequence length)
# max_num_images = 3
# max_num_tiles = 4

cross_attention_token_mask = [
    # Batch item 0: 3 images
    [
        [0, 5],      # Image 0: attend to tokens 0-5
        [2, 8],      # Image 1: attend to tokens 2-8
        [3, 10],     # Image 2: attend to tokens 3-10
    ],
    # Batch item 1: 2 images
    [
        [1, 6],      # Image 0: attend to tokens 1-6
        [4, 9],      # Image 1: attend to tokens 4-9
    ]
]

num_tiles = [
    # Batch item 0: number of tiles for each image
    [2, 3, 2],     # Image 0 has 2 tiles, Image 1 has 3 tiles, Image 2 has 2 tiles
    # Batch item 1: number of tiles for each image
    [1, 4]         # Image 0 has 1 tile, Image 1 has 4 tiles
]

max_num_tiles = 4
length = 10

ARGS = {
    "cross_attention_token_mask": cross_attention_token_mask,
    "num_tiles": num_tiles,
    "max_num_tiles": max_num_tiles,
    "length": length,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 4, dtype family int, shape (2, 10, 3, 4) — shape (2, 10, 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_cross_attention_token_mask Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
PKU-YuanGroup/LLaVA-CoT/inference/processing_mllama.py
code served (permissive licence) · get_code("deb9060d831b0db4")
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 2, 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
import numpy as np

# Define ARGS dictionary with valid arguments for get_cross_attention_token_mask
ARGS = {
    "input_ids": [1, 2, 101, 3, 4, 101, 5, 6, 7],
    "image_token_id": 101
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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 2, 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
replace_target Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
PKU-YuanGroup/LLaVA-CoT/train/datasets/cot_dataset.py
code served (permissive licence) · get_code("c394d8c2569821ee")
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 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

torch.manual_seed(0)

# Construct arguments for replace_target function
# The function takes a target (a sequence of 3 elements) and a seq (a list/sequence)
# It searches for the target pattern in seq and replaces matching triplets with (-100, -100, -100)

target = [1, 2, 3]
seq = [1, 2, 3, 4, 5, 1, 2, 3, 6, 7]

ARGS = {
    "target": target,
    "seq": seq
}
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 list, ndim 1, 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
tokenize_dialogs Ran
ran; our contract draft was wrong, not the code
PKU-YuanGroup/LLaVA-CoT/train/datasets/cot_dataset.py
code served (permissive licence) · get_code("dfe890e1cf5fdda7")
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 copy

torch.manual_seed(0)

class MockTokenizer:
    def __init__(self):
        self.pad_token_id = 0

class MockProcessor:
    def __init__(self):
        self.tokenizer = MockTokenizer()
    
    def apply_chat_template(self, dialogs):
        # Return a simple text prompt based on number of dialogs
        return " ".join([f"dialog {i}" for i in range(len(dialogs))])
    
    def __call__(self, images=None, text=None, padding=True, return_tensors=None):
        # Return a batch dict with input_ids containing token sequences
        # Include token 128009 (eot marker) and other special tokens
        batch_size = len(images) if images is not None else 2
        seq_len = 12
        
        input_ids = []
        for i in range(batch_size):
            # Create a sequence with special tokens
            seq = [128006, 9125, 128007, 5, 6, 7, 128009, 128006, 78191, 128007, 8, 9]
            input_ids.append(seq)
        
        return {
            'input_ids': torch.tensor(input_ids)
        }

# Create mock dialogs - list of dialog structures
dialogs = [
    [{"role": "user", "content": "Hello"}],
    [{"role": "user", "content": "Hi there"}]
]

# Create mock images - list of image-like objects
images = [torch.randn(3, 224, 224), torch.randn(3, 224, 224)]

# Create processor
processor = MockProcessor()

ARGS = {
    'dialogs': dialogs,
    'images': images,
    'processor': processor
}
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 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

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 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 6 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-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

Large language models have demonstrated substantial advancements in reasoning capabilities. However, current Vision-Language Models (VLMs) often struggle to perform systematic and structured reasoning, especially when handling complex visual question-answering tasks. In this work, we introduce LLaVA-CoT, a large VLM designed to conduct autonomous multistage reasoning. Unlike chain-of-thought prompting, LLaVA-CoT independently engages in sequential stages of summarization, visual interpretation, logical reasoning, and conclusion generation. This structured approach enables LLaVA-CoT to achieve marked improvements on reasoning-intensive tasks. To accomplish this, we construct the LLaVA-CoT-100k dataset, integrating samples from various visual question answering sources and providing structured reasoning annotations. Besides, we propose a test-time stage-wise retracing search method (SWIRES), which enables effective and efficient test-time scaling. Remarkably, with only 100k training samples and test-time scaling, LLaVA-CoT not only outperforms its base model by 9.4% on a wide range of multimodal reasoning benchmarks, but also surpasses the performance of larger and even closed-source models, such as Gemini-1.5-pro, GPT-4o-mini, and Llama-3.2-90B-Vision-Instruct. The code, dataset, and pre-trained weights are publicly available at https://github.com/PKU-YuanGroup/LLaVA-CoT.

For agents

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

get_harvested_code_for_paper("2411.10440")
get_code_for_paper("2411.10440")
have("2411.10440")

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

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

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

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

Connect an agent — have() is free.