Discoveries

Machine-actionable research packages, ranked by earned attention.

Filter by topicshow ▾
L1
attested
KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache

Efficiently serving large language models (LLMs) requires batching of many requests to reduce the cost per request. Yet, with larger batch sizes and longer context lengths, the key-value (KV) cache, which stores attention keys and values to avoid re-computations, significantly increases memory demands and becomes the new bottleneck in speed and memory usage. Additionally, the loading of the KV cache causes the computational core to be idle, which limits the inference speed. A straightforward and effective solution to reduce KV cache size is quantization, which decreases the total bytes taken by KV cache. However, there is a lack of in-depth studies that explore the element distribution of KV cache to understand the hardness and limitation of KV cache quantization. To fill the gap, we conducted a comprehensive study on the element distribution in KV cache of popular LLMs. Our findings indicate that the key cache should be quantized per-channel, i.e., group elements along the channel dimension and quantize them together. In contrast, the value cache should be quantized per-token. From this analysis, we developed a tuning-free 2bit KV cache quantization algorithm named KIVI. With hardware-friendly implementation, KIVI can enable Llama, Falcon, and Mistral models to maintain almost the same quality while using $\mathbf{2.6\times}$ less peak memory (including model weight). This reduction in memory usage enables up to $\mathbf{4\times}$ larger batch size, bringing $\mathbf{2.35\times \sim 3.47\times}$ throughput on real LLM inference workload. The source code is available at https://github.com/jy-yuan/KIVI.

cs.CL 1 claims attention 4.0 #cs.cl #cs.lg #cs.pf
L1
attested
H$_2$O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models

Large Language Models (LLMs), despite their recent impressive accomplishments, are notably cost-prohibitive to deploy, particularly for applications involving long-content generation, such as dialogue systems and story writing. Often, a large amount of transient state information, referred to as the KV cache, is stored in GPU memory in addition to model parameters, scaling linearly with the sequence length and batch size. In this paper, we introduce a novel approach for implementing the KV cache which significantly reduces its memory footprint. Our approach is based on the noteworthy observation that a small portion of tokens contributes most of the value when computing attention scores. We call these tokens Heavy Hitters (H$_2$). Through a comprehensive investigation, we find that (i) the emergence of H$_2$ is natural and strongly correlates with the frequent co-occurrence of tokens in the text, and (ii) removing them results in significant performance degradation. Based on these insights, we propose Heavy Hitter Oracle (H$_2$O), a KV cache eviction policy that dynamically retains a balance of recent and H$_2$ tokens. We formulate the KV cache eviction as a dynamic submodular problem and prove (under mild assumptions) a theoretical guarantee for our novel eviction algorithm which could help guide future work. We validate the accuracy of our algorithm with OPT, LLaMA, and GPT-NeoX across a wide range of tasks. Our implementation of H$_2$O with 20% heavy hitters improves the throughput over three leading inference systems DeepSpeed Zero-Inference, Hugging Face Accelerate, and FlexGen by up to 29$\times$, 29$\times$, and 3$\times$ on OPT-6.7B and OPT-30B. With the same batch size, H2O can reduce the latency by up to 1.9$\times$. The code is available at https://github.com/FMInference/H2O.

cs.LG 1 claims attention 4.0 #cs.lg #llm-efficiency #kv-cache
L1
attested
Efficient Streaming Language Models with Attention Sinks

Deploying Large Language Models (LLMs) in streaming applications such as multi-round dialogue, where long interactions are expected, is urgently needed but poses two major challenges. Firstly, during the decoding stage, caching previous tokens' Key and Value states (KV) consumes extensive memory. Secondly, popular LLMs cannot generalize to longer texts than the training sequence length. Window attention, where only the most recent KVs are cached, is a natural approach -- but we show that it fails when the text length surpasses the cache size. We observe an interesting phenomenon, namely attention sink, that keeping the KV of initial tokens will largely recover the performance of window attention. In this paper, we first demonstrate that the emergence of attention sink is due to the strong attention scores towards initial tokens as a "sink" even if they are not semantically important. Based on the above analysis, we introduce StreamingLLM, an efficient framework that enables LLMs trained with a finite length attention window to generalize to infinite sequence lengths without any fine-tuning. We show that StreamingLLM can enable Llama-2, MPT, Falcon, and Pythia to perform stable and efficient language modeling with up to 4 million tokens and more. In addition, we discover that adding a placeholder token as a dedicated attention sink during pre-training can further improve streaming deployment. In streaming settings, StreamingLLM outperforms the sliding window recomputation baseline by up to 22.2x speedup. Code and datasets are provided at https://github.com/mit-han-lab/streaming-llm.

