# DMSD Horizon Edition v0.8
## Online Calibration Memory / Learning Router

**日期：** 2026-09-30  
**狀態：** COMPLETE  
**基礎：** v0.7 Algorithm Portfolio / Auto-Router

---

# 1. v0.8 的核心

v0.7 已經能：

\[
\text{predict}
\rightarrow
\text{microbenchmark}
\rightarrow
\text{route}.
\]

v0.8 再加一層：

\[
\boxed{
\text{remember why the router believes what it believes}.
}
\]

也就是：

\[
\boxed{
\text{Calibration Memory}.
}
\]

---

# 2. Append-Only Calibration Ledger

所有 benchmark evidence 不覆寫。

每筆保存：

```text
entry_id
source epoch
environment fingerprint
task
algorithm
size
time
evidence kind
sample protocol
dispersion
provenance
```

目前 ledger：

\[
\boxed{114}
\]

entries。

---

# 3. Historical 與 Local 可以同時存在

Certificate crossover：

\[
\text{v0.6 historical}\approx94.99
\]

\[
\text{v0.7 robust local}\approx80.85
\]

\[
\text{v0.8 refined local}\approx80.91.
\]

v0.8 不刪掉 94.99。

而是把三筆都保存。

因此：

\[
\boxed{
\text{Learning}\neq\text{Destroying Provenance}.
}
\]

---

# 4. Environment Fingerprint

Calibration 現在綁定：

- platform；
- Python；
- architecture；
- logical CPU count；
- NumPy；
- BLAS implementation / version / thread count；
- memory limit。

本 runtime fingerprint：

```text
52715b12b3d096388d272ab95e6f963a6b0a620df71023e5ff121926dc292074
```

它是：

\[
\boxed{
\text{calibration identity key}
}
\]

不是 hardware attestation。

---

# 5. Fingerprint 一樣也可能變慢

Certificate @100：

scalar：

\[
3.843\ \mu s
\rightarrow
5.027\ \mu s
\]

約：

\[
\boxed{+30.8\%}.
\]

vectorized：

\[
3.674
\rightarrow
4.100\ \mu s
\]

約：

\[
+11.6\%.
\]

coarse environment fingerprint 沒變。

因此：

\[
\boxed{
\text{Fingerprint Match}
\not\Rightarrow
\text{Performance Stationarity}.
}
\]

---

# 6. Drift Candidate

v0.8 記錄：

```text
LOCAL_PERFORMANCE_DRIFT_CANDIDATE
causal status = UNRESOLVED
```

可能原因包括：

- load；
- CPU frequency；
- scheduler；
- cache / allocator；
- benchmark protocol；
- thermal / microstate；
- 未追蹤環境變數。

所以不能直接說：

> hardware drift 已證明。

---

# 7. Calibration Staleness

舊 evidence 不刪除，
只降低 routing priority。

示範：

\[
S_{\rm age}
=
2^{-\Delta e/4}.
\]

所以：

```text
age 0 -> 1.000
age 4 -> 0.500
age 8 -> 0.250
```

這是 routing policy，
不是統計概率。

---

# 8. Evidence Ranking

第一版權重：

```text
ROBUST_LOCAL         1.00
ACTIVE_ROBUST        1.00
LOCAL_MEASURED       0.90
HISTORICAL_MEASURED  0.82
PROVISIONAL_LOCAL    0.55
```

再乘：

- staleness；
- dispersion factor。

得到：

\[
\boxed{
\text{Trust Score}.
}
\]

---

# 9. Trust Score 不是 Confidence Probability

它不能被解讀成：

> 83% chance 這筆 benchmark 正確。

它只回答：

> 如果同一 exact point 有很多 provenance，router 現在優先用哪一筆？

---

# 10. Calibration Cache

Ledger 是 source of truth。

Cache 對：

```text
(task, algorithm, size)
```

選最高 routing trust entry。

目前：

\[
\boxed{
105
}
\]

exact cache points。

例如 certificate scalar @100，
cache 會選 robust local，
但 historical evidence 仍在 ledger。

---

# 11. Active Benchmark Scheduler

Router 不應均勻地重跑所有 benchmark。

優先測：

- crossover 附近；
- extrapolation edge；
- evidence gap；
- drift candidate；
- resource boundary。

v0.8 第一版 VOI proxy：

\[
V=
\frac{
0.45U+0.35X+0.20G
}{
\sqrt{C_{\rm probe}+\epsilon}
}
\]

其中：

- \(U\)：decision uncertainty；
- \(X\)：extrapolation need；
- \(G\)：evidence gap；
- \(C_{\rm probe}\)：probe cost。

這是 declared heuristic，
不是 universal theorem。

---

# 12. Active Scheduler Top 3

排名前三：

1. certificate @85；
2. GEMM \(n=96\)；
3. sieve \(N=30M\)。

本輪三個全部真的執行。

---

# 13. Active Probe — Certificate 85

robust active measurement：

scalar：

\[
4.334\ \mu s
\]

vectorized：

\[
4.128\ \mu s.
\]

vectorized 略勝。

---

# 14. Certificate Boundary 再收斂

v0.7：

80 relations 時 scalar 略快。

v0.8：

85 relations 時 vector 略快。

log-ratio interpolation：

\[
\boxed{
C^*\approx80.91.
}
\]

v0.7 robust：

\[
80.85.
\]

所以 local routing boundary 現在非常穩定地落在：

\[
\boxed{\sim81\text{ relations}}
\]

附近。

仍只對本 runtime 成立。

---

# 15. Active Probe — GEMM 96

NumPy/OpenBLAS：

\[
25.38\ \mu s
\]

Python naive：

\[
37.29\text{ ms}.
\]

