kv-cache.svg 2.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 426 160" font-family="system-ui, sans-serif" font-size="14">
  2. <rect x="0" y="0" width="426" height="160" rx="8" fill="#f5f3ef"/>
  3. <defs>
  4. <marker id="arrowhead" markerWidth="7" markerHeight="5" refX="7" refY="2.5" orient="auto">
  5. <polygon points="0,0 7,2.5 0,5" fill="#198754"/>
  6. </marker>
  7. </defs>
  8. <!-- request 1 (y=16) -->
  9. <text x="94" y="35" fill="#333" font-weight="bold" text-anchor="end">Request 1:</text>
  10. <rect x="106" y="16" width="138" height="30" rx="4" fill="#d1e7dd" stroke="#198754" stroke-width="1"/>
  11. <text x="175" y="36" fill="#333" text-anchor="middle">System prompt</text>
  12. <text x="256" y="36" fill="#333" text-anchor="middle">+</text>
  13. <rect x="270" y="16" width="138" height="30" rx="4" fill="#cfe2ff" stroke="#0d6efd" stroke-width="1"/>
  14. <text x="339" y="36" fill="#333" text-anchor="middle">User question A</text>
  15. <!-- annotation: cache save -->
  16. <text x="175" y="64" fill="#198754" font-size="11" text-anchor="middle">Saved to KV cache</text>
  17. <!-- arrow -->
  18. <line x1="175" y1="70" x2="175" y2="90" stroke="#198754" stroke-width="1.2" marker-end="url(#arrowhead)"/>
  19. <text x="188" y="85" fill="#198754" font-size="11">Reuse</text>
  20. <!-- request 2 (y=96) -->
  21. <text x="94" y="115" fill="#333" font-weight="bold" text-anchor="end">Request 2:</text>
  22. <rect x="106" y="96" width="138" height="30" rx="4" fill="#d1e7dd" stroke="#198754" stroke-width="1" stroke-dasharray="6,3"/>
  23. <text x="175" y="116" fill="#333" text-anchor="middle">System prompt</text>
  24. <text x="256" y="116" fill="#333" text-anchor="middle">+</text>
  25. <rect x="270" y="96" width="138" height="30" rx="4" fill="#cfe2ff" stroke="#0d6efd" stroke-width="1"/>
  26. <text x="339" y="116" fill="#333" text-anchor="middle">User question B</text>
  27. <!-- bottom labels -->
  28. <text x="175" y="144" fill="#198754" font-size="11" text-anchor="middle">No recomputation</text>
  29. <text x="339" y="144" fill="#0d6efd" font-size="11" text-anchor="middle">Only this is computed</text>
  30. </svg>