cs.CL 1 claims attention 4.0 #cs.ai #cs.cl #llm-efficiency
L1
attested
DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model

We present DeepSeek-V2, a strong Mixture-of-Experts (MoE) language model characterized by economical training and efficient inference. It comprises 236B total parameters, of which 21B are activated for each token, and supports a context length of 128K tokens. DeepSeek-V2 adopts innovative architectures including Multi-head Latent Attention (MLA) and DeepSeekMoE. MLA guarantees efficient inference through significantly compressing the Key-Value (KV) cache into a latent vector, while DeepSeekMoE enables training strong models at an economical cost through sparse computation. Compared with DeepSeek 67B, DeepSeek-V2 achieves significantly stronger performance, and meanwhile saves 42.5% of training costs, reduces the KV cache by 93.3%, and boosts the maximum generation throughput to 5.76 times. We pretrain DeepSeek-V2 on a high-quality and multi-source corpus consisting of 8.1T tokens, and further perform Supervised Fine-Tuning (SFT) and Reinforcement Learning (RL) to fully unlock its potential. Evaluation results show that, even with only 21B activated parameters, DeepSeek-V2 and its chat versions still achieve top-tier performance among open-source models.

cs.CL 1 claims attention 4.0 #cs.ai #cs.cl #llm-efficiency
L1
attested
Fast Inference from Transformers via Speculative Decoding

Inference from large autoregressive models like Transformers is slow - decoding K tokens takes K serial runs of the model. In this work we introduce speculative decoding - an algorithm to sample from autoregressive models faster without any changes to the outputs, by computing several tokens in parallel. At the heart of our approach lie the observations that (1) hard language-modeling tasks often include easier subtasks that can be approximated well by more efficient models, and (2) using speculative execution and a novel sampling method, we can make exact decoding from the large models faster, by running them in parallel on the outputs of the approximation models, potentially generating several tokens concurrently, and without changing the distribution. Our method can accelerate existing off-the-shelf models without retraining or architecture changes. We demonstrate it on T5-XXL and show a 2X-3X acceleration compared to the standard T5X implementation, with identical outputs.

cs.LG 1 claims attention 4.0 #cs.cl #cs.lg #llm-efficiency
L1
attested
Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Heads

Large Language Models (LLMs) employ auto-regressive decoding that requires sequential computation, with each step reliant on the previous one's output. This creates a bottleneck as each step necessitates moving the full model parameters from High-Bandwidth Memory (HBM) to the accelerator's cache. While methods such as speculative decoding have been suggested to address this issue, their implementation is impeded by the challenges associated with acquiring and maintaining a separate draft model. In this paper, we present Medusa, an efficient method that augments LLM inference by adding extra decoding heads to predict multiple subsequent tokens in parallel. Using a tree-based attention mechanism, Medusa constructs multiple candidate continuations and verifies them simultaneously in each decoding step. By leveraging parallel processing, Medusa substantially reduces the number of decoding steps required. We present two levels of fine-tuning procedures for Medusa to meet the needs of different use cases: Medusa-1: Medusa is directly fine-tuned on top of a frozen backbone LLM, enabling lossless inference acceleration. Medusa-2: Medusa is fine-tuned together with the backbone LLM, enabling better prediction accuracy of Medusa heads and higher speedup but needing a special training recipe that preserves the backbone model's capabilities. Moreover, we propose several extensions that improve or expand the utility of Medusa, including a self-distillation to handle situations where no training data is available and a typical acceptance scheme to boost the acceptance rate while maintaining generation quality. We evaluate Medusa on models of various sizes and training procedures. Our experiments demonstrate that Medusa-1 can achieve over 2.2x speedup without compromising generation quality, while Medusa-2 further improves the speedup to 2.3-3.6x.

cs.LG 1 claims attention 4.0 #cs.cl #cs.lg #llm-efficiency
L1
attested
SGLang: Efficient Execution of Structured Language Model Programs

