Repository navigation
Conversation
GenerateHelperEndToEndTests exercises the public randkv.transformers.generate path end to end on CPU: - a tiny randomly initialized Qwen3 model (2 layers, vocab 32), built locally - no checkpoint download; - tokenizer inputs from a fixed in-test character vocabulary - no downloaded tokenizer; - greedy generation of 24 tokens against a budget of 24 + buffer 4, forcing multiple eviction rounds; - assertions on the cache the helper creates (captured via the past_key_values handed to the model): physical size never exceeds budget + buffer, at least two eviction rounds per layer, absolute position tracking advances past the physical bound, retained positions per head are strictly increasing with the prompt fully protected and the newest token retained; - a determinism check: same seed, same output. Each test runs in about half a second.
This branch has not been deployed
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.
Closes #2
What this adds
GenerateHelperEndToEndTestsintests/test_transformers.py: an offline, CPU-only end-to-end test that goes through the publicrandkv.transformers.generatehelper (the existing generation tests constructRandKVCachedirectly instead).Qwen3ForCausalLM(2 layers, hidden 32, vocab 32, fixed seed) built from a config in the test — no checkpoint download.RandKVConfig(budget=24, buffer_size=4).Assertions
The helper creates its cache internally, so the test model records the
past_key_valuesit is handed and the test inspects that cache:Verification
pytest tests/→ 45 passed (43 existing + 2 new).