Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Kangaroo: Lossless Self-Speculative Decoding for Accelerating LLMs via Double Early Exiting

Kangaroo speeds up LLM decoding by drafting from the model's own shallow layers

  • Problem Speculative decoding needs a separate draft model, which is costly to train, and other self-drafting methods accept few tokens.
  • Method Kangaroo reuses the target's first few layers as a draft model instead of training a new one, adds a small adapter, and stops drafting when confidence drops.
  • Results Kangaroo averages 1.72× speedup on Vicuna-7B across Spec-Bench with tree decoding, compared to 1.63× for Medusa with tree.

Why drafting with a second model is costly

Autoregressive decoding of an LLM is limited mainly by memory traffic rather than arithmetic, so the hardware is underused while one token is produced. Speculative decoding exploits that slack: a cheap draft model proposes several tokens, and the big model checks them in one forward pass. The catch is the draft model itself, which is usually a separate network trained from scratch on a large corpus.

Self-drafting methods drop the separate network but bring their own trade-offs. Medusa adds heads on the last decoder layer, and REST retrieves draft tokens from a database. Lookahead reaches a higher token acceptance rate than Medusa on math, yet its drafting is slower, so its end-to-end speedup is slightly lower. Draft & Verify gets high acceptance by skipping layers of the target, but its small model is slow enough to erode the gain.

The authors ask whether a draft can come from the target's own shallow layers without a separate training run. They also ask whether drafting can stop early on hard tokens, so that the cost of drafting stays small.

Building the draft from shallow layers

Kangaroo takes the first l layers of the target LLM, written \(M_b[:l]\), and uses their hidden states as draft features. For a prefix \(x_t\), the shallow features are \(f_t = M_b[:l](x_t)\), with l chosen from 1 to L. Those early features do not match the representation of the final layer, and the adapter is there to close that gap.

