Optimized Multi-Token Joint Decoding With Auxiliary Model for LLM Inference

## Abstract

Abstract Large language models (LLMs) have achieved remarkable success across diverse tasks, yet their inference processes are hindered by substantial time and energy demands due to single-token generation at each decoding step. While previous methods such as speculative decoding mitigate these inefficiencies by producing multiple tokens per step, each token is still generated by its single-token distribution, thereby enhancing speed without improving output quality. In contrast, our work simultaneously enhances inference speed and improves the output effectiveness. We consider multi-token joint decoding (MTJD), which generates multiple tokens from their joint distribution at each iteration, theoretically reducing perplexity and enhancing task performance. However, MTJD suffers from the high cost of sampling from the joint distribution of multiple tokens. Inspired by speculative decoding, we introduce multi-token assisted decoding (MTAD), a novel framework designed to accelerate MTJD. MTAD leverages a smaller auxiliary model to approximate the joint distribution of a larger model, incorporating a verification mechanism that not only ensures the accuracy of this approximation, but also improves the decoding efficiency over conventional speculative decoding.
Theoretically, we demonstrate that MTAD closely approximates exact MTJD with bounded error. Empirical evaluations using Llama-2 and OPT models ranging from 13B to 70B parameters across various tasks reveal that MTAD reduces perplexity by 21.2% and improves downstream performance compared to standard single-token sampling. Furthermore, MTAD achieves a 1.42 × \times × speed-up and consumes 1.54 × \times × less energy than conventional speculative decoding methods. These results highlight MTAD’s ability to make multi-token joint decoding both effective and efficient, promoting more sustainable and high-performance deployment of LLMs.

## 1 Introduction

Large Language Models (LLMs) such as GPT-4 and Llama-2 (Touvron et al., ) have demonstrated extraordinary capabilities across a wide range of tasks (Brown et al., ; Chowdhery et al., ; Thoppilan et al., ; Touvron et al., ). Despite their impressive performance, the deployment of LLMs is often constrained by substantial inference costs in terms of time and energy. This inefficiency primarily stems from the autoregressive nature of these models, where generating a sequence of $K$ tokens requires $K$ separate model calls. Each call involves loading large weight matrices and intermediate results from GPU global memory to computing units, leading to repeated memory accesses and limited hardware utilization (Samsi et al., ; Leviathan et al., ).

To tackle this challenge, researchers have delved into non-autoregressive decoding approaches. Early methods (Ghazvininejad et al., ; Gu et al., ; Guo et al., ) aimed at reducing inference latency by concurrently generating multiple tokens. But these methods usually require task-dependent techniques and information to match the performance of autoregressive decoding (Kim et al., ; Xiao et al., ).
More recently, speculative decoding has emerged (Leviathan et al., ; Chen et al., ; Kim et al., ; Sun et al., ), exploiting the observation that most of the small model’s prediction aligns well with that of a large model.
It leverages a smaller auxiliary model to draft a few future tokens autoregressively, which are subsequently validated in parallel by the larger model. As the smaller model operates significantly faster and parallel token verification incurs a similar time cost as generating a single token, speculative decoding achieves an overall speed-up of $1$-$2\times$.
Despite gains in speed, these methods still generate each token based on its single-token probability. Consequently, it does not enhance the effectiveness of the generated sequences.

In this work, we aim to go beyond the conventional trade-off between efficiency and effectiveness by introducing multi-token joint decoding (MTJD). Unlike traditional approaches, MTJD produces multiple tokens from their joint distribution at each decoding step. Theoretically, we show this joint generation can lead to lower perplexity and hence improved task performance. However, directly sampling from the joint distribution of multiple tokens poses significant computational challenges, rendering MTJD impractical.

Inspired by speculative decoding, we propose multi-token assisted decoding (MTAD), a novel framework designed to approximate and accelerate MTJD. MTAD employs a smaller auxiliary model to estimate the joint distribution of a larger model, significantly reducing computational demands. To ensure the accuracy of this approximation, MTAD incorporates a verification mechanism that not only guarantees the accuracy of the draft tokens but also enhances efficiency beyond conventional speculative decoding by maximizing the number of accepted tokens per iteration.
We provide both theoretical and empirical analyses to demonstrate that MTAD improves perplexity and downstream performance. Meanwhile, it achieves significant reductions in energy and time usage compared to existing decoding strategies.

Our contributions are as follows:

- 1.
We introduce multi-token joint decoding (MTJD), a multi-token joint decoding approach that theoretically reduces perplexity by generating tokens from their joint distribution.
- 2.
We develop multi-token assisted decoding (MTAD), an efficient approximation of MTJD with bounded error that leverages a smaller model for distribution approximation.
- 3.
We analyze the energy consumption of LLM inference. To our knowledge, we are the first to give theoretical and empirical evidence that, despite that MTAD and other speculative decoding algorithms increase the number of FLOPs needed during LLM inference, they reduce the overall energy consumption by reducing the overhead induced by accessing GPU global memory.
- 4.
We conducted comprehensive evaluations with Llama-2 and OPT models (ranging from 13B to 70B parameters) across various tasks, demonstrating that MTAD enhances perplexity by 21.2% and improves downstream effectiveness compared to standard single-token sampling, while also achieving a 1.42$\times$ speed-up and reducing energy consumption by 1.54$\times$ compared to conventional speculative decoding methods.

