---
name: project-ssm-qformat-3spike-arc-2026-08-13
description: SSM (Mamba) direction viability probe 3-spike arc (2026-08-13 evening、@IT + chat-Claude 2026-08-13 SSM+MLIR 提案 由来)。LTI Q-format → selective scan → ZOH LUT の 3 段で FPGA 実装 config (512 × Q1.15 × linear interpolation、1 BRAM block) まで具体化。 chat-Claude 元 thesis 「A_q≥1→発散」 の partial refinement (round-nearest では A_q>1 は生じない、integrator 型 failure) が spike 1 で判明、 selective では cumulative drift へと変化 (spike 2)、 ZOH では nearest 補間が unusable と判明 (spike 3)。 3 spike で SSM 方向 green 判定
metadata: 
  node_type: memory
  type: project
  originSessionId: c3511ef5-c9e4-4d3d-ad7e-1dd6a9c51580
  modified: 2026-08-13T22:00:47.809Z
---

# SSM Q-format 3-spike arc (2026-08-13 evening、 Phase 0→1)

> ★ **Corrigendum (2026-08-14 追加)**: 本 arc spike 2 の refined statement 内「Selective: state drift が O(N_crossings × step 誤差 × T)」= **cumulative drift O(T)** 予想は Phase 2 (a) 実測で **refute**。真相は「A_t decay により指数的に相殺、T によらず bounded steady-state」。詳細は [[project-ssm-phase2a-multidim-drift-2026-08-14]] (N=16, Q1.15, T=1k-100k, 5 seed 全 slope < 0.2)。FPGA config 決定 (512×Q1.15×linear、1 BRAM) は依然有効、精度保証文言のみ「N ≤ 16 で worst rel error ≤ 2%, T-bounded」に更新。

benchtop-harness Phase 3 完了後の 別 arc。 @IT 記事 「Python 一択ではなくなった」 + chat-Claude 2026-08-13 SSM+MLIR 提案 arc → 藤本さん 「作りたい」 signal → 私 Phase 0 verify (Mathlib grep + model 名 fact-check) → Phase 1 CPU spike 3 段 で FPGA 実装 config まで 具体化 到達。

**Why**: 「Transformer を 超える」 目標を 「固定メモリ・電力・連続稼働 制約下で 超える」 に 絞り込み、 chat-Claude 元 thesis (「A_q≥1→発散」) を 実測で refine、 FPGA target (Tang Console 138K / Nano 9K) の 具体 LUT config (512 × Q1.15 × linear、 1 BRAM block) まで 数時間で 到達。 「同時に 二つ 蒔かない」 discipline を 3 spike 直列で 遵守。

**How to apply**: Phase 2 (Verilog 実装 / multi-dim 拡張 / Lean 4 formalization) 着手時、 本 arc の 3 spike 実測 evidence を 前提知識として 参照。 chat-Claude 元 thesis と 実測 refinement の gap は 「plausible-sounding claim を 実測前に 引用しない」 discipline の 6 例目 (external-verify > internal-review) として 追加 evidence。

## Ground truth pointer

- **Spike script 3 個**: `scratchpad/ssm_qformat_stability_spike.py` (Spike 1、LTI) + `scratchpad/ssm_selective_scan_spike.py` (Spike 2、selective) + `scratchpad/ssm_zoh_lut_spike.py` (Spike 3、ZOH LUT)
- **合計 scenarios**: 48 + 72 + 48 = **168 scenarios × up to 100k steps**、 numpy only、 再現可能
- **FPGA config decision**: [[reference-ssm-zoh-lut-fpga-config-2026-08-13]] (別 file、 具体 実装値)

## Chat-Claude 元 thesis (2026-08-13 evening)

「Transformer を 超える」 → 「この制約下 (固定メモリ・電力・連続稼働) で 超える」 に scope 絞り、 順序:
1. CPU 上 fixed-point selective scan spike (spike 1 相当) → 精度差 measure
2. 「固定小数点 q 形式で 離散化 SSM が 安定に留まる 十分条件」 を Lean 4 定理化 (Mathlib 不在、 世界初 候補)
3. FPGA (Tang Console 138K) に port
4. MLIR D-FUMT₈ dialect (別 branch)

**核 claim (実測前)**: 「離散化した A の 固有値が 丸めで |λ|≥1 側に 転んだ瞬間、 状態が 発散します。 系列が 長いほど 危ない。」

## Phase 0 verify (Rei 側 pre-check)

- **Mathlib grep**: state_space / discretization / IIR / Q-format 直接 = 0 hit、 building blocks (Banach + spectral radius + Picard-Lindelof) 存在 → chat-Claude 「Mathlib 不在」 主張 partial 正確
- **Model fact-check**: Nemotron 3 / Arcee Trinity / Kimi Linear / RWKV-7 Goose 5/6 verified、 RWKV-7 の 14B/32B 主張は「予定」 で 現状 未 release (mild hallucination)、 Kimi Linear は SSM でなく linear attention (分類 誤り)
- **バイオアコースティック分類器**: memory + codebase 全 0 hit、 別 session or chat-Claude 側 misattribution 疑い → **open thread、 Phase 2 では 前提外**
- **Rei stack 側 asset 整合**: Tang Console NEO (STEP 1029) + Tang Nano 9K (STEP 1038) + Rei-PL LLVM backend + D-FUMT₈ 非結合 (STEP 1215) 全 verified