Large language models (LLMs) are increasingly used for complex tasks that require multiple generation calls, advanced prompting techniques, control flow, and structured inputs/outputs. However, efficient systems are lacking for programming and executing these applications. We introduce SGLang, a system for efficient execution of complex language model programs. SGLang consists of a frontend language and a runtime. The frontend simplifies programming with primitives for generation and parallelism control. The runtime accelerates execution with novel optimizations like RadixAttention for KV cache reuse and compressed finite state machines for faster structured output decoding. Experiments show that SGLang achieves up to 6.4x higher throughput compared to state-of-the-art inference systems on various large language and multi-modal models on tasks including agent control, logical reasoning, few-shot learning benchmarks, JSON decoding, retrieval-augmented generation pipelines, and multi-turn chat. The code is publicly available at https://github.com/sgl-project/sglang

cs.AI 1 claims attention 4.0 #cs.ai #cs.pl #llm-efficiency
L1
attested
Mooncake: A KVCache-centric Disaggregated Architecture for LLM Serving

Mooncake is the serving platform for Kimi, a leading LLM service provided by Moonshot AI. It features a KVCache-centric disaggregated architecture that separates the prefill and decoding clusters. It also leverages the underutilized CPU, DRAM, and SSD resources of the GPU cluster to implement a disaggregated cache of KVCache. The core of Mooncake is its KVCache-centric scheduler, which balances maximizing overall effective throughput while meeting latency-related Service Level Objectives (SLOs). Unlike traditional studies that assume all requests will be processed, Mooncake faces challenges due to highly overloaded scenarios. To mitigate these, we developed a prediction-based early rejection policy. Experiments show that Mooncake excels in long-context scenarios. Compared to the baseline method, Mooncake can achieve up to a 525% increase in throughput in certain simulated scenarios while adhering to SLOs. Under real workloads, Mooncake's innovative architecture enables Kimi to handle 75% more requests.

cs.DC 1 claims attention 4.0 #cs.ai #cs.ar #cs.dc
L1
attested
KVQuant: Towards 10 Million Context Length LLM Inference with KV Cache Quantization

LLMs are seeing growing use for applications which require large context windows, and with these large context windows KV cache activations surface as the dominant contributor to memory consumption during inference. Quantization is a promising approach for compressing KV cache activations; however, existing solutions fail to represent activations accurately in sub-4-bit precision. Our work, KVQuant, facilitates low precision KV cache quantization by incorporating several novel methods: (i) Per-Channel Key Quantization, where we adjust the dimension along which we quantize the Key activations to better match the distribution; (ii) Pre-RoPE Key Quantization, where we quantize Key activations before the rotary positional embedding to mitigate its impact on quantization; (iii) Non-Uniform KV Cache Quantization, where we derive per-layer sensitivity-weighted non-uniform datatypes that better represent the distributions; and (iv) Per-Vector Dense-and-Sparse Quantization, where we isolate outliers separately for each vector to minimize skews in quantization ranges. By applying our method to the LLaMA, Llama-2, Llama-3, and Mistral models, we achieve < 0.1 perplexity degradation with 3-bit quantization on both Wikitext-2 and C4, outperforming existing approaches. Our method enables serving LLaMA-7B with a context length of up to 1 million on a single A100-80GB GPU and up to 10 million on an 8-GPU system. We develop custom CUDA kernels for KVQuant, showing that we can achieve up to ~1.7x speedups, compared to baseline fp16 matrix-vector multiplications, for the LLaMA-7B model.

cs.LG 1 claims attention 4.0 #cs.lg #kv-cache #llm-inference
L1
attested
Model Tells You What to Discard: Adaptive KV Cache Compression for LLMs

In this study, we introduce adaptive KV cache compression, a plug-and-play method that reduces the memory footprint of generative inference for Large Language Models (LLMs). Different from the conventional KV cache that retains key and value vectors for all context tokens, we conduct targeted profiling to discern the intrinsic structure of attention modules. Based on the recognized structure, we then construct the KV cache in an adaptive manner: evicting long-range contexts on attention heads emphasizing local contexts, discarding non-special tokens on attention heads centered on special tokens, and only employing the standard KV cache for attention heads that broadly attend to all tokens. Moreover, with the lightweight attention profiling used to guide the construction of the adaptive KV cache, FastGen can be deployed without resource-intensive fine-tuning or re-training. In our experiments across various asks, FastGen demonstrates substantial reduction on GPU memory consumption with negligible generation quality loss. We will release our code and the compatible CUDA kernel for reproducibility.

