Home/Algo Bridge/LRU / LFU Cache (Hash + Doubly Linked List)/LC_146
⚡ Practice in Flashcards
🌉 Problem-Level AI BridgeLC_146 · 中等

LC_146 (LRU Cache) ➔ Prefix Cache Attention Block

Doubly linked list paired with hash table guarantees O(1) eviction and lookup for recency-based memory retention.

1️⃣ 1️⃣ Classical DSA Origin

LC_146 · LRU Cache

Pattern: LRU / LFU Cache (Hash + Doubly Linked List) — Hybrid architecture combining hash table with a doubly linked list. The hash table provides O(1) direct address lookup, while the doubly linked list maintains recency access order (LRU) or frequency (LFU) for O(1) insertion, elevation, and eviction.

⚡ Open LC-146 Solution ➔
2️⃣ 2️⃣ Production AI System Transfer

SGLang RadixAttention Prefix Caching & KV Tree Management · Prefix Cache Attention Block

Industrial Application: Powers vLLM block eviction and SGLang RadixAttention node pruning when GPU HBM approaches allocation thresholds.

🧬 Target AI Kernel Interface
def prefix_cache_attention(q: torch.Tensor, k_new: torch.Tensor, v_new: torch.Tensor, k_cached: torch.Tensor, v_cached: torch.Tensor) -> torch.Tensor

🔗 Related Algorithmic Bridges

LC_140 ➔ RadixAttention: Longest Prefix Match KV Cache
Algorithmic foundation connecting classic data structures to LLM high-pe...
LC_140 ➔ Prefix Cache Attention Block
Algorithmic foundation connecting classic data structures to LLM high-pe...
LC_208 ➔ RadixAttention: Longest Prefix Match KV Cache
Trie structures merge identical token prefixes across diverging branches...
LC_208 ➔ Prefix Cache Attention Block
Trie structures merge identical token prefixes across diverging branches...
LC_146 ➔ RadixAttention: Longest Prefix Match KV Cache
Doubly linked list paired with hash table guarantees O(1) eviction and l...
LC_146 ➔ PagedAttention: Virtual Memory Block Table Mapping
Doubly linked list paired with hash table guarantees O(1) eviction and l...
← LC_146 (LRU Cache) → SGLang RadixAttention Prefix Caching & KV Tree ManagementLC_146 (LRU Cache) → vLLM PagedAttention & Block-Paged KV Cache →