These advancements position MTAD as a robust solution for making multi-token joint decoding both effective and efficient, thereby facilitating more sustainable and high-performance deployment of large-scale language models. Our code is publicly available(^1^11[https://anonymous.4open.science/r/LLMSpeculativeSampling-EE52](https://anonymous.4open.science/r/LLMSpeculativeSampling-EE52)).

## 2 Preliminaries

### 2.1 Decodings of LLMs

##### Decoding and Perplexity.

Let $p$ denote the distribution defined by LLM model $M_{p}$. Given an input context $input$, a decoding algorithm generates a sequence of $N$ tokens whose likelihood is denoted as $p(x_{1:N}|input)$. The likelihood of the sequence is directly linked to *perplexity* of the sequence, which is the exponentiated average negative log-likelihood of all tokens. Based on autoregressive decomposition $p(x_{1:N}|input)=\prod_{t=1}^{N}p(x_{t}|x_{1:t-1},input)$(^2^22In the paper, we omit $input$ when there is no ambiguity.), the perplexity is defined as:

$$ $PPL(x_{1:N})=\exp\left\{-\frac{1}{N}\sum_{t=1}^{N}\log p(x_{t}|x_{1:t-1})\right\}$ (1) $$

Perplexity serves as a direct metric for assessing the effectiveness of a decoding algorithm. In practice, when a model is well-trained, lower perplexity often correlates with improved downstream performance. For example, beam sampling aims to return output with lower perplexity and is proven to have better downstream performance in general (Shi et al., ).

To further demonstrate the relationship between perplexity and downstream performance, we evaluate GPT-3.5-turbo on the spider (Yu et al., ) dataset. Using a temperature of 2, the model generated 10 outputs for each input. We measured the average perplexities and execution accuracies for the outputs with the highest, lowest, and median (the 5-th lowest) perplexity. As shown in Table 1, lower perplexity correlates with improved downstream performance, even in one of today’s largest models.

**Table 1: Relationship between perplexity and execution accuracy (EA, higher the better) for GPT-3.5-turbo.**
| Output | Avg. PPL $\downarrow$ | EA (%) $\uparrow$ |
| --- | --- | --- |
| Highest PPL | 4.13 | 33 |
| 5-th Lowest PPL | 1.40 | 58 |
| Lowest PPL | 1.07 | 62 |

Now we introduce commonly used decoding approaches.

##### Multinomial Sampling.

Multinomial sampling, also known as standarized sampling or single-token sampling, samples the next token $x_{t}$ based on $\mathcal{T}\circ p(\cdot|x_{1:t-1},input)$, where $\mathcal{T}$ is a warping operation applied to enhance the high probability region. Some common warping operations include top-k warping, which limits the selection to the top k tokens, and top-p warping, where tokens are sampled from the smallest possible subset of the vocabulary whose cumulative probability mass exceeds a specified threshold. The deterministic version of multinomial sampling (i.e., greedy decoding) is a special case when $k=1$.

##### Beam Sampling.

Beam sampling aims to improve output perplexity over multinomial sampling.
For each position $t$ ($1\leq t\leq N$), it maintains $W>1$ candidate sequences, which are also called *beams*.
Assume we have already kept the $W$ sequences $\mathcal{I}_{t-1}=\{x_{1:t-1}^{(1)},\ldots,x_{1:t-1}^{(W)}\}$ at position $t-1$, $W$ sequences with length $t$ are then sampled from $\mathcal{T}\circ p_{beam}$, where $p_{beam}:\mathcal{I}_{t-1}\times V\rightarrow[0,1]$ is the beam sampling probability:

$$ $p_{beam}(x_{1:t-1}^{(i)},x_{t})=\frac{p(x_{1:t-1}^{(i)},x_{t}|input)}{\sum_{x_ {1:t-1}^{(j)},x^{\prime}_{t}\in\mathcal{I}_{t-1}\times V}p(x_{1:t-1}^{(j)},x_{ t}^{\prime}|input)}$ (2) $$

Notice that $p(x_{1:t-1}^{(i)},x_{t}|input)=p(x_{t}|x_{1:t-1}^{(i)},input)\cdot p(x_{1:t-1}
^{(i)}|input)$. In practice, beam sampling stores the likelihood $p(x_{1:t-1}^{(i)}|input)$ for each beam, and the computation complexity of $p_{beam}$ is $O(W\cdot|V|)$. In deterministic beam sampling, the top $W$ sequences with the highest likelihood $p_{beam}(x_{1:t})$ will be kept.

### 2.2 Vanilla Speculative Decoding

Besides effectiveness, speculative decoding is proposed by (Leviathan et al., ; Chen et al., ) to accelerate the inference of LLMs. It utilizes a small model to generate the next $\gamma$ tokens and then uses the large model to verify the drafted tokens *in parallel*, which is summarized below:

- 1.
Let $input$ be the input context, the small model samples $\gamma$ draft tokens $x_{1},\ldots,x_{\gamma}$ using multinomial sampling based on $\tilde{q}(x_{t}|x_{1:t-1},input))$ for $t=1,\ldots,\gamma$, where $\tilde{q}=\mathcal{T}\circ q$ and $q$ is the small model’s output distribution.
- 2.
The large model verifies the draft tokens in parallel by computing the conditional probability $\tilde{p}(x_{t}|x_{1:t-1},input)$ for $t=1,\ldots,\gamma$.
- 3.
Each draft token $x_{t}$ is accepted with probability $\min(1,\tilde{p}(x_{t})/\tilde{q}(x_{t}))$.
The draft tokens before the first rejected token are kept as the decoding output. An additional token is sampled from a residual distribution as a correction to the first rejected token. Then the accepted tokens and the resampled token are appended to the context $input$ as the input to the next iteration.
- 4.
Repeat step 1-3 until reaching the stopping criteria, e.g., reaching the length limit..

Because the large model verifies $\gamma$ tokens in parallel with one run, the time cost is smaller than calling it $\gamma$ times. Meanwhile, although the small model still runs in an autoregressive way, its inference speed is much faster than the large model. As a result, speculative decoding achieves a speedup of 1–2× compared to multinomial sampling while maintaining an identical sampling distribution.

## 3 Methodology

As discussed in Section 2, the goal of this work is to design an algorithm that yields lower perplexity and better efficiency than multinomial sampling and vanilla speculative decoding.
In this section, we first introduce multi-token joint decoding (MTJD), which generates multiple tokens based on their joint likelihood. We prove it can yield lower perplexity. Then we introduce multi-token assisted decoding (MTAD), which approximates and accelerates MTJD by exploiting an auxiliary model.

### 3.1 Multi-Token Joint Decoding

We first introduce a new decoding algorithm to improve multinomial sampling in terms of perplexity.

###### Definition 3.1 .

Multi-Token Joint Decoding. Let $M_{p}$ be the large target model with distribution $p$. Different from single-token multinomial sampling, multi-token joint decoding (MTJD) generates the next $\gamma_{i}$ tokens at step $i$ based on their joint conditional probability $p(x_{t+1:t+\gamma_{i}}|x_{1:t})$, where $\gamma_{i}$ is an integer no less than 1 and $t=\sum_{i^{\prime}=1}^{i-1}{\gamma_{i^{\prime}}}$, i.e., the total tokens generated in the previous $i-1$ steps.

Figure: Figure 1: Perplexity and Rouge-L score of the output when $\gamma_{i}=K$ for MTJD with OPT-125M and Llama-2-68M fine-tuned on ChatGPT-Prompts (Rashad, ) dataset.
Refer to caption: extracted/5896490/figures/k-tokenGD.png

Multinomial sampling is a special case of MTJD where $\gamma_{i}=1$, $\forall i$. When $\gamma_{1}=N$, MTJD generates the sequence directly based on their joint likelihood. So intuitively, output perplexity should improve as $\gamma_{i}$ increases.
Besides, generating $\gamma_{i}$ tokens simultaneously allows MTJD to consider their interactions. In contrast, multinomial sampling selects each token without considering any future tokens. So MTJD is less prone to choosing local optima.

Theorem 3.2 shows the limit of perplexity of MTJD when $N$ approaches infinity. The proofs are included in the Appendix A.

###### Theorem 3.2 .

Assume at the $i$-th ($i=1,\ldots,N$) iteration, MTJD generates $\gamma_{i}$ tokens. Let $\Gamma_{i}$ denote the total number of tokens generated at the first $i$ iterations. Let $x_{1:\Gamma_{N}}$ denote the generated tokens. When $N\rightarrow\infty$

$$ $PPL_{p}(x_{1:\Gamma_{N}})\rightarrow\exp\left(-\frac{1}{\bar{\gamma}}\mathbb{E }_{\gamma}L_{p}(\gamma,\tilde{p})\right)$ (3) $$

where $\bar{\gamma}$ is the expected number of $\gamma_{i}$, $\tilde{p}=\mathcal{T}\circ p$ represents how we sample the next $\gamma_{i}$ tokens from $p$ (e.g., in deterministic sampling, $\tilde{p}=\arg\max\circ p$ always returns the tokens with the highest joint likelihood), and $L_{p}(\gamma,\tilde{p})$ is the expected log-likelihood of the $\gamma$ tokens sampled from $\tilde{p}$:

$$ $L_{p}(\gamma,\tilde{p})=\mathbb{E}_{x_{1:t}\in\mathcal{X}}\sum_{x_{t+1:t+ \gamma}}\tilde{p}(x_{t+1:t+\gamma}|x_{1:t})\log p(x_{t+1:t+\gamma}|x_{1:t})$ (4) $$

Here $\mathcal{X}$ is the space of all possible inputs.

###### Corollary 3.3 .

Based on Theorem 3.2, we can show that when $N\rightarrow\infty$, greedy MTJD (i.e., top-1 MTJD sampling) has lower perplexity than greedy decoding (top-1 single-token sampling).

Empirical evidence supports our claim. We fine-tune both a Llama and an OPT model on the ChatGPT-Prompts dataset and evaluate the output perplexity and Rouge-L scores with example outputs.
Figure 1 shows the output perplexity and Rouge-L scores of MTJD with $\gamma_{i}$ set to a constant $K$, where $K=1,\ldots,5$. Notice that setting $K=1$ is equivalent to multinomial sampling. We use beam sampling to approximate the $\arg\max$ sampling from the joint distribution $p(x_{t+1:t+K}|x+{1:t},input)$.
We can see that the perplexity keeps dropping when $K$ increases. It confirms our claim that increasing $\gamma_{i}$ will increase the output perplexity.
Moreover, the Rouge-L score also improves with $K$, supporting our claim that better perplexity reflects enhanced performance in downstream tasks.

###### Definition 3.1 .

###### Theorem 3.2 .

###### Corollary 3.3 .

### 3.2 Multi-Token Assisted Decoding

Unfortunately, the computation cost of MTJD is infeasible in practice, since the time and space complexity to compute the joint distribution of $\gamma_{i}$ tokens is $|V|^{\gamma_{i}}$.
Inspired by speculative decoding and the facts that “even when a small model is an order of magnitude smaller than a large model, only a small fraction of the small model’s prediction deviate from those of the large model” (Leviathan et al., ; Kim et al., ), we propose multi-token assisted decoding (MTAD), which exploits a small auxiliary model $M_{q}$ to accelerate MTJD approximately. The core idea is to (1) use the joint distribution $q(x_{t+1:t+\gamma_{i}}|x_{1:t})$ output by $M_{q}$ to approximate $p(x_{t+1:t+\gamma_{i}}|x_{1:t})$(^3^33It is also valid to approximate $\tilde{p}$ with $\tilde{q}$. Without loss of generality, we consider non-warped distribution in the illustration of MTAD.) and generate $\gamma$ draft tokens from $q(x_{t+1:t+\gamma_{i}}|x_{1:t})$, then (2) use the large model to validate draft tokens in parallel and accept the *longest* draft prefix sub-sequence that passes verification, and (3) sample an additional token from the distribution of the large model without extra overhead to ensure at least one token is generated at each iteration.
However, it is still infeasible to directly generate draft tokens from the joint distribution $q(x_{t+1:t+\gamma_{i}}|x_{1:t})$. So we propose to further approximate this process with beam sampling, which is an effective and efficient algorithm to generate sequences with high likelihood.
In this way, MTAD reduces the number of runs of the large model to generate $N$ tokens, thus accelerating the inference in the same way as vanilla speculative decoding does. Algorithm 1 in the Appendix illustrates the pseudocode of MTAD algorithm.

Figure: Figure 2: An example of MTAD’s verification process. MTAD accepts the *longest* draft sub-sequence that passes verification based on joint likelihood.
Refer to caption: x1.png

##### Draft Tokens Verification

Figure 2 illustrates the verification process of MTAD.
Let $x_{t+1},\ldots,x_{t+\gamma}$ be the draft tokens generated by beam sampling with the auxiliary model. Since beam sampling is a widely recognized algorithm to generate sequences with high overall likelihood (Leblond et al., ), it is reasonable to assume $q(x_{t+1:t+\gamma}|x_{1:t})$ is large. Also, since beam sampling works in an autoregressive way, we can also assume that $\forall j\in\{1,\ldots,\gamma\}$, $q(x_{t+1:t+j}|x_{1:t})$ is large.
To approximate MTJD, for each step $i$, MTAD needs to ensure the accepted tokens $x_{t+1:t+\gamma_{i}}$ ($0\leq\gamma_{i}\leq\gamma$) also have high joint likelihood with the large model $M_{p}$. So MTAD first computes the joint likelihood $p(x_{t+1:t+j}|x_{1:t})$ for $j=1,\ldots,\gamma$.
Then for each prefix sub-sequence $x_{t+1:t+j}$, it passes verification if and only if $\min(1,\frac{p(x_{t+1:t+j}|x_{1:t})}{q(x_{t+1:t+j}|x_{1:t})})>\tau$, where $\tau\in[0,1)$ is a pre-defined threshold. Notice that if $\min(1,\frac{p(x_{t+1:t+j}|x_{1:t})}{q(x_{t+1:t+j}|x_{1:t})})>\tau$, we have $\frac{p(x_{t+1:t+j}|x_{1:t})}{q(x_{t+1:t+j}|x_{1:t})}>\tau$, which means $\frac{q(x_{t+1:t+j}|x_{1:t})-p(x_{t+1:t+j}|x_{1:t})}{p(x_{t+1:t+j}|x_{1:t})}<
\frac{1}{\tau}-1$. Therefore, our acceptance policy guarantees that when $q(x_{t+1:t+j}|x_{1:t})>p(x_{t+1:t+j}|x_{1:t})$, the relative error is bounded. And if $q(x_{t+1:t+j}|x_{1:t})\leq p(x_{t+1:t+j}|x_{1:t})$, it means the sub-sequence has higher likelihood in the large model, then it is reasonable to accept it. After verifying all the sub-sequences, MTAD accepts the *longest* prefix sub-sequence that passes verification.

The verification step of MTAD ensures that the accepted tokens have a high joint likelihood with the large model. We have shown that selecting multiple tokens based on their joint likelihood lead to better output perplexity. Thus, MTAD is more effective than multinomial sampling and vanilla speculative decoding. Furthermore, since MTAD accepts the longest draft sub-sequence with high likelihood, it can tolerate low-quality tokens as long as the joint likelihood is high. So at each iteration, MTAD can accept more draft tokens than vanilla speculative decoding, which results in better efficiency.

Next, we theoretically analyze the approximation error of MTAD. Lemma 3.4 shows the upper bound of MTAD’s perplexity. And Theorem 3.5 shows the upper bound of the ratio between the perplexity of approximate MTAD and exact MTJD. The proofs are given in Appendix A.

###### Lemma 3.4 .

Let us assume that when the small auxiliary model generates draft tokens with beam sampling, the beam width is large enough such that the returned log-likelihood is close to the maximum log-likelihood, i.e.,

$$ $\mathbb{E}_{x_{1:\Gamma_{i-1}}\in\mathcal{X}}\log q(x_{\Gamma_{i-1}+1:\Gamma_{ i}-1}|x_{1:\Gamma_{i-1}}))\geq(1-\epsilon)\mathbb{E}_{x_{1:\Gamma_{i-1}}\in \mathcal{X}}\max_{x_{\Gamma_{i-1}+1:\Gamma_{i}-1}}\log q(x_{\Gamma_{i-1}+1: \Gamma_{i}-1}|x_{1:\Gamma_{i-1}}))$ (5) $$

