We lifted 13 functions out of this paper's own repositories and ran 10 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.
| Repository | Role | Ran |
|---|---|---|
| thu-nics/framefusion | canonical | 10 of 13 |
| Function | Status | Where it lives |
|---|---|---|
| repeat_kv | Ran | thu-nics/framefusion/framefusion/models/internvl/modeling_internlm2.py code served (permissive licence) · get_code("3c76e52815c5401d") |
| Qwen2DecoderLayer_merge_then_prune_by_cost_forward | Ran | thu-nics/framefusion/framefusion/models/qwen2/modeling_qwen2.py code served (permissive licence) · get_code("12a855af63d45bc2") |
| Qwen2VLDecoderLayer_fastv_forward | Ran | thu-nics/framefusion/framefusion/models/qwen2/modeling_qwen2_vl_baseline.py code served (permissive licence) · get_code("682eafc6f1711f42") |
| Qwen2VLDecoderLayer_merge_then_fastv_cost_given_forward | Ran | thu-nics/framefusion/framefusion/models/qwen2/modeling_qwen2_vl.py code served (permissive licence) · get_code("3153f92d89ff16c1") |
| Qwen2VLModel_merge_then_fastv_cost_given_forward | Ran | thu-nics/framefusion/framefusion/models/qwen2/modeling_qwen2_vl.py code served (permissive licence) · get_code("5661336a3d308111") |
| compute_density_overhead | Ran | thu-nics/framefusion/framefusion/models/qwen2/modeling_qwen2_baseline.py code served (permissive licence) · get_code("264c5b9a2f25be7e") |
| get_attr_by_name | Ran | thu-nics/framefusion/framefusion/utils.py code served (permissive licence) · get_code("ccac3bd0c453b847") |
| get_vllm_embedding | Ran | thu-nics/framefusion/framefusion/models/minicpmv/modeling_minicpmv.py code served (permissive licence) · get_code("6f3669639f7ffa02") |
| rotate_half | Ran | thu-nics/framefusion/framefusion/models/internvl/modeling_internlm2.py code served (permissive licence) · get_code("e03d53ba9d4f9ae5") |
| scaled_dot_product_attention | Ran | thu-nics/framefusion/framefusion/utils.py code served (permissive licence) · get_code("2e002934a51f4e51") |
| Qwen2VLModel_fastv_forward | Not yet run | thu-nics/framefusion/framefusion/models/qwen2/modeling_qwen2_vl_baseline.py code served (permissive licence) · get_code("18116389c0c9cc0c") |
| apply_rotary_pos_emb | Not yet run | thu-nics/framefusion/framefusion/models/internvl/modeling_internlm2.py code served (permissive licence) · get_code("c028aebfc37921e4") |
| generate | Not yet run | thu-nics/framefusion/framefusion/models/internvl/modeling_internvl_chat.py code served (permissive licence) · get_code("421deb414feba11c") |
Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.
The increasing demand to process long and high-resolution videos significantly burdens Large Vision-Language Models (LVLMs) due to the enormous number of visual tokens. Existing token reduction methods primarily prune tokens based on importance metrics, such as cumulative attention scores. However, even important tokens may exhibit high redundancy caused by similarity among adjacent video frames and repetitive visual elements. To address this limitation, we propose FrameFusion, a novel token reduction approach integrating similarity-based merging with importance-based pruning. We conduct a thorough study on token similarity characteristics, revealing three key insights: (1) spatially corresponding visual tokens between adjacent frames have higher cosine similarities compared to other token pairs; (2) high token similarities prominently decrease in deeper model layers; and (3) token similarity rankings are highly consistent across different layers. Guided by these observations, FrameFusion computes token similarities exclusively between corresponding visual tokens from adjacent frames, applies token merging at initial successive layers followed by pruning in deeper layers, and adopts a cascaded merging strategy to further enhance efficiency. We evaluate FrameFusion comprehensively across six diverse LVLMs, ranging from 2B to 72B parameters, using five video benchmarks encompassing video retrieval, question-answering, and spatial-temporal understanding tasks. Experiments show that FrameFusion reduces visual tokens by 70%, achieving 1.6-3.6x end-to-end speedups, with an average performance impact of less than 3%. Our code is available at: https://github.com/thu-nics/FrameFusion.
The same record, over MCP at https://syntology.ai/mcp:
get_harvested_code_for_paper("2501.01986")
get_code_for_paper("2501.01986")
have("2501.01986")
Connect an agent — have() is free.