---
name: project-ssm-phase2a-multidim-drift-2026-08-14
description: SSM Phase 2 (a) multi-dim state N=16 spike 完 — Q1.15 の worst-case rel error は per-dim 1.19% / 出力 y 1.77% で 3-spike arc の <1% 断定を refinement、更に T=1k→100k で全 5 seed の log-log slope が < 0.2 (bounded) = 3-spike arc の 「cumulative drift 系」 予想を 実測で refute、bounded steady-state ceiling が真相。Q1.7 は N=16 で完全 unusable (24× drift)、Q1.23 は余裕 (0.005% 以下)
metadata: 
  node_type: memory
  type: project
  originSessionId: 0fbf78aa-8dcf-4dd5-8e62-89880c1846c6
  modified: 2026-08-13T22:00:22.547Z
---

# SSM Phase 2 (a) — Multi-dim state N=16 spike 完 (2026-08-14)

3-spike arc (2026-08-13、N=1) の「Q1.15 sufficient (max rel error <1%)」結論を N=16 実 Mamba スケールで検証。Phase 2 (b) rei-fpga IR spike 完了直後に (a) 着手。FPGA 接続なし、Python の数値実験のみ。

**Why**: 3-spike arc は 1-D で結論を出しており、実 Mamba (N=16-64) では per-dim error 分布 + 出力 y 集約時の compound/cancel + cumulative drift の 3 点で結論が持たない可能性があった。FPGA config 決定 (512×Q1.15×linear、1 BRAM) が 実 Mamba スケールで持つか、Tang に焼く前に Python で見極める。

**How to apply**: SSM を rei-fpga IR や FPGA に載せる時、precision 選択は「Q1.15 で worst-case rel error ≤ 2%, T-bounded」を前提にしてよい。Q1.7 は N=16 で 24× drift なので絶対採用しない。Q1.23 なら 0.005% で余裕がある。**「cumulative drift O(T)」の 3-spike arc の予想は refute された** = 長時間 (T=100k+) 稼働も同じ ceiling で bounded。

## Ground truth pointer

- **spike scripts**:
  - `scratchpad/ssm_multidim_spike.py` — N=16, T=10k, 10 seeds × 3 precision (Q1.7 / Q1.15 / Q1.23)
  - `scratchpad/ssm_multidim_drift.py` — N=16, Q1.15, T=1k/3k/10k/30k/100k, 5 seeds、log-log slope
- **model**: Mamba style 1-input-channel N-hidden-dim、`A_cont ~ -exp(uniform(log 0.001, log 1))` 初期化、`B/C ~ N(0, 0.25)`, `k=1, b=0`, `x_t ~ N(0, 1)`
- **量子化ルール**: 定数を 1 回量子化 + 各時刻の中間量 (Δ, A_t, B_t, Ah, Bx, h_new, C·h, Σ) を都度量子化。exp/softplus は float 計算後量子化 (LUT 実装のモデル)

## Spike 1: Precision × N=16 grid (T=10k, 10 seeds)

| precision | worst-dim rel (median) | worst-dim rel (max) | mean-dim rel (max) | 出力 y rel (max) |
|---|---|---|---|---|
| Q1.7 | 18.8× | **24.5×** (=2450%) | 4.2× | **23.2×** |
| **Q1.15** | 0.72% | **1.19%** | 0.27% | **1.77%** |
| Q1.23 | 0.0027% | 0.0043% | 0.0005% | 0.0034% |

**主要発見**:
1. **Q1.15 の worst-case per-dim rel error は 1.19%** で 3-spike arc の <1% 断定を超過
2. **出力 y の rel error は per-dim より大きい傾向** (median 0.52%, max 1.77%) — C-重み付き和で誤差が systematic に compound
3. **Q1.7 は N=16 で trajectory が別物** (24× drift) — 3-spike arc の 「stable technically but massive drift」から更に悪化して事実上 unusable
4. **worst dim は seed 毎に違う** (dim 15, 2, 6, 7, 4, 6, 9, 13, 11) — 特定 dim の構造欠陥ではなく A_cont 値分布依存

## Spike 2: Cumulative drift T-scaling (N=16, Q1.15, 5 seeds)

各 seed で T=1k → 100k と延ばし、worst-dim rel error の log-log slope を測定:

| seed | T=1k | T=3k | T=10k | T=30k | T=100k | slope | 解釈 |
|---|---|---|---|---|---|---|---|
| 0 | 0.54% | 0.94% | 1.19% | 1.15% | 1.13% | +0.14 | bounded |
| 1 | 0.34% | 0.76% | 0.85% | 0.89% | 0.87% | +0.17 | sublog |
| 2 | 0.27% | 0.38% | 0.42% | 0.42% | 0.41% | +0.08 | bounded |
| 3 | 0.30% | 0.41% | 0.45% | 0.45% | 0.48% | +0.09 | bounded |
| 4 | 1.15% | 1.27% | 1.11% | 0.97% | 1.02% | **-0.04** | **decreasing** |

- **全 5 seed の slope < 0.2** (0.5 ≈ √T random walk、1.0 ≈ O(T) linear、0 ≈ bounded)
- seed 4 は **負の slope** = T=1k の worst が T=100k 時点で下回っている
- Q1.15 error は T によらず **1-1.2% で頭打ち**

