reinforcement-learning

Guides implementation and review of RL algorithms including PPO, DQN, and RLHF pipelines.

Updated Mar 3, 2026
One-click install
npx skills add https://github.com/Devil-2621/gsr-research-model --skill reinforcement-learning-devil-2621
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: reinforcement-learning
Source: https://github.com/Devil-2621/gsr-research-model/tree/main/.cursor/skills/reinforcement-learning
Command: npx skills add https://github.com/Devil-2621/gsr-research-model --skill reinforcement-learning-devil-2621

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Reinforcement learning training is unstable and error-prone: sparse rewards stall learning, unclipped policy updates cause collapse, and RLHF without KL penalties leads to reward hacking. This Skill grounds AI responses in curated reference patterns, known failure modes, and validation rules so RL code is built and reviewed correctly. ## Core Features & Use Cases - Implementation Patterns: Consult references/patterns.md for algorithm taxonomy (value-based, policy-based, actor-critic), PPO hyperparameter configs, and the three-step RLHF pipeline (SFT, reward model, PPO with KL penalty). - Failure Diagnosis: Use references/sharp_edges.md to explain critical issues like reward hacking, catastrophic policy collapse, sparse-reward failure, Q-value overestimation, and KL divergence explosion, each with symptoms and fixes. - Code Validation: Apply references/validations.md regex rules to flag PPO without clipping, missing entropy bonuses, DQN without target networks, and RLHF without KL penalties. - Use Case: When a user asks why their PPO training collapsed, the Skill identifies missing ratio clipping and provides the corrected torch.clamp implementation. ## Quick Start Ask the AI to review my PPO training loop for stability issues and explain why the policy collapsed after 10k steps.

Frequently Asked Questions about reinforcement-learning

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement PPO clipping correctly in PyTorch?

PPO clipping computes the probability ratio between new and old policies, then clamps it to [1-eps, 1+eps] and takes the minimum of clipped and unclipped surrogate objectives. Typical clip epsilon is 0.2, preventing catastrophic policy updates.

What is the difference between on-policy and off-policy RL algorithms?

On-policy algorithms like PPO and A2C learn only from current policy samples, offering stability but requiring fresh data. Off-policy methods like DQN and SAC learn from any samples using a replay buffer, improving sample efficiency.

Why does RLHF cause reward hacking in language models?

The reward model is an imperfect proxy for human preferences, so aggressive optimization finds exploits like verbosity or sycophancy. Fix it with a KL penalty to the reference model, reward model ensembles, and early stopping on held-out evaluation.

Why is my DQN agent overestimating Q-values?

Standard DQN uses max over noisy estimates, systematically selecting positively biased values. Double DQN fixes this by using the online network to select actions and the target network to evaluate them, breaking the overestimation cycle.

How do I fix an RL agent that never learns from sparse rewards?

Sparse rewards make credit assignment impossible, so apply potential-based reward shaping to add intermediate signals without changing the optimal policy. Alternatives include curiosity-driven exploration, hierarchical RL with subgoals, and curriculum learning.