where $\epsilon$ is an error term and $\epsilon\leq 0$ because $\log q\leq 0$.

Furthermore, let $H(p,q)$ the single-token cross entropy between $p$ and $q$, i.e., $H(p,q)=-\mathbb{E}_{x_{1:t\in\mathcal{X}}}\sum_{x_{t+1}}p(x_{t+1}|x_{1:t})\log
q
(x_{t+1}|x_{1:t})$.

With the two assumption above, when $N\rightarrow\infty$ we have

$$ $PPL_{q}({x_{1:\Gamma_{N}}})\leq\exp(-\frac{1-\epsilon}{\bar{\gamma}}\mathbb{E} _{\gamma}L_{q}(\gamma-1,\arg\max\circ q)+\frac{H(p,q)}{\bar{\gamma}})$ (6) $$

where

$$ $L_{q}(\gamma,\arg\max\circ q)=\mathbb{E}_{x_{1:t}\in\mathcal{X}}\max_{x_{t+1:t +\gamma}}\log q(x_{t+1:t+\gamma}|x_{1:t}))$ (7) $$

###### Theorem 3.5 .

Let $x_{1:\Gamma_{N}}$ be the tokens generated by approximate MTAD, and $x^{*}_{1:\Gamma_{N}}$ be the tokens generated by deterministic exact MTJD.
Assume $\forall x_{1:t}\in\mathcal{X}$, $\|\log p(x|x_{1:t})-\log q(x|x_{1:t})\|_{\infty}\leq U$, where $U$ is a constant.
We have

$$ $\lim_{N\rightarrow\infty}\frac{PPL_{p}(x_{1:\Gamma_{N}})}{PPL_{p}(x^{*}_{1: \Gamma_{N}})}\leq\tau^{-\frac{1}{\bar{\gamma}}}\exp\left(\frac{(1-\epsilon\bar {\gamma})H(p)+(1-\epsilon+\bar{\gamma})U}{\bar{\gamma}}\right)$ (8) $$

where $H(p)$ is the entropy of $p$ and $\epsilon<0$ is the error term of beam sampling (see Lemma 3.4).

Theorem 3.5 suggests the approximation error of MTAD is bounded by a factor related to the verification threshold $\tau$, average number of accepted tokens $\bar{\gamma}$, the difference between the large and small models (measured by $U$), the error of beam sampling $\epsilon$, and the entropy of the large model itself.
In addition, the following theorem analyzes $\bar{\gamma}$. The proof is illustrated in Appendix A.

###### Theorem 3.6 .

Following the assumption in Theorem 3.5, we have
$\bar{\gamma}\geq\frac{|\log\tau|}{U}$.

With Theorem 3.6, we observe that when $q\rightarrow p$, we have $U\rightarrow 0$ and $\bar{\gamma}\rightarrow\infty$. Meanwhile, when $\epsilon\rightarrow 0$, meaning the beam width for the auxiliary model is large enough, the ratio bound in Theorem 3.5 converges to 1, It implies that MTAD converges to MTJD under these limiting conditions.

Similar to Spectr (Sun et al., ) and SpecInfer (Miao et al., ), it is possible to enhance the number of accepted tokens in MTAD by allowing the draft model to generate multiple draft sequences and applying tree-based attention (Miao et al., ) for simultaneous verification. However, our preliminary experiment results suggest that since MTAD already selects the longest accepted prefix sub-sequence, the advantage of generating multiple draft tokens is less significant. Moreover, this approach increases the memory cost during inference and may affect the error bounds derived above. Therefore, we leave a more detailed exploration of this extension as future work.

###### Lemma 3.4 .

###### Theorem 3.5 .

###### Theorem 3.6 .

## 4 Energy Efficiency Analysis

Previous studies (Leviathan et al., ; Chen et al., ; Kim et al., ; Sun et al., ) only focus on the speed of speculative decoding.
However, an equally important consideration is energy consumption. To our knowledge, there is no existing work evaluating the impact of speculative decoding on inference energy consumption.
Although MTAD and speculative decoding increase the number of FLOPs due to the involvement of a small auxiliary model and the rollback operation, they concurrently reduce the inference time and memory operations, which are key factors of GPU energy consumption (Allen & Ge, ; Chen et al., ).
Consequently, it poses an open question regarding whether speculative decoding increases or decreases overall energy consumption.

To understand the net effect of speculative decoding, we decompose the total energy consumption into two parts following (Allen & Ge, ):

$$ $E_{total}=PW_{flop}T_{flop}+PW_{mem}T_{mem}$ (9) $$

where $PW_{flop},PW_{mem}$ denote the power (energy/second) of FLOPs and memory operations, and $T_{flop},T_{mem}$ denote the time spent on these operations.
When input batch size increases, $PW_{flop}$ increases until it reaches the power of maximum FLOPs, denoted as $PW^{*}_{flop}$. Meanwhile, $PW_{mem}$ is irrelevant to the input batch size, as it only depends on the memory hardware.

**Table 2: The effect of batch size to inference speed and energy consumption. The number of inputs is the product of the number of LLM runs and input batch size.**
| Batch Size | Energy (J) | Energy/run (J) | Energy/Input (J) | Time (s) | Time/run (s) | Time/input(s) |
| --- | --- | --- | --- | --- | --- | --- |
| 1 | 42,450 | 14.1 | 14.1 | 1,129 | 0.376 | 0.376 |
| 2 | 49,621 | 16.5 | 8.26 | 1,191 | 0.397 | 0.198 |
| 4 | 53,325 | 17.7 | 4.43 | 1,178 | 0.392 | 0.098 |
| 8 | 59,210 | 19.7 | 2.46 | 1,211 | 0.403 | 0.050 |
| 16 | 74,058 | 24.7 | 1.54 | 1,255 | 0.418 | 0.026 |

**Table 3: Speed and energy cost of multinomial sampling (ms) and speculative decoding (spec).**
|  | OPT | Llama-2 |  |  |
| --- | --- | --- | --- | --- |
|  | ms | spec | ms | Spec |
| tokens/s | 23.8 | 35.6 | 22.0 | 31.6 |
| J/token | 11.3 | 5.74 | 11.2 | 6.97 |

To determine the relative magnitude relationship between $PW_{flop}$ and $PW_{mem}$, we first point out the fact that GPU memory operations in LLM inference are dominated by accessing off-chip global memory, which consumes about $100\times$ of energy compared to accessing on-chip shared memory (Jouppi et al., ). It is because each multiprocessor on GPU usually has 64KB of on-chip memory shared by multiple threads, while storing a single layer of LLM, say T5-11b (Raffel et al., ), requires about 1GB memory. Moreover, Allen and Ge showed that doing sequential read from off-chip memory consumes $20$-$30\%$ more power than running maximum FLOPs (Allen & Ge, ). So we have $PW_{mem}>PW^{*}_{flop}\geq PW_{flop}$. Notice that $PW^{*}_{flop}=PW_{flop}$ only if the batch size reaches the maximum parallelization capacity of GPUs.
During multinomial sampling and speculative decoding, the batch size is usually small (Leviathan et al., ). So most of the computing power is not utilized (Leviathan et al., ), which means $PW_{mem}\gg PW_{flop}$.

In addition, previous studies have shown that during LLM inference $T_{mem}\gg T_{flop}$ (Leviathan et al., ).
Therefore, the energy induced by memory operations, i.e., $PW_{mem}T_{mem}$ dominates $E_{total}$. Since speculative decoding reduces $T_{mem}$ by reducing the number of runs of the large model, it should reduce the inference energy consumption to a similar extent as it reduces time consumption.

To validate our hypothesis, we conducted an experiment to evaluate how batch size influences energy consumption during inference.
We ran OPT-13b models on a Nvidia L40 GPUs with 48GB memory. Fixing the total number of runs of the large model while varying the input batch size $b\in\{1,2,4,8,16\}$ for each run, we measured time and energy cost. The details of energy measurement are illustrated in the Appendix D. Table 2 shows the results. As batch size doubles, although the number of FLOPs doubles, the energy consumption per run increases slightly. This observation demonstrates that $PW_{mem}T_{mem}$ dominates $E_{total}$. Moreover, we measured the speed and energy consumption of running multinomial sampling with the large model and speculative decoding using OPT (125M, 13B) and Llama-2 (68M, 13B) models. The results, shown in Table 3, indicate that speculative decoding reduces the energy consumption and the time cost. This observation corroborates our claim to the energy efficiency of speculative decoding.

## 5 Experiments

Datasets and Models. We use five public datasets for evaluation: (1) ChatGPT-Prompt (Rashad, ), (2) ChatAlpaca (Bian et al., ), (3) CNN Dailymail (See et al., ), (4) Spider (Yu et al., ), and (5) MT-bench (Zheng et al., ). Table 8 in the Appendix shows more details of the datasets.
Following previous studies (Kim et al., ), we use two public LLM families in our experiments: OPT (Zhang et al., ) and Llama-2 (Touvron et al., ). In this section, we set the large model to be OPT-13B and Llama-2-13B as they are the largest models that can run on a single 40GB GPU, and use Llama-68M (Miao et al., ) and OPT-125M as the small models. Appendix C reports additional experiment results with OPT-30B and Llama-2-chat-70B.

Baselines. For each pair of small and large models, we compare our method with four speculative decoding methods: vanilla speculative decoding (speculative) (Lee et al., ; Chen et al., ), Spectr (Sun et al., ), SpecInfer (Miao et al., ), and BiLD (Kim et al., ). Our implementation of MTAD and all the baselines are based on a public implementation of speculative decoding (Bear, ). For each method, we let it generate at most 128 tokens for each input and run it for $1,000$ seconds. We open-sourced our code for reproduction. All the methods are stochastic with top-$k$ and top-$p$ sampling. The details of the hyper-parameters (e.g., $k$ and $p$) and machine configurations of the experiments can be found in the Appendix D, E, and F.

Appendix C reports additional experiments and ablation studies.

