--- license: mit tags: - RLHF - RLCD - alignment - rotation --- # RLHF + RLCD Rotation **First to combine RLHF + RLCD in rotation!** ## Idea RLHF alone is expensive. RLCD alone is not enough. My idea: **Rotate them!** > **RLHF -> RLCD -> RLHF -> RLCD** ## How it works 1. **RLHF Step:** Learn from human taste, human preference. 2. **RLCD Step:** Learn from contrastive distillation, positive vs negative prompt. 3. **DEAD_ZONE = 0.05:** If the difference between RLHF and RLCD is small, keep both ON. Don't switch. This prevents mode collapse. 4. **Repeat:** Unknown number of steps. ## Note about Code Image The image shared is only a part of the code. ![Code Part](./part_code.png) ## Why it works - **RLHF** gives human intelligence. - **RLCD** gives contrastive diversity. - **Rotation** prevents repetition. - **DEAD_ZONE** prevents collapse. RLHF + RLCD = 0.7, 0.8, 0.9. Real thinking. ## Results - No mode collapse. - No repetition. - Model stays smart, not dumber. ## Training This training is not finished yet. It needs more resources to reach the target. ### Setup - **Base Model:** There is no hope yet of reaching 100 million, but it is expandable without problem. - **Method:** RLHF + RLCD Rotation - **LoRA:** Yes, optimized LoRA - **dtype:** float32 - **Optimizer:** AdamW (lr=2e-4) ## Why expandable? Because it contains an idea like a person who reads a book once and forgets it 👋👀 But it stays stored in his mind, and he returns to read it many times to memorize it. That is real training. ### Why it needs more resources? With LoRA + float32, training is heavier. - **float32** keeps weights precise, no loss. - **LoRA** needs optimization. - **group_params** is used for the adapter only, for optimization, nothing else. This costs more RAM / VRAM, but it is necessary to get the correct result. ### group_params I made an improvement for LoRA: - `group_params` is only for the adapter. - Only adapter weights are optimized. - Base model is frozen. - No conflict at all. ### Checked - Full code checked. - Adapter checked. - Weights checked. - **No conflict at all!** ### What is needed? To finish training and get the required result, we need more resources: - More VRAM / RAM - Clean run, no interruption ### Status **Code is clean. Code is complete. Code is checked.** **Training is waiting for resources.** ## Code No code shared. Idea only. ## Author **Mouad Tarif** ## Contact **email**:mouad.tarif@inbox.ru **linkedin**:https://www.linkedin.com/in/mouad-tarif-297688340 ```markdown **Important note** I thought about a training with a completely different code structure than that one 👋 And a small hint: those who used Fisher, which is a well-known function from 2017, I used the same method, but without following those who made it. The important thing is, those who worked on the training made it so weights don't change because of a penalty, and that led to forgetting. I hope for help and support for what I worked on. I don't think so at all, so I will find different ideas for training on the resources I have. I opened a new communication channel, a new official account on LinkedIn, and I put the link to my personal account. This idea I published about RLCD and RLHF is from my own thinking, officially, not from anyone else. And here are the different ideas I have. ```