SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2007.11731 · 2020

Comprehensive Image Captioning via Scene Graph Decomposition

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; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 4 failures of our instrument; 0 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/2007.11731.json · badge: /api/ran/2007.11731.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
yiwuzhong/sub-gc community (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
FunctionStatusWhere it lives
cook_refs Ran
ran on a synthesized input
yiwuzhong/sub-gc/misc/diversity/bleu_scorer.py
code served (permissive licence) · get_code("39b6c760a9bd2617")
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. 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 collections import defaultdict

def precook(s, n=4, out=False):
    """Takes a string as input and returns an object that can be given to
    either cook_refs or cook_test. This is optional: cook_refs and cook_test
    can take string arguments as well."""
    words = s.split()
    counts = defaultdict(int)
    for k in range(1, n + 1):
        for i in range(len(words) - k + 1):
            ngram = tuple(words[i:i + k])
            counts[ngram] += 1
    return (len(words), counts)

def cook_refs(refs, eff=None, n=4):
    """Takes a list of reference sentences for a single segment
    and returns an object that encapsulates everything that BLEU
    needs to know about them."""
    '\n    input each reference sentence; output sentence length and maximum counts of unique n-grams\n    '
    reflen = []
    maxcounts = {}
    for ref in refs:
        rl, counts = precook(ref, n)
        reflen.append(rl)
        for ngram, count in counts.items():
            maxcounts[ngram] = max(maxcounts.get(ngram, 0), count)
    if eff == 'shortest':
        reflen = min(reflen)
    elif eff == 'average':
        reflen = float(sum(reflen)) / len(reflen)
    return (reflen, maxcounts)


ARGS = {
    'refs': [
        'the quick brown fox jumps',
        'a fast brown fox leaps'
    ],
    'eff': None,
    'n': 4
}
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 — a tuple output has no array shape of its own; none is 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
cook_test Ran
ran on a synthesized input
yiwuzhong/sub-gc/misc/diversity/bleu_scorer.py
code served (permissive licence) · get_code("efa004f9940cb5c8")
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.

from collections import defaultdict

# First, let's understand what cook_test expects:
# - test: a string (test sentence)
# - xxx_todo_changeme: a tuple of (reflen, refmaxcounts)
#   - reflen: a list of reference lengths OR a single length
#   - refmaxcounts: a defaultdict with ngram counts
# - eff: optional efficiency mode ('closest' or None)
# - n: number of n-grams (default 4)

# Create a reference using precook
def precook(s, n=4, out=False):
    """Takes a string as input and returns an object that can be given to
    either cook_refs or cook_test. This is optional: cook_refs and cook_test
    can take string arguments as well."""
    words = s.split()
    counts = defaultdict(int)
    for k in range(1, n + 1):
        for i in range(len(words) - k + 1):
            ngram = tuple(words[i:i + k])
            counts[ngram] += 1
    return (len(words), counts)

# Create reference data
ref_sentence = "the cat sat on the mat"
ref_length, ref_counts = precook(ref_sentence, n=4)

# For the xxx_todo_changeme parameter, we need (reflen, refmaxcounts)
# Looking at the code, reflen can be a list (when eff='closest') or a single value
# refmaxcounts is a defaultdict with ngram tuples as keys and counts as values

# Create test data
test_sentence = "the cat sat on mat"

ARGS = {
    "test": test_sentence,
    "xxx_todo_changeme": (ref_length, ref_counts),
    "eff": None,
    "n": 4
}
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 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
pack_wrapper Ran
ran; our contract draft was wrong, not the code
yiwuzhong/sub-gc/models/AttModel.py
code served (permissive licence) · get_code("c555e7f1fba71b9c")
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 3, dtype family float, shape (2, 4, 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
import torch.nn as nn
from torch.nn.utils.rnn import PackedSequence, pack_padded_sequence, pad_packed_sequence

torch.manual_seed(0)

# Define a minimal module that processes PackedSequence
class SimplePackedModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, packed_sequence):
        # Expects a PackedSequence and returns a tensor
        # For this wrapper, we just return the data as-is or apply a simple transformation
        return packed_sequence.data

# Create test data
batch_size = 2
seq_len = 5
feature_dim = 4

# att_feats: (batch_size, seq_len, feature_dim)
att_feats = torch.randn(batch_size, seq_len, feature_dim)

# att_masks: (batch_size, seq_len) - binary mask where sum gives lengths
# Create masks with different lengths for each sample
att_masks = torch.zeros(batch_size, seq_len)
att_masks[0, :4] = 1  # First sample has length 4
att_masks[1, :3] = 1  # Second sample has length 3

# Create the module
module = SimplePackedModule()

ARGS = {
    "module": module,
    "att_feats": att_feats,
    "att_masks": att_masks,
}
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 Tensor, ndim 3, dtype family float, shape (2, 4, 4) — shape (2, 4, 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
pad_unsort_packed_sequence Ran
ran; our contract draft was wrong, not the code
yiwuzhong/sub-gc/models/AttModel.py
code served (permissive licence) · get_code("bfac58a04b6835f5")
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 3, dtype family float, shape (2, 4, 3) 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 torch.nn.utils.rnn import pack_padded_sequence

torch.manual_seed(0)

# Create a simple packed sequence
# We need: batch_size=2, sequence_length=4, input_size=3
batch_size = 2
seq_length = 4
input_size = 3

# Create input tensor (seq_length, batch_size, input_size)
data = torch.randn(seq_length, batch_size, input_size)

# Create lengths for each sequence in the batch
lengths = torch.tensor([4, 3], dtype=torch.long)

# Pack the sequence
packed_input = pack_padded_sequence(data, lengths, enforce_sorted=False)

# Create inverse indices for unsorting
# pack_padded_sequence with enforce_sorted=False returns sorted_indices
# We need the inverse permutation to unsort
sorted_indices = packed_input.sorted_indices
inv_ix = torch.argsort(sorted_indices)

ARGS = {
    "input": packed_input,
    "inv_ix": inv_ix
}
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 3, dtype family float, shape (2, 4, 3) — shape (2, 4, 3) 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
precook Ran
ran; our contract draft was wrong, not the code
yiwuzhong/sub-gc/misc/diversity/bleu_scorer.py
code served (permissive licence) · get_code("ec4448373d72d636")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 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.

ARGS = {
    "s": "the quick brown fox jumps over the lazy dog",
    "n": 4,
    "out": False
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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
sort_pack_padded_sequence Ran
ran; our contract draft was wrong, not the code
yiwuzhong/sub-gc/models/AttModel.py
code served (permissive licence) · get_code("e56d2f9cbd9cb8b1")
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. 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 torch.nn.utils.rnn import pack_padded_sequence

torch.manual_seed(0)

# Create a small batch of padded sequences
# batch_size=2, max_seq_length=3, embedding_dim=4
batch_size = 2
max_seq_length = 3
embedding_dim = 4

input_tensor = torch.randn(batch_size, max_seq_length, embedding_dim)
lengths = torch.tensor([3, 2], dtype=torch.long)

ARGS = {
    "input": input_tensor,
    "lengths": lengths,
}
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 — a tuple output has no array shape of its own; none is 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, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 4 later) and 2 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
precook 22 other papers
10 dated earlier, 12 later
1411.4555 (2014-11)
Show and Tell: A Neural Image Caption Generator
1502.03044 (2015-02)
Show, Attend and Tell: Neural Image Caption Generation with Visual Attention
1611.09268 (2016-11)
MS MARCO: A Human Generated MAchine Reading COmprehension Dataset
and 19 more not named here
pad_unsort_packed_sequence 14 other papers
6 dated earlier, 8 later · 2 only as an assembly brick
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
1707.07998 (2017-07)
Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering
1906.05963 (2019-06)
Image Captioning: Transforming Objects into Words
and 11 more not named here
pack_wrapper 13 other papers
5 dated earlier, 8 later · 2 only as an assembly brick
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
1707.07998 (2017-07)
Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering
1906.05963 (2019-06)
Image Captioning: Transforming Objects into Words
and 10 more not named here
sort_pack_padded_sequence 10 other papers
5 dated earlier, 5 later · 2 only as an assembly brick
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
1707.07998 (2017-07)
Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering
1906.05963 (2019-06)
Image Captioning: Transforming Objects into Words
and 7 more not named here

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

We address the challenging problem of image captioning by revisiting the representation of image scene graph. At the core of our method lies the decomposition of a scene graph into a set of sub-graphs, with each sub-graph capturing a semantic component of the input image. We design a deep model to select important sub-graphs, and to decode each selected sub-graph into a single target sentence. By using sub-graphs, our model is able to attend to different components of the image. Our method thus accounts for accurate, diverse, grounded and controllable captioning at the same time. We present extensive experiments to demonstrate the benefits of our comprehensive captioning model. Our method establishes new state-of-the-art results in caption diversity, grounding, and controllability, and compares favourably to latest methods in caption quality. Our project website can be found at http://pages.cs.wisc.edu/~yiwuzhong/Sub-GC.html.

For agents

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

get_harvested_code_for_paper("2007.11731")
get_code_for_paper("2007.11731")
have("2007.11731")

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

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

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

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

Connect an agent — have() is free.