{"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/scalable-autoregressive-image-generation-with","title":"Scalable Autoregressive Image Generation with Mamba","arxiv_id":"2408.12245","date":"2024-08-22","proceeding":null,"authors":["Haopeng Li","Jinyue Yang","Kexin Wang","Xuerui Qiu","Yuhong Chou","Xin Li","Guoqi Li"],"abstract":"We introduce AiM, an autoregressive (AR) image generative model based on Mamba architecture. AiM employs Mamba, a novel state-space model characterized by its exceptional performance for long-sequence modeling with linear time complexity, to supplant the commonly utilized Transformers in AR image generation models, aiming to achieve both superior generation quality and enhanced inference speed. Unlike existing methods that adapt Mamba to handle two-dimensional signals via multi-directional scan, AiM directly utilizes the next-token prediction paradigm for autoregressive image generation. This approach circumvents the need for extensive modifications to enable Mamba to learn 2D spatial representations. By implementing straightforward yet strategically targeted modifications for visual generative tasks, we preserve Mamba's core structure, fully exploiting its efficient long-sequence modeling capabilities and scalability. We provide AiM models in various scales, with parameter counts ranging from 148M to 1.3B. On the ImageNet1K 256*256 benchmark, our best AiM model achieves a FID of 2.21, surpassing all existing AR models of comparable parameter counts and demonstrating significant competitiveness against diffusion models, with 2 to 10 times faster inference speed. Code is available at https://github.com/hp-l33/AiM","url_abs":"https://arxiv.org/abs/2408.12245v3","url_pdf":"https://arxiv.org/pdf/2408.12245v3.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":"scalable-autoregressive-image-generation-with","repo_url":"https://github.com/hp-l33/aim","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"mamba","task_name":"Mamba"}],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"},{"method_slug":"mamba","method_name":"Mamba"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2408.12245","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2408.12245"}},"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/hp-l33/aim","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":4,"ran":4,"ran_fixture":1,"unverified":4},"by_repo_kind":{"official":{"samples":13,"ran":9,"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":"01b5cf639b6bac89","entry":"Normalize","repo":"hp-l33/aim","repo_kind":"official","path":"models/stage1/vq_model.py","file_url":"https://github.com/hp-l33/aim/blob/HEAD/models/stage1/vq_model.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":"01b5cf639b6bac89"}},{"code_sha256_prefix":"4ef4ba3561e3efa7","entry":"collate_fn","repo":"hp-l33/aim","repo_kind":"official","path":"trainer.py","file_url":"https://github.com/hp-l33/aim/blob/HEAD/trainer.py","link_basis":"first_harvest_node","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":"4ef4ba3561e3efa7"}},{"code_sha256_prefix":"774c95b77d7621f3","entry":"compute_entropy_loss","repo":"hp-l33/aim","repo_kind":"official","path":"models/stage1/vq_model.py","file_url":"https://github.com/hp-l33/aim/blob/HEAD/models/stage1/vq_model.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"774c95b77d7621f3"}},{"code_sha256_prefix":"9206a5875c1b30e9","entry":"get_checkpoint_path","repo":"hp-l33/aim","repo_kind":"official","path":"util/helper.py","file_url":"https://github.com/hp-l33/aim/blob/HEAD/util/helper.py","link_basis":"first_harvest_node","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":"9206a5875c1b30e9"}},{"code_sha256_prefix":"221b2d116fdf1032","entry":"get_obj_from_str","repo":"hp-l33/aim","repo_kind":"official","path":"util/helper.py","file_url":"https://github.com/hp-l33/aim/blob/HEAD/util/helper.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":"221b2d116fdf1032"}},{"code_sha256_prefix":"03310bba324ae4fb","entry":"modulate","repo":"hp-l33/aim","repo_kind":"official","path":"models/stage2/block.py","file_url":"https://github.com/hp-l33/aim/blob/HEAD/models/stage2/block.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"03310bba324ae4fb"}},{"code_sha256_prefix":"3137073275f8c21a","entry":"nonlinearity","repo":"hp-l33/aim","repo_kind":"official","path":"models/stage1/vq_model.py","file_url":"https://github.com/hp-l33/aim/blob/HEAD/models/stage1/vq_model.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3137073275f8c21a"}},{"code_sha256_prefix":"68729b3b14f1970a","entry":"pil_loader","repo":"hp-l33/aim","repo_kind":"official","path":"util/data.py","file_url":"https://github.com/hp-l33/aim/blob/HEAD/util/data.py","link_basis":"first_harvest_node","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":"68729b3b14f1970a"}},{"code_sha256_prefix":"d856f17cd1fdf61e","entry":"sample","repo":"hp-l33/aim","repo_kind":"official","path":"models/stage2/generation.py","file_url":"https://github.com/hp-l33/aim/blob/HEAD/models/stage2/generation.py","link_basis":"first_harvest_node","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":"d856f17cd1fdf61e"}},{"code_sha256_prefix":"bd88744ce2657bd9","entry":"create_training_arguments","repo":"hp-l33/aim","repo_kind":"official","path":"train_stage2.py","file_url":"https://github.com/hp-l33/aim/blob/HEAD/train_stage2.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":"bd88744ce2657bd9"}},{"code_sha256_prefix":"09c473eb11e68418","entry":"decode","repo":"hp-l33/aim","repo_kind":"official","path":"models/stage2/generation.py","file_url":"https://github.com/hp-l33/aim/blob/HEAD/models/stage2/generation.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":"09c473eb11e68418"}},{"code_sha256_prefix":"f0ac78b4e05be194","entry":"instantiate_from_config","repo":"hp-l33/aim","repo_kind":"official","path":"util/helper.py","file_url":"https://github.com/hp-l33/aim/blob/HEAD/util/helper.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":"f0ac78b4e05be194"}},{"code_sha256_prefix":"da95e9a7906f3d52","entry":"modify_logit_for_repetition_penalty","repo":"hp-l33/aim","repo_kind":"official","path":"models/stage2/generation.py","file_url":"https://github.com/hp-l33/aim/blob/HEAD/models/stage2/generation.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":"da95e9a7906f3d52"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}