Add README.md
Browse files
README.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
| 2 |
|
| 3 |
A runtime control plane that sits above paged KV memory and continuously adjusts allocation, retention, offload, and routing policy according to observed request patterns.
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
## Project Structure
|
| 6 |
|
| 7 |
```
|
|
@@ -23,10 +51,8 @@ apac/
|
|
| 23 |
|
| 24 |
```bash
|
| 25 |
pip install -e .
|
| 26 |
-
# Run oracle gap analysis on
|
| 27 |
-
python -m apac.experiments.oracle_gap --workload
|
| 28 |
-
# Run with BurstGPT production traces
|
| 29 |
-
python -m apac.experiments.oracle_gap --workload burstgpt --num-requests 10000
|
| 30 |
```
|
| 31 |
|
| 32 |
## Key Concepts
|
|
@@ -36,32 +62,12 @@ python -m apac.experiments.oracle_gap --workload burstgpt --num-requests 10000
|
|
| 36 |
- **Oracle**: Computes Belady-optimal (hindsight) decisions for routing, retention, and offload
|
| 37 |
- **Controller**: Online APAC that makes decisions based on observable signals only
|
| 38 |
|
| 39 |
-
## Oracle Gap Analysis
|
| 40 |
-
|
| 41 |
-
The oracle gap study is the foundational experiment. It measures how much a perfect controller (with full future knowledge) can improve over static policies:
|
| 42 |
-
|
| 43 |
-
- **Eviction gap**: Bélády-optimal vs LRU eviction
|
| 44 |
-
- **Routing gap**: Optimal pool selection vs round-robin
|
| 45 |
-
- **Retention gap**: Perfect prefix durability vs no retention tags
|
| 46 |
-
- **Admission gap**: Optimal capacity reservation vs no reserve
|
| 47 |
-
|
| 48 |
-
Early findings: **LRU eviction is near-optimal for prefix-sharing workloads** — the gap for adaptive control comes from routing, admission, and offload dimensions, not eviction alone.
|
| 49 |
-
|
| 50 |
## Datasets Used
|
| 51 |
|
| 52 |
- [BurstGPT](https://huggingface.co/datasets/lzzmm/BurstGPT) — 5.29M rows, Azure OpenAI production traces
|
| 53 |
- [WildChat-1M](https://huggingface.co/datasets/allenai/WildChat-1M) — 1M timestamped conversations
|
| 54 |
- [ShareGPT52K](https://huggingface.co/datasets/RyokoAI/ShareGPT52K) — Length distribution reference
|
| 55 |
|
| 56 |
-
## Built on vLLM Internals
|
| 57 |
-
|
| 58 |
-
The simulator faithfully models vLLM V1's actual block management:
|
| 59 |
-
- `BlockPool` with hash-based prefix caching and LRU eviction
|
| 60 |
-
- `KVCacheManager.allocate_slots()` / `free()` / `cache_blocks()` semantics
|
| 61 |
-
- Scheduler token budgets with decode-first priority (chunked prefill)
|
| 62 |
-
- `KVEventBatch` (BlockStored/BlockRemoved/AllBlocksCleared) event schema
|
| 63 |
-
- ZMQ PUB/SUB event publishing with replay buffer
|
| 64 |
-
|
| 65 |
## References
|
| 66 |
|
| 67 |
- PagedAttention (vLLM): [arxiv:2309.06180](https://arxiv.org/abs/2309.06180)
|
|
@@ -70,5 +76,3 @@ The simulator faithfully models vLLM V1's actual block management:
|
|
| 70 |
- Ada-KV: [arxiv:2407.11550](https://arxiv.org/abs/2407.11550)
|
| 71 |
- LMCache: [arxiv:2510.09665](https://arxiv.org/abs/2510.09665)
|
| 72 |
- SGLang RadixAttention: [arxiv:2312.07104](https://arxiv.org/abs/2312.07104)
|
| 73 |
-
- Marconi: [arxiv:2411.19379](https://arxiv.org/abs/2411.19379)
|
| 74 |
-
- KVShare: [arxiv:2503.16525](https://arxiv.org/abs/2503.16525)
|
|
|
|
| 2 |
|
| 3 |
A runtime control plane that sits above paged KV memory and continuously adjusts allocation, retention, offload, and routing policy according to observed request patterns.
|
| 4 |
|
| 5 |
+
## Key Findings (Latest Results)
|
| 6 |
+
|
| 7 |
+
### 1. LRU Eviction is Near-Optimal for Single-Pool Prefix Sharing
|
| 8 |
+
Running Bélády (hindsight-optimal) eviction against LRU under memory pressure:
|
| 9 |
+
- **Oracle gap: 0%** across throughput, TTFT, and cache hit rate
|
| 10 |
+
- Implication: APAC's value cannot come from better eviction alone
|
| 11 |
+
|
| 12 |
+
### 2. Multi-Pool Routing Offers Dramatic Latency Improvements
|
| 13 |
+
Comparing routing policies under memory pressure (2 pools, 128 blocks each, 500 requests):
|
| 14 |
+
|
| 15 |
+
| Policy | Throughput | p99 TTFT | Cache Hits |
|
| 16 |
+
|--------|-----------|----------|------------|
|
| 17 |
+
| **Oracle** | **89.7 rps** | **76 ms** | 11,468 |
|
| 18 |
+
| Round-robin | 87.5 rps | 964 ms | 61,226 |
|
| 19 |
+
| Random | 85.0 rps | 1097 ms | 67,687 |
|
| 20 |
+
| Least-loaded | 88.1 rps | 1173 ms | 38,525 |
|
| 21 |
+
|
| 22 |
+
**Key result: Oracle routing reduces p99 TTFT by 92%** (964ms → 76ms)
|
| 23 |
+
|
| 24 |
+
The oracle routes each request to the pool with the best prefix cache coverage for that request's prefix. This maximizes cache reuse per-pool and dramatically reduces queueing delays.
|
| 25 |
+
|
| 26 |
+
### 3. Class-Based Routing Can Be Catastrophic
|
| 27 |
+
Routing all shared-prefix requests to a single "hot" pool:
|
| 28 |
+
- **p99 TTFT: 2278ms** (vs 964ms for round-robin)
|
| 29 |
+
- Throughput drops 2% from overload on the hot pool
|
| 30 |
+
|
| 31 |
+
Implication: Intelligent routing requires per-request prefix analysis, not coarse class-based heuristics.
|
| 32 |
+
|
| 33 |
## Project Structure
|
| 34 |
|
| 35 |
```
|
|
|
|
| 51 |
|
| 52 |
```bash
|
| 53 |
pip install -e .
|
| 54 |
+
# Run oracle gap analysis on BurstGPT traces
|
| 55 |
+
python -m apac.experiments.oracle_gap --workload burstgpt --block-size 16 --num-blocks 2048
|
|
|
|
|
|
|
| 56 |
```
|
| 57 |
|
| 58 |
## Key Concepts
|
|
|
|
| 62 |
- **Oracle**: Computes Belady-optimal (hindsight) decisions for routing, retention, and offload
|
| 63 |
- **Controller**: Online APAC that makes decisions based on observable signals only
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
## Datasets Used
|
| 66 |
|
| 67 |
- [BurstGPT](https://huggingface.co/datasets/lzzmm/BurstGPT) — 5.29M rows, Azure OpenAI production traces
|
| 68 |
- [WildChat-1M](https://huggingface.co/datasets/allenai/WildChat-1M) — 1M timestamped conversations
|
| 69 |
- [ShareGPT52K](https://huggingface.co/datasets/RyokoAI/ShareGPT52K) — Length distribution reference
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
## References
|
| 72 |
|
| 73 |
- PagedAttention (vLLM): [arxiv:2309.06180](https://arxiv.org/abs/2309.06180)
|
|
|
|
| 76 |
- Ada-KV: [arxiv:2407.11550](https://arxiv.org/abs/2407.11550)
|
| 77 |
- LMCache: [arxiv:2510.09665](https://arxiv.org/abs/2510.09665)
|
| 78 |
- SGLang RadixAttention: [arxiv:2312.07104](https://arxiv.org/abs/2312.07104)
|
|
|
|
|
|