**Table 4: Inference efficiency and output perplexity of different methods on ChatGPT-Prompt (CP), ChatAlpaca (CA), CNNDailyMail (CD), Spider (SP), and MT-Bench (MT) datasets. Bold numbers mark the best result, underlined numbers mark the second best.**
| \hlineB3 |  |  | speculative | BiLD | Spectr | SpecInfer | MTAD |
| --- | --- | --- | --- | --- | --- | --- | --- |
| \hlineB3<br>CP | Llama-2 | speed (token/s) $\uparrow$ | 36.8$\pm$0.53 | 34.4$\pm$0.87 | 45.1$\pm$1.32 | 29.7$\pm$ 0.40 | 63.0$\pm$0.20 |
| energy (J/token) $\downarrow$ | 6.62$\pm$0.91 | 7.45$\pm$0.90 | 5.17$\pm$0.88 | 9.52$\pm$0.10 | 3.38$\pm$0.02 |  |  |
| perplexity $\downarrow$ | 3.64$\pm$0.11 | 3.15$\pm$0.06 | 3.64$\pm$0.08 | 3.64$\pm$0.11 | 2.06$\pm$0.06 |  |  |
| OPT | speed (token/s) $\uparrow$ | 33.8$\pm$2.47 | 31.5$\pm$1.87 | 38.0$\pm$2.20 | 32.8$\pm$ 0.58 | 55.8$\pm$0.30 |  |
| energy (J/token) $\downarrow$ | 7.48$\pm$0.07 | 8.75$\pm$0.13 | 6.08$\pm$0.11 | 10.3$\pm$1.49 | 3.61$\pm$0.03 |  |  |
| perplexity $\downarrow$ | 5.47$\pm$0.11 | 4.51$\pm$0.09 | 5.27$\pm$0.09 | 5.12$\pm$0.01 | 3.00$\pm$0.09 |  |  |
| CA | Llama-2 | speed (token/s) $\uparrow$ | 31.6$\pm$0.35 | 28.8$\pm$0.20 | 27.7$\pm$0.29 | 26.5$\pm$0.49 | 44.1$\pm$0.25 |
| energy (J/token) $\downarrow$ | 6.98$\pm$0.15 | 7.99$\pm$0.15 | 7.20$\pm$0.08 | 7.52$\pm$0.32 | 4.72$\pm$0.03 |  |  |
| perplexity $\downarrow$ | 2.13$\pm$0.03 | 1.95$\pm$0.03 | 2.15$\pm$0.01 | 2.15$\pm$0.01 | 1.88$\pm$0.05 |  |  |
| OPT | speed (token/s) $\uparrow$ | 35.6$\pm$0.45 | 38.5$\pm$0.93 | 28.4$\pm$0.34 | 31.4$\pm$0.39 | 49.6$\pm$0.42 |  |
| energy (J/token) $\downarrow$ | 5.74$\pm$0.11 | 5.12$\pm$0.06 | 6.24$\pm$0.11 | 8.68$\pm$1.83 | 4.03$\pm$0.02 |  |  |
| perplexity $\downarrow$ | 3.32$\pm$0.10 | 2.60$\pm$0.06 | 3.16$\pm$0.06 | 3.42$\pm$0.03 | 2.07$\pm$0.03 |  |  |
| CD | Llama-2 | speed (token/s) $\uparrow$ | 30.7$\pm$0.18 | 30.5$\pm$0.21 | 25.0$\pm$0.31 | 24.6$\pm$0.06 | 44.2$\pm$0.99 |
| energy (J/token) $\downarrow$ | 7.07$\pm$0.19 | 7.41$\pm$0.16 | 8.22$\pm$0.19 | 7.59$\pm$0.85 | 4.80$\pm$0.12 |  |  |
| perplexity $\downarrow$ | 2.87$\pm$0.08 | 2.93$\pm$0.03 | 3.06$\pm$0.11 | 2.92$\pm$0.09 | 2.63$\pm$0.10 |  |  |
| OPT | speed (token/s) $\uparrow$ | 31.7$\pm$0.91 | 30.9$\pm$0.80 | 23.7$\pm$0.40 | 25.7$\pm$0.36 | 43.6$\pm$0.33 |  |
| energy (J/token) $\downarrow$ | 6.37$\pm$0.11 | 6.71$\pm$0.17 | 7.31$\pm$0.17 | 8.03$\pm$0.63 | 4.86$\pm$0.03 |  |  |
| perplexity $\downarrow$ | 3.97$\pm$0.06 | 3.74$\pm$0.09 | 4.04$\pm$0.07 | 3.92$\pm$ 0.34 | 3.17$\pm$0.06 |  |  |
| SP | Llama-2 | speed (token/s) $\uparrow$ | 24.0$\pm$0.28 | 26.2$\pm$0.08 | 24.2$\pm$0.29 | 23.8$\pm$0.20 | 26.4$\pm$0.28 |
| energy (J/token) $\downarrow$ | 10.75$\pm$0.02 | 9.84$\pm$0.07 | 11.0$\pm$0.08 | 11.0$\pm$0.76 | 9.01$\pm$0.07 |  |  |
| perplexity $\downarrow$ | 2.26$\pm$0.01 | 2.13$\pm$0.03 | 2.29$\pm$0.04 | 2.29$\pm$0.03 | 1.87$\pm$0.03 |  |  |
| OPT | speed (token/s) $\uparrow$ | 24.6$\pm$0.30 | 29.9$\pm$0.55 | 19.8$\pm$0.13 | 24.1$\pm$0.10 | 34.4$\pm$0.46 |  |
| energy (J/token) $\downarrow$ | 15.6$\pm$3.55 | 13.6$\pm$3.07 | 20.1$\pm$2.52 | 16.9$\pm$2.75 | 11.7$\pm$2.36 |  |  |
| perplexity $\downarrow$ | 2.30$\pm$0.07 | 1.90$\pm$0.01 | 2.20$\pm$0.09 | 2.21$\pm$ 0.01 | 1.63$\pm$0.03 |  |  |
| MT | Llama-2 | speed (token/s) $\uparrow$ | 23.0$\pm$1.10 | 23.7$\pm$1.43 | 19.1$\pm$2.71 | 23.7$\pm$2.03 | 29.4$\pm$2.71 |
| energy (J/token) $\downarrow$ | 7.99$\pm$0.26 | 7.40$\pm$0.19 | 9.27$\pm$0.54 | 9.20$\pm$0.73 | 6.71$\pm$1.19 |  |  |
| perplexity $\downarrow$ | 3.64$\pm$0.51 | 3.44$\pm$0.76 | 3.64$\pm$0.51 | 3.63$\pm$0.50 | 2.21$\pm$0.18 |  |  |
| OPT | speed (token/s) $\uparrow$ | 34.0$\pm$3.00 | 44.7$\pm$2.92 | 28.7$\pm$2.46 | 28.5$\pm$2.74 | 48.0$\pm$1.80 |  |
| energy (J/token) $\downarrow$ | 12.1$\pm$0.36 | 6.23$\pm$0.67 | 12.9$\pm$1.73 | 13.2$\pm$1.88 | 6.11$\pm$0.82 |  |  |
| perplexity $\downarrow$ | 2.02$\pm$0.40 | 1.50$\pm$0.27 | 1.97$\pm$0.38 | 1.99$\pm$ 0.33 | 1.10$\pm$0.03 |  |  |
| \hlineB3 |  |  |  |  |  |  |  |

### 5.1 Comparison with Baselines

Table 4 shows the primary results of our experiments while Table 5 details the block efficiency, defined as the average number of tokens generated per iteration, of different methods. The standard deviations in the tables are computed by repeating each experiment four times(^4^44For MT-Bench, the standard deviation also accounts for variations across different tasks.).
First,
we observe that MTAD is significantly more efficient than all baselines in terms of both energy and time. On one hand, the energy consumption of MTAD is on average $1.54\times$ smaller than that of vanilla speculative decoding. On the other hand, MTAD is $1.10-1.71\times$ faster than vanilla speculative decoding, $1.38\times$ faster than BiLD, $1.59\times$ faster than Spectr, and $1.60\times$ faster than SpecInfer. SpecInfer and Spectr has better block efficiency than vanilla speculative decoding, but are slower. This may be due to the fact that they have to verify multiple draft sequences, which introduces extra overhead and may not be perfectly parallelized, especially when the memory overhead exceeds the GPU memory capacity. Meanwhile, MTAD has the best block efficiency without causing any extra overhead, hence it is significantly more efficient.

**Table 5: Average number of tokens generated at each iteration across all datasets.**
|  | Llama-2 | OPT |
| --- | --- | --- |
| spec | 2.02$\pm$0.05 | 2.60$\pm$0.06 |
| BiLD | 1.83$\pm$0.10 | 2.68$\pm$0.36 |
| Spectr | 2.73$\pm$0.43 | 3.45$\pm$0.42 |
| SpecInfer | 2.74$\pm$0.46 | 3.45$\pm$0.40 |
| MTAD | 3.17$\pm$0.43 | 4.30$\pm$0.03 |

Next,
we compare the output perplexity of different algorithms. The perplexity scores of vanilla speculative decoding, SpecInfer, and Spectr are close since their sampling distributions are equivalent. Meanwhile, BiLD approximates the sampling distribution of single-token multinomial sampling but yields better perplexity. It is because we set a strict acceptance threshold for BiLD, which lowers the acceptance rate but ensures every token has a high probability in the large model, thus improving the overall likelihood. More importantly, there is a significant gap between MTAD and other baselines. On average, the perplexity of MTAD is $21.2\%$ lower than that of speculative decoding.

**Table 6: Downstream task scores of speculative decoding and MTAD. All the scores are higher the better.**
|  |  | spec | MTAD |
| --- | --- | --- | --- |
| CD | Rouge-L | 0.114 | 0.118 |
| SP | EA | 11.5 | 13.0 |
| MT | Humanities | 2.95 | 3.15 |
| Extraction | 1.80 | 2.50 |  |
| Roleplay | 3.10 | 3.80 |  |
| Math | 1.10 | 1.00 |  |
| Coding | 1.25 | 1.10 |  |
| Reasoning | 3.80 | 3.15 |  |
| STEM | 2.85 | 3.10 |  |
| Writing | 3.80 | 3.65 |  |
| Average | 2.58 | 2.68 |  |

In addition, to show MTAD indeed improves the downstream effectiveness, we compare the performance metrics of speculative decoding and MTAD on CNNDM, Spider, and MT-Bench datasets.(^5^55All speculative baselines are equivalent to multinomial sampling) We exclude the other two datasets as they lack explicit downstream metrics. And we exclude the results of OPT models due to their consistently poor performance across all evaluated datasets. As illustrated in Table 6, MTAD outperforms speculative decoding across all three datasets, thereby validating our claim that MTAD achieves superior effectiveness compared to conventional decoding methods that rely on single-token distributions.

