HGCA: Hybrid GPU-CPU Attention for Long Context LLM Inference

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Deng, Weishu, Yang, Yujie, Du, Peiran, Xiang, Lingfeng, Lin, Zhen, Zhong, Chen, Jiang, Song, Lu, Hui, Rao, Jia
Formato: Preprint
Publicado: 2025
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866908433772445696
author Deng, Weishu
Yang, Yujie
Du, Peiran
Xiang, Lingfeng
Lin, Zhen
Zhong, Chen
Jiang, Song
Lu, Hui
Rao, Jia
author_facet Deng, Weishu
Yang, Yujie
Du, Peiran
Xiang, Lingfeng
Lin, Zhen
Zhong, Chen
Jiang, Song
Lu, Hui
Rao, Jia
contents Scaling inference for large language models (LLMs) is increasingly constrained by limited GPU memory, especially due to growing key-value (KV) caches required for long-context generation. While existing approaches offload KV caches to CPU memory or apply sparse attention to reduce GPU load, they often underutilize CPU compute resources and compromise accuracy. We present HGCA, a hybrid CPU-GPU attention mechanism that enables scalable, high-throughput LLM inference with near-full attention quality. HGCA performs dense attention on recently generated KV entries retained in GPU memory and parallel sparse attention on selected, salient KV entries in CPU memory. The attention outputs are efficiently merged using log-sum-exp fusion, minimizing PCIe transfer overhead. HGCA also introduces a finegrained, per-head sparsification strategy optimized for CPU execution, preserving contextual relevance while reducing computation. Our implementation seamlessly integrates into existing LLM frameworks without requiring model retraining. Experiments across diverse models and workloads show that HGCA achieves superior scalability, supports longer sequences and larger batch sizes, and outperforms existing sparse attention baselines in both performance and accuracy -- all on commodity GPU hardware.
format Preprint
id arxiv_https___arxiv_org_abs_2507_03153
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle HGCA: Hybrid GPU-CPU Attention for Long Context LLM Inference
Deng, Weishu
Yang, Yujie
Du, Peiran
Xiang, Lingfeng
Lin, Zhen
Zhong, Chen
Jiang, Song
Lu, Hui
Rao, Jia
Machine Learning
Scaling inference for large language models (LLMs) is increasingly constrained by limited GPU memory, especially due to growing key-value (KV) caches required for long-context generation. While existing approaches offload KV caches to CPU memory or apply sparse attention to reduce GPU load, they often underutilize CPU compute resources and compromise accuracy. We present HGCA, a hybrid CPU-GPU attention mechanism that enables scalable, high-throughput LLM inference with near-full attention quality. HGCA performs dense attention on recently generated KV entries retained in GPU memory and parallel sparse attention on selected, salient KV entries in CPU memory. The attention outputs are efficiently merged using log-sum-exp fusion, minimizing PCIe transfer overhead. HGCA also introduces a finegrained, per-head sparsification strategy optimized for CPU execution, preserving contextual relevance while reducing computation. Our implementation seamlessly integrates into existing LLM frameworks without requiring model retraining. Experiments across diverse models and workloads show that HGCA achieves superior scalability, supports longer sequences and larger batch sizes, and outperforms existing sparse attention baselines in both performance and accuracy -- all on commodity GPU hardware.
title HGCA: Hybrid GPU-CPU Attention for Long Context LLM Inference
topic Machine Learning
url https://arxiv.org/abs/2507.03153