The adapter takes \(f_t\), applies LayerNorm, runs multi-head attention, and adds the result back through a residual connection. The update is \(f'_t = f_t + \mathrm{MultiHead}(\mathrm{LayerNorm}(f_t))\), and the feed-forward network of a standard block is left out. The target's LM Head \(W\) stays frozen and maps the normalized adapter output to the draft distribution \(M_s(x \mid x_t)=\mathrm{Softmax}(W^\top \mathrm{LayerNorm}(f'_t))\).

With hidden size \(N=4096\), the adapter has \(4N^2+2N\) parameters, which the paper puts at 67.1M. That is about 11.3% of the parameters in Medusa's heads. Because the draft reuses the target's own layers and head, the design avoids training and deploying a separate draft model.

Verifying drafts in one parallel pass

While drafting, each proposed token also yields an early-exited feature, and those features are kept. They are stacked into one matrix \(f_{t:t+\gamma}\) of size \(N \times (\gamma+1)\), and the remaining layers \(M_b[l:]\) process that matrix together. So the verification cost is one pass over the upper part of the model, not one pass per drafted token.

The target's top-1 choices are compared with the drafted tokens, following the standard rule. The accepted length is the longest matching prefix plus one, so it ranges from 1 to \(\gamma+1\). Standard speculative decoding keeps the target's sampling distribution, and Kangaroo keeps this acceptance rule.

If every drafted token is accepted, the next round can start one token further along. The unit holding the last two features then saves one drafting pass, because that feature was already computed.

Training the adapter

Only the adapter's multi-head attention and two normalization layers are trained, while the target model and its LM Head stay fixed. The loss is cross-entropy in which the target's conditional distribution \(M_b(x \mid x_t)\) acts as a soft label for \(\log M_s(x \mid x_t)\), averaged over positions \(t\). Minimizing this loss pushes the draft distribution toward the target's distribution.

The adapter is trained for 10 epochs with AdamW on the ShareGPT dataset, following Medusa. For Vicuna-7B, training took around 24 hours on 8 NVIDIA V100 GPUs.

Stopping drafts on low confidence

Fixed-length drafting spends time on hard tokens and can miss easy ones, so Kangaroo stops once confidence drops. The stopping rule is \(\max_{x} M_s(x \mid x_t) \le \eta\), where \(\eta\) is a threshold, so drafting halts when the top-1 probability is at or below \(\eta\). The authors observe that accepted tokens tend to have high top-1 probability, while rejected tokens cluster at lower values.

They treat the top-1 probability as a reliable indicator of acceptance, which is an assumption their own threshold rests on.

In tree decoding, the big model verifies several paths at once, and the same confidence test is applied to each node. A child's confidence is the product of its own conditional probability and its parent's, with the root set to 1. At the first level the top-K tokens are kept, and deeper levels select the top-K from the K times K child candidates.

Expansion stops when the tree reaches a maximum size or when the highest score at a level falls below \(\eta\), and single-sequence decoding is the case K equals 1.

Speedup on Spec-Bench

The authors test Vicuna-7B and Vicuna-13B on the six Spec-Bench subtasks. Baselines are Lookahead, Medusa, REST and SpS, and SpS uses Vicuna-68M as its draft model. Results are reported as walltime speedup ratio and as Compression Rate.

For Vicuna-7B, Kangaroo with tree decoding averages 1.72×, compared to 1.63× for Medusa with tree. Without the tree, Kangaroo averages 1.50×, compared to 1.41× for Medusa without the tree.

On Vicuna-13B, Kangaroo with tree averages 1.65×, compared to 1.24× for Medusa with tree. Without the tree, Kangaroo averages 1.44×, compared to 1.34× for Medusa without the tree. The authors report about a 12% gain from tree over single-sequence decoding at both model sizes.

Single-sequence Kangaroo with 67M additional parameters is described as comparable to SpS. With tree verification, Kangaroo outperforms SpS on most datasets. Medusa-1 has 591M additional parameters, while the Kangaroo adapter has 67M.

Adapter design ablation

The authors vary the adapter architecture on Vicuna-7B and report average Spec-Bench speedup next to parameter counts. The feed-forward network makes up 67% of a transformer block's parameters, so it is the main part dropped in the Kangaroo design.

The authors read these rows as support for a lighter adapter at the tested sizes.

Exit depth and stopping threshold

A deeper exit gives a stronger draft but raises drafting latency, so the exit layer sets a trade-off. The authors set l to 2 for Vicuna-7B and to 3 for Vicuna-13B. They recommend an exit layer between one-sixteenth and one-tenth of the target depth N.

With the threshold at zero, the fixed-step strategy reaches the highest compression rate but a suboptimal walltime speedup. For single-sequence decoding the authors use γ equal to 6 and η equal to 0.6. Across architectures and subtasks, the top-1 confidence distributions point to a stable threshold between 0.6 and 0.8.

Sampling at non-zero temperature

Two confidence variants are compared: the original top-1 confidence and a top-1 computed from temperature-scaled logits.

At T equal to 0.2 with the original confidence, the average speedup is 1.48×, close to the 1.50× under greedy decoding. The adjusted confidence drops to 1.34× at the same temperature. The authors explain that the adjusted confidence tends to be overestimated when T is below 1, which makes early stopping harder to trigger. At T equal to 0.5 with the original confidence, the average is 1.43×.

Limitations

The authors say the effect of Kangaroo depends on the target model and the task, and a representation gap may persist in complex tasks. The main evaluation covers Vicuna-7B and Vicuna-13B on Spec-Bench, and Llama2-13B-Chat appears only in an appendix table.

The reported results have no error bars or significance tests. Without them, small gaps between methods can't be read as settled differences. The adapter training cost is reported for Vicuna-7B only.

Paper info

Authors
Liu, Fangcheng, Tang, Yehui, Liu, Zhenhua, Ni, Yunsheng, Tang, Duyu, Han, Kai, Wang, Yunhe
Venue
Advances in Neural Information Processing Systems · Published
First published
2024-12-16
Added
2026-11-25
DOI
10.52202/079017-0381
Original paper terms
Check in the original ↗
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Liu, Fangcheng, Tang, Yehui, Liu, Zhenhua, Ni, Yunsheng, Tang, Duyu, Han, Kai, Wang, Yunhe (2024). Kangaroo: Lossless Self-Speculative Decoding for Accelerating LLMs via Double Early Exiting. Advances in Neural Information Processing Systems. https://doi.org/10.52202/079017-0381

BibTeX
@article{fangcheng2024kangaroo,
  title = {{Kangaroo: Lossless Self-Speculative Decoding for Accelerating LLMs via Double Early Exiting}},
  author = {Liu, Fangcheng and Tang, Yehui and Liu, Zhenhua and Ni, Yunsheng and Tang, Duyu and Han, Kai and Wang, Yunhe},
  year = {2024},
  journal = {Advances in Neural Information Processing Systems},
  doi = {10.52202/079017-0381},
  url = {https://papers.nips.cc/paper_files/paper/2024/hash/16336d94a5ffca8de019087ab7fe403f-Abstract-Conference.html}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up