Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RAE Training Methodology
|
| 2 |
+
## Recursive Abstraction Engine as Training-Time Cognitive Installation
|
| 3 |
+
|
| 4 |
+
> **The handwriting principle**: Slow, multi-representational, generative reconstruction
|
| 5 |
+
> during training installs richer internal representations β producing fast, effortless
|
| 6 |
+
> retrieval at inference. The hand was slow so the mind could be fast later.
|
| 7 |
+
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
## Core Thesis
|
| 11 |
+
|
| 12 |
+
Standard fine-tuning trains models on flat `input β output` pairs. This is **typing** β
|
| 13 |
+
discriminative lookup from heavy context. RAE Training forces models through **multi-phase
|
| 14 |
+
generative reconstruction**, creating the neural equivalent of handwriting:
|
| 15 |
+
|
| 16 |
+
| Property | Handwriting | RAE Training |
|
| 17 |
+
|----------|------------|--------------|
|
| 18 |
+
| Forced sequential reconstruction | Must regenerate each letter from memory | Must generate each cognitive phase from internal state |
|
| 19 |
+
| Multi-pathway co-firing | Motor + visual + spatial + linguistic | Saturation + abstraction + descent + integration |
|
| 20 |
+
| Temporal bottleneck | Slowness forces deeper encoding | Multi-phase chain forces richer weight geometry |
|
| 21 |
+
| Variability | No two handwritten letters identical | Stochastic phase generation prevents rote memorization |
|
| 22 |
+
| Closed-loop embodiment | Proprioceptive error correction | Phase-to-phase coherence loss creates self-correction |
|
| 23 |
+
|
| 24 |
+
## Architecture
|
| 25 |
+
|
| 26 |
+
```
|
| 27 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 28 |
+
β RAE TRAINING PIPELINE β
|
| 29 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
| 30 |
+
β β
|
| 31 |
+
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
|
| 32 |
+
β βSATURATIONβββββΊβABSTRACTIONβββββΊβ DESCENT βββββΊβINTEGRATE β β
|
| 33 |
+
β β tokens β β tokens β β tokens β β tokens β β
|
| 34 |
+
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
|
| 35 |
+
β β² β β
|
| 36 |
+
β βββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 37 |
+
β β
|
| 38 |
+
β Loss = Ξ»βΒ·L_sat + Ξ»βΒ·L_abs + Ξ»βΒ·L_desc + Ξ»βΒ·L_int β
|
| 39 |
+
β + Ξ»_cohΒ·L_coherence + Ξ»_compΒ·L_compression β
|
| 40 |
+
β β
|
| 41 |
+
β Key: ALL phases contribute to loss, not just final answer β
|
| 42 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
## Training Objectives (Multi-Objective Co-Training)
|
| 46 |
+
|
| 47 |
+
1. **Phase Generation Loss** β Each RAE phase must be generated correctly
|
| 48 |
+
2. **Cross-Phase Coherence Loss** β Abstractions must logically follow from saturation
|
| 49 |
+
3. **Compression Loss** β Abstraction phase penalized for being longer than saturation
|
| 50 |
+
4. **Prediction Accuracy Loss** β Descent-phase predictions evaluated against ground truth
|
| 51 |
+
5. **Integration Quality Loss** β Final synthesis must incorporate phase outputs
|
| 52 |
+
|
| 53 |
+
## Quick Start
|
| 54 |
+
|
| 55 |
+
### Option A: AutoTrain (No-Code)
|
| 56 |
+
```bash
|
| 57 |
+
pip install autotrain-advanced
|
| 58 |
+
autotrain --config configs/autotrain_rae_sft.yaml
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
### Option B: Custom Trainer (Full Control)
|
| 62 |
+
```bash
|
| 63 |
+
pip install -r requirements.txt
|
| 64 |
+
python src/train_rae.py --config configs/rae_training_config.json
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
### Option C: HuggingFace Spaces
|
| 68 |
+
Upload to a Space with GPU β see `scripts/deploy_to_hf_space.sh`
|
| 69 |
+
|
| 70 |
+
## Dataset Format
|
| 71 |
+
|
| 72 |
+
RAE training data uses JSONL with structured multi-phase reasoning:
|
| 73 |
+
|
| 74 |
+
```json
|
| 75 |
+
{
|
| 76 |
+
"messages": [
|
| 77 |
+
{"role": "system", "content": "You are an RAE-trained reasoner..."},
|
| 78 |
+
{"role": "user", "content": "<problem>"},
|
| 79 |
+
{"role": "assistant", "content": "<SATURATION>...</SATURATION><ABSTRACTION>...</ABSTRACTION><DESCENT>...</DESCENT><INTEGRATION>...</INTEGRATION>"}
|
| 80 |
+
]
|
| 81 |
+
}
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
## Files
|
| 85 |
+
|
| 86 |
+
```
|
| 87 |
+
rae-training/
|
| 88 |
+
βββ README.md # This file
|
| 89 |
+
βββ requirements.txt # Python dependencies
|
| 90 |
+
βββ configs/
|
| 91 |
+
β βββ autotrain_rae_sft.yaml # AutoTrain config (no-code path)
|
| 92 |
+
β βββ rae_training_config.json # Custom trainer config
|
| 93 |
+
β βββ base_models.json # Tested base model registry
|
| 94 |
+
βββ src/
|
| 95 |
+
β βββ dataset_generator.py # Generates RAE-structured training data
|
| 96 |
+
β βββ rae_data_formatter.py # Formats raw data into RAE phases
|
| 97 |
+
β βββ train_rae.py # Custom RAE trainer with multi-phase loss
|
| 98 |
+
β βββ rae_loss.py # Multi-objective loss functions
|
| 99 |
+
β βββ rae_tokenizer_utils.py # Phase-aware tokenization
|
| 100 |
+
βββ evaluation/
|
| 101 |
+
β βββ eval_rae_model.py # Evaluation harness
|
| 102 |
+
β βββ benchmarks.json # Test problems for before/after comparison
|
| 103 |
+
βββ data/
|
| 104 |
+
β βββ seed_problems.jsonl # Seed problems for dataset generation
|
| 105 |
+
βββ scripts/
|
| 106 |
+
βββ generate_dataset.sh # End-to-end dataset generation
|
| 107 |
+
βββ run_training.sh # Training launcher
|
| 108 |
+
βββ deploy_to_hf_space.sh # HF Spaces deployment
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
## Theory: Why This Works
|
| 112 |
+
|
| 113 |
+
See the companion document `THEORY.md` for the full neuroscience-to-ML mapping.
|
| 114 |
+
|
| 115 |
+
**TL;DR**: Handwriting activates widespread brain connectivity because it forces
|
| 116 |
+
*generative reconstruction through multiple representational modalities simultaneously
|
| 117 |
+
under a temporal bottleneck*. RAE training replicates this by forcing the model to
|
| 118 |
+
traverse Saturation β Abstraction β Descent β Integration phases, with loss computed
|
| 119 |
+
on ALL phases β meaning the model cannot shortcut to the answer. The multi-phase
|
| 120 |
+
structure installs richer weight geometry that persists as faster, more capable
|
| 121 |
+
inference after training.
|