{"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/vector-quantized-image-modeling-with-improved-1","title":"Vector-quantized Image Modeling with Improved VQGAN","arxiv_id":"2110.04627","date":"2021-10-09","proceeding":"ICLR 2022 4","authors":["Jiahui Yu","Xin Li","Jing Yu Koh","Han Zhang","Ruoming Pang","James Qin","Alexander Ku","Yuanzhong Xu","Jason Baldridge","Yonghui Wu"],"abstract":"Pretraining language models with next-token prediction on massive text corpora has delivered phenomenal zero-shot, few-shot, transfer learning and multi-tasking capabilities on both generative and discriminative language tasks. Motivated by this success, we explore a Vector-quantized Image Modeling (VIM) approach that involves pretraining a Transformer to predict rasterized image tokens autoregressively. The discrete image tokens are encoded from a learned Vision-Transformer-based VQGAN (ViT-VQGAN). We first propose multiple improvements over vanilla VQGAN from architecture to codebook learning, yielding better efficiency and reconstruction fidelity. The improved ViT-VQGAN further improves vector-quantized image modeling tasks, including unconditional, class-conditioned image generation and unsupervised representation learning. When trained on ImageNet at \\(256\\times256\\) resolution, we achieve Inception Score (IS) of 175.1 and Fr'echet Inception Distance (FID) of 4.17, a dramatic improvement over the vanilla VQGAN, which obtains 70.6 and 17.04 for IS and FID, respectively. Based on ViT-VQGAN and unsupervised pretraining, we further evaluate the pretrained Transformer by averaging intermediate features, similar to Image GPT (iGPT). This ImageNet-pretrained VIM-L significantly beats iGPT-L on linear-probe accuracy from 60.3% to 73.2% for a similar model size. VIM-L also outperforms iGPT-XL which is trained with extra web image data and larger model size.","url_abs":"https://arxiv.org/abs/2110.04627v3","url_pdf":"https://arxiv.org/pdf/2110.04627v3.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":"vector-quantized-image-modeling-with-improved-1","repo_url":"https://github.com/ai-forever/movqgan","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"vector-quantized-image-modeling-with-improved-1","repo_url":"https://github.com/lucidrains/DALLE2-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"vector-quantized-image-modeling-with-improved-1","repo_url":"https://github.com/thuangb/enhancing-transformers","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"vector-quantized-image-modeling-with-improved-1","repo_url":"https://github.com/thuanz123/enhancing-transformers","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"vector-quantized-image-modeling-with-improved-1","repo_url":"https://github.com/CuddleSabe/VQGAN","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"image-reconstruction","task_name":"Image Reconstruction"},{"task_slug":"representation-learning","task_name":"Representation Learning"},{"task_slug":"transfer-learning","task_name":"Transfer Learning"}],"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":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"cosine-annealing","method_name":"Cosine Annealing"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"discriminative-fine-tuning","method_name":"Discriminative Fine-Tuning"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"gpt","method_name":"GPT"},{"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":"linear-warmup-with-cosine-annealing","method_name":"Linear Warmup With Cosine Annealing"},{"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":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"},{"method_slug":"weight-decay","method_name":"Weight Decay"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/image-reconstruction-on-imagenet","task":"Image Reconstruction","dataset":"ImageNet","model":"ViT-VQGAN (16x16)","rank_in_archive_order":9,"of":15,"metrics":{"FID":"1.28"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2110.04627","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2110.04627"}},"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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ai-forever/movqgan","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/CuddleSabe/VQGAN","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/thuangb/enhancing-transformers","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lucidrains/DALLE2-pytorch","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/thuanz123/enhancing-transformers","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":1,"ran":2,"unverified":6},"by_repo_kind":{"listed":{"samples":9,"ran":3,"repositories":2}},"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":"8b0e794d4d8f9b13","entry":"default_conv","repo":"CuddleSabe/VQGAN","repo_kind":"listed","path":"VQGAN/archs/common.py","file_url":"https://github.com/CuddleSabe/VQGAN/blob/HEAD/VQGAN/archs/common.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8b0e794d4d8f9b13"}},{"code_sha256_prefix":"cd569444547de84f","entry":"get_position_from_periods","repo":"CuddleSabe/VQGAN","repo_kind":"listed","path":"VQGAN/models/lr_scheduler.py","file_url":"https://github.com/CuddleSabe/VQGAN/blob/HEAD/VQGAN/models/lr_scheduler.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cd569444547de84f"}},{"code_sha256_prefix":"f6b0e1eb5b7df3e3","entry":"master_only","repo":"CuddleSabe/VQGAN","repo_kind":"listed","path":"VQGAN/utils/dist_util.py","file_url":"https://github.com/CuddleSabe/VQGAN/blob/HEAD/VQGAN/utils/dist_util.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f6b0e1eb5b7df3e3"}},{"code_sha256_prefix":"76042afc43214587","entry":"conv2d","repo":"thuangb/enhancing-transformers","repo_kind":"listed","path":"enhancing/losses/op/conv2d_gradfix.py","file_url":"https://github.com/thuangb/enhancing-transformers/blob/HEAD/enhancing/losses/op/conv2d_gradfix.py","link_basis":"harvester_set","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":"76042afc43214587"}},{"code_sha256_prefix":"5f98b4db51504bf7","entry":"conv_transpose2d","repo":"thuangb/enhancing-transformers","repo_kind":"listed","path":"enhancing/losses/op/conv2d_gradfix.py","file_url":"https://github.com/thuangb/enhancing-transformers/blob/HEAD/enhancing/losses/op/conv2d_gradfix.py","link_basis":"harvester_set","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":"5f98b4db51504bf7"}},{"code_sha256_prefix":"ce977f8c2571b94b","entry":"could_use_op","repo":"thuangb/enhancing-transformers","repo_kind":"listed","path":"enhancing/losses/op/conv2d_gradfix.py","file_url":"https://github.com/thuangb/enhancing-transformers/blob/HEAD/enhancing/losses/op/conv2d_gradfix.py","link_basis":"harvester_set","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":"ce977f8c2571b94b"}},{"code_sha256_prefix":"e3931d2003beff13","entry":"hinge_d_loss","repo":"thuangb/enhancing-transformers","repo_kind":"listed","path":"enhancing/losses/layers.py","file_url":"https://github.com/thuangb/enhancing-transformers/blob/HEAD/enhancing/losses/layers.py","link_basis":"harvester_set","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":"e3931d2003beff13"}},{"code_sha256_prefix":"50984532271d504f","entry":"least_square_d_loss","repo":"thuangb/enhancing-transformers","repo_kind":"listed","path":"enhancing/losses/layers.py","file_url":"https://github.com/thuangb/enhancing-transformers/blob/HEAD/enhancing/losses/layers.py","link_basis":"harvester_set","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":"50984532271d504f"}},{"code_sha256_prefix":"1c3cd7aa5e8128bd","entry":"vanilla_d_loss","repo":"thuangb/enhancing-transformers","repo_kind":"listed","path":"enhancing/losses/layers.py","file_url":"https://github.com/thuangb/enhancing-transformers/blob/HEAD/enhancing/losses/layers.py","link_basis":"harvester_set","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":"1c3cd7aa5e8128bd"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}