[PR #522] [CLOSED] DeepSeek: expose Engram cache telemetry #577

Closed
opened 2026-10-29 21:27:04 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/522
Author: @handmade0octopus
Created: 10/26/2026
Status: ❌ Closed

Base: main ← Head: pr/ds4-engram-telemetry


📝 Commits (1)

  • 6b74701 DeepSeek: expose Engram cache telemetry

📊 Changes

6 files changed (+28 additions, -2 deletions)

View changed files

📝 serve/server.py (+9 -1)
📝 serve/test_server.py (+9 -1)
📝 src/ds4/ds4_engram_io.hpp (+1 -0)
📝 src/ds4/ds4_main.cpp (+7 -0)
📝 src/ds4/ds4_model.cu (+1 -0)
📝 src/ds4/ds4_model.hpp (+1 -0)

📄 Description

Summary

Expose the existing DeepSeek Engram row-cache and lookup counters through the engine's STAT output and the Monitor's metric descriptions:

  • eg_cache_rows
  • eg_cache_cap
  • eg_cache_row_bytes
  • eg_lookup_rows
  • eg_lookup_hits
  • eg_lookup_reads

eg_cache_row_bytes is the payload width of one cached row, allowing consumers to report actual cached payload as rows × row_bytes and to verify the configured cache capacity. It is not a claim about total process RAM: hash-table, block-bookkeeping, scratch, and model allocations are separate.

The three cumulative eg_lookup_* values are emitted as Prometheus counters; cache occupancy/capacity/row width remain gauges. The text-format test checks the new names, values, and types.

No cache policy, model computation, or default setting changes.

Benefits

The existing DS4_ENGRAM_CACHE_MB setting can hold tens of millions of rows, but API/dashboard consumers could not verify its actual capacity, occupancy, payload width, or whether lookups were being served by cache hits versus file reads. These fields make large-cache operation measurable and provide the accounting needed to validate hit rate and lookups = hits + reads over real agent workloads.

Validation

Windows CUDA / DeepSeek-V4.1-Flash IQ1_M:

  • Confirmed the 8 GiB configuration exposed 32,537,631 rows × 264 bytes of row payload capacity.
  • A 159-context agent-style soak completed 1,307,298 prompt tokens and 62,860,080 lookups.
  • Final counters: 46,663,701 hits + 16,196,379 reads = 62,860,080 lookups (74.23% hits).
  • Final cached payload: 3.982 GiB, below the row-payload cap; cache occupancy and capacity were reported live.
  • Metric-description, STAT, and dashboard mapping checks passed, including exact completed prefill/decode rates.
  • After a clean v1.1.29 rebase, the full 101-test server suite passed (3 platform skips), including the Prometheus name/value/type assertions, along with the 32-test DS4 conformance suite.
  • Windows CUDA build and HIP name-compatibility scan pass. No runtime behavior beyond observability is changed.

#275/#295 already provide the bounded Engram row cache and asynchronous reads; this PR only exposes their state and counters. It does not propose another cache implementation or a universal 8 GiB default. #364 reports prefill expert-residency/streaming statistics, which are different from Engram cache occupancy and lookup accounting.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mw00/project-maya/pull/522 **Author:** [@handmade0octopus](https://github.com/handmade0octopus) **Created:** 10/26/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/ds4-engram-telemetry` --- ### 📝 Commits (1) - [`6b74701`](https://github.com/mw00/project-maya/commit/6b74701a194c2602be7deaecfb539d71c1b161c0) DeepSeek: expose Engram cache telemetry ### 📊 Changes **6 files changed** (+28 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+9 -1) 📝 `serve/test_server.py` (+9 -1) 📝 `src/ds4/ds4_engram_io.hpp` (+1 -0) 📝 `src/ds4/ds4_main.cpp` (+7 -0) 📝 `src/ds4/ds4_model.cu` (+1 -0) 📝 `src/ds4/ds4_model.hpp` (+1 -0) </details> ### 📄 Description ## Summary Expose the existing DeepSeek Engram row-cache and lookup counters through the engine's `STAT` output and the Monitor's metric descriptions: - `eg_cache_rows` - `eg_cache_cap` - `eg_cache_row_bytes` - `eg_lookup_rows` - `eg_lookup_hits` - `eg_lookup_reads` `eg_cache_row_bytes` is the payload width of one cached row, allowing consumers to report actual cached payload as `rows × row_bytes` and to verify the configured cache capacity. It is **not** a claim about total process RAM: hash-table, block-bookkeeping, scratch, and model allocations are separate. The three cumulative `eg_lookup_*` values are emitted as Prometheus **counters**; cache occupancy/capacity/row width remain **gauges**. The text-format test checks the new names, values, and types. No cache policy, model computation, or default setting changes. ## Benefits The existing `DS4_ENGRAM_CACHE_MB` setting can hold tens of millions of rows, but API/dashboard consumers could not verify its actual capacity, occupancy, payload width, or whether lookups were being served by cache hits versus file reads. These fields make large-cache operation measurable and provide the accounting needed to validate hit rate and `lookups = hits + reads` over real agent workloads. ## Validation Windows CUDA / DeepSeek-V4.1-Flash IQ1_M: - Confirmed the 8 GiB configuration exposed **32,537,631 rows × 264 bytes** of row payload capacity. - A 159-context agent-style soak completed **1,307,298 prompt tokens** and **62,860,080 lookups**. - Final counters: **46,663,701 hits + 16,196,379 reads = 62,860,080 lookups** (**74.23% hits**). - Final cached payload: **3.982 GiB**, below the row-payload cap; cache occupancy and capacity were reported live. - Metric-description, `STAT`, and dashboard mapping checks passed, including exact completed prefill/decode rates. - After a clean v1.1.29 rebase, the full 101-test server suite passed (3 platform skips), including the Prometheus name/value/type assertions, along with the 32-test DS4 conformance suite. - Windows CUDA build and HIP name-compatibility scan pass. No runtime behavior beyond observability is changed. ## Related work / overlap check #275/#295 already provide the bounded Engram row cache and asynchronous reads; this PR only exposes their state and counters. It does not propose another cache implementation or a universal 8 GiB default. #364 reports prefill expert-residency/streaming statistics, which are different from Engram cache occupancy and lookup accounting. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:27:04 +07:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mw00/project-maya#577
No description provided.