Datasets:
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- RLHF
|
| 5 |
+
- RLCD
|
| 6 |
+
- alignment
|
| 7 |
+
- rotation
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# RLHF + RLCD Rotation
|
| 11 |
+
|
| 12 |
+
**First to combine RLHF + RLCD in rotation!**
|
| 13 |
+
## Idea
|
| 14 |
+
|
| 15 |
+
RLHF alone is expensive. RLCD alone is not enough.
|
| 16 |
+
|
| 17 |
+
My idea: **Rotate them!**
|
| 18 |
+
|
| 19 |
+
> **RLHF -> RLCD -> RLHF -> RLCD**
|
| 20 |
+
|
| 21 |
+
## How it works
|
| 22 |
+
|
| 23 |
+
1. **RLHF Step:** Learn from human taste, human preference.
|
| 24 |
+
2. **RLCD Step:** Learn from contrastive distillation, positive vs negative prompt.
|
| 25 |
+
3. **DEAD_ZONE = 0.05:** If the difference between RLHF and RLCD is small, keep both ON. Don't switch. This prevents mode collapse.
|
| 26 |
+
4. **Repeat:** 14000 steps.
|
| 27 |
+
## Note about Code Image
|
| 28 |
+
|
| 29 |
+
The image shared is only a part of the code.
|
| 30 |
+
|
| 31 |
+

|
| 32 |
+
## Why it works
|
| 33 |
+
|
| 34 |
+
- **RLHF** gives human intelligence.
|
| 35 |
+
- **RLCD** gives contrastive diversity.
|
| 36 |
+
- **Rotation** prevents repetition.
|
| 37 |
+
- **DEAD_ZONE** prevents collapse.
|
| 38 |
+
|
| 39 |
+
RLHF + RLCD = 0.7, 0.8, 0.9. Real thinking.
|
| 40 |
+
|
| 41 |
+
## Results
|
| 42 |
+
|
| 43 |
+
- No mode collapse.
|
| 44 |
+
- No repetition.
|
| 45 |
+
- Model stays smart, not dumber.
|
| 46 |
+
## Training
|
| 47 |
+
|
| 48 |
+
This training is not finished yet. It needs more resources to reach the target.
|
| 49 |
+
|
| 50 |
+
### Setup
|
| 51 |
+
|
| 52 |
+
- **Base Model:** 100M
|
| 53 |
+
- **Method:** RLHF + RLCD Rotation
|
| 54 |
+
- **LoRA:** Yes, optimized LoRA
|
| 55 |
+
- **dtype:** float32
|
| 56 |
+
- **Optimizer:** AdamW (lr=2e-4)
|
| 57 |
+
|
| 58 |
+
### Why it needs more resources?
|
| 59 |
+
|
| 60 |
+
With LoRA + float32, training is heavier.
|
| 61 |
+
|
| 62 |
+
- **float32** keeps weights precise, no loss.
|
| 63 |
+
- **LoRA** needs optimization.
|
| 64 |
+
- **group_params** is used for the adapter only, for optimization, nothing else.
|
| 65 |
+
|
| 66 |
+
This costs more RAM / VRAM, but it is necessary to get the correct result.
|
| 67 |
+
|
| 68 |
+
### group_params
|
| 69 |
+
|
| 70 |
+
I made an improvement for LoRA:
|
| 71 |
+
|
| 72 |
+
- `group_params` is only for the adapter.
|
| 73 |
+
- Only adapter weights are optimized.
|
| 74 |
+
- Base model is frozen.
|
| 75 |
+
- No conflict at all.
|
| 76 |
+
|
| 77 |
+
### Checked
|
| 78 |
+
|
| 79 |
+
- Full code checked.
|
| 80 |
+
- Adapter checked.
|
| 81 |
+
- Weights checked.
|
| 82 |
+
- **No conflict at all!**
|
| 83 |
+
|
| 84 |
+
### What is needed?
|
| 85 |
+
|
| 86 |
+
To finish training and get the required result, we need more resources:
|
| 87 |
+
|
| 88 |
+
- More VRAM / RAM
|
| 89 |
+
- Clean run, no interruption
|
| 90 |
+
|
| 91 |
+
### Status
|
| 92 |
+
|
| 93 |
+
**Code is clean. Code is complete. Code is checked.**
|
| 94 |
+
**Training is waiting for resources.**
|
| 95 |
+
|
| 96 |
+
## Code
|
| 97 |
+
|
| 98 |
+
No code shared. Idea only.
|
| 99 |
+
|
| 100 |
+
## Author
|
| 101 |
+
|
| 102 |
+
**Tarif**
|
| 103 |
+
First to propose RLHF + RLCD Rotation.
|