Repository navigation
Handling KV Cache Corruption During L2-to-L1 Promotion in HiCache #44633
Replies: 1 comment 2 replies
|
The distinction I'd make is between transfer completion and payload integrity. In the current load path, For the corruption scenario you describe, I'd start with an optional page-level integrity mode and a narrowly defined failure model.
The important integration point is before a consumer can use the corresponding layer. Because loading is pipelined, adding one final check after all layers finish would be too late if an earlier layer has already run. Verification would need to gate the layer-ready event, or the whole promotion would need to remain unavailable until verified. I'd measure both designs rather than assume their latency costs are equivalent. A detected mismatch can become a cache miss if it is caught before consumption and the original request inputs are available for recomputation. Invalidate the bad page, keep only a verified contiguous prefix, and coordinate the retry across participating ranks. Reclaim transfer buffers only after their in-flight work is finished. If inference has already consumed the page, restart from a known-good state or fail the request. A device failure or an unavailable original input should not be hidden as an ordinary miss. I haven't benchmarked this on GPUs, so I wouldn't attach an overhead estimate. I'd compare integrity off/on across page sizes, dtypes, prefix lengths and concurrency, measuring hit TTFT, p99 latency, throughput and extra memory traffic. Fault injection should cover a host bit flip after checksum creation, wrong-page association, slot reuse and corruption on only one rank. That would test both detection and recovery, rather than just whether a checksum kernel runs quickly. |
Uh oh!
There was an error while loading. Please reload this page.
Background
HiCache supports hierarchical KV cache management, allowing cached data to be transferred from L2 (host memory) to L1 (GPU memory) when a cache hit occurs.
However, what happens if the KV cache data stored in L2 is already corrupted when it is promoted back to L1?
As far as I understand the current implementation, there does not appear to be an explicit data integrity validation mechanism in this path to detect such corruption before the data is reused. If corrupted KV cache data is loaded into L1 and used for inference, it could potentially lead to incorrect model outputs or other unexpected behavior.
Discussion Points
I'd like to discuss how HiCache should handle this scenario:
Data integrity validation: Should we introduce checksums or hashes to detect corruption when transferring KV cache data from L2 to L1? What would be the performance overhead?
Corruption handling: If corruption is detected, should we discard the corrupted cache entry and recompute the KV cache from the original tokens, rather than reusing invalid data?
Error propagation and recovery: How should the system handle corrupted entries during cache promotion? Should it fall back to a cache miss and continue inference, or report an error in certain cases?
Validation granularity: Should integrity checks be performed per token, per page, or per cache entry? Given HiCache's page-based management, would page-level checks provide a reasonable balance between reliability and overhead?
Performance considerations: How can we introduce integrity protection without significantly affecting cache-hit latency and overall inference throughput?
All reactions