Conversation
Assisted-by: GPT-5.6 Sol Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Assisted-by: GPT-5.6 Sol Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Assisted-by: GPT-5.6 Sol Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
4 tasks
Assisted-by: GPT-5.6 Sol Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Assisted-by: GPT-5.6 Sol Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
ajaxdude
marked this pull request as ready for review
September 14, 2026 07:25
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.
Overview
Add the model-free DeepSeek V4.1 Engram core on top of the schema branch from halo-box#49.
e4m3_e8m0_32_row264metadata layoutThis is the bounded disk-table, decoder, and token-history hash layer only. It does not add attention graph injection, routed-expert streaming, a memory watchdog, or real-model execution.
Depends on halo-box#49 and implements the Engram-core portion of halo-box#48. This fork PR is for stacked review and will be recreated or retargeted after ggml-org#49 merges.
Measurements
No performance claim is made. This PR is model-free infrastructure and was not run against the published model payload.
Baseline: N/A - no throughput or memory claim.
After: N/A - no throughput or memory claim.
Correctness:
bd66c402070042bf0a79ad6ece8242de4c93680c:make test-engramctest --test-dir build-engram --output-on-failure -R '^(test-deepseek41-schema|test-engram|test-generate-models)$'ctest --test-dir build-engram-sanitize --output-on-failure -R '^test-engram$'68df4a97268c457a8b9a1e199864a79d8df03097: Python DeepSeek41 schema tests - 4/4 passed;ctest --test-dir build-engram --output-on-failure -R '^(test-deepseek41-schema|test-engram|test-generate-models)$'- 3/3 passed; ASan/UBSan schema and Engram tests - 2/2 passed68df4a97268c457a8b9a1e199864a79d8df03097: no significant issues found9a18bb4288547c093ea922a97efba3caef12e640:cmake -S . -B build -DLLAMA_BUILD_TESTS=ON -DLLAMA_BUILD_TOOLS=OFF,cmake --build build --target test-engram -j4, thenctest --test-dir build --output-on-failure -R '^test-engram$'- 1/1 passed, including the O_DIRECT EOF-tail regressionThe focused test covers layout rejection, full-history and chunk equivalence, masks, invalid tokens without history mutation, large offsets, repeated and batched rows, all E4M3/E8M0 code combinations, BF16 rounding, signed zero, invalid row IDs, short reads, and arithmetic overflow. It also exercises qwen4exp PLE gathers through the extracted reader in buffered and uncached modes, verifies threaded read exceptions propagate without termination or deadlock, and includes a Linux O_DIRECT regression for a valid final row shorter than the aligned bounce length.
Additional information
The existing published GGUF remains the compatibility target. It uses
engram_q_norm,engram_k_norm, andengram_kv, carries mappeddeepseek41.engram.pad_id, stores primes as UINT32 and multipliers as UINT64, and omits explicit offsets because offsets are the cumulative prime sums.The newer ggml-org#28696 converter instead writes
engram_q,engram_k, andengram_wkv, plus explicit offsets and shape keys. This PR does not rename the published tensor contract or add unneeded aliases; a later model-loader integration can accept those names and metadata forms additively after validating that offsets equal the cumulative published layout.Exact internal API added:
llama_engram_hasher(layout)validates immutable metadata;hash(history, tokens, mask, count, rows)emits[token][layer][column]llama_engram_history::reset()establishes the dead/pad prefix statellama_engram_decode_row()decodes one native 264-byte rowllama_engram_table(path, offset, rows)opens a strict uncached extent;read()andread_batch()return BF16-rounded values in F32 storageGraph integration must keep one history per sequence, pass the token mask used by the reference, select the 24-row layer slice, stage only the returned packed rows, suppress Engram output at masked positions, and never create, map, prefetch, warm, or backend-admit the full table tensor.
Requirements