{"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/videorope-what-makes-for-good-video-rotary","title":"VideoRoPE: What Makes for Good Video Rotary Position Embedding?","arxiv_id":"2502.05173","date":"2025-02-07","proceeding":null,"authors":["Xilin Wei","Xiaoran Liu","Yuhang Zang","Xiaoyi Dong","Pan Zhang","Yuhang Cao","Jian Tong","Haodong Duan","Qipeng Guo","Jiaqi Wang","Xipeng Qiu","Dahua Lin"],"abstract":"While Rotary Position Embedding (RoPE) and its variants are widely adopted for their long-context capabilities, the extension of the 1D RoPE to video, with its complex spatio-temporal structure, remains an open challenge. This work first introduces a comprehensive analysis that identifies four key characteristics essential for the effective adaptation of RoPE to video, which have not been fully considered in prior work. As part of our analysis, we introduce a challenging V-NIAH-D (Visual Needle-In-A-Haystack with Distractors) task, which adds periodic distractors into V-NIAH. The V-NIAH-D task demonstrates that previous RoPE variants, lacking appropriate temporal dimension allocation, are easily misled by distractors. Based on our analysis, we introduce \\textbf{VideoRoPE}, with a \\textit{3D structure} designed to preserve spatio-temporal relationships. VideoRoPE features \\textit{low-frequency temporal allocation} to mitigate periodic oscillations, a \\textit{diagonal layout} to maintain spatial symmetry, and \\textit{adjustable temporal spacing} to decouple temporal and spatial indexing. VideoRoPE consistently surpasses previous RoPE variants, across diverse downstream tasks such as long video retrieval, video understanding, and video hallucination. Our code will be available at \\href{https://github.com/Wiselnn570/VideoRoPE}{https://github.com/Wiselnn570/VideoRoPE}.","url_abs":"https://arxiv.org/abs/2502.05173v1","url_pdf":"https://arxiv.org/pdf/2502.05173v1.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":"videorope-what-makes-for-good-video-rotary","repo_url":"https://github.com/wiselnn570/videorope","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"hallucination","task_name":"Hallucination"},{"task_slug":null,"task_name":"Position"},{"task_slug":"video-retrieval","task_name":"Video Retrieval"},{"task_slug":"video-understanding","task_name":"Video Understanding"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2502.05173","atlas_url":"https://app.syntology.ai/?focus=2502.05173","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2502.05173"}},"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/wiselnn570/videorope","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_fixture":1,"ran":10,"ran_honours":3,"ran_draft_wrong":2,"unverified":1},"by_repo_kind":{"official":{"samples":17,"ran":16,"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":"30d7eec482ebf6b1","entry":"repeat_kv","repo":"wiselnn570/videorope","repo_kind":"official","path":"videorope_plus/v_ruler/easy_context/modeling_qwen2.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/videorope_plus/v_ruler/easy_context/modeling_qwen2.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":2,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"30d7eec482ebf6b1"}},{"code_sha256_prefix":"2c362ca95cf34cdf","entry":"apply_m_modify_multimodal_rotary_pos_emb","repo":"wiselnn570/videorope","repo_kind":"official","path":"videorope-transformer/modeling_videorope.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/videorope-transformer/modeling_videorope.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":"2c362ca95cf34cdf"}},{"code_sha256_prefix":"5d81bffdb6022427","entry":"apply_rotary_pos_emb","repo":"wiselnn570/videorope","repo_kind":"official","path":"videorope_plus/v_ruler/easy_context/modeling_qwen2.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/videorope_plus/v_ruler/easy_context/modeling_qwen2.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":"5d81bffdb6022427"}},{"code_sha256_prefix":"6e45201fa27cb24a","entry":"ceil_by_factor","repo":"wiselnn570/videorope","repo_kind":"official","path":"videorope_plus/v_ruler/produce_haystack_embedding.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/videorope_plus/v_ruler/produce_haystack_embedding.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"6e45201fa27cb24a"}},{"code_sha256_prefix":"763b44466cc2146f","entry":"check_ans","repo":"wiselnn570/videorope","repo_kind":"official","path":"videorope_plus/v_ruler/eval/check_lengthy_multimodal_stack.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/videorope_plus/v_ruler/eval/check_lengthy_multimodal_stack.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":"763b44466cc2146f"}},{"code_sha256_prefix":"c35ff4a704e9ca5b","entry":"cross_ent_normal","repo":"wiselnn570/videorope","repo_kind":"official","path":"videorope_plus/v_ruler/easy_context/low_mem_cross_ent.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/videorope_plus/v_ruler/easy_context/low_mem_cross_ent.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":"c35ff4a704e9ca5b"}},{"code_sha256_prefix":"1b0cdd72d3d865a1","entry":"extract_characters_regex","repo":"wiselnn570/videorope","repo_kind":"official","path":"videorope_plus/v_ruler/eval/check_lengthy_multimodal_stack.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/videorope_plus/v_ruler/eval/check_lengthy_multimodal_stack.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":"1b0cdd72d3d865a1"}},{"code_sha256_prefix":"8155263d7ff19bb3","entry":"floor_by_factor","repo":"wiselnn570/videorope","repo_kind":"official","path":"videorope_plus/v_ruler/produce_haystack_embedding.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/videorope_plus/v_ruler/produce_haystack_embedding.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"8155263d7ff19bb3"}},{"code_sha256_prefix":"e32e49fba862aa72","entry":"get_chunk","repo":"wiselnn570/videorope","repo_kind":"official","path":"eval/model_longvideobench_qwen2_vl.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/eval/model_longvideobench_qwen2_vl.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":"e32e49fba862aa72"}},{"code_sha256_prefix":"b6f76fcc05062c30","entry":"get_chunk","repo":"wiselnn570/videorope","repo_kind":"official","path":"eval/model_videohallucer.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/eval/model_videohallucer.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":"b6f76fcc05062c30"}},{"code_sha256_prefix":"15f446d6c10dc173","entry":"read_jsonl","repo":"wiselnn570/videorope","repo_kind":"official","path":"eval/model_longvideobench_qwen2_vl.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/eval/model_longvideobench_qwen2_vl.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":"15f446d6c10dc173"}},{"code_sha256_prefix":"b99eea6376d1e212","entry":"rotate_half","repo":"wiselnn570/videorope","repo_kind":"official","path":"videorope-transformer/modeling_videorope.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/videorope-transformer/modeling_videorope.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b99eea6376d1e212"}},{"code_sha256_prefix":"e252767324188623","entry":"round_by_factor","repo":"wiselnn570/videorope","repo_kind":"official","path":"videorope_plus/v_ruler/produce_haystack_embedding.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/videorope_plus/v_ruler/produce_haystack_embedding.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e252767324188623"}},{"code_sha256_prefix":"8e9a7dcac92dd395","entry":"save_upload_json","repo":"wiselnn570/videorope","repo_kind":"official","path":"videorope_plus/v_ruler/eval/check_lengthy_multimodal_stack.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/videorope_plus/v_ruler/eval/check_lengthy_multimodal_stack.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":"8e9a7dcac92dd395"}},{"code_sha256_prefix":"076c252c52cbb161","entry":"split_list","repo":"wiselnn570/videorope","repo_kind":"official","path":"eval/model_longvideobench_qwen2_vl.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/eval/model_longvideobench_qwen2_vl.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"076c252c52cbb161"}},{"code_sha256_prefix":"6f1b3ba8631fba49","entry":"yarn_get_mscale","repo":"wiselnn570/videorope","repo_kind":"official","path":"videorope-vllm/rotary_embedding.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/videorope-vllm/rotary_embedding.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":"6f1b3ba8631fba49"}},{"code_sha256_prefix":"eb4d16c3bba7cff8","entry":"apply_multimodal_rotary_pos_emb","repo":"wiselnn570/videorope","repo_kind":"official","path":"videorope-transformer/modeling_videorope.py","file_url":"https://github.com/wiselnn570/videorope/blob/HEAD/videorope-transformer/modeling_videorope.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":"eb4d16c3bba7cff8"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}