### 5.2 Ablation Study

#### 5.2.1 Number of Beams

First, we investigate how the number of beams used in the beam decoding of the small model affects the inference performance. Table 7 shows the results. Increasing the number of beams improves the quality of the draft tokens, which not only improves the output perplexity but also increases the average acceptance length and hence leads to better efficiency. But we can see that the increment slows down when the number of beams is large enough. In addition, when the number of beams is too large, the inference cost of the small model will become too high.

**Table 7: Effect of number of beams to the inference performance on ChatGPT-Prompts dataset.**
|  | # beams | 2 | 4 | 6 | 8 |
| --- | --- | --- | --- | --- | --- |
|  | speed (token/s) $\uparrow$ | 55.9 | 59.9 | 60.2 | 61.3 |
| Llama-2 | energy (J/token) $\downarrow$ | 2.43 | 2.25 | 2.22 | 2.20 |
|  | perplexity $\downarrow$ | 2.44 | 2.12 | 2.14 | 2.10 |
|  | speed (token/s) $\uparrow$ | 51.0 | 54.1 | 54.3 | 55.9 |
| OPT | energy (J/token) $\downarrow$ | 2.50 | 2.32 | 2.36 | 2.30 |
|  | perplexity $\downarrow$ | 3.63 | 3.16 | 3.42 | 3.19 |

#### 5.2.2 Acceptance Threshold

Figure: Figure 3: Effect of acceptance threshold on output perplexity and decoding speed.
Refer to caption: extracted/5896490/figures/ppl_tau.png

Next, we evaluate the effect of acceptance threshold $\tau$. Intuitively, when we increase $\tau$ from 0 to 1, the acceptance criterion becomes more strict, the efficiency drops while the output perplexity increases. Surprisingly, this expectation is only partially correct. As shown in Figure 3, the efficiency indeed drops when $\tau$ increases. However, the perplexity increases when $\tau$ is close to 1. When $\tau=1$, all the draft tokens are rejected, which makes MTAD equivalent to multinomial sampling. Similarly, when $\tau$ is close to 1, the advantage of multi-token joint decoding on effectiveness disappears, hence the perplexity becomes close to the perplexity of multinomial sampling. Another surprising observation is that the perplexity of MTAD is good when $\tau=0$. When $\tau=0$, MTAD is equivalent to generating $\gamma$ tokens using beam decoding with the small model, then generating an additional token with the large model. The fact that MTAD achieves good perplexity when $\tau=0$ can be explained by the fact that “even when a small model is an order of magnitude smaller than a large model, only a small fraction of the small model’s predictions deviate from those of the large model” (Kim et al., ; Leviathan et al., ). Moreover, when $\tau$ ranges from $0.1$ to $0.9$, the performance of MTAD is relatively stable, suggesting that MTAD is not sensitive to the acceptance threshold.

## 6 Related Work

Efficient Decoding Inference. There are extensive studies on improving large model inference efficiency. Well-known methods include model quantization (Frantar et al., ; Lin et al., ), model pruning (Gale et al., ; Sanh et al., ), and model distillation (Hinton et al., ). Despite achieving significant speed-ups, a common drawback of these methods is that they have to sacrifice the model’s effectiveness.

A direction closer to our work is non-autoregressive decoding. It is first proposed by (Gu et al., ) to generate multiple tokens in parallel. That is, the model simultaneously predicts $p(x_{t+k}|x_{1:t})$ ($k=1,2,\ldots$). Subsequent studies further improved the performance of parallel decoding by incorporating additional information (Wang et al., ; Sun et al., ; Li et al., ) or using additional iterations to refine predictions (Ghazvininejad et al., ; Lee et al., ; Guo et al., ). However, these works require continuous training of the model and usually either compromise the model effectiveness or require task-dependent techniques to achieve comparable performance (Kim et al., ).

Speculative Decoding. Speculative decoding was recently proposed in (Leviathan et al., ; Chen et al., ) as a way to accelerate LLM inference. Spectr (Sun et al., ) enhances speculative decoding by letting the small model generate multiple i.i.d. draft sequences.
While speculative decoding and Spectr use the large model to verify all the tokens drafted by the small model, BiLD (Kim et al., ) only calls the large model when the probability output by the small model is below a pre-defined threshold $\tau_{1}$. The large model rejects a token if its negative log-likelihood is larger than threshold $\tau_{2}$.
SpecInfer (Miao et al., ) uses one or multiple small models to generate a draft token tree to increase the average acceptance length for each iteration.
All these methods can be perceived as exact or approximate versions of sampling tokens from the conditional distribution $p(x_{t}|x_{<t})$. Therefore, their output perplexity is bounded by greedy decoding.

An orthogonal direction to improve speculative decoding is to improve the effectiveness of the small draft model. It is obvious that if more draft tokens are accepted, the overall inference speed will increase. BiLD (Kim et al., ) uses a model prediction alignment technique to better train the small model. Liu et al. (Liu et al., ) propose online speculative decoding to continually update the draft model based on observed input data. Instead, Rest (He et al., ) uses a retrieval model to produce draft tokens. An alternative way is to train additional heads in the large model to predict future tokens. Representative works include EAGLE (Li et al., ) and MEDUSA (Cai et al., ). Importantly, these works are orthogonal to speculative decoding techniques, including our proposed method. This orthogonality means that the improvements offered by more accurate draft tokens could be combined with our method for better effectiveness.

## 7 Conclusion

We introduce multi-token assisted decoding that significantly enhances output quality along with better time and energy efficiency. A distinctive aspect of our work is the exploration of speculative decoding’s impact on inference energy consumption, an often neglected area in existing studies.
This research contributes not only a novel decoding approach but also valuable insights for optimizing LLM deployment in real-world applications where considerations of both quality and efficiency are crucial.

## Appendix A Proof

### A.1 Proof of Theorem 3.2

###### Proof.

$$ $\displaystyle PPL(x_{1:\Gamma_{N}})$ $\displaystyle=\exp\left(-\frac{1}{\Gamma_{N}}\sum_{i=1}^{\Gamma_{N}}\log p(x_{ i}|x_{1:i-1})\right)$ (10) $\displaystyle=\exp\left(-\frac{N}{\Gamma_{N}}\frac{1}{N}\sum_{i=1}^{N}\log p(x _{\Gamma_{i-1}:\Gamma_{i}}|x_{1:\Gamma_{i-1}})\right)$ $$

When $N\rightarrow\infty$, $\frac{\Gamma_{N}}{N}\rightarrow\bar{\gamma}$, and $\frac{1}{N}\sum_{i=1}^{N}\log p(x_{\Gamma_{i-1}:\Gamma_{i}}|x_{1:\Gamma_{i-1}}
)\rightarrow\mathbb{E}_{x_{1:t}\in\mathcal{X}}\sum_{\gamma}\sum_{x_{t+1:t+
\gamma}}P(\gamma)\tilde{p}(x_{t+1:t+\gamma}|x_{1:t})\log p(x_{t+1:t+\gamma}|x_
{1:t})=\mathbb{E}_{\gamma}L_{p}(\gamma,\tilde{p})$
∎

###### Proof.

### A.2 Proof of Corollary 3.3

###### Proof.

For deterministic multi token sampling, $\tilde{p}_{multi}=\arg\max\circ p$, so we have

$$ $L_{p}(\gamma,\tilde{p}_{multi})=E_{x_{1:t}\in\mathcal{X}}\max_{x_{t+1:t+\gamma }}\log p(x_{t+1:t+\gamma}|x_{1:t})$ (11) $$

Notice that deterministic greedy sampling can be seen as a special case of MJGD where $\tilde{p}_{single}(x_{t+1:t+\gamma}|x_{1:t})=1$
if and only if $x_{t+i}=\arg\max_{x}p(x|x_{1:t+i-1})$ for $i=1,\ldots,\gamma$. Let $x^{*}_{t+1:t+\gamma}$ be the tokens generated by deterministic MJGD and let $x^{\prime}_{t+1:t+\gamma}$ be the tokens generated by deterministic greedy decoding. For any fixed $\gamma$ and $x_{1:t}$, we have $\log p(x^{\prime}_{t+1:t+\gamma}|x_{1:t})\leq\max_{x_{t+1:t+\gamma}}\log p(x_{
t+1:t+\gamma}|x_{1:t})=\log p(x^{*}_{t+1:t+\gamma}|x_{1:t})$. Therefore,
$L_{p}(\gamma,\tilde{p}_{single})\leq L_{p}(\gamma,\tilde{p}_{multi})$.
Then with Theorem 3.2, we know that the perplexity of greedy decoding will be higher.
∎

###### Proof.

### A.3 Proof of Lemma 3.4

We first prove the following Lemma.

###### Lemma A.1 .

Let $PPL_{p}$ and $PPL_{q}$ denote the perplexity of tokens under distribution $p$ and $q$. When $N\rightarrow\infty$, we have

$$ $\frac{PPL_{p}(x_{1:\Gamma_{N}})}{PPL_{q}(x_{1:\Gamma_{N}})}\leq\tau^{-\frac{1} {\bar{\gamma}}}$ (12) $$

where $\tau$ is the verification threshold.

###### Proof.

In the $i$-th iteration, the first $\gamma_{i}-1$ tokens are the accepted draft tokens and the last token is sampled from $p$. Based on our verification criteria, we know that for the accepted draft tokens, we have

$$ $\frac{p(x_{\Gamma_{i-1}+1:\Gamma_{i-1}+\gamma_{i}-1}|x_{1:\Gamma_{i-1}})}{q(x_ {\Gamma_{i-1}+1:\Gamma_{i-1}+\gamma_{i}-1}|x_{1:\Gamma_{i-1}})}\geq\tau.$ (13) $$

So,

$$ $\frac{p({x_{1:\Gamma_{N}}})}{q({x_{1:\Gamma_{N}}})}\geq\tau^{N}\prod_{i=1}^{N} \frac{p(x_{\Gamma_{i}}|x_{1:\Gamma_{i}-1})}{q(x_{\Gamma_{i}}|x_{1:\Gamma_{i}-1 })}$ (14) $$

Notice that