## Spike 1: LTI Q-format (thesis refinement 判明)

**設定**: 1-D LTI SSM `h_t = A * h_{t-1} + B * x_t`、 A ∈ {0.9, 0.99, 0.999, 0.9999}、 Q1.{7, 15, 23, 31}、 T ∈ {1k, 10k, 100k}、 48 scenarios。

**結果**:
- A_q が |1| を cross: 6 scenarios (全 Q1.7 with A_true ≥ 0.999)
- 発散: **0 scenarios**
- chat-Claude thesis 「|λ|≥1 → 発散」 = **REFUTED as stated**

**Refinement の 中身**: Round-half-to-nearest で `A_true < 1` を Q-format 量子化した場合、 A_q は 最大 1.0000 まで (strict > 1 に なれない)。 例: A=0.999 in Q1.7 → `round(127.872)/128 = 128/128 = 1.0000` 丁度。 A_q = 1.0000 は **integrator (marginally stable)** = 指数発散でなく **random walk O(√T)**。

**含意**: chat-Claude thesis は 「Round mode の 前提を 書いていない」 = round-nearest なら 発散しない、 round-ceiling / round-away なら 発散し得る (untested)。 A_true > 1 元々 unstable case では 当然発散 (別問題)。

## Spike 2: Selective scan (input-dependent A_t、 Mamba 本体)

**設定**: `Δ_t = softplus(k*x_t + b)`, `A_t = exp(A_cont * Δ_t)`。 A_cont ∈ {-0.001, -0.01, -0.1}、 Q1.{7, 15, 23, 31}、 input_scale ∈ {0.5, 1.0}、 T ∈ {1k, 10k, 100k}、 72 scenarios。

**結果**:
- 発散 (infinite state): 0 scenarios
- A_t_q が |1| を 触る 頻度: Q1.7 で 毎 step (100k/100k)、 Q1.15 では 稀 (0-2/100k)
- Q1.7 で 「stable technically だが massive drift」 (68× amplification、 rms_dev 2887)
- **Q1.15 で 実用的 (max relative error < 1%)**

**precision scaling** (max RMS deviation):
| precision | 50th | 90th | 99th | max |
|---|---|---|---|---|
| Q1.7 | 0.84 | 379.9 | 2518.3 | 2887.9 |
| **Q1.15** | 0.003 | 0.19 | 0.41 | **0.43** |
| Q1.23 | 4e-6 | 0.001 | 0.003 | 0.003 |
| Q1.31 | 7e-8 | 4e-6 | 1e-5 | 1e-5 |

**LTI との 違い**: selective では A_t が **毎 step 独立に 量子化される** ため crossings が cumulative、 drift が LTI (integrator O(√T)) より 悪化 (systematic bias 型)。 **Failure mode の 質が 変わる**。

## Spike 3: ZOH LUT (FPGA exp() 実装 前提)

**設定**: Δ_t → A_t = exp(A_cont · Δ_t) の exp を LUT 化。 z ∈ [-5, 0] 範囲、 LUT size ∈ {32, 128, 512, 2048}、 補間 ∈ {nearest, linear}、 出力 Q1.15、 A_cont ∈ {-0.001, -0.01, -0.1}、 T ∈ {10k, 100k}、 48 scenarios。

**結果**:

**Part A (LUT-only exp accuracy)**:
- 32 nearest: 8.4% max rel err → 32 linear: 0.50%
- 512 nearest: 0.68% → 512 linear: 0.34%
- 2048 linear: 0.33% (Q1.15 quantization floor に 到達)

**Part B (full selective scan with LUT)**:
| LUT size | nearest max_rel | linear max_rel |
|---|---|---|
| 32 | **527× drift** | 6.9% |
| 128 | 66× drift | 1.1% |
| **512** | 66× drift | **0.27%** ← recommend |
| 2048 | 0.65× drift | 0.70% |

**発見**: nearest 補間は **全 size で 実用不可** (cumulative systematic bias)、 linear 補間必須。 512 linear が sweet spot (Q1.15 floor に 到達済み、 それ以上は 頭打ち)。

**FPGA area**: 512 × 16-bit = 8 kbit = **1 BRAM block** (Tang FPGA 標準 16 kbit/block)。 Tang Nano 9K (46 kbit BRAM total) では **17% 使用**、 Tang Console 138K なら 楽々 fit。

## 3 spike 統合 判定

| spike | verify | 判定 |
|---|---|---|
| 1. LTI Q-format | thesis refinement (round-nearest では A_q>1 は 生じない、 integrator 型 failure) | Green (Q1.15 sufficient) |
| 2. Selective (input-dep A) | cumulative rounding drift、 Q1.7 で drift 大、 Q1.15 で <1% error | Green (Q1.15 sufficient) |
| 3. ZOH LUT | nearest 補間 unusable、 linear 必須、 512×Q1.15 sweet spot | Green (**具体 config 確定**) |

