Download code/sera_v4/frontend_probe/SPEC.md from phammminhhieu/trace-vla-code: direct link, hf CLI and curl.
- Browser
- Download file 5.32 kB
-
https://huggingface.co/phammminhhieu/trace-vla-code/resolve/main/code/sera_v4/frontend_probe/SPEC.md
- Command line
-
hf download hf://phammminhhieu/trace-vla-code/code/sera_v4/frontend_probe/SPEC.md
-
curl -L -o SPEC.md https://huggingface.co/phammminhhieu/trace-vla-code/resolve/main/code/sera_v4/frontend_probe/SPEC.md
Frontend probe — SPEC (fixed 2026-11-18 BEFORE any frontend training)
Protocol: paired micro-train, same seed 42 + same data order + same init family as Stage 1 arm D, 10,000 micro-steps per arm, sequential on the single GPU. Base configuration for every arm = sera-v4-d-skillroute (v4_moe_mode=skillroute, joint stage, batch 8 × accum 4, LR peak 1e-4, warmup 200 micro, cosine → 1e-5 @10k, bf16, eval_split 0.1).
Arms
- F0 — control (NO training). Arm D's existing checkpoint 010000. Known: val FM @10k = 0.3979; routing @10k task_cos mean 0.766 [0.740, 0.745, 0.636, 0.944], eff [5.27, 6.12, 7.00, 8.00], no dead/swamp. F0 still needs its 70-ep probe baseline (to be measured with the same harness as F1/F2).
- F1 — unfreeze. D config +
--policy.finetune_vision_last_n_layers=2--policy.finetune_language_last_n_layers=1(the config fields the trunk already exposes; semantics verified in code + a 40-step smoke with trainable-parameter count BEFORE the full launch). Init = init_skillroute (same as D). Run name: sera-v4-f1-unfreeze.
- F2 — alignment loss. D config, backbone fully frozen, + auxiliary patch–text loss (below). Init = init_skillroute. Run name: sera-v4-f2-align.
F2 loss (exact definition)
Computed per micro-batch on SERA's projected tokens (512-d):
- V_i = visual tokens of sample i AFTER vision_projection + camera embedding + LayerNorm (the tokens that enter Fusion), all positions.
- t_j = masked-mean pooled text tokens of sample j AFTER text projection (the same pooled text the skillroute router consumes).
- Per-patch cosine c[i,j,p] = cos(V_i[p], t_j), L2-normalised vectors.
- Pair score S[i,j] = τ_pool · logsumexp_p( c[i,j,p] / τ_pool ), τ_pool = 0.1 (soft top-k pooling over patches, MIL-style).
- L_align = ½ [ CE(S/τ_ce → identity) + CE(Sᵀ/τ_ce → identity) ], τ_ce = 0.07, CE over the micro-batch (batch 8; in-batch negatives — same-task collisions possible, accepted as label noise, logged).
- total loss = FM + 0.01·balance + 0.0002·specialization + λ·L_align,
λ = 0.1 (initial L_align ≈ ln 8 ≈ 2.08 → contribution ≈ 0.21,
decaying as alignment improves; logged per step as
align_loss). - Implementation: new config field
v4_align_lambda(default 0.0 = off, F0/F1 unaffected); loss added in the policy forward next to the other aux losses. Inference path unchanged.
Measurements per arm (all three arms, same instruments)
- Val FM at eval milestones (2000-step cadence, same as Stage 1). Elimination signal only: an arm whose val FM @10k is > 0.02 WORSE than F0's 0.3979 is eliminated without a probe.
- Routing @10k (P1 set, 3,840 obs, measure_routing.py): must not regress vs F0 — task_cos mean ≤ 0.816 (F0 + 0.05) and no NEW dead expert vs F0 (F0 has none). A regression here does not kill the arm if the probe wins, but must be reported alongside.
- Closed-loop probe (DECISIVE): fixed 7 weak tasks × 10 episodes =
70 episodes, the same weak-task set as the lineage probe (the 7 tasks
used for the v2/v3/DINO probe baselines — identified from the
diagnostics program records before any probe runs; benchmark task ids,
mapping verified per the eval_task_identity lesson). Metrics:
- success /70 (primary),
- right-object rate: fraction of episodes where the FIRST object the robot grasps (gripper close followed by that object lifting / moving with the gripper, detected from simulator state) is the task's target object; episodes with no grasp count as not-right.
- subgoal/secondary stats if the harness exposes them cheaply.
Gate (fixed in advance)
- An arm PASSES iff probe success ≥ F0 success + 4 (out of 70) AND it is not eliminated by the val-FM rule. Right-object rate is reported as the mechanistic check: a pass with a WORSE right-object rate than F0 is flagged as suspect (win not attributable to the front-end change).
- If both F1 and F2 pass, the better probe score wins; a tie is broken by right-object rate, then by val FM.
- If neither passes, the frozen trunk + projection-only interface is kept as-is and the front-end question is closed with these numbers.
Kill rules (per arm, as Stage 1)
Any expert > 80% of routing selections at a measured milestone, loss divergence (train loss NaN or > 3× its running band sustained), or repeated OOM → stop that arm, log in WORKLOG, move to the next leg of the chain. F1-specific: if the 40-step smoke shows trainable params or VRAM that cannot fit 16 GB at batch 8, reduce to vision_last_n=1 before launching and record the change here.
Eval harness requirements (built during F1/F2 training)
- Wrapper eval_v4.py mirroring train_v4.py (import the v3 processor module BEFORE loading checkpoint processors — the registry gotcha).
- One fixed episode protocol for all arms: same initial states / seeds per task across arms (paired episodes), TASK_SUITE_MAX_STEPS per suite from the diagnostics records, success from the environment's own check, grasp/target detection from simulator object state.
- A 2-task × 1-episode smoke on F0 validates the harness end-to-end before any full probe; harness bugs found later invalidate only the affected arm's probe and are logged.