rlhf

rlhf is a skill for Claude Code from itsmostafa/llm-engineering-skills. It costs 40 tokens per session (2,957 once invoked), scanned A, original, MIT.

A guide to reinforcement learning from human feedback, a method for training language models to better match human judgments about useful, safe, and honest answers. It also covers preference data, reward models, and related alignment methods.

In plain words
What is it for?
Use it to learn about preference-data collection, reward modeling, policy optimization, instruction tuning, and direct alignment methods such as DPO.
Why use it?
Training a model to predict text alone does not guarantee that its answers will meet human expectations. Human feedback provides another signal for shaping its behavior.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the llm-engineering-skills plugin — 9 skills shipped together

Good fit Use it to learn about preference-data collection, reward modeling, policy optimization, instruction tuning, and direct alignment methods such as DPO.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/itsmostafa/llm-engineering-skills/rlhf
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add itsmostafa/llm-engineering-skills --skill rlhf
Clone the repo
git clone --depth 1 https://github.com/itsmostafa/llm-engineering-skills

Made for: Claude Code.

Or install llm-engineering-skills, the plugin that ships this one along with the rest of its 9 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rlhf

README.md
[![agentmods](https://agentmods.dev/badge/skills/itsmostafa/llm-engineering-skills/rlhf.svg)](https://agentmods.dev/skills/itsmostafa/llm-engineering-skills/rlhf)
Your own site
<a href="https://agentmods.dev/skills/itsmostafa/llm-engineering-skills/rlhf"><img src="https://agentmods.dev/badge/skills/itsmostafa/llm-engineering-skills/rlhf.svg" alt="Measured on agentmods" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,957 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00040 $0.02957
Opus 5 $0.00020 $0.01478
Sonnet 5 $0.00008 $0.00591
Haiku 4.5 $0.00004 $0.00296

Measured 8d ago against content hash 06ca7de506f6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

rlhf scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/rlhf/SKILL.md · 365 lines

How it starts

The opening of the file, as written. The whole thing — 365 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Understanding RLHF

Reinforcement Learning from Human Feedback (RLHF) is a technique for aligning language models with human preferences. Rather than relying solely on next-token prediction, RLHF uses human judgment to guide model behavior toward helpful, harmless, and honest outputs.

Table of Contents

Core Concepts

Why RLHF?

Pretraining produces models that predict likely text, not necessarily good text. A model trained on internet data learns to complete text in ways that reflect its training distribution—including toxic, unhelpful, or dishonest patterns. RLHF addresses this gap by optimizing for human preferences rather than likelihood.

The core insight: humans can often recognize good outputs more easily than they can specify what makes an output good. RLHF exploits this by collecting human judgments and using them to shape model behavior.

The Alignment Problem

Language models face several alignment challenges:

  • Helpfulness: Following instructions and providing useful information
  • Harmlessness: Avoiding toxic, dangerous, or inappropriate outputs
  • Honesty: Acknowledging uncertainty and avoiding fabrication
  • Intent alignment: Understanding what users actually want, not just what they say

RLHF provides a framework for encoding these properties through preference data.

Key Components

  1. Preference data: Human judgments comparing model outputs
  2. Reward model: A learned function approximating human preferences
  3. Policy optimization: RL algorithms that maximize expected reward
  4. Regularization: Constraints preventing deviation from the base model

Read the full file on GitHub · 365 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 365 lines · 40 tokens per session scan A 06ca7de506f6

Subscribe to this mod's changes

rlhf is a skill published in the GitHub repository itsmostafa/llm-engineering-skills (23 stars, last pushed 4mo ago), licensed MIT. It adds 40 tokens to every session and 2,957 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

kaggle-learner

This skill should be used when the user asks to "learn from Kaggle", "study Kaggle solutions", "analyze Kaggle competitions", or mentions Kaggle competition URLs. Provides access to extracted knowledge from winning Kaggle solutions across NLP, CV, time series, tabular, and multimodal domains.

Galaxy-Dawn/claude-scholar · 69 tokens

llm-as-computer

Execute programs on a compiled transformer stack machine where every instruction fetch and memory read is a parabolic attention head. Demonstrates that transformer attention + FF layers can implement a working computer. Use when user mentions "llm-as-computer", "lac", "stack machine", "compiled transformer"…

oaustegard/claude-skills · 90 tokens

better-prompt

A prompt editor that turns rough instructions for AI systems into clearer, more complete prompts. It follows published OpenAI and Anthropic guidance.

huangwb8/skills · 107 tokens

ai-engineer-expert

Expert-level AI implementation, deployment, LLM integration, and production AI systems. Use when the user mentions AI engineering, LLM, deployment, production AI, or integration, or when the task involves LLM Patterns, LLM Integration, or Production Systems.

personamanagmentlayer/pcl · 58 tokens

bio-prefect-dask-nextflow

Design reproducible bioinformatics pipelines with Prefect plus Dask or Nextflow. Use when scaffolding local, distributed, or scheduler-backed workflows.

fmschulz/omics-skills · 37 tokens

claude-cookbooks

Claude AI cookbooks - code examples, tutorials, and best practices for using Claude API. Use when learning Claude API integration, building Claude-powered applications, or exploring Claude capabilities.

aiskillstore/marketplace · 41 tokens