AGENT SKILL

reinforcement-learning

Understand and apply reinforcement learning — MDPs, value and policy methods, exploration, reward design, and RLHF basics. Use when decisions are sequential and feedback comes as rewards.

License 许可
MIT
所属仓库
TanNhatCMS/jarvis
最近更新
2026-11-07
Stars
★ 0
Forks
1

01 前言 Front Matter

name
reinforcement-learning
category
ai-research
description
Understand and apply reinforcement learning — MDPs, value and policy methods, exploration, reward design, and RLHF basics. Use when decisions are sequential and feedback comes as rewards.

03 SKILL.md 正文

Reinforcement Learning

Reinforcement learning trains agents to make sequences of decisions by rewarding good outcomes. It's the framework behind game-playing breakthroughs, robotics control, and the human-feedback tuning of language models — powerful where feedback is sequential, tricky everywhere else.

Overview

The setup: an agent observes states, takes actions, receives rewards, and learns a policy maximizing long-term return. The challenges are fundamental — credit assignment (which action deserved the reward?), exploration vs. exploitation, and sample efficiency. In practice, RL shines in simulators and games; in the real world, reward design and safety dominate. RLHF (learning from human preferences) brought RL to language models by replacing hand-designed rewards with learned preference models.

When to use

  • Sequential decision problems with a simulator: games, robotics sims, scheduling, routing.
  • Tuning language models with human preferences (RLHF/RLAIF) or verifiable rewards (math, code).
  • Control problems where the dynamics are complex but simulatable.
  • Understanding RL papers, methods, and their limitations.

Core concepts

  • MDP framing: states, actions, rewards, transitions, discount factor. If you can't frame it as an MDP with a real reward signal, RL probably isn't the tool.
  • Value vs. policy methods: value methods learn "how good is this situation" (Q-learning, DQN); policy methods learn "what should I do" directly (REINFORCE, PPO). Actor-critic combines both — the modern default.
  • Exploration: epsilon-greedy, entropy bonuses, intrinsic curiosity. Without exploration the agent converges to the first mediocre strategy it finds.
  • Reward design: the reward is the objective — misspecified rewards produce reward hacking (the agent games your metric). Design rewards carefully; prefer sparse true rewards over dense proxy rewards that invite gaming.
  • Sample efficiency: RL is data-hungry. Simulators, offline RL from logged data, and model-based methods address this — each with trade-offs.
  • RLHF pipeline: supervised fine-tune → train reward model on human preferences → optimize policy against it (PPO or DPO-style) with KL regularization to stay near the base model.

Practical workflow

  1. Frame the MDP honestly: is there a real reward signal, or are you inventing one? Invented rewards get hacked.
  2. Start with the simplest baseline: random policy performance, then a heuristic — know what "good" looks like.
  3. Build or find a fast simulator; RL needs orders of magnitude more samples than supervised learning.
  4. Choose the algorithm family: PPO as the robust default for policy learning; value methods for discrete-action problems.
  5. Tune exploration and watch for reward hacking — inspect what the agent actually learned, not just the reward curve.
  6. Evaluate on held-out scenarios; test robustness to distribution shift before any real-world deployment.
RL sanity checklist:
[ ] MDP framing with a genuine reward signal
[ ] Random + heuristic baselines established
[ ] Fast simulator available (sample efficiency!)
[ ] Reward checked for hackability
[ ] Learned behavior inspected, not just reward plotted
[ ] Evaluated on unseen scenarios

Common pitfalls

  • Reward hacking: the agent maximizes your metric while violating your intent. The classic RL failure — design rewards as the true objective.
  • No simulator, no RL: trying RL on expensive real-world samples directly. Simulate first; real-world RL is a last resort.
  • Ignoring baselines: elaborate RL that loses to a heuristic. Baselines first.
  • Sparse rewards without shaping: the agent never stumbles on reward. Either shape carefully or use curiosity/exploration bonuses.
  • Unstable training: RL is finicky — seeds, hyperparameters, and implementation details matter enormously. Multiple seeds, always.
  • Deploying uninspected policies: a high-reward policy doing something alarming. Watch the behavior, not the curve.

04 同仓库更多 Skills

TanNhatCMS
TanNhatCMS/jarvis

web-scrape

Turn web pages into LLM-ready markdown via the Firecrawl API (renders JS, anti-bot handling). Use when browser_open/fetch fails on JS-heavy pages, or when you need clean markdown/structured extraction from a site. Requires FIRECRAWL_API_KEY.

★ 0
TanNhatCMS
TanNhatCMS/jarvis

design-taste-frontend

tasteskill v2, the anti-slop frontend skill. Art direction for websites, distilled from a study of 247 curated gallery sites (One Page Love, Awwwards Sites of the Day). Deals researched directions (idea, composition, type, palette, photographs, section blueprints) from a library, enforces a strict no-slop house style with a real-browser inspector, and runs a look-and-fix loop on screenshots. Use this whenever you build, design, redesign, restyle, polish or review a landing page, marketing site, portfolio, product page, one-pager, hero or any public-facing web page, in any stack (HTML/CSS, React, Next.js, Vue, Svelte, Astro, Tailwind) — also when the user says a page looks generic, templated, "AI-made", sloppy, or asks to make it look designed, premium, award-level or less like every other site. Not for dashboards or app screens.

★ 0
TanNhatCMS
TanNhatCMS/jarvis

test-driven-development

Use when implementing any feature or bugfix, before writing implementation code

★ 0
TanNhatCMS
TanNhatCMS/jarvis

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

★ 0
TanNhatCMS
TanNhatCMS/jarvis

requesting-code-review

Use when completing tasks, implementing major features, or before merging to verify work meets requirements

★ 0
TanNhatCMS
TanNhatCMS/jarvis

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).

★ 0