feat: add exact autoregressive KV caching - #4
Open
DivyamTalwar wants to merge 1 commit into
Open
Conversation
Owner
Author
Validation checkpointThe latest head Local review evidence:
The timing is intentionally treated as one observational fixture, not a universal performance claim. The implementation was informed by the public cache lifecycle/parity patterns in Hugging Face Transformers and LitGPT; no third-party code was copied. Per the requested workflow, this PR remains open and must not be merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
generate_tokens, an uncached reference path, parity tests, a CPU/GPU benchmark, and README documentationCompetitive review
Current inference stacks make cache semantics explicit and testable:
This PR is an original repository-local implementation. It copies no competitor code. The adopted product principle is exact cached/reference parity with an explicit cache lifecycle.
Verification
python -m compileall -q model tests benchmarkspytest -q— 13 passedgit diff --checkThe benchmark is observational and hardware/model-size dependent; it is not a universal speed claim.
Safety and compatibility
block_sizeuse_cache=TruePlease review only; do not merge as part of this research wave.