기존 src/models/phase_b_loss_da3.py (v1)는 DA3 paper의 supervision 전략이 아닌, DA3의 출력 스키마에만 맞춰 자체 설계된 loss였다. ckpt 1500에서 viz agent_L/R r=0.95로 나쁘지 않았지만, paper §3.2를 정독하면서 구조적 격차 4개를 발견.
P = D·d + t로 묶이는 관계인데, 이걸 supervise하지 않으면 한쪽이 다른 쪽 보상하는 drift mode 허용. 증거: ray_origin loss ~1.25 vs depth loss ~0.06 — 한 자릿수 차이.lgm_connector_da3.py — pose_enc 노출DA3 cam_dec가 9-DoF [t, q, fov] raw vector를 출력하는데, v1 wrapper는 이를 pose_encoding_to_extri_intri로 변환해 4×4 extrinsic만 노출했음. v2의 L_C는 9-DoF 직접 supervise가 필요하므로 raw pose_enc도 output dict에 추가. back-compat을 위해 extrinsic/intrinsic은 함께 derive해서 유지.
src/models/phase_b_loss_da3_v2.py — paper §3.2 풀 구현 (신규 257L)Total: L = L_D + L_M + L_P + L_C + L_grad, 가중치 모두 1.0 (paper α=β=1)
| 항 | 구현 요지 | v1과의 차이 |
|---|---|---|
| L_D | (1/Z) Σ m_p (D_c · |D̂-D| − λ_c · log D_c). D_c = softplus(pred_conf), λ_c=0.1 | plain L1 → conf-weighted |
| L_M | raw 6-channel L1 (origin scaled by 1/scale + direction unrotated) | 유사 (format 통일) |
| L_P | |P̂ − P_gt_norm|, P̂ = pred_depth · pred_dir + pred_origin, ray 해상도(168×296) | v1 없음 — 신규 |
| L_C | L1(pred_pose_enc, [t_norm(3), q_xyzw(4), fov(2)]), FOV: 2·fx/W | R(3×3) L1 → 9-DoF + FOV |
| L_grad | depth 해상도(294×518)에서 finite-difference L1 (x+y 양방향) | v1 없음 — 신규 |
scripts/train_lgm_robocasa_da3_v0.py에 v2 loss import + --lambda_c arg + log 컬럼 변경. exp dir 패턴을 lgm_robocasa_da3_v0_lossv2_*로 분리하여 v1 checkpoint와 명확히 구분 (v1 dir에서 resume 시 metric-scale vs unit-scale 충돌로 spike 위험).
| 단계 | total | L_D | L_M | L_P | L_C | L_grad | NaN/Inf |
|---|---|---|---|---|---|---|---|
| Random smoke test | 3.7455 | 0.5577 | 0.5481 | 0.8049 | 0.6367 | 1.198 | clean |
| Real data 1차 (ckpt 1500) | 1.2432 | -0.2470 | 0.4168 | 0.5204 | 0.5451 | 0.0078 | clean |
| Real data 2차 (softplus + λ=0.1) | 1.9569 | 0.4667 | 0.4168 | 0.5204 | 0.5451 | 0.0078 | clean |
| Job | Dir | Loss ver | 상태 |
|---|---|---|---|
| 2903 | lgm_robocasa_da3_v0_0430_1822 | v1 baseline | RUNNING ~step 1948 |
| 3219 | lgm_robocasa_da3_v0_lossv2_<ts> | v2 (paper §3.2) | RUNNING step 0+ |
두 잡 모두 끝까지 유지하여 step 1500/3000/5000 ablation 비교 예정.
v1 → v2는 단순 가중치 조정이 아니라 supervision space 자체를 변경한 것이다. metric pred space에서 학습하면 backbone이 원래 출력하던 relative scale 분포와 괴리가 생겨 LoRA가 더 큰 변화를 학습해야 한다. GT-side unit-scale 정규화로 pred는 DA3 자연 공간에 머무르고 LoRA 부담이 줄어든다.
depth와 ray는 P = D·d + t 관계로 묶여있다. L_P 없으면 depth만 잘 학습되고 ray가 drift하는 모드가 허용된다 (v1에서 ray_origin loss가 depth loss 대비 한 자릿수 높았던 이유). L_P는 두 변수를 동시에 구속하는 핀이다.
① 4-GPU DDP 안정성 — 새로 노출된 pose_enc 분기에서 find_unused_parameters 정상 동작 여부
② Step 0~100 loss spike 없음 / NaN/Inf 없음 (특히 softplus(conf).log() numerical edge case)
③ Step 500/1000 viz 품질 — pred depth가 GT 구조 잡는지, conf map 유의미한 분포 보이는지
④ scale 안정성 — P_norm 기반 scale이 v1 per-clip 1.05~1.65보다 안정적인지 확인
① FOV convention round-trip: fov_x = 2·fx/W가 DA3의 pose_encoding_to_extri_intri와 일치하는지 GT extrinsic → pose_enc → 역변환으로 검증 필요
② Quaternion xyzw vs wxyz: _matrix_to_quat_xyzw round-trip 자체 검증
③ softplus(conf) numerical: pred_conf가 매우 negative → softplus→0 → log→-∞. (D_c+1e-6).log()로 막았지만 실학습 중 conf -50까지 가는지 확인
동일 step (1500)에서: scale 변동(v1 1.05~1.65 vs v2 이론상 1), agent_L/R r(v1 0.95 vs v2 ?), eye_in_hand r(v1 0.74 vs v2 0.85+ 기대), conf map 정성 검사