Papers › Router-Tuning: A Simple and Effective Approach for Enabling Dynamic-Depth in Transformers

Router-Tuning: A Simple and Effective Approach for Enabling Dynamic-Depth in Transformers

17 Oct 2024arXiv:2410.13184archive 2025-07-28

Shwai He, Tao Ge, Guoheng Sun, Bowei Tian, Xiaoyang Wang, Ang Li, Dong Yu

Traditional transformer models often allocate a fixed amount of computational resources to every input token, leading to inefficient and unnecessary computation. To address this, the Mixture of Depths (MoD) was introduced to dynamically adjust the computational depth by skipping less important layers. Despite its promise, current MoD approaches remain under-explored and face two main challenges: (1) \textit{high training costs due to the need to train the entire model along with the routers that determine which layers to skip}, and (2) \textit{the risk of performance degradation when important layers are bypassed}. In response to the first issue, we propose Router-Tuning, a method that fine-tunes only the router on a small dataset, drastically reducing the computational overhead associated with full model training. For the second challenge, we propose MindSkip, which deploys \textit{Attention with Dynamic Depths}. This method preserves the model's performance while significantly enhancing computational and memory efficiency. Extensive experiments demonstrate that our approach delivers competitive results while dramatically improving the computation efficiency, e.g., 21% speedup and only a 0.2% performance drop. The code is released at \url{https://github.com/CASE-Lab-UMD/Router-Tuning}.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2410.13184")

Code

Syntology Ran 13 of 14 code samples harvested from 1 repository linked to this paper; 1 has no recorded run. Of those that ran: 2 ran · our draft was wrong; 11 ran with no contract checked.

By repository: official repository: 14 samples from 1 repository, 13 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

case-lab-umd/router-tuning officialmentioned in papermentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

14 samples harvested; 13 ran; 0 honoured the contract we drafted; 1 has no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · our draft was wrong
11ran
1unverified

Licence: 14 of the 14 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from case-lab-umd/router-tuning. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: 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. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

convert_to_type case-lab-umd/router-tuning/utils/cache.py official repository ran no licence file found · pointer only · 9a39a79cccd7fa9f · report
encode_with_messages_format case-lab-umd/router-tuning/entrypoints/finetune/finetune_router_tuning.py official repository ran · our draft was wrong no licence file found · pointer only · 1cb0eeb16cf04ee3 · report
encode_with_prompt_completion_format case-lab-umd/router-tuning/entrypoints/finetune/finetune_router_tuning.py official repository ran · our draft was wrong no licence file found · pointer only · 88b8bf1223d522a4 · report
find_factors_with_minimal_sum case-lab-umd/router-tuning/utils/algorithms.py official repository ran fingerprinted no licence file found · pointer only · 44817f3718b05bf8 · report
find_files case-lab-umd/router-tuning/utils/io.py official repository ran fingerprinted no licence file found · pointer only · b317237cdf13806f · report
get_demonstrations case-lab-umd/router-tuning/utils.py official repository ran no licence file found · pointer only · 7ffd1b8c6cf87361 · report
instagger_prompt case-lab-umd/router-tuning/utils/evaluation/prompts.py official repository ran fingerprinted no licence file found · pointer only · ebe6dd6a79dacbd5 · report
llama2_prompt case-lab-umd/router-tuning/utils/evaluation/prompts.py official repository ran fingerprinted no licence file found · pointer only · 8f2ead0d177cde5d · report
load_compressed_file_7z case-lab-umd/router-tuning/utils/io.py official repository ran no licence file found · pointer only · d080647f9e54b2b9 · report
load_compressed_file_gz case-lab-umd/router-tuning/utils/io.py official repository ran no licence file found · pointer only · 7127466930d8fc22 · report
load_data case-lab-umd/router-tuning/utils.py official repository ran no licence file found · pointer only · 41701d57e69b77ea · report
supports_router_tuning_patch case-lab-umd/router-tuning/utils/model/model_patch.py official repository ran no licence file found · pointer only · b174c668ab8e8ebc · report
vicuna_prompt case-lab-umd/router-tuning/utils/evaluation/prompts.py official repository ran fingerprinted no licence file found · pointer only · b9379d07b346863f · report
apply_router_tuning_patch case-lab-umd/router-tuning/utils/model/model_patch.py official repository unverified no licence file found · pointer only · a0357baa562f6a38 · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections