Repository navigation
Conversation
Add explicit cache context sizing for cached component transpilation so decoder graphs can reserve the model context length instead of deriving capacity from the capture prompt. Gemma4, Qwen, and LFM cached decode builders now share the same config-driven resolver while preserving their existing capture-derived fallback sizes when no model context field is available. For Gemma4, sliding-attention layers keep the configured sliding-window cache size while full-attention layers receive the requested full cache length. Add a retranspile path that reuses existing converted weights, wire the cache context option through the CLI and transpile entrypoint, and make lowering honor per-attention cache length metadata. Add token-file input support for exact-token live generation and a context-scaling benchmark tool that records CSV/JSONL summaries and plots. Cover the new CLI plumbing, retranspile behavior, context parsing, and per-layer cache metadata with focused tests. Signed-off-by: Noah Cylich <noahcylich@gmail.com>
Signed-off-by: Noah Cylich <noahcylich@gmail.com>
Signed-off-by: Noah Cylich <noahcylich@gmail.com> # Conflicts: # python/tests/test_cli_transpile_defaults.py
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.
Summary
cactus convert --cache-context-lengthand--retranspileso graph artifacts can be rebuilt from existing converted weights.cactus runand the chat test binary, plus a context-scaling benchmark tool that writes CSV/JSONL summaries and PNG plots.Validation
source ./venv/bin/activate && python -m py_compile python/tests/transpile/tools/benchmark_gemma4_context_scaling.py && pytest -q python/tests/test_transpile_cache_context.py python/tests/test_cli_run.py python/tests/test_bindings.py::TestTranspileOptions python/tests/test_bindings.py::TestCliParser::test_run_command_chunked_bundle_flags python/tests/test_cli_transpile_defaults.py python/tests/test_optimize_gemma4_attention.pysource ./venv/bin/activate && cactus buildsource ./venv/bin/activate && cactus run weights/gemma-4-e4b-it --input-ids-file /tmp/gemma4_cactus_verify_tokens.txt --max-new-tokens 4 --result-json /tmp/gemma4_cactus_verify_result.json