phammminhhieu's picture
TRACE-VLA code snapshot 2026-11-22 11:47 +07: 456 canonical files + SHA256 manifest + sync report (part 2)
ae1ed83 verified
Raw History Blame Contribute Delete
4.12 kB
"""TRACE-VLA reference configuration (spec v1.1, sections 5-16).
v1.1 changes relative to v1.0:
- DELTA windows are 8 sampled frames with stride 4 (50% overlap);
a 64-frame demo gives 15 valid windows in 16 reserved positions.
- Residuals are local (offset 1), medium (offset 4), and endpoint.
Offset 8 is not used inside an 8-frame window.
- The cross-skill alignment loss is an optional experiment and is
DISABLED by default (lambda_delta = 0, spec 16.1/16.3).
- SYNC uses global soft cross-attention over all valid demo tokens;
there is no progress pointer in the initial configuration.
- PULSE is kept in the architecture but its loss weight is 0 and it
does not control SYNC (spec 10.1).
- The default training objective is L_total = L_flux + 0.1 * L_echo
(spec 16.1). ECHO stays enabled in the main architecture.
"""
from dataclasses import dataclass, field
@dataclass
class TraceConfig:
# Foundation / widths
backbone_id: str = "google/tipsv2-b14"
vision_width: int = 768
d_model: int = 512
n_heads: int = 8
ffn_width: int = 2048
# Vision geometry
image_size: int = 224
patch_grid: int = 16 # 16x16 raw patches at 224 px, patch 14
pooled_grid: int = 8 # 8x8 after 2x2 pooling -> 64 patches
n_live_cameras: int = 2
# State / action
state_dim: int = 8
action_dim: int = 7
chunk: int = 16 # action chunk length H
exec_k: int = 4 # executed actions per replan K
effect_horizon: int = 4 # ECHO target offset H in control steps
# Execution history: current obs + 3 past replan observations
history_len: int = 3
replan_stride: int = 4 # control steps between replans
fps: float = 10.0
# DELTA (spec v1.1 sections 6-8)
demo_max_frames: int = 64
window_len: int = 8
window_stride: int = 4
max_windows: int = 16 # reserved positions; <= 15 valid at T=64
residual_offsets: tuple = (1, 4) # local, medium; endpoint separate
delta_blocks: int = 2
skill_temperature: float = 0.07 # only for the optional alignment loss
# Ablation switch for the D01/C02 "ordered raw windows" arm: when
# False, DELTA carries appearance only - no residual tokens enter
# the temporal sequence and the endpoint residual is not added to
# the Local token. Default True (the D06 representation).
delta_use_residuals: bool = True
# Demo memory selector: "delta" is the v1.1 reference. "static"
# selects the order-free slot memory (static_memory.py) used ONLY
# as the D00/S00 control in validation probes.
demo_mode: str = "delta"
# SYNC / PULSE (spec v1.1 sections 9-10)
context_tokens: int = 64
sync_blocks: int = 2
# NEXUS
nexus_blocks: int = 6
effect_tokens: int = 16 # 4x4 spatial query grid (spec range 16-32;
# 16 is held fixed across E00/E01/E02)
# FLUX
euler_steps: int = 4
# ECHO (spec v1.1 section 13)
huber_delta: float = 1.0
echo_tau_min: float = 0.5
# Prediction/target width. The reference path predicts in the frozen
# 768-dim space, so no target projection exists. Setting 512 makes
# the head output 512 and routes targets through the FIXED
# (non-trainable) projection of spec 13.5.
echo_target_dim: int = 768
# Loss weights (spec v1.1 section 16.1)
lambda_flux: float = 1.0
lambda_echo: float = 0.1
lambda_delta: float = 0.0 # cross-skill alignment: optional, off
lambda_pulse: float = 0.0 # progress prediction: optional, off
# Path/loss gates. The DELTA path itself is part of the main
# architecture; the flags below gate only the auxiliary losses.
use_delta: bool = True # DELTA module/path present
use_echo_loss: bool = True
use_delta_loss: bool = False # optional skill alignment (spec 16.3)
use_pulse: bool = True # PULSE head present (spec 10.1)
use_pulse_loss: bool = False # PULSE loss off; no SYNC control
def pooled_patches(self) -> int:
return self.pooled_grid * self.pooled_grid