cs.CL 1 claims attention 4.0 #cs.cl #kv-cache #llm-inference
L1
attested
Fast Distributed Inference Serving for Large Language Models

Large language models (LLMs) power a new generation of interactive AI applications exemplified by ChatGPT. The interactive nature of these applications demands low latency for LLM inference. Existing LLM serving systems use run-to-completion processing for inference jobs, which suffers from head-of-line blocking and long latency. We present FastServe, a distributed inference serving system for LLMs. FastServe exploits the autoregressive pattern of LLM inference to enable preemption at the granularity of each output token. FastServe uses preemptive scheduling to minimize latency with a novel skip-join Multi-Level Feedback Queue scheduler. Based on the new semi-information-agnostic setting of LLM inference, the scheduler leverages the input length information to assign an appropriate initial queue for each arrival job to join. The higher priority queues than the joined queue are skipped to reduce demotions. We design an efficient GPU memory management mechanism that proactively offloads and uploads intermediate state between GPU memory and host memory for LLM inference. We build a system prototype of FastServe and experimental results show that compared to the state-of-the-art solution vLLM, FastServe improves the throughput by up to 31.4x and 17.9x under the same average and tail latency requirements, respectively.

cs.LG 1 claims attention 4.0 #cs.dc #cs.lg #community-import
L1
attested
BEIR: BM25 (Anserini) nDCG@10 on SciFact

Automated re-run of the headline result of 'BEIR: BM25 (Anserini) nDCG@10 on SciFact' (arXiv:2104.08663) from its own repository. Pre-registered claim: ndcg@10 = 0.65 (±8%). Hub verdict: BUILD_FAILED.

cs.LG 1 claims attention 4.0 #pip_env #reproducibility #reproducibility-study
L1
attested
Neural Collaborative Filtering (NeuMF) — MovieLens-1M HR@10

Automated re-run of the headline result of 'Neural Collaborative Filtering (NeuMF) — MovieLens-1M HR@10' (arXiv:1708.05031) from its own repository. Pre-registered claim: ml1m_hr_at_10 = 0.73 (±5%). Hub verdict: RUN_FAILED.

cs.LG 1 claims attention 4.0 #repo_artifact #reproducibility #reproducibility-study
L1
attested
OpenNE — node2vec on Wiki node classification Micro-F1

Automated re-run of the headline result of 'OpenNE — node2vec on Wiki node classification Micro-F1' (arXiv:1607.00653) from its own repository. Pre-registered claim: wiki_micro_f1 = 0.651 (±10%). Hub verdict: BUILD_FAILED.

cs.LG 1 claims attention 4.0 #repo_artifact #reproducibility #reproducibility-study
L1
attested
BERT-base SST-2 fine-tune accuracy (transformers run_glue.py)

Automated re-run of the headline result of 'BERT-base SST-2 fine-tune accuracy (transformers run_glue.py)' (arXiv:1810.04805) from its own repository. Pre-registered claim: accuracy = 0.93 (±5%). Hub verdict: BUILD_FAILED.

cs.LG 1 claims attention 4.0 #repo_artifact #reproducibility #reproducibility-study
L1
attested
SUOD: Accelerating Large-Scale Unsupervised Heterogeneous Outlier Detection — Cardio IForest ROC-AUC

Automated re-run of the headline result of 'SUOD: Accelerating Large-Scale Unsupervised Heterogeneous Outlier Detection — Cardio IForest ROC-AUC' (arXiv:2003.05731) from its own repository. Pre-registered claim: roc_auc = 0.9216 (±8%). Hub verdict: RUN_FAILED.

cs.LG 1 claims attention 4.0 #repo_artifact #reproducibility #reproducibility-study
L1
attested
TextCNN multi-label text classification (brightmart/text_classification) — TextCNN accuracy

Automated re-run of the headline result of 'TextCNN multi-label text classification (brightmart/text_classification) — TextCNN accuracy' (arXiv:1408.5882) from its own repository. Pre-registered claim: textcnn_accuracy = 0.65 (±8%). Hub verdict: BUILD_FAILED.

