@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 1cb8c6c5fe
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 14, 05:30 UTC

[Doc] Fix numbering sequence in prefix caching (#27357)

Signed-off-by: William Song <jinwook@umich.edu>

William Song committed Oct 23, 2025 at 02:35 UTC 1cb8c6c5fe96ad12fcb79691fdc099f7ffc03c9f
1 file changed +10 -10
docs/design/prefix_caching.md
+10 -10
@@ -213,22 +213,22 @@ In this example, we assume the block size is 4 (each block can cache 4 tokens),
213
214 ![Example Time 1](../assets/design/prefix_caching/example-time-1.png)
215
216 -**Time 3: Request 0 makes the block 3 full and asks for a new block to keep decoding.** We cache block 3 and allocate block 4.
216 +**Time 2: Request 0 makes the block 3 full and asks for a new block to keep decoding.** We cache block 3 and allocate block 4.
217
218 -![Example Time 3](../assets/design/prefix_caching/example-time-3.png)
218 +![Example Time 2](../assets/design/prefix_caching/example-time-3.png)
219
220 -**Time 4: Request 1 comes in with the 14 prompt tokens, where the first 10 tokens are the same as request 0.** We can see that only the first 2 blocks (8 tokens) hit the cache, because the 3rd block only matches 2 of 4 tokens.
220 +**Time 3: Request 1 comes in with the 14 prompt tokens, where the first 10 tokens are the same as request 0.** We can see that only the first 2 blocks (8 tokens) hit the cache, because the 3rd block only matches 2 of 4 tokens.
221
222 -![Example Time 4](../assets/design/prefix_caching/example-time-4.png)
222 +![Example Time 3](../assets/design/prefix_caching/example-time-4.png)
223
224 -**Time 5: Request 0 is finished and free.** Blocks 2, 3 and 4 are added to the free queue in the reverse order (but block 2 and 3 are still cached). Block 0 and 1 are not added to the free queue because they are being used by Request 1.
224 +**Time 4: Request 0 is finished and free.** Blocks 2, 3 and 4 are added to the free queue in the reverse order (but block 2 and 3 are still cached). Block 0 and 1 are not added to the free queue because they are being used by Request 1.
225
226 -![Example Time 5](../assets/design/prefix_caching/example-time-5.png)
226 +![Example Time 4](../assets/design/prefix_caching/example-time-5.png)
227
228 -**Time 6: Request 1 is finished and free.**
228 +**Time 5: Request 1 is finished and free.**
229
230 -![Example Time 6](../assets/design/prefix_caching/example-time-6.png)
230 +![Example Time 5](../assets/design/prefix_caching/example-time-6.png)
231
232 -**Time 7: Request 2 comes in with the 29 prompt tokens, where the first 12 tokens are the same as request 0\.** Note that even the block order in the free queue was `7 - 8 - 9 - 4 - 3 - 2 - 6 - 5 - 1 - 0`, the cache hit blocks (i.e., 0, 1, 2) are touched and removed from the queue before allocation, so the free queue becomes `7 - 8 - 9 - 4 - 3 - 6 - 5`. As a result, the allocated blocks are 0 (cached), 1 (cached), 2 (cached), 7, 8, 9, 4, 3 (evicted).
232 +**Time 6: Request 2 comes in with the 29 prompt tokens, where the first 12 tokens are the same as request 0\.** Note that even the block order in the free queue was `7 - 8 - 9 - 4 - 3 - 2 - 6 - 5 - 1 - 0`, the cache hit blocks (i.e., 0, 1, 2) are touched and removed from the queue before allocation, so the free queue becomes `7 - 8 - 9 - 4 - 3 - 6 - 5`. As a result, the allocated blocks are 0 (cached), 1 (cached), 2 (cached), 7, 8, 9, 4, 3 (evicted).
233
234 -![Example Time 7](../assets/design/prefix_caching/example-time-7.png)
234 +![Example Time 6](../assets/design/prefix_caching/example-time-7.png)