SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1707.07998 · 2017

Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering

arXiv · PDF · Open in the Atlas

Code that ran

9 of 9 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, 1 violated it and 0 have no contract verdict; 8 failures of our instrument; 0 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, 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/1707.07998.json · badge: /api/ran/1707.07998.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
chrisc36/bottom-up-attention-vqa extension (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
kangkang59812/GraphCaption reimplementation (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
ruotianluo/Transformer_Captioning reimplementation (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
FunctionStatusWhere it lives
elementwise_logsumexp Ran
ran; our contract draft was wrong, not the code
chrisc36/bottom-up-attention-vqa/vqa_debias_loss_functions.py
pointer only (licence: GPL-3.0) · get_code("4bd23f3562cfbd1c")
How it ran

The body of this sample is withheld: GPL-3.0, as GitHub detects it on this paper's repository, chrisc36/bottom-up-attention-vqa, is not in the permissive set Syntology serves inline. 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.

attention Ran
ran; our contract draft was wrong, not the code
ruotianluo/Transformer_Captioning/models/TransformerModel.py
pointer only (licence: NONE) · get_code("20bb0ff4a2d77a03")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ruotianluo/Transformer_Captioning 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.

clones Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from dilab-ustcsz/cmust
pointer only · get_code("a3722169bbc81569")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

convert_sigmoid_logits_to_binary_logprobs Ran
ran; our contract draft was wrong, not the code
chrisc36/bottom-up-attention-vqa/vqa_debias_loss_functions.py
pointer only (licence: GPL-3.0) · get_code("0e2c50fe59debfb7")
How it ran

The body of this sample is withheld: GPL-3.0, as GitHub detects it on this paper's repository, chrisc36/bottom-up-attention-vqa, is not in the permissive set Syntology serves inline. 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.

pack_wrapper Ran
ran; our contract draft was wrong, not the code
kangkang59812/GraphCaption/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
kangkang59812/GraphCaption/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
renormalize_binary_logits Ran
ran; our contract draft was wrong, not the code
chrisc36/bottom-up-attention-vqa/vqa_debias_loss_functions.py
pointer only (licence: GPL-3.0) · get_code("21690a7e909f0f41")
How it ran

The body of this sample is withheld: GPL-3.0, as GitHub detects it on this paper's repository, chrisc36/bottom-up-attention-vqa, is not in the permissive set Syntology serves inline. 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.

sort_pack_padded_sequence Ran
ran; our contract draft was wrong, not the code
kangkang59812/GraphCaption/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
subsequent_mask Ran
ran, violated the contract we drafted
ruotianluo/Transformer_Captioning/models/TransformerModel.py
pointer only (licence: NONE) · get_code("dd03765c7da9ca51")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ruotianluo/Transformer_Captioning 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.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 9 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 9 later) and 0 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
clones 79 other papers
3 dated earlier, 76 later · 11 only as an assembly brick
1411.4555 (2014-11)
Show and Tell: A Neural Image Caption Generator
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
1706.03762 (2017-06)
Attention Is All You Need
and 76 more not named here
attention 27 other papers
4 dated earlier, 23 later
1411.4555 (2014-11)
Show and Tell: A Neural Image Caption Generator
1609.08144 (2016-09)
Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
and 24 more not named here
subsequent_mask 21 other papers
2 dated earlier, 19 later
1411.4555 (2014-11)
Show and Tell: A Neural Image Caption Generator
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
1905.12926 (2019-05)
Controllable Unsupervised Text Attribute Transfer via Editing Entangled Latent Representation
and 18 more not named here
pad_unsort_packed_sequence 14 other papers
1 dated earlier, 13 later · 2 only as an assembly brick
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 11 more not named here
pack_wrapper 13 other papers
1 dated earlier, 12 later · 2 only as an assembly brick
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 10 more not named here
sort_pack_padded_sequence 10 other papers
1 dated earlier, 9 later · 2 only as an assembly brick
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 7 more not named here
convert_sigmoid_logits_to_binary_logprobs 4 other papers
4 later
1909.03683 (2019-09)
Don't Take the Easy Way Out: Ensemble Based Methods for Avoiding Known Dataset Biases
2003.06576 (2020-03)
Counterfactual Samples Synthesizing for Robust Visual Question Answering
2010.16010 (2020-10)
Loss re-scaling VQA: Revisiting the LanguagePrior Problem from a Class-imbalance View
and 1 more not named here
elementwise_logsumexp 4 other papers
4 later
1909.03683 (2019-09)
Don't Take the Easy Way Out: Ensemble Based Methods for Avoiding Known Dataset Biases
2003.06576 (2020-03)
Counterfactual Samples Synthesizing for Robust Visual Question Answering
2010.16010 (2020-10)
Loss re-scaling VQA: Revisiting the LanguagePrior Problem from a Class-imbalance View
and 1 more not named here
renormalize_binary_logits 3 other papers
3 later
1909.03683 (2019-09)
Don't Take the Easy Way Out: Ensemble Based Methods for Avoiding Known Dataset Biases
2003.06576 (2020-03)
Counterfactual Samples Synthesizing for Robust Visual Question Answering
2111.01026 (2021-11)
Introspective Distillation for Robust Question Answering

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

More are linked than shown here.

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

Abstract

Top-down visual attention mechanisms have been used extensively in image captioning and visual question answering (VQA) to enable deeper image understanding through fine-grained analysis and even multiple steps of reasoning. In this work, we propose a combined bottom-up and top-down attention mechanism that enables attention to be calculated at the level of objects and other salient image regions. This is the natural basis for attention to be considered. Within our approach, the bottom-up mechanism (based on Faster R-CNN) proposes image regions, each with an associated feature vector, while the top-down mechanism determines feature weightings. Applying this approach to image captioning, our results on the MSCOCO test server establish a new state-of-the-art for the task, achieving CIDEr / SPICE / BLEU-4 scores of 117.9, 21.5 and 36.9, respectively. Demonstrating the broad applicability of the method, applying the same approach to VQA we obtain first place in the 2017 VQA Challenge.

For agents

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

get_harvested_code_for_paper("1707.07998")
get_code_for_paper("1707.07998")
have("1707.07998")

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

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

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

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

Connect an agent — have() is free.