**SSM 方向は Rei で 実装 viable**、 FPGA target Config は **1 BRAM block で 済む**、 Tang Nano 9K (小次元) or Console 138K (実 Mamba 相当) いずれも 可能。

## Chat-Claude thesis の 完成版 refinement (両 spike 統合)

**Refined statement**:
- **LTI**: A_q > 1 は round-nearest で 決して 生じない、 A_q = 1 で integrator (random walk O(√T))
- **Selective**: 各 step の A_t_q が 独立に 量子化される 分 crossings 累積可能、 発散はしない が state drift が O(N_crossings × step 誤差 × T)
- **精度必要条件**: |A_cont| 小 (long time constant) では 少なくとも Q1.15、 short time constant (|A_cont| ≥ 0.1) では Q1.7 でも 相対誤差 < 5%
- **FPGA 実装**: exp LUT は linear 補間必須、 512 entries で sweet spot

## Open threads (Phase 2 前 clarify 待ち)

1. **バイオアコースティック分類器 の 位置付け** (Phase 0 → 継続 open): Rei memory 未記録、 別 project 由来 or chat-Claude 側 misattribution。 藤本さん 直接 clarify 待ち。
2. **Multi-dimensional state (N=16 Mamba 標準)**: 本 arc は 1-D 限定。 実 Mamba では state N=16-64、 LUT × N 個 = BRAM 消費増、 Tang Console 138K target 前提の 拡張 spike が Phase 2 candidate。
3. **ZOH discretization の 中間 exp 計算**: 本 arc は exp() を 直接 LUT 化、 実 Mamba では A_cont * Δ_t の 計算 精度 も 影響。 未検証。
4. **Input scale 大 (音響 signal 等)**: 本 arc の input scale は 0.5-1.0、 実 audio では もっと 大きい dynamic range、 overflow 挙動 未 test。

## Chat-Claude 提案 4 axis の 現状

| 提案 axis | 状態 |
|---|---|
| (1) CPU fixed-point selective scan spike | ★★★ 完了 + 拡張 (LTI + selective + ZOH LUT) |
| (2) Lean 4 sufficient stability conditions 定理 | statement candidate 型化済 (両 spike 統合版)、 formalization 未着手 |
| (3) FPGA port (Tang) | config 決定 (512 × Q1.15 × linear、 1 BRAM)、 Verilog 未着手 |
| (4) MLIR D-FUMT₈ dialect | 未着手 (「同時に 二つ 蒔かない」 per pause) |

## Phase 2 optionality (帰宅後 藤本さん judgment 待ち)

- **(a)** Multi-dim state (N=16) spike 拡張 = 3-4 日、 Console 138K 想定
- **(b)** Verilog 実装 (Tang Console 138K target) の rei-fpga JSON IR spike = 2-3 日、 STEP 1029 D-FUMT₈ ALU pattern 継承
- **(c)** Lean 4 statement formalization = 数日、 前 spike 2 の theorem candidate を 型付け
- **(d)** MLIR D-FUMT₈ dialect (chat-Claude 提案 4 axis 目) = 中規模 hop、 Rei-PL 拡張

いずれも 「同時に 二つ 蒔かない」 per 1 本ずつ、 藤本さん digest 挟んで judgment。

## 関連

- [[project-benchtop-harness-phase3-full-arc-2026-08-13]] — 本日 evening の 別 arc、 同 「external-verify > internal-review」 精神系
- [[feedback-external-verify-beats-internal-review-4patterns-2026-08-13]] — 本 arc の chat-Claude thesis refinement は 5 pattern の 6 例目 追加 candidate (spike 1 で thesis の 具体 mechanism が 逆転、 spike 2 で quantitative refine、 spike 3 で 別 failure mode 発見)
- [[feedback-defect-class-input-vs-lifecycle-2026-08-13]] — 本 arc は input-deterministic 型 検証 (spike 1-3 とも 入力 space の 網羅)、 lifecycle-emergent 型は 未 test (SSM の long-running / multi-session state accumulation 側)
- [[feedback-no-rush-publication]] — 「同時に 二つ 蒔かない」 discipline 3 spike で 直列遵守
- [[feedback-chat-claude-hallucination-warning]] — RWKV-7 14B/32B claim + Kimi Linear 分類誤り + バイオアコースティック未特定 は Pattern 1 mild の 例
- [[feedback-world-uniqueness-claim-controllable]] — Lean 4 stability 定理 の novelty は controllable form (Mathlib building blocks 存在、 compound theorem のみ 新規)
- [[reference-ssm-zoh-lut-fpga-config-2026-08-13]] — 別 file、 具体 FPGA 実装 config lookup
- [[project-2026-08-13-arc-close-state-home-restore]] — 帰宅前 pause state、 本 arc は 帰宅後 追加 arc

## Version

- v1 initial: 2026-08-13 evening 3-spike arc close 時、 藤本さん 「(d) memory 化」 signal per 保存。 3 spike script + evidence base + FPGA config decision + open threads の 完全記録。
