{"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/magref-masked-guidance-for-any-reference","title":"MAGREF: Masked Guidance for Any-Reference Video Generation","arxiv_id":"2505.23742","date":"2025-05-29","proceeding":null,"authors":["Yufan Deng","Xun Guo","Yuanyang Yin","Jacob Zhiyuan Fang","Yiding Yang","Yizhi Wang","Shenghai Yuan","Angtian Wang","Bo Liu","Haibin Huang","Chongyang Ma"],"abstract":"Video generation has made substantial strides with the emergence of deep generative models, especially diffusion-based approaches. However, video generation based on multiple reference subjects still faces significant challenges in maintaining multi-subject consistency and ensuring high generation quality. In this paper, we propose MAGREF, a unified framework for any-reference video generation that introduces masked guidance to enable coherent multi-subject video synthesis conditioned on diverse reference images and a textual prompt. Specifically, we propose (1) a region-aware dynamic masking mechanism that enables a single model to flexibly handle various subject inference, including humans, objects, and backgrounds, without architectural changes, and (2) a pixel-wise channel concatenation mechanism that operates on the channel dimension to better preserve appearance features. Our model delivers state-of-the-art video generation quality, generalizing from single-subject training to complex multi-subject scenarios with coherent synthesis and precise control over individual subjects, outperforming existing open-source and commercial baselines. To facilitate evaluation, we also introduce a comprehensive multi-subject video benchmark. Extensive experiments demonstrate the effectiveness of our approach, paving the way for scalable, controllable, and high-fidelity multi-subject video synthesis. Code and model can be found at: https://github.com/MAGREF-Video/MAGREF","url_abs":"https://arxiv.org/abs/2505.23742v1","url_pdf":"https://arxiv.org/pdf/2505.23742v1.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":"magref-masked-guidance-for-any-reference","repo_url":"https://github.com/magref-video/magref","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"human-domain-subject-to-video","task_name":"Human-Domain Subject-to-Video"},{"task_slug":"open-domain-subject-to-video","task_name":"Open-Domain Subject-to-Video"},{"task_slug":"single-domain-subject-to-video","task_name":"Single-Domain Subject-to-Video"},{"task_slug":"video-generation","task_name":"Video Generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/open-domain-subject-to-video-on-opens2v-eval","task":"Open-Domain Subject-to-Video","dataset":"OpenS2V-Eval","model":"MAGREF-480P","rank_in_archive_order":7,"of":10,"metrics":{"Aesthetics":"0.4502","FaceSim":"0.3083","GmeScore":"0.7047","Motion":"0.2181","NaturalScore":"0.6949","NexusScore":"0.4304","Total Score":"0.4793","Venue":"Open-Source"},"uses_additional_data":false}],"syntology":{"syntology_url":"https://syntology.ai/paper/2505.23742","atlas_url":"https://app.syntology.ai/?focus=2505.23742","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2505.23742"}},"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/magref-video/magref","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_draft_wrong":3,"ran":2,"ran_violates":1,"ran_fixture":1,"unverified":7},"by_repo_kind":{"official":{"samples":14,"ran":7,"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":"98f385d847636a3e","entry":"basic_clean","repo":"magref-video/magref","repo_kind":"official","path":"magref/modules/tokenizers.py","file_url":"https://github.com/magref-video/magref/blob/HEAD/magref/modules/tokenizers.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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"98f385d847636a3e"}},{"code_sha256_prefix":"fc80adbc3ff1d836","entry":"pad_freqs","repo":"magref-video/magref","repo_kind":"official","path":"magref/distributed/xdit_context_parallel.py","file_url":"https://github.com/magref-video/magref/blob/HEAD/magref/distributed/xdit_context_parallel.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":"fc80adbc3ff1d836"}},{"code_sha256_prefix":"1d28c4a06c930d63","entry":"rope_apply","repo":"magref-video/magref","repo_kind":"official","path":"magref/modules/model.py","file_url":"https://github.com/magref-video/magref/blob/HEAD/magref/modules/model.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1d28c4a06c930d63"}},{"code_sha256_prefix":"dc160d63c5846f4a","entry":"rope_params","repo":"magref-video/magref","repo_kind":"official","path":"magref/modules/model.py","file_url":"https://github.com/magref-video/magref/blob/HEAD/magref/modules/model.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"dc160d63c5846f4a"}},{"code_sha256_prefix":"e34a97853e924d88","entry":"sinusoidal_embedding_1d","repo":"magref-video/magref","repo_kind":"official","path":"magref/modules/model.py","file_url":"https://github.com/magref-video/magref/blob/HEAD/magref/modules/model.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e34a97853e924d88"}},{"code_sha256_prefix":"9542161e9640b858","entry":"whitespace_clean","repo":"magref-video/magref","repo_kind":"official","path":"magref/modules/tokenizers.py","file_url":"https://github.com/magref-video/magref/blob/HEAD/magref/modules/tokenizers.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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"9542161e9640b858"}},{"code_sha256_prefix":"dd27a4bda5e8824c","entry":"xlm_roberta_large","repo":"magref-video/magref","repo_kind":"official","path":"magref/modules/xlm_roberta.py","file_url":"https://github.com/magref-video/magref/blob/HEAD/magref/modules/xlm_roberta.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"dd27a4bda5e8824c"}},{"code_sha256_prefix":"2659ec11ef2cea0d","entry":"attention","repo":"magref-video/magref","repo_kind":"official","path":"magref/modules/attention.py","file_url":"https://github.com/magref-video/magref/blob/HEAD/magref/modules/attention.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":"2659ec11ef2cea0d"}},{"code_sha256_prefix":"1066f2140d4e9845","entry":"canonicalize","repo":"magref-video/magref","repo_kind":"official","path":"magref/modules/tokenizers.py","file_url":"https://github.com/magref-video/magref/blob/HEAD/magref/modules/tokenizers.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":"1066f2140d4e9845"}},{"code_sha256_prefix":"78d2ce0959095290","entry":"count_conv3d","repo":"magref-video/magref","repo_kind":"official","path":"magref/modules/vae.py","file_url":"https://github.com/magref-video/magref/blob/HEAD/magref/modules/vae.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":"78d2ce0959095290"}},{"code_sha256_prefix":"7ea44a4680b76539","entry":"flash_attention","repo":"magref-video/magref","repo_kind":"official","path":"magref/modules/attention.py","file_url":"https://github.com/magref-video/magref/blob/HEAD/magref/modules/attention.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":"7ea44a4680b76539"}},{"code_sha256_prefix":"d3d53f877a9af3a3","entry":"fp16_clamp","repo":"magref-video/magref","repo_kind":"official","path":"magref/modules/t5.py","file_url":"https://github.com/magref-video/magref/blob/HEAD/magref/modules/t5.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":"d3d53f877a9af3a3"}},{"code_sha256_prefix":"cbc3565ced3e12b6","entry":"pos_interpolate","repo":"magref-video/magref","repo_kind":"official","path":"magref/modules/clip.py","file_url":"https://github.com/magref-video/magref/blob/HEAD/magref/modules/clip.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":"cbc3565ced3e12b6"}},{"code_sha256_prefix":"f0b4a00c14f06595","entry":"shard_model","repo":"magref-video/magref","repo_kind":"official","path":"magref/distributed/fsdp.py","file_url":"https://github.com/magref-video/magref/blob/HEAD/magref/distributed/fsdp.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":"f0b4a00c14f06595"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}