Phase 4 — 전문가 슬라이스 데이터 경로 (M1)

약한 기기가 1.4 GB 레이어가 아니라 6 MB짜리 전문가 몇 개만 내려받는다 — 그리고 샤딩 계산은 monolithic과 3.6e-12까지 일치한다.

검증 · 실제 Qwen3.5-122B-A10B

전문가 슬라이스는 바이트 복사 — dequant 없음

256→8
전문가 차원 슬라이스
~6.1
MB / 전문가 (Q4+Q6)
206 MB
2층 × 16전문가 다운로드
200
HTTP, 유효한 GGUF

MoE 전문가 텐서는 모든 전문가를 최외곽 ggml 차원에 쌓으므로, 리더는 (n_expert, rows, row_bytes)의 원시 양자화 바이트를 노출한다. 전문가 *e*는 양자블록 정렬 연속 슬랩이다 — 슬라이스는 문자 그대로 data[a:b]이며, dequant도 re-pack도 없다.

write_expert_shard_gguf — 검증된 라운드트립.

sliced = tensor.data[a:b]              # outermost axis = expert
writer.add_tensor(name, sliced, raw_dtype=tensor.tensor_type)
# router (ffn_gate_inp) & shared expert stay on the backbone → excluded
GET /api/proxy/models/{m}/expert-shard?layers=0:2&experts=0:16  # node-token authed
A laser slicing one expert slab into a mini-GGUF beside a perfectly level balance scale
수치 oracle

dispatch + combine == monolithic, 정확히

실제 122B layer-0 전문가(dequant 레퍼런스)로, 전문가를 4개 샤드로 나눠 따로 계산하고 combine한 결과가 monolithic MoE FFN과 일치한다: 샤딩은 같은 가중합의 정확한 재그룹핑이지, 근사가 아니다.

3.6e-12
max|mono − sharded|
1.2e-07
상대 오차
True
allclose(1e-5)
28/256
관여한 전문가
C++ 워커, 하드웨어 검증

linkcpp-expert-worker가 ROCm에서 oracle을 재현

  • 순수 ggml/gguf(libllama 없음): 슬라이스를 GPU 백엔드에 로드하고 mul_mat_id(up/gate) → swiglu → mul_mat_id(down)을 실행.
  • ROCm 빌드 + 실행(MI250): 122B layer-0, 전문가 [0,8), 4토큰.
  • oracle 대비 cosine 0.99995, allclose(1e-3) = True, max|Δ| = 7.9e-7 — 이 잔차 자체가 교차 백엔드 동등성(ROCm vs numpy)의 첫 실측 사례다.
  • 같은 코드 경로가 CUDA/Metal/Vulkan/CPU를 커버한다(mul_mat_id/swiglu는 기본 ggml; CUDA엔 전용 MoE 커널).

가장 어렵고 위험한 조각 — 온디바이스 워커 커널 — 이 여기서 검증됐다. 남은 것은 백본↔워커 오케스트레이션이었고, 워커는 이 슬라이스를 소비하는 검증된 순수 함수다.