$$ $\left(\prod_{i=1}^{N}\frac{p(x_{\Gamma_{i}}|x_{1:\Gamma_{i}-1})}{q(x_{\Gamma_{ i}}|x_{1:\Gamma_{i}-1})}\right)^{\frac{1}{N}}=\exp\left(\frac{1}{N}\sum_{i=1}^ {N}\log\left(\frac{p(x_{\Gamma_{i}}|x_{1:\Gamma_{i}-1})}{q(x_{\Gamma_{i}}|x_{1 :\Gamma_{i}-1})}\right)\right)$ (15) $$

When $N\rightarrow\infty$, since the last token at each iteration is sampled from $p$, we have

$$ $\frac{1}{N}\sum_{i=1}^{N}\log\left(\frac{p(x_{\Gamma_{i}}|x_{1:\Gamma_{i}-1})} {q(x_{\Gamma_{i}}|x_{1:\Gamma_{i}-1})}\right)\rightarrow\mathbb{E}_{p}\log \left(\frac{p(x_{\Gamma_{i}}|x_{1:\Gamma_{i}-1})}{q(x_{\Gamma_{i}}|x_{1:\Gamma _{i}-1})}\right)=KL(p,q)\geq 0$ (16) $$

So

$$ $\left(\prod_{i=1}^{N}\frac{p(x_{\Gamma_{i}}|x_{1:\Gamma_{i}-1})}{q(x_{\Gamma_{ i}}|x_{1:\Gamma_{i}-1})}\right)^{\frac{1}{N}}\geq 1$ (17) $$

Therefore,

$$ $\frac{p({x_{1:\Gamma_{N}}})}{q({x_{1:\Gamma_{N}}})}\geq\tau^{N}$ (18) $$

Thus,

$$ $\frac{PPL_{p}(x_{1:\Gamma_{N}})}{PPL_{q}(x_{1:\Gamma_{N}})}=\left(\frac{p({x_{ 1:\Gamma_{N}}})}{q({x_{1:\Gamma_{N}}})}\right)^{-\frac{1}{\Gamma_{N}}}\leq\tau ^{-\frac{N}{\Gamma_{N}}}\rightarrow\tau^{-\frac{1}{\bar{\gamma}}}$ (19) $$

∎

Now, we prove Lemma 3.4.

###### Proof.

$$ $-\log PPL_{q}(x_{1:\Gamma_{N}})=\frac{1}{\Gamma_{N}}\sum_{i=1}^{N}(\log q(x_{ \Gamma_{i-1}+1:\Gamma_{i}-1}|x_{1:\Gamma_{i-1}})+\log q(x_{\Gamma_{i}}|x_{1: \Gamma_{i}-1}))\\$ (20) $$

When $N\rightarrow\infty$, since the first $\gamma_{i}-1$ tokens are sampled with beam decoding, we have

$$ $\displaystyle\frac{1}{N}\sum_{i=1}^{N}\log q(x_{\Gamma_{i-1}+1:\Gamma_{i}-1}|x _{1:\Gamma_{i-1}}))$ $\displaystyle\rightarrow\mathbb{E}_{\gamma}\mathbb{E}_{x_{1:t\in\mathcal{X}}} \log q(x_{t+1:t+\gamma-1|x_{1:t}})$ (21) $\displaystyle\geq(1-\epsilon)\mathbb{E}_{\gamma}\mathbb{E}_{x_{1:\Gamma_{i-1}} \in\mathcal{X}}\max_{x_{\Gamma_{i-1}+1:\Gamma_{i}-1}}q(x_{\Gamma_{i-1}+1: \Gamma_{i}-1}|x_{1:\Gamma_{i-1}}))$ $\displaystyle=(1-\epsilon)\mathbb{E}_{\gamma}L_{q}(\gamma-1,\arg\max\circ q)$ $$

Since the last token at each iteration is sampled from $p$, we have

$$ $\frac{1}{N}\sum_{i=1}^{N}\log q(x_{\Gamma_{i}}|x_{1:\Gamma_{i}-1}))\rightarrow \mathbb{E}_{x_{1:t}\in\mathcal{X}}\mathbb{E}_{p}\log q(x_{t+1}|x_{1:t})=-H(p,q)$ (22) $$

So

$$ $-\log PPL_{q}(x_{1:\Gamma_{N}})\geq\frac{1-\epsilon}{\bar{\gamma}}\mathbb{E}_{ \gamma,x_{1:\Gamma_{i-1}}\in\mathcal{X}}\max_{x_{t+1:t+\gamma}}q(x_{t+1:t+ \gamma}|x_{1:t}))-\frac{H(p,q)}{\bar{\gamma}}$ (23) $$

$$ $PPL_{q}(x_{1:\Gamma_{N}})\leq\exp\left(\frac{H(p,q)}{\bar{\gamma}}-\frac{1- \epsilon}{\bar{\gamma}}\mathbb{E}_{\gamma}L_{q}(\gamma-1,\arg\max\circ q)\right)$ (24) $$

∎

###### Lemma A.1 .

###### Proof.

###### Proof.

### A.4 Proof of Theorem 3.5

###### Proof.

We have

$$ $\displaystyle\lim_{N\rightarrow\infty}\frac{PPL_{p}(x_{1:\Gamma_{N}})}{PPL_{p} (x^{*}_{1:\Gamma_{N}})}$ $\displaystyle\leq\tau^{-\frac{1}{\bar{\gamma}}}\lim_{N\rightarrow\infty}\frac{ PPL_{q}(x_{1:\Gamma_{N}})}{PPL_{p}(x^{*}_{1:\Gamma_{N}})}\quad(Lemma\ref{th: lemma})$ (25) $\displaystyle=\tau^{-\frac{1}{\bar{\gamma}}}\frac{\lim_{N\rightarrow\infty}PPL _{q}(x_{1:\Gamma_{N}})}{\exp\left(-\frac{1}{\bar{\gamma}}\mathbb{E}_{\gamma}L_ {p}(\gamma,\arg\max\circ p)\right)}\quad(Theorem\ref{th:exact_inf})$ $\displaystyle\leq\tau^{-\frac{1}{\bar{\gamma}}}\frac{\exp\left(\frac{H(p,q)}{ \bar{\gamma}}-\frac{1-\epsilon}{\bar{\gamma}}\mathbb{E}_{\gamma}L_{q}(\gamma-1 ,\arg\max\circ q)\right)}{\exp\left(-\frac{1}{\bar{\gamma}}\mathbb{E}_{\gamma} L_{p}(\gamma,\arg\max\circ p)\right)}\quad(Lemma\ref{th:method_ppl})$ $\displaystyle=\tau^{-\frac{1}{\bar{\gamma}}}\exp\left(\frac{H(p,q)}{\bar{ \gamma}}-\frac{1-\epsilon}{\bar{\gamma}}\mathbb{E}_{\gamma}L_{q}(\gamma-1,\arg \max\circ q)+\frac{1}{\bar{\gamma}}\mathbb{E}_{\gamma}L_{p}(\gamma,\arg\max \circ p)\right)$ $$

Notice that $L_{p}(\gamma,\arg\max\circ p)\geq L_{p}(\gamma+1,\arg\max\circ p)$ for any $\gamma$. This is because for any $x_{1:t}$, $\max_{x_{t+1:t+\gamma}}\log p(x_{t+1:t+\gamma}|x_{1:t})\geq\max_{x_{t+1:t+
\gamma+1}}\left(\log p(x_{t+1:t+\gamma}|x_{1:t})+\log p(x_{t+\gamma+1}|x_{1:t+
\gamma})\right)=\max_{x_{t+1:t+\gamma+1}}\log p(x_{t+1:t+\gamma+1}|x_{1:t})$.

So

$$ $\displaystyle\lim_{N\rightarrow\infty}\frac{PPL_{p}(x_{1:\Gamma_{N}})}{PPL_{p} (x^{*}_{1:\Gamma_{N}})}$ (26) $\displaystyle\leq$ $\displaystyle\tau^{-\frac{1}{\bar{\gamma}}}\exp\left(\frac{H(p,q)}{\bar{\gamma }}+\frac{\epsilon}{\bar{\gamma}}\mathbb{E}_{\gamma}L_{p}(\gamma,\arg\max\circ p )+\frac{1-\epsilon}{\bar{\gamma}}(\mathbb{E}_{\gamma}L_{p}(\gamma,\arg\max \circ p)-\mathbb{E}_{\gamma}L_{q}(\gamma,\arg\max\circ q))\right)$ $$

Since $\epsilon\leq 0$, and $L_{p}(\gamma,\arg\max\circ p)$ is the maximum log-likelihood, which is larger than the expected log-likelihood (i.e., negative entropy), we have

$$ $\displaystyle\frac{\epsilon}{\bar{\gamma}}\mathbb{E}_{\gamma}L_{p}(\gamma,\arg \max\circ p)$ (27) $\displaystyle=$ $\displaystyle\frac{\epsilon}{\bar{\gamma}}{E}_{\gamma}\mathbb{E}_{x_{1:t}\in \mathcal{X}}\max_{x_{t+1:t+\gamma}}\log p(x_{t+1:t+\gamma}|x_{1:t})$ $\displaystyle\leq$ $\displaystyle\frac{\epsilon}{\bar{\gamma}}{E}_{\gamma}\mathbb{E}_{x_{1:t}\in \mathcal{X}}\sum_{x_{t+1:t+\gamma}}p(x_{t+1:t+\gamma}|x_{1:t})\log p(x_{t+1:t+ \gamma}|x_{1:t})$ $\displaystyle=$ $\displaystyle-\epsilon H(p)$ $$

In addition

$$ $\displaystyle\mathbb{E}_{\gamma}L_{p}(\gamma,\arg\max\circ p)-\mathbb{E}_{ \gamma}L_{q}(\gamma,\arg\max\circ q)$ (28) $\displaystyle=$ $\displaystyle\mathbb{E}_{\gamma}(L_{p}(\gamma,\arg\max\circ p)-L_{q}(\gamma, \arg\max\circ q))$ $\displaystyle=$ $\displaystyle\mathbb{E}_{\gamma}\left(\mathbb{E}_{x_{1:t}\in\mathcal{X}}\max_{ x_{t+1:t+\gamma}}\log p(x_{t+1:t+\gamma}|x_{1:t})-\mathbb{E}_{x_{1:t}\in \mathcal{X}}\max_{x_{t+1:t+\gamma}}\log q(x_{t+1:t+\gamma}|x_{1:t})\right)$ $\displaystyle=$ $\displaystyle\mathbb{E}_{\gamma}\mathbb{E}_{x_{1:t}\in\mathcal{X}}\left(\max_{ x_{t+1:t+\gamma}}\log p(x_{t+1:t+\gamma}|x_{1:t})-\max_{x_{t+1:t+\gamma}}\log q (x_{t+1:t+\gamma}|x_{1:t})\right)$ $\displaystyle\leq\mathbb{E}_{\gamma}\mathbb{E}_{x_{1:t}\in\mathcal{X}}\max_{x_ {t+1:t+\gamma}}\left(\log p(x_{t+1:t+\gamma}|x_{1:t})-\log q(x_{t+1:t+\gamma}| x_{1:t})\right)$ $\displaystyle=\mathbb{E}_{\gamma}\mathbb{E}_{x_{1:t}\in\mathcal{X}}\max_{x_{t+ 1:t+\gamma}}\left(\sum_{i=1}^{\gamma}\log p(x_{t+i}|x_{1:t+i-1})-\log q(x_{t+i }|x_{1:t+i-1})\right)$ $\displaystyle\leq\mathbb{E}_{\gamma}\mathbb{E}_{x_{1:t}\in\mathcal{X}}U\gamma \quad(because\ \|\log p(x|x_{1:t})-\log q(x|x_{1:t})\|_{\infty}\leq U)$ $\displaystyle=U\bar{\gamma}$ $$

