Robust Length Prediction: A Perspective from Heavy-Tailed Prompt-Conditioned Distributions
Organizations: State Key Laboratory of Novel Software Technology, Nanjing University, Nanjing 210023, China · School of Artificial Intelligence, Nanjing University, Nanjing 210023, China
Abstract
Output-length prediction is important for efficient LLM serving, as it directly affects batching, memory reservation, and scheduling. For prompt-only length prediction, most existing methods use a one-shot sampled length as the label, implicitly treating each prompt as if it had one true target length. We show that this is unreliable: even under a fixed model and decoding setup, the same prompt induces a prompt-conditioned output length distribution, not a deterministic scalar, and this distribution is consistent with heavy-tailed behavior. Motivated by this, we cast length prediction as robust estimation from heavy-tailed prompt-conditioned length distributions. We propose prompt-conditioned length distribution (ProD) methods, which construct training targets from multiple independent generations of the same prompt. Two variants are developed to reuse the served LLM's hidden states: \mbox{ProD-M}, which uses a median-based target for robust point prediction, and ProD-D, which uses a distributional target that preserves prompt-conditioned uncertainty. We provide theoretical justifications by analyzing the estimation error under a surrogate model. Experiments across diverse scenarios show consistent gains in prediction quality.
Figures & tables
| Method | Qwen | Llama | ||||||||
| Math | Coding | LongSeq | Chat | Avg | Math | Coding | LongSeq | Chat | Avg | |
| Constant Median | 59.59 | 56.41 | 146.11 | 264.90 | 131.75 | 32.07 | 37.83 | 95.69 | 213.31 | 94.73 |
| 41.60 | 57.28 | 72.21 | 185.84 | 89.23 | 24.41 | 41.28 | 50.01 | 142.28 | 64.50 | |
| TRAIL-mean | 44.04 | 44.70 | 72.70 | 143.50 | 76.24 | 26.29 | 37.93 | 50.99 | 116.84 | 58.01 |
| TRAIL-last | 35.13 | 36.63 | 57.68 | 127.47 | 64.23 | 24.51 | 35.74 | 41.04 | 95.03 | 49.08 |
| EGTP | 49.50 | 57.14 | 69.84 | 276.27 | 113.19 | 28.25 | 37.98 | 46.73 | 148.08 | 65.26 |
| Method | Qwen | Llama | ||||||
| Math | Coding | LongSeq | Chat | Math | Coding | LongSeq | Chat | |
| 54.79 0.8 | 63.38 1.1 | 96.00 6.6 | 201.33 4.7 | 33.31 1.3 | 52.57 2.9 | 82.97 3.8 | 154.78 4.1 | |
| TRAIL-mean | 59.74 3.0 | 59.21 2.8 | 99.58 6.2 | 174.14 5.6 | 34.59 1.4 | 46.71 3.1 | 87.13 4.4 | 137.98 6.5 |
| TRAIL-last | 54.11 8.2 | 56.44 7.4 | 88.07 4.9 | 154.45 6.0 | 32.48 1.1 | 45.29 4.1 | 76.75 2.9 | 112.84 5.3 |
| EGTP | 67.30 7.5 | 62.89 1.0 | 96.84 6.1 | 278.12 5.3 | 36.39 1.6 | 49.55 2.9 | 81.37 3.6 | 163.95 5.0 |
| ProD-M | 47.10 0.8 | 43.43 1.1 | 86.00 5.2 | 147.18 4.6 | 29.32 1.0 | 40.86 3.8 | 73.22 3.2 | 109.73 3.9 |
| Method | Qwen | Llama | ||||||
| Math | Coding | LongSeq | Chat | Math | Coding | LongSeq | Chat | |
| 43.91 0.5 | 57.56 0.2 | 75.65 2.0 | 186.75 3.6 | 25.76 0.7 | 44.69 2.8 | 55.57 1.2 | 146.21 3.8 | |
| TRAIL-mean | 49.84 2.8 | 52.82 2.6 | 80.64 3.3 | 158.33 5.3 | 27.16 0.3 | 36.61 1.8 | 60.07 3.7 | 129.79 4.4 |
| TRAIL-last | 42.46 9.6 | 49.47 8.0 | 67.91 1.2 | 138.46 6.3 | 24.89 0.2 | 35.23 1.6 | 48.11 0.9 | 102.48 2.6 |
| EGTP | 58.56 9.2 | 56.90 0.3 | 77.14 3.0 | 266.55 3.1 | 29.70 1.1 | 40.80 2.1 | 53.55 1.0 | 156.07 4.5 |
| ProD-M | 33.56 0.4 | 35.01 1.2 | 65.44 1.3 | 130.60 2.6 | 20.79 0.2 | 29.05 1.0 | 43.45 1.4 | 98.95 1.3 |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
LLM Serving
Large language model serving studies how to deliver model responses with low latency, high throughput, and efficient use of compute and memory.
See all 207 papers