SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2004.00390 · 2020

More Grounded Image Captioning by Distilling Image-Text Matching Model

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 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 1 has no contract verdict; 6 failures of our instrument; 1 no recorded run), measured 2026-11-21; 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/2004.00390.json · badge: /api/ran/2004.00390.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
YuanEZhou/Grounded-Image-Captioning canonical (classifier label)
classifier basis: census
7 ran · 1 no recorded run
FunctionStatusWhere it lives
count_bad Ran
ran on a synthesized input
YuanEZhou/Grounded-Image-Captioning/eval_utils.py
code served (permissive licence) · get_code("0a4de8f498e3e70c")
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.

import torch

torch.manual_seed(0)

ARGS = {
    'sen': 'the quick brown fox jumps over the dog'
}
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 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
pack_wrapper Ran
ran; our contract draft was wrong, not the code
YuanEZhou/Grounded-Image-Captioning/models/AttModel.py
code served (permissive licence) · get_code("d2379d710eedc4ae")
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, 5, 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)

# Create a simple module that processes packed sequences
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        # x is the data from a PackedSequence
        return self.linear(x)

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

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

# att_masks: (batch_size, max_seq_len) with 1s for valid positions, 0s for padding
# Different lengths for each sample: first has 5 valid, second has 3 valid
att_masks = torch.tensor([
    [1, 1, 1, 1, 1],
    [1, 1, 1, 0, 0]
], dtype=torch.float32)

# Create module
module = SimpleModule()

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
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, 5, 4) — shape (2, 5, 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
YuanEZhou/Grounded-Image-Captioning/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
resnet18 Ran
ran; our contract draft was wrong, not the code
YuanEZhou/Grounded-Image-Captioning/misc/resnet.py
code served (permissive licence) · get_code("2b17380e9938d559")
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 ResNet. 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 torch.nn as nn
from torchvision.models.resnet import BasicBlock

torch.manual_seed(0)

ARGS = {
    'pretrained': False,
}
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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
resnet34 Ran
ran; our contract draft was wrong, not the code
YuanEZhou/Grounded-Image-Captioning/misc/resnet.py
code served (permissive licence) · get_code("d206d964368eeb24")
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 ResNet. 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 torch.nn as nn
import torchvision.models.resnet
from torchvision.models.resnet import BasicBlock

torch.manual_seed(0)

ARGS = {
    'pretrained': False,
}
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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
resnet50 Ran
ran; our contract draft was wrong, not the code
YuanEZhou/Grounded-Image-Captioning/misc/resnet.py
code served (permissive licence) · get_code("fade30a7dab7a039")
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 ResNet. 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 torch.nn as nn
from torchvision.models.resnet import Bottleneck
import torchvision.models.resnet

torch.manual_seed(0)

ARGS = {
    'pretrained': False,
}
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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
sort_pack_padded_sequence Ran
ran; our contract draft was wrong, not the code
YuanEZhou/Grounded-Image-Captioning/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
language_eval Not yet run
unverified (harvested, no recorded run)
YuanEZhou/Grounded-Image-Captioning/eval_utils.py
code served (permissive licence) · get_code("45c05576f202e2b6")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 7 are also present in other papers whose code we hold (7 with at least one paper dated earlier, 0 the same month, 7 later) and 1 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
pad_unsort_packed_sequence 14 other papers
5 dated earlier, 9 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
4 dated earlier, 9 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
4 dated earlier, 6 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
resnet18 9 other papers
8 dated earlier, 1 later
1605.06409 (2016-05)
R-FCN: Object Detection via Region-based Fully Convolutional Networks
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
1803.09845 (2018-03)
Neural Baby Talk
and 6 more not named here
resnet34 9 other papers
8 dated earlier, 1 later
1605.06409 (2016-05)
R-FCN: Object Detection via Region-based Fully Convolutional Networks
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
1803.09845 (2018-03)
Neural Baby Talk
and 6 more not named here
resnet50 5 other papers
3 dated earlier, 2 later
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
1906.05963 (2019-06)
Image Captioning: Transforming Objects into Words
1908.06954 (2019-08)
Attention on Attention for Image Captioning
and 2 more not named here
count_bad 4 other papers
3 dated earlier, 1 later
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
1908.06954 (2019-08)
Attention on Attention for Image Captioning
2002.12204 (2020-02)
Visual Commonsense R-CNN
and 1 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-21.

Repositories linked to this paper

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

Abstract

Visual attention not only improves the performance of image captioners, but also serves as a visual interpretation to qualitatively measure the caption rationality and model transparency. Specifically, we expect that a captioner can fix its attentive gaze on the correct objects while generating the corresponding words. This ability is also known as grounded image captioning. However, the grounding accuracy of existing captioners is far from satisfactory. To improve the grounding accuracy while retaining the captioning quality, it is expensive to collect the word-region alignment as strong supervision. To this end, we propose a Part-of-Speech (POS) enhanced image-text matching model (SCAN \cite{lee2018stacked}): POS-SCAN, as the effective knowledge distillation for more grounded image captioning. The benefits are two-fold: 1) given a sentence and an image, POS-SCAN can ground the objects more accurately than SCAN; 2) POS-SCAN serves as a word-region alignment regularization for the captioner's visual attention module. By showing benchmark experimental results, we demonstrate that conventional image captioners equipped with POS-SCAN can significantly improve the grounding accuracy without strong supervision. Last but not the least, we explore the indispensable Self-Critical Sequence Training (SCST) \cite{Rennie_2017_CVPR} in the context of grounded image captioning and show that the image-text matching score can serve as a reward for more grounded captioning \footnote{https://github.com/YuanEZhou/Grounded-Image-Captioning}.

For agents

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

get_harvested_code_for_paper("2004.00390")
get_code_for_paper("2004.00390")
have("2004.00390")

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

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

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

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

Connect an agent — have() is free.