Repository navigation
Validate native memory compression in a trained causal language model - #19
Merged
Merged
Conversation
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.
Row similarity and SGNS objectives leave full predictive distributions untested. Add a train-only, causal character n-gram + GRU language-model reference with full softmax, and put the native C embedding adapter in its actual inference path.
Exact suffix keys end at the current input character, before the next-character target. Vocabulary/key counts fit training text only; missing keys map to zero memory and unseen characters to an explicit unknown class. Evaluation streams recurrent state across chunks and scores every target after a common burn-in. Unit tests cover future perturbations, split boundaries, unknown targets, streaming state and scalar probability/KL oracles.
The benchmark trains maximum orders 4/8/12 with seeds 3/7/11, then compares lossless storage and direct cosine+norm approximate variants without retraining. Validation selects under fixed PPL/KL/top-1 budgets. A separate audit reports held-out budget exceedances without changing that choice; paired character-block intervals preserve local dependence.
Measured on a fixed 131072-character TinyShakespeare prefix, 64 dimensions and 1200x16x32 training targets per model:
Raw reports, hashes, exact commands, environment, audit and figure are in
docs/causal_lm_evidence_20261024/. Tests: 52 passed; Ruff passed. Text, lookup keys and checkpoints remain local.Scope: small character-GRU reference, finite training and one corpus. This does not establish trained Engram/Transformer quality, convergence, framework-level memory savings or universal threshold safety. Higher order compresses better here but also has worse original PPL under the fixed training budget. Relaxing cosine adds little compression while increasing validation KL.