SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1908.06954 · 2019

Attention on Attention for Image Captioning

arXiv · PDF · Open in the Atlas

Code that ran

9 of 14 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; 7 failures of our instrument; 5 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/1908.06954.json · badge: /api/ran/1908.06954.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
husthuaan/AoANet canonical (classifier label)
classifier basis not recorded on the link
7 ran · 1 no recorded run
Lieberk/Paddle-AoA-Captioning community (classifier label)
classifier basis not recorded on the link
2 ran · 2 no recorded run
Yinan-Zhao/AoANet_VizWiz community (classifier label)
classifier basis not recorded on the link
0 ran · 2 no recorded run
FunctionStatusWhere it lives
array_to_str Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Lieberk/Paddle-AoA-Captioning/misc/rewards.py
pointer only (licence: MIT); the stored copy get_code serves, from 98lingchen/MICCAI2026, is pointer only (licence: NONE) · get_code("cab04f1e2101c79a")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from 98lingchen/MICCAI2026, 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.

count_bad Ran
ran on a synthesized input
husthuaan/AoANet/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
husthuaan/AoANet/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
husthuaan/AoANet/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
pickle_load Ran
ran on a synthesized input
Lieberk/Paddle-AoA-Captioning/misc/utils.py
code served (permissive licence) · get_code("05a5570decb65f28")
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 six
from six.moves import cPickle
import io
import pickle

# Create a simple object to pickle
test_data = {
    'key1': 'value1',
    'key2': [1, 2, 3],
    'key3': {'nested': 'dict'}
}

# Create a file-like object (BytesIO) with pickled data
f = io.BytesIO()
pickle.dump(test_data, f)
f.seek(0)  # Reset to beginning for reading

ARGS = {
    'f': f
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
six — 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
resnet18 Ran
ran; our contract draft was wrong, not the code
husthuaan/AoANet/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
husthuaan/AoANet/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
husthuaan/AoANet/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
husthuaan/AoANet/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)
husthuaan/AoANet/eval_utils.py
code served (permissive licence) · get_code("06b72839dcd7433f")
How it ran

no invocation recorded.

language_eval Not yet run
unverified (harvested, no recorded run)
Lieberk/Paddle-AoA-Captioning/misc/eval_utils.py
code served (permissive licence) · get_code("1025831953c8de89")
How it ran

no invocation recorded.

language_eval Not yet run
unverified (harvested, no recorded run)
Yinan-Zhao/AoANet_VizWiz/eval_utils.py
code served (permissive licence) · get_code("3b970e4dd2aa2488")
How it ran

no invocation recorded.

load_para Not yet run
unverified (harvested, no recorded run)
Yinan-Zhao/AoANet_VizWiz/finetune_vizwiz.py
code served (permissive licence) · get_code("b5a3aa10efea531b")
How it ran

no invocation recorded.

pickle_dump Not yet run
unverified (harvested, no recorded run)
Lieberk/Paddle-AoA-Captioning/misc/utils.py
code served (permissive licence) · get_code("2302f3c9ece22a91")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 9 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 0 the same month, 9 later) and 5 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
3 dated earlier, 11 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
3 dated earlier, 10 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
3 dated earlier, 7 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
6 dated earlier, 3 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
6 dated earlier, 3 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
2 dated earlier, 3 later
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
1906.05963 (2019-06)
Image Captioning: Transforming Objects into Words
2004.00390 (2020-04)
More Grounded Image Captioning by Distilling Image-Text Matching Model
and 2 more not named here
count_bad 4 other papers
1 dated earlier, 3 later
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
2002.12204 (2020-02)
Visual Commonsense R-CNN
2004.00390 (2020-04)
More Grounded Image Captioning by Distilling Image-Text Matching Model
and 1 more not named here
language_eval 3 other papers
1 dated earlier, 2 later
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
2002.12204 (2020-02)
Visual Commonsense R-CNN
aaai_29097 (2024 (year only))
Noise-Aware Image Captioning with Progressively Exploring Mismatched Words
array_to_str 2 other papers
2 later
1909.11059 (2019-09)
Unified Vision-Language Pre-Training for Image Captioning and VQA
2606.21447 (2026-06)
Precision Recall Controllable Radiology Report Generation via Hybrid Natural Language and Clinical Reward Learning

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

Attention mechanisms are widely used in current encoder/decoder frameworks of image captioning, where a weighted average on encoded vectors is generated at each time step to guide the caption decoding process. However, the decoder has little idea of whether or how well the attended vector and the given attention query are related, which could make the decoder give misled results. In this paper, we propose an Attention on Attention (AoA) module, which extends the conventional attention mechanisms to determine the relevance between attention results and queries. AoA first generates an information vector and an attention gate using the attention result and the current context, then adds another attention by applying element-wise multiplication to them and finally obtains the attended information, the expected useful knowledge. We apply AoA to both the encoder and the decoder of our image captioning model, which we name as AoA Network (AoANet). Experiments show that AoANet outperforms all previously published methods and achieves a new state-of-the-art performance of 129.8 CIDEr-D score on MS COCO Karpathy offline test split and 129.6 CIDEr-D (C40) score on the official online testing server. Code is available at https://github.com/husthuaan/AoANet.

For agents

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

get_harvested_code_for_paper("1908.06954")
get_code_for_paper("1908.06954")
have("1908.06954")

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

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

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

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

Connect an agent — have() is free.