Wenjie Li, Cunxiao Du, Heming Xia, Jun Zhang, Yongqi Li
We lifted 3 functions out of this paper's own repositories and ran 2 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 |
|---|---|---|
| hemingkx/swift | canonical | 1 of 1 |
| hemingkx/SWIFT | — | 1 of 2 |
| Function | Status | Where it lives |
|---|---|---|
| bitfit_linear_forward | Ran | hemingkx/swift/model/swift/modeling_llama.py code served (permissive licence) · get_code("83928773e04983e7") |
| initialize_past_key_values | Ran | hemingkx/SWIFT/evaluation_llama/inference_swift.py code served (permissive licence) · get_code("aadc9c83d7ec2701") |
| swift_forward | Not yet run | hemingkx/SWIFT/evaluation_llama/inference_swift.py code served (permissive licence) · get_code("5663f83ddb69c3a6") |
Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.
Speculative decoding (SD) has emerged as a widely used paradigm to accelerate LLM inference without compromising quality. It works by first employing a compact model to draft multiple tokens efficiently and then using the target LLM to verify them in parallel. While this technique has achieved notable speedups, most existing approaches necessitate either additional parameters or extensive training to construct effective draft models, thereby restricting their applicability across different LLMs and tasks. To address this limitation, we explore a novel plugand-play SD solution with layer-skipping, which skips intermediate layers of the target LLM as the compact draft model. Our analysis reveals that LLMs exhibit great potential for self-acceleration through layer sparsity and the task-specific nature of this sparsity. Building on these insights, we introduce SWIFT, an on-the-fly self-speculative decoding algorithm that adaptively selects intermediate layers of LLMs to skip during inference. SWIFT does not require auxiliary models or additional training, making it a plug-and-play solution for accelerating LLM inference across diverse input data streams. Our extensive experiments across a wide range of models and downstream tasks demonstrate that SWIFT can achieve over a 1.3×∼1.6× speedup while preserving the original distribution of the generated text. We release our code in https://github.com/hemingkx/SWIFT.
The same record, over MCP at https://syntology.ai/mcp:
get_harvested_code_for_paper("2410.06916")
get_code_for_paper("2410.06916")
have("2410.06916")
Connect an agent — have() is free.