And $H(p,q)=H(p)+KL(p\|q)$.

$$ $\displaystyle KL(p\|q)$ $\displaystyle=\mathbb{E}_{x_{1:t}\in\mathcal{X}}\sum_{x}p(x|x_{1:t})(\log p(x| x_{1:t})-\log p(x|x_{1:t}))$ (29) $\displaystyle\leq\mathbb{E}_{x_{1:t}\in\mathcal{X}}\sum_{x}p(x|x_{1:t})U\leq U$ $$

So $H(p,q)\leq H(p)+U$. Therefore,

$$ $\lim_{N\rightarrow\infty}\frac{PPL_{p}(x_{1:\Gamma_{N}})}{PPL_{p}(x^{*}_{1: \Gamma_{N}})}\leq\tau^{-\frac{1}{\bar{\gamma}}}\exp\left(\frac{(1-\epsilon\bar {\gamma})H(p)+(1-\epsilon+\bar{\gamma})U}{\bar{\gamma}}\right)$ (30) $$

∎

###### Proof.

### A.5 Proof of Theorem 3.6

###### Proof.

Recall that we accept $x_{t+1:t+j}$ if and only if $\log p(x_{t+1:t+j}|x_{1:t})-\log q(x_{t+1:t+j}|x_{1:t})\geq\log\tau$. Since $\|\log p(x|x_{1:t})-\log q(x|x_{1:t})\|_{\infty}\leq U$, we have

$$ $\log p(x_{t+1:t+j}|x_{1:t})-\log q(x_{t+1:t+j}|x_{1:t})\geq-jU$ (31) $$

Therefore $x_{t+1:t+j}$ is always accepted if $j\leq\frac{|\log\tau|}{U}$. So $\bar{\gamma}\geq\frac{|\log\tau|}{U}$
∎

###### Proof.

## Appendix B Pseudocode of MJSD

See Algorithm 1.

Figure: Algorithm 1 One Iteration of MTAD Algorithm

**Table 8: Dataset Statistics**
| Dataset | Task | Avg. Input Len |
| --- | --- | --- |
| ChatGPT-Prompt | Instruction | 25.2 |
| ChatAlpaca | Chat | 277.7 |
| CNNDM | Summarization | 3,967.1 |
| Spider | Text-to-SQL | 347.68 |
| MT-Bench | Various(^1^11The tasks of MT-Bench cover humanities, extraction, roleplay, math, coding, reasoning, stem, writing, and STEM.) | N/A(^2^22MT-Bench contains multi-turn tasks where the input includes the responses of LLMs, so the input length is not fixed.) |

## Appendix C Additional Experiments

### C.1 Resutlts with OPT-30B and Llama-2-70B

Here we report the performances of different methods for OPT (350M and 30B) and Llama-2-Chat (7B and 70B). Table 9 shows the average performances across all datasets. MTAD always achieves the lowest perplexity and the best efficiency.

**Table 9: Inference efficiency and output perplexity of different methods with OPT (350M,30B) and Llama-2-Chat (7B,70B). The mean and standard deviation are computed across all datasets. Bold numbers mark the best result, underlined numbers mark the second best.**
| \hlineB3 |  | speculative | BiLD | Spectr | SpecInfer | MTAD |
| --- | --- | --- | --- | --- | --- | --- |
| \hlineB3<br>Llama-2 | speed (token/s) $\uparrow$ | 8.37$\pm$3.07 | 8.64$\pm$3.50 | 9.11$\pm$3.03 | 8.87$\pm$2.82 | 9.53$\pm$3.29 |
| energy (J/token) $\downarrow$ | 138$\pm$87.7 | 142$\pm$99.7 | 122$\pm$66.4 | 125$\pm$65.4 | 119$\pm$67.7 |  |
| perplexity $\downarrow$ | 1.77$\pm$0.22 | 1.69$\pm$0.25 | 1.73$\pm$0.24 | 1.73$\pm$0.24 | 1.52$\pm$0.19 |  |
| OPT | speed (token/s) $\uparrow$ | 15.3$\pm$1.64 | 14.5$\pm$1.96 | 17.0$\pm$4.14 | 17.4$\pm$4.00 | 19.5$\pm$4.11 |
| energy (J/token) $\downarrow$ | 72.4$\pm$11.5 | 79.6$\pm$3.03 | 68.2$\pm$16.7 | 62.4$\pm$10.3 | 60.0$\pm$12.8 |  |
| perplexity $\downarrow$ | 4.74$\pm$1.96 | 3.50$\pm$1.42 | 4.55$\pm$1.93 | 4.49$\pm$ 1.95 | 2.74$\pm$0.87 |  |
| \hlineB3 |  |  |  |  |  |  |

### C.2 Ablation study of top-k and top-p sampling

Here we conduct an ablation study to show how the value of $k$ and $p$ in top-k and top-p warping affects our method. Table 10 shows the results. We can see that when changing the value of $k$ and $p$, MTAD consistently achieves significantly better performances.

**Table 10: Ablation study of $k$ and $p$ in top-k and top-p sampling**
| K | P | Greedy | Speculative | MJSD |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
|  |  | PPL | Tokens/sec | PPL | Tokens/sec | PPL | Tokens/sec |
| 20 | 0.9 | 3.74 | 22.6 | 3.64 | 36.8 | 2.06 | 63.0 |
| 20 | 0.8 | 3.06 | 22.7 | 3.10 | 38.5 | 1.93 | 58.8 |
| 10 | 0.9 | 3.03 | 22.7 | 3.22 | 38.5 | 1.95 | 62.5 |
| 10 | 0.8 | 2.56 | 22.7 | 2.53 | 40.0 | 1.80 | 62.5 |

### C.3 Additional Experiments on CNNDM and Spider

We also report the downstream effectiveness of our method on CNNDM and Spider when the small model and large model are fine-tuned on the dataset. Table 11 and Table 12 show the results. We can see that MTAD consistenly achieve better effectiveness as well as faster decoding speed.

**Table 11: Comparison of ROUGE-L Scores and Tokens per Second under Different Fine-Tuning Conditions on CNNDM**
|  | No Fine-Tune | Fine-Tune 68M | Fine-Tune Both |  |  |  |
| --- | --- | --- | --- | --- | --- | --- |
| Method | ROUGE-L | Tokens/sec | ROUGE-L | Tokens/sec | ROUGE-L | Tokens/sec |
| Speculative | 0.114 | 37.7 | 0.114 | 20.4 | 0.164 | 24.3 |
| MJSD | 0.118 | 44.2 | 0.121 | 25.0 | 0.168 | 27.1 |

**Table 12: Comparison of Execution Accuracy (EA) and Tokens per Second under Different Fine-Tuning Conditions on Spider**
|  | No Fine-Tune | Fine-Tune 68M | Fine-Tune Both |  |  |  |
| --- | --- | --- | --- | --- | --- | --- |
| Method | EA | Tokens/sec | EA | Tokens/sec | EA | Tokens/sec |
| Speculative | 11.5 | 28.5 | 11.5 | 27.8 | 16.3 | 25.6 |
| MJSD | 13.0 | 30.3 | 14.8 | 32.3 | 18.3 | 29.4 |

## Appendix D Energy Consumption Measurement

We use the command "nvidia-smi --query-gpu=power.draw --format=csv" to get GPU power every second, and sum them up as the total energy consumption.
We use average energy consumption per token to measure energy efficiency. There is a recent study pointing out the measurement error using nvidia-smi (Yang et al., ). We follow the three principles proposed in (Yang et al., ) to minimize the error.

## Appendix E Configuration

The experiments are conducted on a machine with 1 Nvidia L40 GPU (48 GB), 4 CPUs, and 50 GB main memory, using a batch size of 1, which is common for online serving (Schuster et al., ). We set the maximum running time to be an hour for each baseline. We use average tokens/second to measure the inference speed and use perplexity (exponentiated average negative log-likelihood) based on the probability of the large model to measure the output quality. Because different methods might finish different numbers of inputs, we only calculate the perplexity of the first $M$ inputs, where $M$ is the number of inputs finished by greedy decoding.
We use average energy consumption per token to measure energy efficiency. The details of energy measurement are illustrated in the Appendix.

## Appendix F Hyper-parameter Details

In the experiments, we follow the default settings in (Bear, ) to warp the sampling distribution $p$ and $q$ with the following steps, which are the default warpping operations in a public speculative decoding implementation.

- 1.
Keep the probabilities of top 20 tokens unchanged, and set the probabilities of other tokens to 0, then normalize the distribution.
- 2.
Sort the tokens based on their distributions descendingly. Keep the first $K$ tokens such that their cumulative probabilities is larger than 0.9, while set the probabilities of other tokens to 0.

For different methods, we choose their hyper-parameters by using a small validation set. We select the set of hyper-parameters that make the corresponding method have best output perplexity. Table 13 shows the hyper-parameters used in the experiments.

**Table 13: Hyper-parameters of different methods for different models and datasets. L: Llama, O:OPT, CP: ChatGPT-Prompts, CA: ChatAlpaca, CD: CNNDaily.**
|  |  | L,CP | O,CP | L,CA | O,CA | L,CD | O,CD | L,SP | O,SP | L,MT | O,MT |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| speculative | step len $\gamma$ | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 |
| Spectr&SpecInfer | step len $\gamma$ | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 |
| num seq $m$ | 4 | 4 | 2 | 2 | 4 | 2 | 2 | 2 | 2 | 2 |  |
| BiLD | step len $\gamma$ | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 |
| fallback thres $\tau_{1}$ | 0.9 | 0.9 | 0.9 | 0.3 | 0.9 | 0.3 | 0.9 | 0.9 | 0.9 | 0.9 |  |
| rollback thres $\tau_{2}$ | 2 | 2 | 1 | 2 | 3 | 2 | 1 | 1 | 1 | 1 |  |
| MTAD | step len $\gamma$ | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 |
| num beams | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 |  |
| acc/rej thres $\tau$ | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 | 0.9 | 0.1 | 0.9 | 0.1 |  |

