mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4086] [CLOSED] [Engine] add lossless REF and RHT+INT16 disk-state codecs #4898
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4898
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4086
Author: @G0-0000
Created: 10/25/2026
Status: ❌ Closed
Base:
main← Head:feat/conv-cache-state-ref-rht-20261025📝 Commits (3)
7c33492[Engine] add disk conversation cache prerequisites8a4ca50[Engine] add state references to prefix disk snapshots0d689a2[Engine] add RHT+INT16 codec for GDN disk snapshots📊 Changes
19 files changed (+8469 additions, -180 deletions)
View changed files
📝
CMakeLists.txt(+8 -1)📝
docs/DETAILS.md(+169 -12)📝
include/strata/core/conversation_cache.hpp(+142 -21)📝
include/strata/core/conversation_file.hpp(+136 -6)📝
include/strata/core/conversation_snapshot.hpp(+40 -0)➕
include/strata/core/conversation_spill.hpp(+193 -0)➕
include/strata/core/rht_state_codec.hpp(+339 -0)📝
serve/server.py(+56 -2)📝
serve/test_monitor.py(+44 -0)📝
serve/web/app.js(+28 -1)📝
serve/web/index.html(+4 -0)📝
src/core/conversation_file.cpp(+1349 -67)📝
src/core/conversation_file_test.cpp(+1648 -3)📝
src/core/conversation_snapshot.cpp(+61 -0)➕
src/core/conversation_spill.cpp(+1115 -0)➕
src/core/conversation_spill_test.cpp(+1791 -0)📝
src/core/conversation_state.cpp(+45 -6)➕
src/core/rht_state_codec_test.cpp(+336 -0)📝
src/program/generate.cpp(+965 -61)📄 Description
Stacked draft: buildable today, prerequisites not yet merged
This is an opt-in stacked draft for testing and review, not a request to merge the prerequisite port as-is. The branch is based on
mainat7dd5cf18e68c639a8773e096c5c79f971ea2a9f5and includes the disk-cache prerequisites needed to build and use the codecs today.The new work is in the last two commits:
8a4ca507— lossless state references for prefix snapshots (--conversation-cache-disk-state-ref).0d689a288— RHT+INT16 encoding for recurrent GDN state in ordinary base/delta snapshots (--conversation-cache-disk-state-codec-rht).The first commit,
7c334924, is a rebased port of unmerged prerequisite work. It is included so this branch is self-contained and buildable. It should be dropped or replaced by the canonical prerequisite commits when they land. Please review the last two commits as the codec proposal; the prerequisite port is context, not a competing proposal for those PRs.Provenance
The prerequisite port is based on:
--conversation-cache-spill-dir, Aníbal Muñoz Calero, head4af468f6b.d258f1892.--conversation-cache-disk-only, Jim Routh, head3d5b97b84.09d83375d,1bac6f24c), on top of the #1480 branch.The RHT+INT16 disk-boundary encoding approach is based on jundot/omlx, specifically
omlx/cache/boundary_snapshot_store.py.This is a rebased/rewritten port across a large upstream interval, not a clean cherry-pick. The original authors have not reviewed this port. Their original PRs remain the canonical review threads for the prerequisite designs.
Based-on:attribution is recorded in the commit messages.Behavior
Both new codec switches are off by default.
.sess, a checkpoint whose five running-state arrays match the file's live state byte-for-byte can reference that live copy instead of storing a second copy. References are local to the same file, not links to another base file. This is exact deduplication, not quantization.Disk-space results
These results came from offline experiments and the original local implementation, before this cleanup/rebase, using Qwen3.8-Flash-Next UD-Q4_K_XL with int8 K/V. The original model runs used Linux and a Tesla V100-SXM2-32GB; the offline state comparison ran on CPU over real cache snapshots. They were not rerun as real-model tests on this cleaned branch. Measured files and format-derived sizes are identified separately.
On the original local build, the observed RHT base
.sesswas 218,849,020 B (208.71 MiB) and the observed delta.dlogwas 125,250,924 B (119.45 MiB). The base+delta chain was also restored after a same-version restart. These file sizes are recorded measurements from that build, not new measurements of this rebased branch.REF and RHT apply to different state/cache cases; their percentages must not be added into a single whole-cache saving claim.
State-fidelity evidence, not a generation-quality claim
On the same three real cache files (five independent recurrent-state copies, 141,557,760 FP32 values), the offline comparison measured relative L2 error of approximately
1.913e-5for RHT+INT16 versus2.056e-4for FP16.These are state-fidelity and storage measurements only. They are not a generation-quality A/B and do not establish that RHT+INT16 is lossless.
Validation on this branch
Passed on Linux with CUDA 12.9,
sm_70, Release, host-only tests:strata,rht_state_codec_test, and the conversation test targets.rht_state_codec_testconversation_file_testconversation_spill_testsession_save_reclaim_testconversation_cache_testconversation_snapshot_testconversation_validation_testPYTHONPATH=. python3 serve/test_monitor.py: 12/12 passed.strata --version:0.1.49.2.The prerequisite commit was also built and tested separately before REF was applied; the REF commit was built and tested separately before RHT was applied.
Not run / limits
Feedback on the final two codec commits and the preferred unstacking order is welcome.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.