**理由の推測** (未検証だが物理的に妥当): A_t ∈ (0, 1) で decay があるため、過去の量子化誤差は指数減衰し、新規誤差の入力が定常状態に達して bounded。閉じたシステムとして減衰が勝つ。

## 3-spike arc への corrigendum

3-spike arc (`project_ssm_qformat_3spike_arc_2026-08-13.md`) spike 2 の Chat-Claude thesis 完成版 refinement 部:

> **Selective**: 各 step の A_t_q が 独立に 量子化される 分 crossings 累積可能、 発散はしない が **state drift が O(N_crossings × step 誤差 × T)**

の **後半 (O(T) drift)** が **N=16 実測で refute**。真相は:

> **Selective, N=16 実測**: A_t が (0,1) の decay を持つ限り、量子化誤差の累積は指数減衰と相殺され、**T によらず bounded steady state**。Q1.15 で ceiling ~1.2% per-dim, ~1.8% output。

前 arc の「systematic bias 型で悪化」表現は、**LTI との比較で「LTI より steady-state ceiling が高い」**の意味であって「T に対して悪化」ではなかった、と読み直すべき。

前 arc 側 memory に本ファイルへの pointer を corrigendum note として追加済。

## FPGA config への影響

3-spike arc の決定 (512 entries × Q1.15 × linear × 1 BRAM block) は **依然有効**。ただし精度保証の文言を以下に更新:

- 従前: 「Q1.15 で max rel error < 1%」(N=1 前提)
- 更新: 「Q1.15 で N ≤ 16 の worst-case rel error ≤ 2% (per-dim + output aggregation 込み)、T-bounded」

長時間稼働 (T=100k+) でも同じ ceiling なので、SSM の連続稼働制約 (元 chat-Claude thesis「固定メモリ・電力・**連続稼働**」) には むしろ強化された保証。

## Rei-side value 明示 (novelty 主張ゼロ)

- Mamba の precision 分析自体は既存 SSM 系の常套。N=16 が Mamba 「標準」 スケールなのも文献既知。
- 「量子化誤差の指数減衰による bounded 化」は制御工学の常識で、私が発見したものではない。
- 本 spike の Rei-side value = **3-spike arc の自己 corrigendum discipline の 実例** — 前 arc の予想を実測で refute し、両 memory を link して残す。external-verify > internal-review の N 例目 candidate。

## Open threads

1. **N=64 拡張**: 大型 Mamba variant では N=64、Q1.15 で 5% 突破するかどうか未検証。同スクリプトで N を差し替えるだけなので 別 STEP で可能。
2. **入力 dynamic range 変更**: 本 spike は `x_t ~ N(0, 1)`。実 audio では input scale が 5-10 も普通、overflow 発生条件は未 test (spike 2 の open thread 継承)。
3. **B/C 分布の spread 依存**: 本 spike は `B/C ~ N(0, 0.25)`。実 Mamba 学習後の分布 (heavy-tailed の可能性) では出力誤差の tail が変わる可能性。
4. **spike 2 (N=1) の 「cumulative drift」 予想の再確認**: 本 spike で N=16 では refute されたが、N=1 でも真は bounded なのか、それとも N=1 では slope > 0 が出るか未確認。差分の起源が「N の並列冗長性による誤差平均化」か「元々 A_t decay で bounded」かは今後の分析対象。
5. **Steady-state ceiling の理論式**: A_t 分布・quantization step size から steady-state error の理論 upper bound を導出できるか (制御工学の standard analysis 適用可能)。

## Phase 2 残候補 (前 phase 2 (a) 完了)

- **(c)** Lean 4 stability 定理 formalization = 本 spike の bounded steady-state 主張を Lean 4 型化する候補
- **(d)** MLIR D-FUMT₈ dialect = chat-Claude 提案 4 axis の最終、中規模 hop
- (b') Word-level SMT で n=16 乗算器 verify 再挑戦 = 別道具導入、実装数時間見込み

いずれも 1 本ずつ per「同時に二つ蒔かない」。

## 関連

- [[project-ssm-qformat-3spike-arc-2026-08-13]] — 前 arc、本 STEP で spike 2 の cumulative drift 予想を refute (corrigendum note added)
- [[reference-ssm-zoh-lut-fpga-config-2026-08-13]] — FPGA config 決定、本 STEP で精度保証文言 update (≤ 2%, T-bounded)
- [[project-ssm-ir-spike-phase2b-multiplier-ceiling-2026-08-14]] — 同日先行、Phase 2 (b) rei-fpga IR spike 完 (exp LUT + multiplier ceiling)
- [[feedback-external-verify-beats-internal-review-4patterns-2026-08-13]] — 本 STEP は前 arc の内部予想 (cumulative drift O(T)) を外部実測で refute した = 該当パターンの追加例
- [[feedback-no-rush-publication]] — Phase 2 は 1 本ずつ
- [[feedback-world-uniqueness-claim-controllable]] — Mamba 精度分析 + 量子化誤差 bounded 化は既知、novelty 主張ゼロ

## Version

- v1 initial: 2026-08-14 深夜、Phase 2 (a) arc close 時、藤本さん (i) → 進めて signal per 保存。 Spike 1 (10 seeds × 3 precision) + Spike 2 (5 seeds × 5 T checkpoints) の実測数値 + 3-spike arc corrigendum + FPGA config 保証文言更新の完全記録。
