Case Western Reserve University School of Graduate Studies
Optimized KV-Cache Using Attention Head-Wise Similarity
Abstract
dc:descriptionExtended context windows in large language models (32K-1M tokens) have unlocked applications in multi-document analysis and codebase understanding, but the computational costs of managing key value caches remain prohibitive. Semantic clustering addresses this through offline grouping of attention keys for query-dependent sparse loading, but it introduces a critical bottleneck: preprocessing a 32K-token document with LLaMA-2-7B requires over 7 hours on an H100 GPU, limiting practical adoption. We observe that attention heads across layers exhibit substantial redundancy, particularly in middle layers, where different layers produce highly similar attentionpatterns. Our method exploits this redundancy through similarity-based reuse of cluster centroids, guided by adaptive thresholds that protect shallow and deep layers while enabling aggressive reuse in redundant middle layers. We conduct evaluations on three long-context LLMs (LLaMA-2-7B-32K, LongChat-v1.5-7B-32K, LWM-Text-Chat-1M) across eight LongBench tasks. We achieve up to 28.4% reduction in clustering time and 17% average additional memory reduction during inference. Our approach maintains accuracy within 5% of baselines, often matching or exceeding them, making semantic clustering practically deployable for long-context applications at scale.
Degree
thesis:*- Name thesis:degree_name
- Master of Sciences
- Level thesis:degree_level
- masters
- Discipline thesis:degree_discipline
- EECS - Computer and Information Sciences
- Grantor dc:publisher
- Case Western Reserve University School of Graduate Studies
- Year dc:date
- 2026
Author and committee
dc:creator, dc:contributor.*- Author dc:creator
-
- Nakayama , Hiroki
- Advisor dc:contributor.advisor
-
- Wang, An
Subjects
dc:subject × 1Rights
dc:rights- Statement dc:rights
-
- unrestricted
- This thesis or dissertation is protected by copyright: some rights reserved. It is licensed for use under a Creative Commons license. Specific terms and permissions are available from this document's record in the OhioLINK ETD Center.
- Language dc:language
- English
Identifiers
dc:identifier.*- Repository record dc:identifier
- http://rave.ohiolink.edu/etdc/view?acc_num=case1763308274699537