Repository navigation
cvc::nav coef_trainer: learning history, checkpoint blobs, pre-clip grad norm - #1141
Merged
Merged
Conversation
…clip grad norm A falling training loss does not show the policy learned anything. The trainer already scores checkpoints on a fitness (reach on the plant, the untrained policy included) and ends on the best. It recorded nothing else: the global gradient norm adam_step computes was dropped, the per-step loss went to the console every 50 steps, nothing read the heads one by one, and the scored checkpoints were never written out. train_config gains (all off by default; CPU trainer only): - history_path: a JSON-lines history. A header; per outer step the windows' mean loss, the last window's, the learning rate, and the pre-clip gradient norm (mean and max over the step's Adam steps, the share that clipped); per checkpoint (step 0, every checkpoint_every, the last; with or without a fitness) the fitness, best-so-far and rollback flags, and per head (alpha, beta, gamma: the output layer's row) its mean and spread over a fixed probe batch of the scene's agents and its ||dtheta||/||theta|| since the last checkpoint and since the start, the trunk alongside; an end record. - checkpoint_prefix: each checkpoint's policy, as scored (before any rollback), saved as <prefix>.stepNNNNNN.cvcnav. - probe_agents / probe_seed: the probe batch (it selects nothing). coef_trainer::last_grad_norm() / last_lr() expose the last Adam step's. Training is unchanged, bit for bit: the instruments only read the parameters. Tests pin that (same parameters, checkpoint scores, selection and rollbacks with them on, with and without a fitness), and the history's contents.
…N-escaped) On Windows the checkpoint path has backslashes, which the history escapes as a JSON string must; the test looked for the raw path and failed on every Windows lane. Compare against the escaped form.
transfix
added a commit
that referenced
this pull request
Nov 15, 2026
Master's #1217 keeps nothing per thread in state_exec: a native's context (call_args::context()) carries its group, registry and stream, async_host::call and begin_external take it, and the pool drops in_pump_all() and the one-argument run_on_host. - async_host.h: begin_external takes the context, as on master, and keeps this branch's note that a call is finished through the host it was made on. - script_engine.cpp: the sliced form finds the calling program's group from the call's context (exec_group::current(ctx)), else group 0, and reads its data step from the context. - ariadne.cpp: file-pick opens its picker through run_on_host for the group its verbs were bound for (the env's, as its host is), and inline in group 0 and the init lane. - exec_pool: in_pump_all() is back, for the host-thread calls' debug assertion and ScriptLane::run's refusal, read from the pool's calls (their callers' and pumpers' thread ids) under its mutex rather than from thread-locals. - ariadne_runtime_test: the init lane's cycles test no longer compares against the calling thread's own registry, which master removed; it is AriadneInit.RunsAScriptThatLeavesCycles. - ci.yml: the sanitizer's required list names the test by its new name. - STATE_EXEC_THREADED.md: B29-B31 and the file-pick and sliced-call notes name the context-based calls.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A falling training loss does not show that the nav policy learned anything.
coef_traineralready scores checkpoints on a fitness: typicallyreach_on_planton validation seeds, with the untrained policy included and rollback. It then ends on the best. Nothing else was recorded:adam_stepcomputes was dropped;This adds those instruments, all opt-in. It is the cvc::nav side of the same instruments on the GRL-SNAM trainers.
What it adds
New
train_configfields, all off by default:history_path: a JSON-lines history.checkpoint_every, and the last; recorded with or without a fitness):alpha,beta,gamma, each the output layer's row): its mean and spread over a fixed probe batch of the scene's agents, and its||Δθ||/||θ||since the last checkpoint and since the start;checkpoint_prefix: each checkpoint's policy, as it was scored (before any rollback), saved as<prefix>.stepNNNNNN.cvcnav(coef_checkpoint_path).probe_agents,probe_seed(256, 0x5eed): the probe batch, drawn once from the scene. It only feeds the head numbers and selects nothing.coef_trainer::last_grad_norm()andlast_lr().Scope: the CPU
coef_trainer::trainonly;train_coef_mlp_cudaignores the new fields.docs/NAV_TRAINING.mddocuments them under "Recording what training does" and in the hyperparameter table.Defaults unchanged: the evidence
city_scene(64): surrogate and bicycle rollouts, each without a fitness and with a fitness,checkpoint_every 10androllback_drop 0.05. All four give identical output on both builds: the trained parameters' hash, every checkpoint score to 9 digits, the selected step, and the rollbacks.LearningInstrumentsDoNotChangeTrainingturns both instruments on in a run with a fitness and rollback, and in one without a fitness. The trained parameters, checkpoint scores, selection, rollbacks and last grad norm all match the plain run exactly.LearningInstrumentsAreOffByDefault: a defaulttrain_confighas both paths empty, sotrain()takes no instrument branch.Tests (in
nav_coef_train_test)LearningHistoryRecordsStepsCheckpointsAndBlobs:LearningHistoryHeadsMoveOnlyWhenTrained:lr = 0every head'sΔθis 0 and the head numbers repeat at every checkpoint;LastGradNormIsBeforeTheClip: a known gradient's norm is reported above a tiny clip.UnwritableHistoryThrows: an unwritable history throws before any parameter changes.Locally (Linux, GCC 13, Release, no CUDA): all 36
nav_coef_train_testcases pass. That includes the existing gradcheck, convergence, checkpoint selection and rollback tests. CI's clang-format reports nothing on the changed lines.