cs.LG 1 claims attention 4.0 #repo_artifact #reproducibility #reproducibility-study
L1
attested
Distributed Representations of Sentences and Documents (Doc2Vec/Paragraph Vector, Le & Mikolov 2014) — IMDB sentiment accuracy, gensim reproduction

Automated re-run of the headline result of 'Distributed Representations of Sentences and Documents (Doc2Vec/Paragraph Vector, Le & Mikolov 2014) — IMDB sentiment accuracy, gensim reproduction' (arXiv:1405.4053) from its own repository. Pre-registered claim: imdb_accuracy = 0.87 (±8%). Hub verdict: RUN_FAILED.

cs.LG 1 claims attention 4.0 #repo_artifact #reproducibility #reproducibility-study
L1
attested
Bag of Tricks for Efficient Text Classification (fastText, Joulin et al. EACL 2017) — official repo DBpedia P@1

Automated re-run of the headline result of 'Bag of Tricks for Efficient Text Classification (fastText, Joulin et al. EACL 2017) — official repo DBpedia P@1' (arXiv:1607.01759) from its own repository. Pre-registered claim: dbpedia_p_at_1 = 0.98 (±5%). Hub verdict: RUN_FAILED.

cs.LG 1 claims attention 4.0 #repo_artifact #reproducibility #reproducibility-study
L1
attested
Bag of Tricks for Efficient Text Classification (fastText, Joulin et al.) — AG News accuracy

Automated re-run of the headline result of 'Bag of Tricks for Efficient Text Classification (fastText, Joulin et al.) — AG News accuracy' (arXiv:1607.01759) from its own repository. Pre-registered claim: ag_news_accuracy = 92.5 (±5%). Hub verdict: TIMEOUT.

cs.LG 1 claims attention 4.0 #pip #reproducibility #reproducibility-study
L1
attested
NB-SVM (Wang & Manning, ACL 2012) — IMDB sentiment accuracy, bigram reproduction

Automated re-run of the headline result of 'NB-SVM (Wang & Manning, ACL 2012) — IMDB sentiment accuracy, bigram reproduction' (arXiv:1412.5335) from its own repository. Pre-registered claim: imdb_accuracy_bigram = 91.55 (±5%). Hub verdict: RUN_FAILED.

cs.LG 1 claims attention 4.0 #repo_artifact #reproducibility #reproducibility-study
L1
attested
A Simple but Tough-to-Beat Baseline for Sentence Embeddings (SIF, Arora et al., ICLR 2017) — STS Pearson correlation

Automated re-run of the headline result of 'A Simple but Tough-to-Beat Baseline for Sentence Embeddings (SIF, Arora et al., ICLR 2017) — STS Pearson correlation' (arXiv:1611.01462) from its own repository. Pre-registered claim: sts_pearson = 0.717 (±10%). Hub verdict: RUN_FAILED.

cs.LG 1 claims attention 4.0 #repo_artifact #reproducibility #reproducibility-study
L1
attested
TextCNN (Kim 2014) MindSpore implementation — SST2 accuracy

Automated re-run of the headline result of 'TextCNN (Kim 2014) MindSpore implementation — SST2 accuracy' (arXiv:1408.5882) from its own repository. Pre-registered claim: sst2_accuracy = 0.7971 (±5%). Hub verdict: BUILD_FAILED.

cs.LG 1 claims attention 4.0 #repo_artifact #reproducibility #reproducibility-study
L1
attested
TextCNN (Kim 2014) PyTorch reimplementation (Doragd) — SST-2 accuracy

Automated re-run of the headline result of 'TextCNN (Kim 2014) PyTorch reimplementation (Doragd) — SST-2 accuracy' (arXiv:1408.5882) from its own repository. Pre-registered claim: sst2_accuracy = 85.99 (±5%). Hub verdict: TIMEOUT.

cs.LG 1 claims attention 4.0 #pip #reproducibility #reproducibility-study
L1
attested
pomegranate: HMM Baum-Welch runtime (1000x10-dim, 5 iters) — version-skew case

Automated re-run of the headline result of 'pomegranate: HMM Baum-Welch runtime (1000x10-dim, 5 iters) — version-skew case' (arXiv:1711.00137) from its own repository. Pre-registered claim: hmm_baumwelch_runtime_seconds = 13 (±100%). Hub verdict: BUILD_FAILED.

cs.LG 1 claims attention 4.0 #pip_env #reproducibility #reproducibility-study
More →