Skip to content

Nav: sim_world's park on the brakes; why the trained Jolt Humvee looked better; time-pressure training options - #957

Merged
transfix merged 14 commits into
masterfrom
feat/nav-train-time-pressure
Nov 1, 2026
Merged

transfix merged 14 commits into
masterfrom
feat/nav-train-time-pressure

Conversation

@transfix

@transfix transfix commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

The rollback-trained Jolt Humvee policy (#950) reaches 73.8% of held-out goals against the untrained policy's 41.5%, but drives slowly. This PR measures why. The main finding is a sim_world bug, fixed here: once that's fixed, the untrained policy is as good as or better than every trained one.

Stacked on #950 (itself on #942).

The fix that matters: sim_world's park

  • The bug: a vehicle that reached its goal on a plant was parked by braking at the controller's a_max (2 m/s² on the Humvee). From 4–7 m/s that leaves it 4–12 m past the goal, outside the 3 m reach tolerance.
  • The fix: it now brakes at plant_limits::a_brake (nav_plant's brake_margin × max_decel, 6 m/s² on the Humvee).
  • Re-scored with it:
policy reach, old park reach, fixed park on time (within 4 m/s)
untrained 41.5% 77.2% 42.6%
rollback 73.8% 73.1% (−4.1, CI [−7.1, −1.1] vs untrained) 4.7%
  • What it means: the untrained policy was reaching its goals but couldn't stop in them. The rollback policy's +32 points came from learning to creep in at 1.6 m/s.
  • Where it reaches: this affects every sim_world user with a plant, demo3 included.

Scoring (score_on_plant)

  • Reach in time: time_budget_mps and reach_in_time.
  • Speed and stopping: speed en route and arriving, and the share stopped before arriving.
  • Holding the goal: of the arrivals, the share still there at the end, how far off they end, and their speed on arrival.
  • Collisions: building hits and vehicle contact.

Training options (train_config, rollout_kind::jolt; all off by default, so the loss and gradient are unchanged)

  • Progress term: w_progress / progress_speed / progress_tol, plus progress_decel (a stopping profile that charges arrival speed).
  • Continuing episodes: episode_steps / episode_tol.
  • Footprint penalty: coll_offsets / coll_rr, the collision penalty on the vehicle's footprint instead of the scene's 3 m disc with a 7 m margin.

Experiments

  • Settings: JOLT_EXP_{BUDGET_MPS, SELECT_MPS, PROGRESS_MPS, STOP_DECEL, EPISODE, BODY_MARGIN_M, DHAT_M, SCORE}.
  • Diagnostic: WhyTrainingSlowsTheJoltHumvee (JOLT_WHY=1).
  • What it found:
    • The old collision term was 13× the goal term, and the training gradient followed it (cosine +0.999).
    • Before the park fix, the footprint penalty plus 60 s episodes raised on-time arrival (+2.5 and +5.3 points). But those policies came in at 6–7 m/s and overshot.
    • With the park fixed and every option on, no arm beats the untrained policy at a wall-repulsion range (d_hat) of 7, 2 or 1 m. On-time validation drifts down and reach stays flat.
    • A shorter repulsion range alone costs the untrained policy about 3 points of reach and adds building hits.
  • Details: docs/NAV_TRAINING.md, "What the climb buys".

Tests

  • JoltRollout.ProgressTermPricesTheShortfall, now including the stopping profile.
  • JoltRollout.ContinuingEpisodesKeepTheBatchDriving
  • JoltRollout.BodyPenaltyOnTheVehiclesFootprint
  • All pass on Windows, along with nav_test, physics_dyn_bike_plant_test, physics_dyn_4w_plant_test, nav_route_follower_test, nav_coef_train_test and physics_jolt_rollout_test.

…out reach

Jolt and the single-track model train the Humvee to the same held-out reach on Jolt at w_coll 10 (70.3-70.8% against 70.8-72.0%, Jolt minus dynamic -0.9 [-2.6, +0.8]); the collision weight is what moved it. The experiment's defaults are now that run, and with JOLT_EXP_OUT it writes each arm's per-seed held-out reach for seed-by-seed comparisons.
On macOS (package-macos release-grpc jobs) the held-out calibration closes the dissipation to
0.152 against a 0.15 bound and its calibrated step's twist is 1% over the uncalibrated one's, and
the gradient check's beta and gamma (a quarter of alpha there) flip sign against Jolt's finite
differences while the gradient as a whole agrees (ratio 0.92). The calibration's margins are 0.2
and 5%; the per-bias checks apply to components at least a third of the largest (all three on
Windows), and the whole-gradient check is unchanged.
train_config::rollback_drop (off by default): a checkpoint that scores more than the margin under
the best so far sends training back to the best checkpoint's parameters and Adam moments, and
scales the learning rate by rollback_lr_scale from there. The Jolt experiment takes it as
JOLT_EXP_ROLLBACK / JOLT_EXP_ROLLBACK_SCALE and prints the rollbacks.
Before the jump, validation on the Jolt Humvee dips under the seed's level (w_coll 10:
0.40 -> 0.36 by step 150), and a rollback there sends the run back to the seed at half the
learning rate; neither w_coll 10 run of the rollback sweep ever made the jump (held out
42.8% / 40.5% against 70.4% without rollback). A fall past the margin now rolls back only
once the best checkpoint is more than rollback_drop over the first one.
Four runs with rollback_drop 0.03 (w_coll 10 and 20, training seeds 1 and 2) hold their peak to
step 1000 and pool to 72.6% held-out reach against 70.6% without (+2.0 [+0.3, +3.7]); the
hyperparameter table gains checkpoint_every and the rollback fields.
The rollback-trained Jolt Humvee policy reaches 73.8% of held-out goals
but drives slowly: 2.2 m/s in a harness run against the untrained 6.5,
and on nav_plant's held-out seeds it reaches 4.7% of its goals within
4 m/s's time against the untrained 42.6%.

Scoring (cvc::physics::score_on_plant):
- plant_reach_options::time_budget_mps and plant_drive_score::
  reach_in_time: the share that first reached their goals within the
  straight line's distance at that speed.
- speed_mps (en route, to arrival or the run's end), arrive_mps (over
  the agents that arrived), stopped_frac (under 0.5 m/s before arriving),
  building_hits and vehicle_contact_s.

Training (rollout_kind::jolt):
- train_config::w_progress / progress_speed / progress_tol: each step
  pays its shortfall from progress_speed's progress toward the goal, as
  a fraction of a step's worth, until the vehicle is within progress_tol.
  The window-end distance alone hardly prices time, and a sum of steps'
  progress would telescope back to it.
- train_config::episode_steps / episode_tol: a batch drives on across
  outer steps until every agent is at its goal or the limit, instead of
  a fresh batch from rest every outer step (3.6 s at a horizon of 60,
  with goals 25-100 m away, so training never saw a vehicle arrive).
  coef_trainer::episodes() / episodes_arrived() count the batches.

Experiments (CVC_JOLT_TRAIN_EXPERIMENT=1):
- JoltTrainedHumveeOnJoltReach: arms take a w_progress; JOLT_EXP_
  {BUDGET_MPS, SELECT_MPS, PROGRESS_MPS, EPISODE, SCORE} add selection on
  reach in time, the progress term, episodes and scoring saved policies;
  every arm reports the new scores.
- WhyTrainingSlowsTheJoltHumvee (JOLT_WHY=1): the horizon loss split into
  its goal and collision terms with the 4 m/s shortfall beside them, each
  part's gradient and the share of parameters it decides, and on Jolt
  what a sign step along each does.

Tests: JoltRollout.ProgressTermPricesTheShortfall (the term is each
step's shortfall to 1e-5; its model gradient agrees in sign with Jolt's)
and JoltRollout.ContinuingEpisodesKeepTheBatchDriving.
The Jolt rollout's collision penalty was one disc of the scene's rr on
the rear axle with the scene's d_hat as d_safe: at demo3's metric a 3 m
disc and a 7 m margin, so a Humvee paid within ~10 m of any wall. On the
experiment's batches that term was 13 times the goal term, the training
step followed its gradient (cosine 0.999), and a step along it slowed
the Humvees (2.21 -> 1.71 m/s at the rollback policy).

train_config::coll_offsets / coll_rr put the penalty on discs along the
heading from the rear axle instead; empty is the old disc, bit for bit.
The experiments' JOLT_EXP_BODY_MARGIN_M uses nav's footprint (four discs
of 1.3 half-widths, tail to nose) with that margin as d_safe. At 0.55 m
the diagnostic's collision term is 0 on the launches, and the training
step follows the goal term (cosine with the 4 m/s shortfall +0.986).

Test: JoltRollout.BodyPenaltyOnTheVehiclesFootprint.
… did

score_on_plant also scores, of the agents that arrived, the share still
at the goal at the end (held_frac), how far off they ended (end_m) and
their speed on arrival (arrival_mps).

NAV_TRAINING.md gets the measurements:
- the rollback policy's reach is a slow policy's: 4.7% within 4 m/s
  (untrained 42.6%), arriving at 1.6 m/s, so sim_world's park holds 93%
  of its arrivals inside the 3 m tolerance;
- the diagnostic: the 3 m disc with the 7 m margin made the collision
  term 13 times the goal's, and the loss's gradient is its (cosine
  0.999); a step along it slows the Humvees;
- the sweep: with the old penalty no arm improves timely arrival; with
  the footprint and 60 s episodes training raises it for the first time
  (+2.5 and +5.3 points within 4 m/s), but the policies arrive at 6-7 m/s,
  the park's 2 m/s^2 cannot stop them in the tolerance, and reach falls.
…the brakes

The time-pressured Jolt policies arrived at 6-7 m/s and ended 7.5-10 m
past their goals: training asked for full speed up to the tolerance,
and sim_world's park braked at the controller's a_max (2 m/s^2 on the
Humvee), not at what the brakes achieve.

- train_config::progress_decel: with w_progress, p* is also capped at a
  step of v_stop(d) = sqrt(2 decel (d - tol)), the speed the vehicle can
  still stop from at the tolerance, and each step pays its speed over
  v_stop at its end as a fraction of progress_speed (at the goal, any
  speed). The shortfall's gradient follows p*'s bound; the overspeed's
  reaches vx and, through v_stop, the position.
- sim_world: a parked vehicle on a plant brakes at plant_limits::a_brake
  (nav_plant's brake_margin x max_decel, 6 m/s^2 on the Humvee), a_max
  when the plant gives none.
- The Jolt experiments: JOLT_EXP_STOP_DECEL (m/s^2) and JOLT_EXP_DHAT_M,
  the controller's barrier range (the scene's d_hat) in metres, for
  training and scoring alike (experiment_scene).

ProgressTermPricesTheShortfall checks the profile's shortfall and
overspeed against the states step by step, far from the goals and at
them. nav_test, physics_dyn_bike_plant_test, physics_dyn_4w_plant_test,
nav_route_follower_test, nav_coef_train_test and physics_jolt_rollout_test
pass.
With sim_world's park braking at the brakes' limit the untrained Jolt Humvee policy reaches 77.2% of held-out goals (41.5% before): it reached them and could not stop inside the tolerance, and the rollback policy's +32 points were it learning to creep in. With the footprint penalty, 60 s episodes, a stopping profile and the fixed park, no arm improves on the untrained policy at d_hat 7, 2 or 1 m, and a shorter barrier alone costs it about 3 points of reach.
@transfix transfix changed the title Nav: why the trained Jolt Humvee is slow; time pressure, continuing episodes, a footprint collision penalty Nav: sim_world's park on the brakes; why the trained Jolt Humvee looked better; time-pressure training options Nov 1, 2026
…back

# Conflicts:
#	docs/NAV_TRAINING.md
#	src/cvc/tests/nav_plant_test.cpp
…s sign

ProgressTermPricesTheShortfall held the model's derivative of the time
pressure along alpha's bias to Jolt's central difference in sign. On
macOS arm64 they part (model +1.2e-5, Jolt -9.7e-5; on Windows +8.5e-4
and +1.6e-3): the slope is small enough that a contact the perturbation
adds or removes flips Jolt's difference, as the gradcheck test already
allows for beta and gamma there. The test now holds the model's to
finite and non-zero and prints Jolt's beside it.
@transfix
transfix changed the base branch from feat/nav-train-rollback to master November 1, 2026 15:41
…-pressure

# Conflicts:
#	docs/NAV_TRAINING.md
#	inc/cvc/nav/coef_train.h
#	src/cvc/tests/nav_plant_test.cpp
@transfix
transfix merged commit a97b8f6 into master Nov 1, 2026
27 checks passed
@transfix
transfix deleted the feat/nav-train-time-pressure branch November 1, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant