Skip to content
Back to skills

Rlaif Reward Modeling

ASecurity

Train and validate tiny soft-label pairwise reward models that distill RLAIF AI preference distributions with cross-entropy.

  • 247 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 9, 2026
testingpythonbash

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill rlaif_reward_modeling --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rlaif Reward Modeling?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rlaif Reward Modeling
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-rlaif-reward-modeling/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-rlaif-reward-modeling)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
name: rlaif_reward_modeling
description: Train and validate tiny soft-label pairwise reward models that distill RLAIF AI preference distributions with cross-entropy.
---

# RLAIF Reward Modeling

Use this skill when a RLAIF workflow needs canonical reward-model distillation from pairwise AI soft labels. It is designed for small deterministic recovery checks as well as adapter code that mirrors the paper's reward-model objective.

Do not use this skill for direct-RLAIF single-response scoring or policy-gradient updates. It produces a reward model or score trace, not a trained language model policy.

## Inputs

- Pairwise examples with `context`, `response1`, `response2`, and `preference = [p1, p2]`.
- Initial model parameters or defaults for a tiny linear response scorer.
- Training settings such as learning rate and number of steps.

## Outputs

- Updated reward-model parameters.
- Scores and predicted pairwise probability distribution.
- Training trace with `loss_before`, `loss_after`, `params_before`, `params_after`, and `optimizer_state_changed`.

## Workflow

1. Convert each response to deterministic features.
2. Score each response with a shared scalar reward model.
3. Softmax the pair of scores.
4. Compute soft-label cross-entropy against the AI preference distribution.
5. Update parameters with gradient descent.
6. Log before/after losses and parameter changes.

## Validation

Run:

```bash
python scripts/reward_modeling.py --smoke
python tests/test_reward_modeling.py
```

The tests assert that training decreases soft-label cross-entropy, changes parameters, and preserves soft labels without one-hot rounding.

## Limitations

This skill's bundled trainer is intentionally tiny. It proves the canonical RLAIF loss and data contract, but it does not reproduce PaLM 2 reward-model fine-tuning.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.