speedup：

\[
\boxed{
\sim1469\times.
}
\]

OpenBLAS dominance 再往右擴一個 calibration point。

---

# 16. Active Probe — Sieve 30M

兩 algorithms 均得到：

\[
\boxed{
\pi(30,000,000)=1,857,859.
}
\]

odd-only：

\[
0.1381\text{ s}
\]

segmented：

\[
0.2801\text{ s}.
\]

所以 time winner：

\[
\boxed{
\texttt{odd\_only\_bytearray}.
}
\]

segmented 仍保留 memory advantage。

---

# 17. Active Evidence 回寫

前三個 active probes 產生：

\[
6
\]

個 algorithm-size timing entries。

標記：

```text
ACTIVE_ROBUST
epoch = 8
current environment fingerprint
```

Ledger：

\[
108
\rightarrow
\boxed{114}.
\]

---

# 18. Learning Memory Object

可以寫成：

\[
\boxed{
\mathcal M_{\rm cal}
=
(
\mathcal L,
F_E,
S_{\rm stale},
W_{\rm evidence},
D_{\rm drift},
A_{\rm schedule}
)
}
\]

其中：

- \(\mathcal L\)：append-only ledger；
- \(F_E\)：environment fingerprint；
- \(S_{\rm stale}\)：staleness；
- \(W_{\rm evidence}\)：evidence ranking；
- \(D_{\rm drift}\)：drift detector；
- \(A_{\rm schedule}\)：active benchmark scheduler。

---

# 19. Calibration Resolution

DMSD 原本有：

\[
\rho=\text{scale resolution}.
\]

後來有：

\[
\eta=\text{source depth}.
\]

現在再加：

\[
\boxed{
\kappa=\text{calibration resolution}.
}
\]

表示：

> performance surface 哪裡量得密、哪裡量得疏。

因此 benchmark data 本身也變成 lazy multiscale object。

---

# 20. Stale 不等於 Wrong

老 benchmark：

\[
e_{\rm old}
\]

不是被改成 false。

而是：

\[
\boxed{
\text{less preferred for current routing}.
}
\]

這和 DMSD 的 knowledge-state / provenance 原則完全一致。

---

# 21. Active Learning 不等於永遠測量

若：

- winner margin 大；
- evidence 新；
- calibration trust 高；
- 不靠近 boundary；

則：

\[
\boxed{
\text{do not benchmark}.
}
\]

因為 probe 自己也有 cost。

---

# 22. Benchmark Scheduling 也是 Budget Problem

未來可以給：

\[
B_{\rm probe}.
\]

只有：

\[
C_{\rm probe}\le B_{\rm probe}
\]

且 VOI 足夠，
才執行 benchmark。

所以 Router 甚至要解：

> 為了決定該用哪個算法，先花多少計算去比較算法才值得？

---

# 23. Drift 與 Learning

如果 performance shift：

\[
>20\%
\]

可以觸發：

```text
DRIFT_CANDIDATE
```

如果 routing boundary shift：

\[
>10\%
\]

可以觸發：

```text
BOUNDARY_SHIFT_CANDIDATE.
```

但兩者都不是 causal diagnosis。

---

# 24. 完整 Evidence Retrieval

現在 routing calibration lookup 可以依：

```text
active robust exact
↓
robust local exact
↓
recent local exact
↓
historical exact
↓
interpolation
↓
extrapolation
↓
active benchmark
```

而不是：

```text
always trust the latest scalar.
```

---

# 25. Validation

本輪驗證：

- environment fingerprint consistency；
- staleness monotonicity；
- stronger exact evidence wins cache；
- 6 active robust cache entries；
- certificate @85 vector winner；
- GEMM @96 OpenBLAS dominance；
- sieve @30M exact count；
- crossover refinement consistency；
- active scheduler top-3 all executed。

全部：

```text
PASS.
```

---

# 26. 現在完整 Horizon Stack

\[
\boxed{
\text{Scale}
}
\]

↓

\[
\boxed{
\text{Task Family}
}
\]

↓

\[
\boxed{
\text{Algorithm Portfolio}
}
\]

↓

\[
\boxed{
\text{Calibration Memory}
}
\]

↓

\[
\boxed{
\text{Resource Admission}
}
\]

↓

\[
\boxed{
\text{Auto-Routing}
}
\]

↓

\[
\boxed{
\text{Active Recalibration}.
}
\]

---

# 27. 下一步

最自然是：

# Horizon Edition v0.9 — Persistent Performance Surface / Change-Point Model

把離散 calibration points 變成：

\[
T(Q,A,x,E,t)
\]

的 temporal surface。

加入：

- rolling local model；
- regime transition；
- change-point；
- uncertainty band；
- drift segmentation；
- environment clustering；
- calibration migration。

那時候 Router 可以回答：

> 這次慢，是 noise，還是 algorithm / hardware 真正進入新 regime？

---

# 28. 結論

v0.8 最重要的改變：

\[
\boxed{
\text{Router now remembers why it believes what it believes}.
}
\]

不是只保存：

```text
A is faster.
```

而是保存：

```text
A was faster
at this size
in this environment
with this protocol
at this epoch
with this dispersion
and this evidence kind.
```

然後再決定：

> **現在還要不要信？**

---

```text
DMSD Horizon Edition v0.8: COMPLETE
Calibration Ledger: APPEND-ONLY
Environment Fingerprint: ENABLED
Staleness: ENABLED
Evidence Ranking: ENABLED
Drift Candidate Detection: ENABLED
Active Benchmark Scheduler: ENABLED
Active Learning Update: PASS

Next:
v0.9 — Persistent Performance Surface / Change-Point Model
```
