{"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/grounding-language-models-to-images-for","title":"Grounding Language Models to Images for Multimodal Inputs and Outputs","arxiv_id":"2301.13823","date":"2023-01-31","proceeding":null,"authors":["Jing Yu Koh","Ruslan Salakhutdinov","Daniel Fried"],"abstract":"We propose an efficient method to ground pretrained text-only language models to the visual domain, enabling them to process arbitrarily interleaved image-and-text data, and generate text interleaved with retrieved images. Our method leverages the abilities of language models learnt from large scale text-only pretraining, such as in-context learning and free-form text generation. We keep the language model frozen, and finetune input and output linear layers to enable cross-modality interactions. This allows our model to process arbitrarily interleaved image-and-text inputs, and generate free-form text interleaved with retrieved images. We achieve strong zero-shot performance on grounded tasks such as contextual image retrieval and multimodal dialogue, and showcase compelling interactive abilities. Our approach works with any off-the-shelf language model and paves the way towards an effective, general solution for leveraging pretrained language models in visually grounded settings.","url_abs":"https://arxiv.org/abs/2301.13823v4","url_pdf":"https://arxiv.org/pdf/2301.13823v4.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":"grounding-language-models-to-images-for","repo_url":"https://github.com/kohjingyu/fromage","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"grounding-language-models-to-images-for","repo_url":"https://github.com/albertotestoni/ndq_visual_objects","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"image-retrieval","task_name":"Image Retrieval"},{"task_slug":"in-context-learning","task_name":"In-Context Learning"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"text-generation","task_name":"Text Generation"},{"task_slug":"multimodal-generation","task_name":"multimodal generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2301.13823","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2301.13823"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+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":"deterministic:regex_extraction","url":"https://github.com/kohjingyu/fromage","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/albertotestoni/ndq_visual_objects","reach":null}],"summary":{"ran":1,"ran_draft_wrong":1,"unverified":6},"by_repo_kind":{"official":{"samples":6,"ran":2,"repositories":1},"listed":{"samples":2,"ran":0,"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":"12c09a1a10ca585d","entry":"collate_fn","repo":"kohjingyu/fromage","repo_kind":"official","path":"fromage/data.py","file_url":"https://github.com/kohjingyu/fromage/blob/HEAD/fromage/data.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"12c09a1a10ca585d"}},{"code_sha256_prefix":"83ada93fd84968cc","entry":"contrastive_loss","repo":"kohjingyu/fromage","repo_kind":"official","path":"fromage/losses.py","file_url":"https://github.com/kohjingyu/fromage/blob/HEAD/fromage/losses.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"83ada93fd84968cc"}},{"code_sha256_prefix":"89078d34c804bdb7","entry":"FromageModel","repo":"albertotestoni/ndq_visual_objects","repo_kind":"listed","path":"fromage/fromage/models.py","file_url":"https://github.com/albertotestoni/ndq_visual_objects/blob/HEAD/fromage/fromage/models.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"89078d34c804bdb7"}},{"code_sha256_prefix":"6d795e2eab6b7b69","entry":"FrozenArgs","repo":"albertotestoni/ndq_visual_objects","repo_kind":"listed","path":"fromage/fromage/models.py","file_url":"https://github.com/albertotestoni/ndq_visual_objects/blob/HEAD/fromage/fromage/models.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6d795e2eab6b7b69"}},{"code_sha256_prefix":"9fbf7d0daff2eccf","entry":"get_image_from_url","repo":"kohjingyu/fromage","repo_kind":"official","path":"fromage/utils.py","file_url":"https://github.com/kohjingyu/fromage/blob/HEAD/fromage/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"9fbf7d0daff2eccf"}},{"code_sha256_prefix":"a584078acaadacc6","entry":"pad_to_size","repo":"kohjingyu/fromage","repo_kind":"official","path":"fromage/utils.py","file_url":"https://github.com/kohjingyu/fromage/blob/HEAD/fromage/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a584078acaadacc6"}},{"code_sha256_prefix":"a2edc415218fdd3f","entry":"scores_to_ranks","repo":"kohjingyu/fromage","repo_kind":"official","path":"evals/eval_visdial_generation.py","file_url":"https://github.com/kohjingyu/fromage/blob/HEAD/evals/eval_visdial_generation.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a2edc415218fdd3f"}},{"code_sha256_prefix":"43921a5397c18717","entry":"truncate_caption","repo":"kohjingyu/fromage","repo_kind":"official","path":"fromage/utils.py","file_url":"https://github.com/kohjingyu/fromage/blob/HEAD/fromage/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"43921a5397c18717"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}