F
Member
A robot-learning run can reset cleanly at every episode boundary and still learn from the wrong target. The collector may combine task termination and an external rollout time limit into one Boolean, then use that same Boolean to decide whether future value exists.
The simulator state can be correct, the rewards can be recorded correctly, and the learning update can still assign the wrong meaning to the last transition.
### Stopping collection is not always reaching a terminal state
A task-defined terminal state might be successful placement or a specified failure. An external time limit may instead stop data collection while the modelled task could continue. Both events can require a reset before more samples are collected, but they need not have the same value-learning semantics.
The official [Gymnasium time-limit tutorial](https://gymnasium.farama.org/tutorials/gymnasium_basics/handling_time_limits/) distinguishes termination from truncation and explains their effect on bootstrapping. It also makes an important qualification: a time limit intrinsic to a finite-horizon task can itself be termination. In that setting, remaining time belongs in the state representation needed for the Markov formulation.
Therefore, “always bootstrap at every timeout” is not a sound universal rule. First define what the robotics task actually means.
### Inspect the mask that reaches the learning update
For an illustrative one-step value target, a task-terminal transition uses `target = reward`. A nonterminal transition can use `target = reward + gamma * V(next_state)` under the chosen value-learning formulation.
If an external truncation is incorrectly treated as task termination, the future-value term is dropped. If a real terminal failure is incorrectly treated as an ordinary continuation, value can instead leak beyond the task boundary. The direction and size of the resulting learning effect depend on rewards, the value estimate and the algorithm; a training curve alone does not identify the bug.
A practical audit should trace:
- The task's termination definition and the collector's external limits.
- The original termination and truncation signals before wrappers combine them.
- The signals actually stored in the replay or rollout buffer.
- The bootstrap mask used by the learner.
- The observation used to calculate the final transition's next-state value.
That last item matters with automatic-reset or vectorised collectors. A reset observation from the next episode is not the next state of the transition that just ended. Verify the installed wrapper's return convention rather than assuming every collector exposes final observations identically.
### Use synthetic transitions before retraining a policy
Construct a small offline test with known rewards and a stub value function. Give the learner otherwise identical transitions labelled as task-terminal and externally truncated, then compare the calculated targets with the independently specified expectation.
Also test a genuine task deadline, simultaneous flags and wrapper combinations. Decide explicitly how the task definition handles those cases; do not infer semantics from which wrapper happened to set its flag last.
Changing the mask can invalidate comparisons with earlier checkpoints, so preserve the collector, task-definition and buffer-schema versions with training results. Re-labelling old data may require information that the old buffer discarded.
This concerns the statistical meaning of a training transition, not permission to continue physical robot operation after an operational timeout. Runtime stop and recovery requirements remain separate.
**Open engineering question:** does your learning pipeline preserve why an episode ended all the way to the value target? Could you demonstrate the difference using one saved transition, without relying on a full retraining run?
The simulator state can be correct, the rewards can be recorded correctly, and the learning update can still assign the wrong meaning to the last transition.
### Stopping collection is not always reaching a terminal state
A task-defined terminal state might be successful placement or a specified failure. An external time limit may instead stop data collection while the modelled task could continue. Both events can require a reset before more samples are collected, but they need not have the same value-learning semantics.
The official [Gymnasium time-limit tutorial](https://gymnasium.farama.org/tutorials/gymnasium_basics/handling_time_limits/) distinguishes termination from truncation and explains their effect on bootstrapping. It also makes an important qualification: a time limit intrinsic to a finite-horizon task can itself be termination. In that setting, remaining time belongs in the state representation needed for the Markov formulation.
Therefore, “always bootstrap at every timeout” is not a sound universal rule. First define what the robotics task actually means.
### Inspect the mask that reaches the learning update
For an illustrative one-step value target, a task-terminal transition uses `target = reward`. A nonterminal transition can use `target = reward + gamma * V(next_state)` under the chosen value-learning formulation.
If an external truncation is incorrectly treated as task termination, the future-value term is dropped. If a real terminal failure is incorrectly treated as an ordinary continuation, value can instead leak beyond the task boundary. The direction and size of the resulting learning effect depend on rewards, the value estimate and the algorithm; a training curve alone does not identify the bug.
A practical audit should trace:
- The task's termination definition and the collector's external limits.
- The original termination and truncation signals before wrappers combine them.
- The signals actually stored in the replay or rollout buffer.
- The bootstrap mask used by the learner.
- The observation used to calculate the final transition's next-state value.
That last item matters with automatic-reset or vectorised collectors. A reset observation from the next episode is not the next state of the transition that just ended. Verify the installed wrapper's return convention rather than assuming every collector exposes final observations identically.
### Use synthetic transitions before retraining a policy
Construct a small offline test with known rewards and a stub value function. Give the learner otherwise identical transitions labelled as task-terminal and externally truncated, then compare the calculated targets with the independently specified expectation.
Also test a genuine task deadline, simultaneous flags and wrapper combinations. Decide explicitly how the task definition handles those cases; do not infer semantics from which wrapper happened to set its flag last.
Changing the mask can invalidate comparisons with earlier checkpoints, so preserve the collector, task-definition and buffer-schema versions with training results. Re-labelling old data may require information that the old buffer discarded.
This concerns the statistical meaning of a training transition, not permission to continue physical robot operation after an operational timeout. Runtime stop and recovery requirements remain separate.
**Open engineering question:** does your learning pipeline preserve why an episode ended all the way to the value target? Could you demonstrate the difference using one saved transition, without relying on a full retraining run?