## Appendix G License of Datasets and Models

Datasets:

- •
ChatGPT-Prompts: Non (https://huggingface.co/datasets/MohamedRashad/ChatGPT-prompts)
- •
ChatAlpaca: Apache-2.0 License
- •
CNN Dailymail: Apache-2.0 License

Models

- •
OPT-125M and OPT-13B: Model License ([https://github.com/facebookresearch/metaseq/blob/main/projects/OPT/MODEL_LICENSE.md](https://github.com/facebookresearch/metaseq/blob/main/projects/OPT/MODEL_LICENSE.md))
- •
Llama-68M: Apache-2.0 License
- •
Llama-2-13B: Llama-2 Community License Agreement

Codes

- •
LLMSpeculativeSampling ([https://github.com/feifeibear/LLMSpeculativeSampling](https://github.com/feifeibear/LLMSpeculativeSampling))

## Peer Reviews

confidence: 4
contribution: 3
initial_rating: 5
presentation: 2
questions: target model (larger model) is fine-tuned on chat-GPT data for proposed method, is the same fine-tuned model used for other Speculative Decoding (SpD) methods as well? 

What about the draft model? is that fine-tuned as well or used as is? 

Can qualitative generations be shown in the paper? There are cases when lower PPL is observed during SpD as the draft and target model are both generating and accepting repeated tokens.

Did the author also check performances (PPL, speed-up) when using a larger draft model? 

From table 4., it seems like for past SpD methods there is no correlation between high speed (token/s) will lead to low energy (Joule/s), but that doesn't seem to make sense, as both high speed and low energy should be related to high acceptance rate which leads to small number of target model calls. Any comment/thoughts on this? 

Can the authors also add plots on acceptance threshold vs acceptance rate? Given the high token-rates shown in Table 4., I am curious to see how the acceptance rates look like.
soundness: 3
strengths: The paper solves an interesting problem of sampling from a joint distribution which is challenging and proposes an alternate approximate method based on draft model from Speculative Decoding (SpD) 

It uses ideas from SpD to also boost the inference speed.

Paper uses an auxiliary model to predict joint distribution of multiple tokens w/ beam sampling to sample the tokens fast. 

The power analysis provides some insight into the importance of using SpD

Authors provide a robust set of experiments
summary: The paper proposed multi-token assisted decoding by combining multi-token joint decoding and speculative decoding (SpD) to improve the quality of the tokens and inference speed.
weaknesses: the experiment results can be re-checked, my concern is that lower PPL not always results in better quality, it could also be that the draft model is generating repeated tokens which the target model is accepting, given that there's no guarantee that the draft tokens accepted will follow the target distribution. 

the reduction in energy consumption is a by-product of SpD and could have been mentioned in a sub-section rather a full section. 
The acceptance rate of draft model should affect both the token-rate and the energy consumption.

No mention of draft model or target model training and if they are different from the baseline algorithms draft and target model in the experiments section.

---

confidence: 4
contribution: 2
initial_rating: 5
presentation: 3
questions: 1. The threshold for the verification phase of vanilla speculative decoding is sampled from U(0, 1) to ensure losslessness, and MTAD uses a fixed threshold (e.g. 0.1). I'm curious to see if the same speedup can be achieved with the vanilla speculative decoding method using a fixed threshold.

2. The impact from loose thresholds has little effect with PPL and LM-Judger metrics, some more rigorous evaluation (e.g., Humaneval's Pass@K) is needed to validate the methodology.
soundness: 3
strengths: 1. The proposed MTAD guides the generation and verification of draft tokens based on joint probabilities, providing a new idea for speculative decoding.

2. This paper analyzes the speculative decoding technique from an energy perspective for the first time and verifies the energy efficiency of speculative decoding. 

3. In addition to the experimental analysis, the authors also theoretically demonstrate the bounded error as well as the effectiveness of the MTAD algorithm.
summary: This paper introduces a new framework named multi-token assisted decoding (MTAD) by combining speculative decoding with multi-token joint decoding (MTJD). MTAD generates high quality draft tokens by estimating the joint distribution of the target model using draft model, while improving both the speed and quality of inference.
weaknesses: 1. Despite generating texts with lower perplexity, MTAD is still a lossy speculative decoding method. It is unfair to compare MTAD with lossless speculative decoding methods. It might be useful to add some comparisons with other lossy verification methods (e.g. Medusa's Typical Sampling) to verify the superiority of MTAD.

2. The main experiments in this paper use perplexity as an evaluation criterion for performance, and it is clear that MTAD based on PPL verification will have advantages. More experiments on downstream tasks are needed to verify whether MTAD can really improve the quality of text, since PPL and metrics are not strictly positively correlated.

---

confidence: 4
contribution: 2
initial_rating: 5
presentation: 3
questions: See above.
soundness: 2
strengths: - The writing is good and easy to follow.
- The addressed problem is of great importance to the community.
- A new metric is provided to evaluate the effectiveness of speculative sampling, which is insightful.
- Strong experimental results:
  - Evaluated across a range of datasets
  - Shows significant improvements in terms of perplexity, speed, and energy efficiency.
summary: This paper focuses on improving the inference speed of large language models (LLMs). The authors propose a variant of speculative sampling that enhances both inference speed and output quality. Specifically, they explore multi-token joint decoding (MTJD), which generates multiple tokens from their joint distribution at each iteration, theoretically reducing perplexity and improving task performance. Building on this, they incorporate speculative sampling to approximate multi-token joint decoding and design an efficient algorithm, multi-token assistant decoding (MTAD), which achieves bounded error with respect to MTJD. Empirical evaluations demonstrate the effectiveness of the proposed method in terms of speed and perplexity.
weaknesses: - In line 114, the authors claim, “As shown in Table 1, lower perplexity correlates with improved downstream performance, even in one of today’s largest models.” This assertion is questionable. The results in Table 1 are based exclusively on experiments with the Spider dataset, but in many cases, lower perplexity does not inherently lead to better downstream performance. For example, in tasks like machine translation and abstractive summarization, a lower perplexity score sometimes fails to correlate with improved downstream performance. This also can be validated by the right plot in Figure 1.
- Lack of guarantee on quality: In vanilla speculative sampling and multi-draft speculative sampling, one of their advantages is the property of being lossless. This ensures that the quality of output is maintained, which further accelerates LLM inference. However, the proposed method does not have such guarantee. 
- The verification process in this work is similar to that in [1], as both aim to verify a sub-sequence of tokens in a single step rather than one token at a time. However, this study does not include a comparison between MTAD and the method in [1]. The author should further compare their work with it to further improve the quality.
- The experiments also have some limitations:
  - This paper places too much emphasis on perplexity. Since a lower perplexity score does not always correlate with improved downstream performance, the authors should provide a more comprehensive evaluation of downstream performance. I noticed that Table 6 contains some comparisons on downstream performance, but this is insufficient. I encourage the authors to add a "downstream performance" metric to Table 4 so that readers can better understand the effectiveness of the proposed method.
  - I still do not fully understand why the proposed method significantly outperformed multi-draft speculative sampling methods such as Specter and SpecInfer. I suspect this is because (1) the selected baseline is weak, and (2) the configurations are not fair. For example, in Table 13, the number of sequences in Specter and SpecInfer does not match the number of beams in MTAD. I encourage the authors to do the following: (1) select more recent multi-draft speculative sampling methods for comparison, and (2) ensure consistent configurations.


[1] Sun, et al. Optimal Block-Level Draft Verification for Accelerating Speculative Decoding.

---

confidence: 3
contribution: 3
initial_rating: 5
presentation: 3
questions: Please refer to the weakness.
soundness: 3
strengths: 1. This paper theoretically proves that multi-token joint decoding (MTJD) can reduce perplexity and improve task performance compared to single token decoding.
2. This paper introduces multi-token assisted decoding (MTAD), a novel framework designed to accelerate multi-token joint decoding. Theoretically, this paper demonstrate that MTAD closely approximates exact MTJD with bounded error.
3. These results highlight MTAD’s ability to make multi-token joint decoding both effective and efficient.
summary: Considering the inference efficiency, this paper proposes multi-token joint decoding (MTJD), which generates multiple tokens from their joint distribution at each iteration. More importantly, this paper theoretically proves that their method can reduce perplexity and improve task performance compared to single token decoding. Besides, to mitigate the high cost of sampling from the joint distribution of multiple tokens, it introduce a small model to assist the decoding of a larger model. Empirical evaluations reveal that the method reduces perplexity
by 21.2% and improves downstream performance compared to standard single-token sampling. It also achieves a 1.42× speed-up and consumes 1.54× less energy than conventional speculative decoding methods.
weaknesses: 1. This paper primarily conducted experiments on the OPT series and Llama 2 series models. However, the performance of these large models has already fallen far behind the recent Llama 3.1 and Llama 3.2. Could you provide more results on the latest models to demonstrate the generality of the results?

2. The previous methods compared in this paper were all published last year. It would be beneficial to compare with some recently published methods, such as MEDUSA-2 and "Better & Faster Large Language Models via Multi-token Prediction", to prove the effectiveness of the results.

3. In this paper, a major point is that multi-token joint decoding can reduce perplexity and improve task performance. However, the experimental results do not reflect related analytical experiments. Adding relevant experiments could enhance the self-consistency of the method.

Meta-review: The paper introduces Multi-Token Assisted Decoding (MTAD), a speculative decoding framework combining multi-token joint decoding (MTJD) with speculative decoding (SpD).  The proposed framework demonstrates significant gains in perplexity (21.2% reduction), task performance, speed-up (1.42×), and energy efficiency (1.54×) across multiple datasets.

**Strengths** (1) The paper improves speculative decoding with multi-token joint decoding, which advances beyond single-token-based methods. A theoretical analysis of bounded error provides additional insight into the method. (2) Comprehensive evaluation of multiple datasets and tasks.

**Weaknesses** (1) Limited comparison with recent baselines and qualitative analysis (2) Some reviewers raised concerns about the relationship between perplexity and quality

**Decision** Considering the novelty of the proposed methods, and how all the reviewers found the rebuttal addressing their original concerns, I am leaning toward acceptance.

Decision: Accept (Poster)