{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/m2-meshed-memory-transformer-for-image","title":"Meshed-Memory Transformer for Image Captioning","arxiv_id":"1912.08226","date":"2019-12-17","proceeding":"CVPR 2020 6","authors":["Marcella Cornia","Matteo Stefanini","Lorenzo Baraldi","Rita Cucchiara"],"abstract":"Transformer-based architectures represent the state of the art in sequence modeling tasks like machine translation and language understanding. Their applicability to multi-modal contexts like image captioning, however, is still largely under-explored. With the aim of filling this gap, we present M$^2$ - a Meshed Transformer with Memory for Image Captioning. The architecture improves both the image encoding and the language generation steps: it learns a multi-level representation of the relationships between image regions integrating learned a priori knowledge, and uses a mesh-like connectivity at decoding stage to exploit low- and high-level features. Experimentally, we investigate the performance of the M$^2$ Transformer and different fully-attentive models in comparison with recurrent ones. When tested on COCO, our proposal achieves a new state of the art in single-model and ensemble configurations on the \"Karpathy\" test split and on the online test server. We also assess its performances when describing objects unseen in the training set. Trained models and code for reproducing the experiments are publicly available at: https://github.com/aimagelab/meshed-memory-transformer.","url_abs":"https://arxiv.org/abs/1912.08226v2","url_pdf":"https://arxiv.org/pdf/1912.08226v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"m2-meshed-memory-transformer-for-image","repo_url":"https://github.com/aimagelab/meshed-memory-transformer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"m2-meshed-memory-transformer-for-image","repo_url":"https://github.com/Japanese-Image-Captioning/M2-transformer-for-Japanese","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}}],"tasks":[{"task_slug":"image-captioning","task_name":"Image Captioning"},{"task_slug":"machine-translation","task_name":"Machine Translation"},{"task_slug":"text-generation","task_name":"Text Generation"},{"task_slug":"translation","task_name":"Translation"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"relu","method_name":"ReLU"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"test","method_name":"Test"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/image-captioning-on-coco","task":"Image Captioning","dataset":"COCO (Common Objects in Context)","model":"M2 Transformer","rank_in_archive_order":2,"of":17,"metrics":{"CIDEr":"131.2"},"uses_additional_data":false},{"leaderboard":"/sota/image-captioning-on-coco-captions","task":"Image Captioning","dataset":"COCO Captions","model":"Meshed-Memory Transformer","rank_in_archive_order":25,"of":41,"metrics":{"BLEU-1":"80.8","BLEU-4":"39.1","CIDER":"131.2","METEOR":"29.2","ROUGE-L":"58.6","SPICE":"22.6"},"uses_additional_data":false}],"syntology":{"syntology_url":"https://syntology.ai/paper/1912.08226","atlas_url":"https://app.syntology.ai/?focus=1912.08226","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1912.08226"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Japanese-Image-Captioning/M2-transformer-for-Japanese","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/aimagelab/meshed-memory-transformer","reach":{"status":"ok","spdx":"BSD-3-Clause"}}],"summary":{"ran":2,"ran_fixture":1,"ran_draft_wrong":1,"ran_honours":1,"unverified":3},"by_repo_kind":{"official":{"samples":8,"ran":5,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"f5741ff28f6cb706","entry":"cook_test","repo":"aimagelab/meshed-memory-transformer","repo_kind":"official","path":"evaluation/bleu/bleu_scorer.py","file_url":"https://github.com/aimagelab/meshed-memory-transformer/blob/HEAD/evaluation/bleu/bleu_scorer.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"f5741ff28f6cb706"}},{"code_sha256_prefix":"7cb89de9e327ddab","entry":"cook_test","repo":"aimagelab/meshed-memory-transformer","repo_kind":"official","path":"evaluation/cider/cider_scorer.py","file_url":"https://github.com/aimagelab/meshed-memory-transformer/blob/HEAD/evaluation/cider/cider_scorer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"7cb89de9e327ddab"}},{"code_sha256_prefix":"e344c95038ed76fd","entry":"position_embedding","repo":"aimagelab/meshed-memory-transformer","repo_kind":"official","path":"models/transformer/utils.py","file_url":"https://github.com/aimagelab/meshed-memory-transformer/blob/HEAD/models/transformer/utils.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"e344c95038ed76fd"}},{"code_sha256_prefix":"ec4448373d72d636","entry":"precook","repo":"aimagelab/meshed-memory-transformer","repo_kind":"official","path":"evaluation/bleu/bleu_scorer.py","file_url":"https://github.com/aimagelab/meshed-memory-transformer/blob/HEAD/evaluation/bleu/bleu_scorer.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"ec4448373d72d636"}},{"code_sha256_prefix":"35fbc756acf92321","entry":"sinusoid_encoding_table","repo":"aimagelab/meshed-memory-transformer","repo_kind":"official","path":"models/transformer/utils.py","file_url":"https://github.com/aimagelab/meshed-memory-transformer/blob/HEAD/models/transformer/utils.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"35fbc756acf92321"}},{"code_sha256_prefix":"7586e1d32f7325f7","entry":"cook_refs","repo":"aimagelab/meshed-memory-transformer","repo_kind":"official","path":"evaluation/bleu/bleu_scorer.py","file_url":"https://github.com/aimagelab/meshed-memory-transformer/blob/HEAD/evaluation/bleu/bleu_scorer.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"7586e1d32f7325f7"}},{"code_sha256_prefix":"26e17b0aeb64b34c","entry":"cook_refs","repo":"aimagelab/meshed-memory-transformer","repo_kind":"official","path":"evaluation/cider/cider_scorer.py","file_url":"https://github.com/aimagelab/meshed-memory-transformer/blob/HEAD/evaluation/cider/cider_scorer.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"26e17b0aeb64b34c"}},{"code_sha256_prefix":"ca007f4b8a45fbdc","entry":"precook","repo":"aimagelab/meshed-memory-transformer","repo_kind":"official","path":"evaluation/cider/cider_scorer.py","file_url":"https://github.com/aimagelab/meshed-memory-transformer/blob/HEAD/evaluation/cider/cider_scorer.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"ca007f4b8a45fbdc"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}