Skip to content

[FEATURE] neuron Phase 14 — attention 도 HybridGraphLinear 로 (full graph block) #69

Description

@juhy0987

배경 (Phase 13 직후)

Phase 13 (PR #68 머지) 에서 HybridGraphLinear 를 Transformer FFN 위치 에 통합 + RMSNorm 도입 — 4 verdict 모두 PASS, paradigm 의 architecture-agnostic 성질 확인.

하지만 Phase 13 은 attention 의 qkv / out 은 표준 nn.Linear 그대로 유지. paradigm 의 ultimate goal (training-time dynamic parameter count) 까지 가려면 attention 의 channel routing 도 graph 표현이 되어야 함 — Phase 14 의 작업.

목표

  1. HybridGraphCausalSelfAttention — qkv / out projection 을 HybridGraphLinear 로 교체
  2. FullGraphTransformerBlock — attention + FFN 둘 다 graph (block 전체가 graph)
  3. function preservation — adj=full/full + 동일 weight init → standard attention 동치
  4. 4 arch sweep — Phase 13 와 동일 구조이되 이번엔 attention 도 영향:
    • plain
    • hybrid_full_full
    • hybrid_full_around_one
    • hybrid_around_one_around_one

설계 결정

  • qkv projection 은 hidden_dim → 3·hidden_dim 으로 rectangular → identity outer 미지원 (Phase 13 FFN 과 동일)
  • Phase 13 의 HybridGraphTransformerBlock (FFN-only graph) 는 그대로 유지 — Phase 14 는 신규 FullGraphTransformerBlock 으로 추가
  • Phase 13 vs Phase 14 비교 = noteboook 의 sweep 결과로 자연 비교 (별도 cross-phase notebook 불필요)

작업 항목 (단일 PR, sub-issue 불필요)

  • src/graphlm/neuron/graph_attention.py 신규 — HybridGraphCausalSelfAttention + 단위 테스트
  • src/graphlm/neuron/hybrid_transformer.py 확장 — FullGraphTransformerBlock + make_full_block dispatch
  • function preservation 테스트 (standard CausalSelfAttention 와 forward 동치 atol=1e-5)
  • src/graphlm/neuron/hybrid_transformer_demo.py 확장 — FullGraphTransformerLM + train helper (config 재사용)
  • notebooks/02-function-level/13-phase14-graph-attention.ipynb 신규 — 4 arch sweep + 시각화 (FFN-only Phase 13 baseline 과 비교)
  • 0-init 거부 + magnitude rule 일관 적용

완료 조건

  • 160 → ~180+ tests, all green
  • coverage ≥ 70%
  • 노트북 sweep 정상 실행 (GPU 사용자 측), 4 arch loss curve 비교 가능
  • Notion Phase 14 페이지 작성

Phase 14 후의 다음 단계 (Phase 15+)

본 단계에서 block 전체가 graph 확립 후, 다음은:

  • Phase 15: sparsity-driven prune (edge magnitude < threshold → 영구 제거)
  • Phase 16: Net2Net / LiGO 식 growable graph (학습 중 channel/group 추가)

관련

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions