배경
Phase 9 (PR #60) 의 결정적 발견:
group_full ≈ plain Linear (graph 구조 free, function preservation 입증)
group_identity (block-diagonal sparse 시작) = +0.14 loss 열위 — 0-init vanishing 패턴이 graph paradigm 에서도 재현
- 메모리 등록:
0-init 금지 규칙 (feedback_no_zero_init.md)
이 결과를 바탕으로 사용자 vision (히든 레이어 자체를 graph) 의 본질 axis A (channel-as-node) 진입. 그러나 단순 0-init sparse 진입 = Phase 9 의 함정 재현 → A-safe (small random adj init) 로 진입.
핵심 설계 — channel-as-node graph (단일 채널 = 1 node)
hidden_dim H 채널 = H 개 node
edge[in, out]: 각 (in, out) 쌍에 대해 adj[out, in] ∈ ℝ (학습 가능 routing scalar)
effective weight: W_eff = adj ⊙ W (elementwise product)
forward: y = W_eff @ x
- node = 1 채널 (graph 의 vertex, paradigm 의 finest unit)
- edge weight = adj[out, in] · W[out, in]
- adj_init 옵션:
"full" — 모두 1 (function preserving, standard Linear 와 forward 동치)
"uniform_small" — uniform[0.05, 0.15] (Phase 2 sweet spot 패턴 channel-level edge 에 적용)
- ❌
"zero" 옵션 거부 — 0-init 금지 규칙 적용 (명시적 ValueError)
검증할 가설
- function preservation — adj=full 시 standard Linear 와 forward 동치?
- gradient flow through adj — adj 가 학습 가능 (per-edge importance 학습)?
- sweet spot 적용 효과 — adj_init=uniform_small (Phase 2 패턴) 으로 시작 시 plain 과 비교?
- post-training adj 분포 — 학습 후 일부 edge 가 자연 약화 (implicit pruning channel-level)?
- Phase 9 group 과의 비교 — channel-level granularity 가 group-level 보다 표현력 우위?
범위 — Phase 10 = channel graph foundations
신규 모듈 — src/graphlm/neuron/graph_channel.py
ChannelGraphLinear(in_features, out_features, adj_init)
- weight:
(out, in) standard linear weight
- adj:
(out, in) — 학습 가능 per-edge gate scalar
- forward:
y = (adj * weight) @ x (elementwise)
adj_init="full" → 모두 1 (function preserving)
adj_init="uniform_small" → uniform[0.05, 0.15] (sweet spot 패턴)
- ❌
adj_init="zero" 시 ValueError (0-init 금지 규칙)
sparsify_adj(threshold) — Phase 11+ 학습된 routing 의 hard sparsification stub
adj_sparsity() — 현재 |adj| < threshold edges 비율 측정
테스트 — tests/neuron/test_graph_channel.py
- shape (weight + adj 모두
(out, in))
- adj_init values 검증 (full=1, uniform_small ∈ [0.05, 0.15])
- 0-init 거부 검증 —
adj_init="zero" 시 ValueError + 메모리 규칙 명시
- function preservation — adj=full + 같은 W → standard Linear forward 동치 (atol=1e-5)
- gradient flow — weight, adj 모두 grad 흐름
- sparsify_adj / adj_sparsity 동작 + edge case
- in/out features 검증 (positive int)
데모 노트북 — notebooks/02-function-level/09-phase10-channel-graph-foundations.ipynb
- 3 × 2 sweep: arch ∈ {plain, channel_full, channel_uniform_small} × seed ∈ {42, 123} = 6 run
- HIDDEN_DIM=256, GROUP_SIZE 무관 (channel granularity)
- §5 final_loss 비교 + Phase 9 결과 (plain 2.1378, group_full 2.1391) 와 직접 비교
- §6 학습된 adj 분포 분석 (histogram) — Phase 5 의 implicit pruning 패턴이 edge-level 에서 재현?
- §7 adj heatmap (256 × 256 — color-coded sparsity)
- §8 loss curve 3 arch
완료 조건
Phase 11+ 계획
- Phase 11: 계층적 hybrid (Phase 9 group + Phase 10 channel nest) — vision 의 ultimate
- Phase 12: 학습된 routing (DARTS / L0 / Gumbel) 로 adj sparsification 학습
- Phase 13: Transformer 통합 (Q/K/V/O 모두 ChannelGraphLinear or GroupGraphLinear)
참고
배경
Phase 9 (PR #60) 의 결정적 발견:
group_full≈ plain Linear (graph 구조 free, function preservation 입증)group_identity(block-diagonal sparse 시작) = +0.14 loss 열위 — 0-init vanishing 패턴이 graph paradigm 에서도 재현0-init 금지규칙 (feedback_no_zero_init.md)이 결과를 바탕으로 사용자 vision (히든 레이어 자체를 graph) 의 본질 axis A (channel-as-node) 진입. 그러나 단순 0-init sparse 진입 = Phase 9 의 함정 재현 → A-safe (small random adj init) 로 진입.
핵심 설계 — channel-as-node graph (단일 채널 = 1 node)
"full"— 모두 1 (function preserving, standard Linear 와 forward 동치)"uniform_small"— uniform[0.05, 0.15] (Phase 2 sweet spot 패턴 channel-level edge 에 적용)"zero"옵션 거부 —0-init 금지규칙 적용 (명시적 ValueError)검증할 가설
범위 — Phase 10 = channel graph foundations
신규 모듈 —
src/graphlm/neuron/graph_channel.pyChannelGraphLinear(in_features, out_features, adj_init)(out, in)standard linear weight(out, in)— 학습 가능 per-edge gate scalary = (adj * weight) @ x(elementwise)adj_init="full"→ 모두 1 (function preserving)adj_init="uniform_small"→ uniform[0.05, 0.15] (sweet spot 패턴)adj_init="zero"시 ValueError (0-init 금지 규칙)sparsify_adj(threshold)— Phase 11+ 학습된 routing 의 hard sparsification stubadj_sparsity()— 현재 |adj| < threshold edges 비율 측정테스트 —
tests/neuron/test_graph_channel.py(out, in))adj_init="zero"시 ValueError + 메모리 규칙 명시데모 노트북 —
notebooks/02-function-level/09-phase10-channel-graph-foundations.ipynb완료 조건
ChannelGraphLinear구현 + function preservation 검증make lint/make test통과Phase 11+ 계획
참고