界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

trajectory_return_replay

trajectory_return_replay

【效率与协作】Build Self-Imitation Learning replay records by converting completed agent episodes into discounted state-action-return tuples.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: trajectory_return_replay description: Build Self-Imitation Learning replay records by converting completed agent episodes into discounted state-action-return tuples.

Trajectory Return Replay

Use this skill when implementing or validating Self-Imitation Learning data flow from the paper "Self-Imitation Learning". It is appropriate for full RL runs and reduced proxy recoveries that need auditable replay records from the agent's own completed trajectories.

Do not use this skill for expert demonstration replay, one-step TD replay, or offline data whose episode returns cannot be reconstructed.

Inputs

  • Episode steps as JSON records with state, action, reward, and optional done.
  • Discount factor gamma in [0, 1].
  • Optional replay capacity.

Outputs

  • Replay records with state, action, discounted return, reward, and index.
  • Optional JSON item log for recovery evidence.

Workflow

  1. Validate the episode order and discount factor.
  2. Compute Monte Carlo returns backward through the episode.
  3. Pair each return with the original state and action.
  4. Apply deterministic capacity truncation if requested.
  5. Save the records as recovery evidence when running an experiment.

Validation

Run:

python tests/test_trajectory_return_replay.py

The test checks sparse-reward return computation, terminal handling, and capacity truncation.

Limitations

  • This skill does not implement prioritized replay sampling; priorities can be added downstream from positive advantages.
  • It does not interact with an environment; callers provide completed episode steps.

Terminal Propagation Regression

A terminal reward must still propagate to earlier non-terminal steps in the same episode; only a terminal boundary before a previous episode resets the backward return accumulator.

我的收藏