Skip to content

deepseek41 : add disk-backed Engram runtime - #5

Draft
ajaxdude wants to merge 9 commits into
jeromecoste-microsoft-deepseek-v41-attentionfrom
jeromecoste-microsoft-deepseek-v41-engram-runtime
Draft

ajaxdude wants to merge 9 commits into
jeromecoste-microsoft-deepseek-v41-attentionfrom
jeromecoste-microsoft-deepseek-v41-engram-runtime

Conversation

@ajaxdude

@ajaxdude ajaxdude commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Overview

Stacked on #3 at independently approved attention commit c51c971392ca4ee0fe502c532bbe415b14f8a71a, which incorporates corrected schema head 65fdc19831d30b12f06b981c3ca74dd18731f90e.

  • reuse the model-free bounded Engram core from engram : add bounded disk table and hash core #2
  • validate the published DeepSeek V4.1 Engram layout and capture the two I8 [264, rows] table extents without allocating, mapping, warming, or reading the complete tensors
  • hash logical chunks as [token][2][24], read both bounded row packs before execution, and upload each layer pack through backend input tensors
  • maintain transactional per-sequence history with commit, rollback, reset, copy, checkpoint, and restore behavior
  • implement the four-branch normalized signed-square-root sigmoid gate, shared value injection, exact masked-row bypass, and reference BF16 boundaries
  • pin the process-local signed-zero gate callback to the scheduler's verified local CPU backend while surrounding graph work remains eligible for acceleration
  • retain the explicit routed-expert streaming dependency gate, so the published model remains non-runnable

Design and tracking: halo-box#48. Schema dependency: halo-box#49. Attention dependency: #3.

Reference oracle: antirez/ds4 bd66c402070042bf0a79ad6ece8242de4c93680c.

Measurements

No performance claim is made. The complete model remains intentionally gated on the missing routed-expert store/execution layer, so no valid Strix Halo benchmark can be run for this PR in isolation.

Correctness:

  • test-engram
  • test-deepseek41-engram
  • test-deepseek41-runtime
  • test-deepseek41-schema
  • test-llama-archs -a qwen4exp
  • python3 -m pytest -q gguf-py/tests/test_deepseek41_schema.py
  • test-llama-archs -a deepseek41
  • git diff --check

The focused tests cover exact IDs, masked rows including non-BF16 values and signed zero, layer selection and 48-ID token stride, chunked-prefill history, transactional failures, multi-sequence operations, scheduler-backed bounded uploads, projection, gate math, positive/negative-zero copysign behavior, and mixed-backend assignment that keeps surrounding matrix work accelerated while the callback executes on local CPU.

Additional information

The 365 GB published GGUF was not opened. Synthetic sparse test data exercises bounded uncached row reads only. Normal model loading records each Engram table's file, absolute offset, type, and shape, then registers it with TENSOR_SKIP; the model exits on the routed-expert dependency before normal payload mapping begins.

The signed-square-root gate uses a small scheduler-pinned local CPU custom operation until GGML provides a backend-wide copysign primitive. The builder rejects non-CPU backends and CPU backends that are not registered in the scheduler. This prevents RPC from receiving a process-local callback pointer while preserving the oracle's copysign behavior for positive and negative zero. Masked positions select the original residual row with get_rows, so they bypass BF16 rounding byte-for-byte.

The final Engram core input is #2 head 68df4a97268c457a8b9a1e199864a79d8df03097 (tree d29fe52949867680c39bc15e7bcc6e9fa7cb33bb). Its six implementation/test files are byte-identical in this PR; the only expected delta is the DeepSeek V4.1 runtime and test registration in the two CMake files.

The source commits in this stack are:

  • 74c5167c7f8107404364c9161158652a1eadb1d6 - bounded disk table, hashing, and decode core
  • 8a59f344389368b591a11fa717bca3a7cdf329bf - bounded read failure handling
  • 4a214505044d8e0a8d136a8f1737bab727be6814 - DeepSeek V4.1 runtime, model wiring, graph, and tests
  • 78175bfc2 - exact masked-row and signed-zero gate semantics
  • 4ac4d4a84 - local CPU scheduler pin and mixed-backend regression
  • e094c50c5 - normal merge of the repaired attention/schema base
  • d57dd1c5a - normal merge of the updated attention/schema base
  • 0ed3b2eb9 - single reconciliation with the final corrected attention/schema input
  • 0fa6b96b2 - reconciliation with the independently approved attention fixes

Requirements

  • I have read and agree with the contributing guidelines
  • This change is Strix Halo specific, or justified by measurements on Strix Halo. General llama.cpp improvements belong in halo-box/llama.cpp instead
  • AI usage disclosure: AGENT-AUTHORED by GPT-5.6 Sol. The agent reused the reviewed core commits, implemented the DeepSeek V4.1 integration and tests, and prepared this draft PR.
  • What was NOT verified: no real GGUF payload was loaded or mapped; no end-to-end logits, routed-expert execution, ROCm/Vulkan execution, Strix Halo hardware run, or performance benchmark was performed. The current model gate prevents complete inference until the next routed-expert stack layer lands.

Jerome Coste and others added 3 commits September 12, 2026 08:55
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>
Jerome Coste and others added 2 commits September 12, 2026 09:26
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>
Jerome Coste and others added 4 commits September 12, 2026 19:51
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>
Assisted-by: GPT-5.6 Sol

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
ajaxdude pushed a commit that referenced this pull request Sep 14, 2026
Merge exact accepted PR #5 head 0fa6b96 without changing bounded routed-expert execution.

Assisted-by: GPT-5.6 Sol

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant