CritiPrefill: A Segment-wise Criticality-based Approach for Prefilling Acceleration in LLMs

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Lv, Junlin, Feng, Yuan, Xie, Xike, Jia, Xin, Peng, Qirong, Xie, Guiming
Formato: Preprint
Publicado: 2024
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866912039263272960
author Lv, Junlin
Feng, Yuan
Xie, Xike
Jia, Xin
Peng, Qirong
Xie, Guiming
author_facet Lv, Junlin
Feng, Yuan
Xie, Xike
Jia, Xin
Peng, Qirong
Xie, Guiming
contents Large language models have achieved notable success across various domains, yet efficient inference is still limited by the quadratic computation complexity of the attention mechanism. The inference consists of prefilling and decoding phases. Although several attempts have been made to accelerate decoding, the inefficiency of the prefilling phase, especially for long-context tasks, remains a challenge. In this paper, we observe a locality in query criticality during the prefilling phase of long-context processing: adjacent query tokens tend to focus on similar subsets of the past Key-Value (KV) cache. Based on this observation, we propose CritiPrefill, a criticality-based segment-wise prefilling method. This method partitions the input sequence's queries and KV cache into segments and blocks, utilizing a segment-wise algorithm to estimate the query criticality. By pruning non-critical computations between query segments and cache blocks in the self-attention mechanism, the prefilling process can be significantly accelerated. Extensive evaluations on multiple long-context datasets show up to 2.7x speedup on Llama3-8B and 3.0x speedup on Yi-9B for 128K context length on a single A100 GPU, with minimal quality degradation.
format Preprint
id arxiv_https___arxiv_org_abs_2409_12490
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle CritiPrefill: A Segment-wise Criticality-based Approach for Prefilling Acceleration in LLMs
Lv, Junlin
Feng, Yuan
Xie, Xike
Jia, Xin
Peng, Qirong
Xie, Guiming
Computation and Language
Artificial Intelligence
Machine Learning
Large language models have achieved notable success across various domains, yet efficient inference is still limited by the quadratic computation complexity of the attention mechanism. The inference consists of prefilling and decoding phases. Although several attempts have been made to accelerate decoding, the inefficiency of the prefilling phase, especially for long-context tasks, remains a challenge. In this paper, we observe a locality in query criticality during the prefilling phase of long-context processing: adjacent query tokens tend to focus on similar subsets of the past Key-Value (KV) cache. Based on this observation, we propose CritiPrefill, a criticality-based segment-wise prefilling method. This method partitions the input sequence's queries and KV cache into segments and blocks, utilizing a segment-wise algorithm to estimate the query criticality. By pruning non-critical computations between query segments and cache blocks in the self-attention mechanism, the prefilling process can be significantly accelerated. Extensive evaluations on multiple long-context datasets show up to 2.7x speedup on Llama3-8B and 3.0x speedup on Yi-9B for 128K context length on a single A100 GPU, with minimal quality degradation.
title CritiPrefill: A Segment-wise Criticality-based Approach for Prefilling Acceleration in LLMs
topic Computation and Language
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2409.12490