Task-Centric Acceleration of Small-Language Models
Organizations: Amazon
Abstract
Small language models (SLMs) have emerged as efficient alternatives to large language models for task-specific applications. However, they are often employed in high-volume, low-latency settings, where efficiency is crucial. We propose TASC, Task-Adaptive Sequence Compression, a framework for SLM acceleration comprising two use-cases: When performing SLM fine-tuning, we propose TASC-ft, which iteratively enriches the tokenizer vocabulary with high-frequency output n-grams and then fine-tunes the model to utilize the expanded vocabulary. Next, we propose an inference-time method, termed TASC-spec. TASC-spec is a lightweight, training-free speculative decoding method that constructs an n-gram draft model from the task's output corpus, mixing task and context n-gram information.TASC-spec avoids any additional training, while bypassing draft-target vocabulary alignment constraints. We demonstrate the effectiveness of both methods across multiple low output-variability generation tasks. Our methods show consistent improvements in inference efficiency while maintaining task performance.
Figures & tables
| Bigram Entropy | # Unique Bigrams For CDF | |||||
|---|---|---|---|---|---|---|
| Task | Input | Output | Input | Output | Ratio | |
| Sentiment Analysis (Finance) | ||||||
| Yes/No Questions (Medical) | ||||||
| POS Tagging | ||||||
| Intent Classification & Slot Fill | ||||||
| Massive Classification (Legal) | ||||||
| # Added Tokens | ||||||
|---|---|---|---|---|---|---|
| Judge Score |
| Dataset | Method | Speedup |
|---|---|---|
| Asclepius | ||
| TASC-spec (ours) | ||
| N-Grammys (bigram) | ||
| N-Grammys (mixed) | ||
| MedQuaD | ||
| TASC-spec (ours) |
| Task | Dataset Name |
|---|---|
| Sentiment Analysis (Finance) | Malo et al. (2014) |
| Yes/No Questions (Medical) | Kweon et al. (2024) |
| POS Tagging | Silveira et al. (2014) |
| Intent Classification & Slot Fill | FitzGerald et al. (2023) |
| Massive Classification (Legal) | Chalkidis et al. (2019) |
| Abbreviation Expansion (Medical) | Kweon et al. (2024) |
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| Number of tokens | Intent accuracy ( ) | Slot F1 ( ) | Joint accuracy ( ) | Average sample runtime [ms] ( ) |
| 0 | 90.4 | 76.45 | 63.0 | 302 |
| 250 | 91.5 | 77.0 | 64.6 | 260 |
| 500 | 91.3 | 77.0 | 64.3 | 258.9 |
| 1000 | 91.1 | 76.2 | 63.4 | 256 |
| Method | TASC-ft | TASC-spec |
|---|---|---|
| Speedup |
| EUR-LEX | ||
| # Train Epochs | F1 | Avg. runtime |
| MASSIVE | ||
| # Added Tokens | F1 score | Average Runtime [ms] |
|---|---|---|
| 0 | ||
| 150 | ||
| 500 | ||
| 1000 |
| - | Output | Input | ||
|---|---|---|---|---|
| Dataset | Entropy (before) | Entropy (after) | Entropy (before) | Entropy (after) |
| EUR-LEX | 0.423 | 0.592 | 0.4502 | 0.455 |
| Asclepius | 0.402 | 0.537 | 0.479 | 0.562 |