Open-source ChatGPT, minus the millions and the weights
A complete PyTorch scaffold for replicating ChatGPT’s RLHF pipeline on PaLM, released without weights or compute for the open-research community.

What it does
This repo lays out the full three-stage RLHF pipeline in PyTorch: an autoregressive PaLM transformer, a binned RewardModel that scores completions, and a PPO-driven RLHFTrainer that refines the policy against those scores. It is explicitly a skeleton—there are no pretrained weights, so out of the box it generates random tokens.
The interesting bit The author is admirably blunt that this is “just the ship and overall map,” and even flags Direct Preference Optimization as a likely successor that could replace the whole reward-model-and-PPO complexity with a few lines of cross-entropy. That honesty is refreshing in a field crowded with repos that imply inference-ready magic.
Key highlights
- Implements the full RLHF loop: base
PaLMmodel,RewardModel, andRLHFTrainer. - Reward model supports both full finetuning and
LoRAadapters, acknowledging the original paper struggled with overfitting here. - Integrated Flash Attention from PyTorch 2.0 for memory-efficient training.
- Explicitly disclaims containing a trained model; it is architecture and training logic only.
Caveats
- No trained weights are provided, and the README notes you still need “millions of dollars of compute + data” plus expert tuning to produce anything useful.
- Several trainer conveniences remain unfinished, including Hugging Face
accelerateintegration, variable-length prompt sampling, and a human-feedback collection UI.
Verdict Worth a look if you are researching RLHF mechanics or building a custom training stack from first principles. If you need an off-the-shelf conversational model to deploy today, this is explicitly not it.
Frequently asked
- What is lucidrains/PaLM-rlhf-pytorch?
- A complete PyTorch scaffold for replicating ChatGPT’s RLHF pipeline on PaLM, released without weights or compute for the open-research community.
- Is PaLM-rlhf-pytorch open source?
- Yes — lucidrains/PaLM-rlhf-pytorch is open source, released under the MIT license.
- What language is PaLM-rlhf-pytorch written in?
- lucidrains/PaLM-rlhf-pytorch is primarily written in Python.
- How popular is PaLM-rlhf-pytorch?
- lucidrains/PaLM-rlhf-pytorch has 7.9k stars on GitHub.
- Where can I find PaLM-rlhf-pytorch?
- lucidrains/PaLM-rlhf-pytorch is on GitHub at https://github.com/lucidrains/PaLM-rlhf-pytorch.