spinning-up-deep-rl
できること
このスキルは、OpenAIのSpinning Upの資料を使って深層強化学習を説明します。強化学習を学んでいる、または応用している学生やエンジニアを対象としています。
使う場面
- ✓深層強化学習の仕組みを学んでいるとき。
- ✓PPO、SAC、TD3などのアルゴリズムを比較したいとき。
- ✓強化学習のコードが、はっきりしたエラーなしに失敗するとき。
スキルのリンク
https://github.com/alirezarezvani/claude-skills/blob/main/engineering/spinning-up-deep-rl/skills/spinning-up-deep-rl/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“PPOの仕組みと、基本的な方策勾配よりも安定している理由を説明してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、ガイドの中核となる枠組みから答えます。詳しいトピックについては、回答の前に関連する章を調べて、出典に基づいて答えます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Spinning Up in Deep RL
Author: Joshua Achiam (OpenAI) | Source: spinningup.readthedocs.io, MIT | Chapters: 20 | Generated: 2026-08-25
How to Use This Skill
- No argument — load the core frameworks below
- A topic — ask about
advantage function,target networks,entropy regularization; I resolve it through the Topic Index and read that chapter file chNN— I load that chapter's summary- "what chapters do you have?" — the full index
/cs-spinning-up-deep-rl # core frameworks + chapter index
/cs-spinning-up-deep-rl entropy regularization # topic index -> ch19, read that chapter
/cs-spinning-up-deep-rl ch09 # one chapter summary
When you ask about something not in Core Frameworks, I read the relevant chapter file before answering rather than guessing from the index.
Core Frameworks & Mental Models
The RL problem
pi* = argmax_pi J(pi), where J(pi) = E_{tau~pi}[R(tau)]. Every algorithm approximates
this; where it substitutes a different objective (a Bellman residual, a surrogate), that
substitution is the source of its failure modes. Four value functions — V^pi, Q^pi, V*,
Q* — all obey Bellman self-consistency, and a*(s) = argmax_a Q*(s,a) is why Q-learning
is a viable family at all. Advantage A^pi(s,a) = Q^pi(s,a) - V^pi(s) is the relative-quality
signal policy gradients run on. (ch07)
The two branching questions
Place any algorithm by asking: does it have or learn a model, and what does it learn (policy, Q-function, value function, model). That generates the whole landscape. (ch08)
Policy optimization vs Q-learning — the central trade-off
- Policy optimization is principled: you directly optimize the thing you want. Stable and reliable. On-policy, so it cannot reuse data, so it is sample-hungry.
- Q-learning only indirectly optimizes performance, by training
Q_thetato satisfy a self-consistency equation. Many failure modes, so less stable. But substantially more sample efficient when it works, because it reuses everything. - Satisfying the Bellman equations well carries no guarantee of good policy performance.
- The two are not exclusive — DDPG and SAC live between them deliberately. (ch08)
The policy gradient template
grad J = E[ sum_t grad log pi_theta(a_t|s_t) * Phi_t ]. Five valid choices of Phi_t:
full return, reward-to-go, reward-to-go minus a baseline, Q^pi, and A^pi. All share an
expectation and differ in variance. Two rules get you from the first to the last:
- Don't let the past distract you — drop rewards obtained before the action. Those terms had zero mean and nonzero variance: pure noise.
- Baselines — by the EGLP lemma, any state-only
b(s)can be added or subtracted freely. The standard choice isV^pi(s_t), learned by MSE regression onto reward-to-go. (ch09)
The policy-gradient loss is not a loss function
Its data distribution depends on the parameters, and it does not measure performance even in expectation. Only at the current parameters, with data from those parameters, does it have the negative gradient of performance. You can send it to negative infinity while performance craters, and it usually will. Only average return means anything. (ch09)
Broken RL code almost always fails silently
It runs fine; the agent just never learns. Usually something is computed with the wrong
equation, on the wrong distribution, or piped to the wrong place. If it doesn't work, assume
there's a bug before touching hyperparameters. Debug by measuring everything and reading the
code critically. The archetype is one missing squeeze: a [N] vs [N,1] shape mismatch is
broadcast-compatible, raises nothing, and silently turns the Bellman backup into an [N,N]
matrix. (ch10, ch12)
Learn by doing
Write your own implementations, shortest correct version of each, simplest algorithms first. VPG, DQN, A2C, PPO, DDPG, roughly in that order; ~250-300 lines each. Single-threaded before parallel. Iterate fast in simple environments — under 5 minutes turnaround at the debug stage. Do not attempt Atari or Humanoid before the toy task works. Read papers for their ablations and supplementary material, but do not overfit to paper details (the original DDPG's architecture, init scheme and batch norm are not strictly necessary) or to existing implementations (their abstractions serve reuse, not your
よくある質問
どのアルゴリズムを扱っていますか?
VPG、TRPO、PPO、DDPG、TD3、SACなどのトピックを扱っています。
特定のトピックについて尋ねられますか?
はい。エントロピー正則化などのトピックを指定すると、対応する章を見つけます。
学習のコードのデバッグも手伝いますか?
はい。エラーなしに失敗する強化学習のコードのデバッグを扱います。
詳細
作者による元の説明
Use when learning or applying deep RL from OpenAI's Spinning Up: MDPs, policy gradients, VPG, TRPO, PPO, DDPG, TD3, SAC, debugging RL code that fails silently, or multi-seed experiments. Indexes the 20 chapters for on-demand reading.
人気
- GitHubのスター
- 29k
- ランキング
- #9609
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
agent-launcher-orchestrator
29kひとつの明確な目標から始めて、自分のアカウントでClaudeのマネージドエージェントを計画し、作成し、テストし、スケジュールするまでを段階的に支援します。
grade-iterate
29kマネージドエージェントの作業をルーブリックに照らして採点し、固定された回数だけ改善させることで、終わりなく繰り返さないようにします。
interview
29kAIエージェントのアイデアについてインタビューし、回答をもとに、何かを起動する前の構築計画にまとめます。
run-without-you
29kマネージドエージェントを、スケジュールまたはイベントの発生によってあなたがいなくても動くように設定します。起動の前にcronの時刻を確認します。