palm-rlhf-pytorch
Operate the PaLM-rlhf-pytorch package for PaLM modeling, reward modeling, and RLHF/post-training workflows.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- palm-rlhf-pytorch
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Operate the PaLM-rlhf-pytorch package for PaLM modeling, reward modeling, and RLHF/post-training workflows.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/package-overview.md2.4 KB
- 参考文档references/repo-provenance.md1.7 KB
- 参考文档references/repo-routing-metadata.json575 B
- 参考文档references/troubleshooting.md3.4 KB
- 脚本scripts/inspect_palm_rlhf.py3.2 KB
03 SKILL.md 正文
PaLM-rLHF PyTorch
Use this repo skill for the PaLM-rlhf-pytorch package: the base PaLM transformer, reward models, implicit process rewards, and post-training trainers such as PPO, GRPO, TPO, and FlowRL.
What This Skill Covers
palm-modeling: construct, inspect, finetune, and smoke-check the basePaLMtransformer.reward-modeling: train or inspectRewardModelandImplicitPRMworkflows.policy-optimization: useRLHFTrainer,ActorCritic, GRPO, TPO, or FlowRL for post-training.
Start Here
- Read
references/package-overview.mdfor the public import surface and package shape. - Read
references/troubleshooting.mdfor install/import, backend, and dependency pitfalls. - Run the bundled inspector to confirm the installed package is usable:
python scripts/inspect_palm_rlhf.py --device auto --check-cuda
If you only want a parser/import check first, use:
python scripts/inspect_palm_rlhf.py --help
Installation
From a checkout of this repository, install the package in editable mode:
python -m pip install -e .
The project metadata requires Python 3.6+, but the verified inspection environment uses Python 3.11 with PyTorch 2.13 CUDA wheels. Keep the version consistent with the installed environment you are targeting.
Route to the Right Sub-Skill
- Ask about PaLM construction, next-token loss, generation, embeddings, LoRA scopes, or the source pretraining recipe →
sub-skills/palm-modeling/SKILL.md. - Ask about reward scores, prompt masks, binned rewards, or implicit process rewards →
sub-skills/reward-modeling/SKILL.md. - Ask about PPO/GRPO/TPO/FlowRL trainers, prompt-token-id setup, or bounded post-training smoke tests →
sub-skills/policy-optimization/SKILL.md.
Public Import Surface
The root package exports these user-facing names:
from palm_rlhf_pytorch import PaLM, RewardModel, RLHFTrainer, ActorCritic, ImplicitPRM
Trainer variants are module-qualified:
from palm_rlhf_pytorch import grpo, tpo, flowrl
Use the root exports for the standard PPO path and the module-qualified names for the newer trainer variants.
Common Prompt Shapes
"Build me a tiny PaLM smoke test"→palm-modeling."How do I score sequences or train a reward model?"→reward-modeling."Which RLHF trainer should I use?"→policy-optimization."The example fails on CPU or with a missing extra"→ root troubleshooting plus the relevant sub-skill."I need one small end-to-end smoke"→ root route plus the three sub-skills in order.
Fast Verification Ladder
- Run
python scripts/inspect_palm_rlhf.py --help. - Run
python scripts/inspect_palm_rlhf.py --device auto --check-cuda. - Run the smallest sub-skill smoke script for the workflow you care about.
- Only then consider a longer or more specialized workflow.
Self-Containment Rule
All runtime guidance here is self-contained. Do not direct future agents to open, run, or depend on the original repository checkout once the skill has been generated.
Freshness Check
Before treating this skill as current for a checkout, read references/repo-provenance.md. If the repo commit or dirty state differs from that snapshot, refresh the skill.
Related References
references/package-overview.mdfor the verified import surface and workflow map.references/troubleshooting.mdfor package-wide recovery steps.- Each sub-skill's
references/directory for workflow-specific API tables, recipes, and troubleshooting. - Each sub-skill's
scripts/directory for the safe tiny smoke helpers that correspond to that workflow.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).