Reproduce a small experiment on catastrophic forgetting during continued training.
Study how a KL penalty against a frozen copy of a model affects knowledge retention.
Sweep the penalty strength and see the tradeoff between old and new knowledge.
Use the small transformer setup as a base for testing your own forgetting mitigation idea.
| 6elphegor/dreaming | 0xallam/my-recipe | 0xhassaan/nn-from-scratch | |
|---|---|---|---|
| Stars | 0 | — | 0 |
| Language | Python | Python | Python |
| Last pushed | — | 2022-11-22 | — |
| Maintenance | — | Dormant | — |
| Setup difficulty | moderate | moderate | moderate |
| Complexity | 3/5 | 2/5 | 4/5 |
| Audience | researcher | general | developer |
Figures from each repo's GitHub metadata at analysis time.
Needs PyTorch and a GPU for reasonable speed, though it can run slowly on CPU.
Dreaming is a small research project studying a problem called catastrophic forgetting, which happens when a model learns new information but loses accuracy on things it learned earlier. The experiment trains a small transformer model to memorize 10,000 key and value pairs, treated as old knowledge, then continues training it on 1,000 fresh pairs, treated as new knowledge. Simply fine-tuning on the new pairs without any protection turns out to wipe out most of the old knowledge: only about 29 percent of the old pairs are still remembered afterward, even though none of the new data actually contradicts the old. The fix tested here adds a penalty during the new training that compares the model's answers to those of a frozen copy of itself from before the new training began, using sequences the frozen copy generates on its own, which is why the project calls this dreaming. Adding even a small amount of this penalty recovers most of the lost old knowledge while still learning almost all of the new pairs, and a moderate setting keeps over 98 percent of the old knowledge with almost no cost to the new. Pushing the penalty too high starts to block learning the new pairs without adding much more protection for the old ones. The code trains a roughly 1.1 million parameter transformer from scratch and runs the full sweep of settings in under four minutes on a GPU, though it also works slower on a CPU. Running it requires PyTorch, and making the result charts requires matplotlib. The main script is a single Python file that both defines the model and runs the training, alongside a separate script for plotting results and one for inspecting the pretrained model afterward. This is a small scale experiment rather than a ready made tool, aimed at people curious about how catastrophic forgetting behaves and one way researchers try to reduce it.
A small research experiment testing a method that helps a model keep old memorized knowledge while learning new information.
Mainly Python. The stack also includes Python, PyTorch, matplotlib.
Unknown from the shown README, check the repository license file for exact terms.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly researcher.
This repo across BitVibe Labs
Verify against the repo before relying on details.