SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2412.04449 · 2024

p-MoD: Building Mixture-of-Depths MLLMs via Progressive Ratio Decay

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 8 functions out of this paper's own repositories and ran 8 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.

RepositoryRoleRan
mcg-nju/p-mod canonical 8 of 8
FunctionStatusWhere it lives
collate_fn Ran mcg-nju/p-mod/llava/eval/model_vqa_loader.py
code served (permissive licence) · get_code("20e4f665698a3d18")
divide_to_patches Ran mcg-nju/p-mod/llava/mm_utils.py
code served (permissive licence) · get_code("7e03b180fa317c9a")
get_chunk Ran mcg-nju/p-mod/llava/eval/model_vqa.py
code served (permissive licence) · get_code("42a46570620cd9fa")
is_none Ran mcg-nju/p-mod/llava/eval/model_vqa_mmbench.py
code served (permissive licence) · get_code("bae18947b56f2be1")
resize_and_pad_image Ran mcg-nju/p-mod/llava/mm_utils.py
code served (permissive licence) · get_code("468eedeba67f1b00")
select_best_resolution Ran mcg-nju/p-mod/llava/mm_utils.py
code served (permissive licence) · get_code("3999ff487573f32c")
split_list Ran mcg-nju/p-mod/llava/eval/model_vqa.py
code served (permissive licence) · get_code("076c252c52cbb161")
unpad_image Ran mcg-nju/p-mod/llava/model/llava_arch.py
code served (permissive licence) · get_code("55c32993da87759b")

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Despite the remarkable performance of multimodal large language models (MLLMs) across diverse tasks, the substantial training and inference costs impede their advancement. In this paper, we propose p-MoD, an efficient MLLM architecture that significantly reduces training and inference costs while maintaining model performance. The majority of computation in MLLMs stems from the overwhelming volume of vision tokens processed by the transformer-based LLM. Accordingly, we leverage the Mixture-of-Depths (MoD) mechanism, where each LLM layer selects essential vision tokens to process while skipping redundant ones. However, integrating MoD into MLLMs is non-trivial. To address the challenges of training and inference stability as well as limited training data, we adapt the MoD module with two novel designs: tanh-gated weight normalization (TanhNorm) and symmetric token reweighting (STRing). Moreover, we observe that vision tokens exhibit higher redundancy in deeper layers and thus design a progressive ratio decay (PRD) strategy, which gradually reduces the token retention ratio layer by layer, employing a shifted cosine schedule. This crucial design fully unleashes the potential of MoD, significantly boosting the efficiency and performance of our models. Extensive experiments on two baseline models across 15 benchmarks show that our model matches or even surpasses the performance of corresponding baselines, while requiring only 55.6% TFLOPs and 53.7% KV cache storage during inference, and 77.7% GPU hours during training.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2412.04449")
get_code_for_paper("2412.04449")
have("2412.04449")

Connect an agent — have() is free.