Upload ANALYSIS.md with huggingface_hub
Browse files- ANALYSIS.md +120 -0
ANALYSIS.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Parameter Golf SOTA Analysis & Novel Optimization Plan
|
| 2 |
+
|
| 3 |
+
## Current SOTA: 1.0810 BPB (PR #1493)
|
| 4 |
+
|
| 5 |
+
### Techniques Already Used (the current stack):
|
| 6 |
+
1. **SP8192 tokenizer** - SentencePiece 8192 vocab (up from 1024 baseline)
|
| 7 |
+
2. **11 layers x 512d x 8H/4KV** - GQA architecture
|
| 8 |
+
3. **MLP 4x** with LeakyReLU(0.5)^2 activation
|
| 9 |
+
4. **Depth recurrence** - loops layers 3-5, creating 17 virtual from 11 physical layers
|
| 10 |
+
5. **Parallel residuals** (from layer 7) - GPT-J style parallel attention+MLP
|
| 11 |
+
6. **XSA** (cross-sequence attention) on all 11 layers
|
| 12 |
+
7. **Partial RoPE** (16/64 dims) - saves RoPE compute, rest is free dimensions
|
| 13 |
+
8. **Layerwise LN scale** (1/sqrt(layer_idx+1))
|
| 14 |
+
9. **QK-Gain 5.25** - learnable per-head query scaling
|
| 15 |
+
10. **U-Net skip connections** with sigmoid skip gates
|
| 16 |
+
11. **Resid mixing** (learnable convex combination of current+initial hidden state)
|
| 17 |
+
12. **MuonEq-R optimizer** (row-normalized Muon + Newton-Schulz)
|
| 18 |
+
13. **EMA** (decay 0.9965)
|
| 19 |
+
14. **GPTQ SDClip** (int6 matrices, int8 embeddings) with byte-shuffle + Brotli-11
|
| 20 |
+
15. **Score-first TTT** at eval (SGD lr=0.005, mom=0.9, 3 epochs, 32K chunks)
|
| 21 |
+
16. **Sliding window eval** (stride=64)
|
| 22 |
+
17. **LZMA code compression**
|
| 23 |
+
18. **Orthogonal weight init** for large matrices
|
| 24 |
+
19. **WD=0.095** (high weight decay drives RMS down β better compression ratio)
|
| 25 |
+
20. **Warmdown 72%** (cosine decay over final 72% of training)
|
| 26 |
+
21. **Sequence length 2048** (up from 1024 baseline)
|
| 27 |
+
|
| 28 |
+
### Architecture Details:
|
| 29 |
+
- Encoder indices: [0,1,2,3,4,5,3,4]
|
| 30 |
+
- Decoder indices: [5,3,4,5,6,7,8,9,10]
|
| 31 |
+
- Parallel residuals: layers 7-10
|
| 32 |
+
- XSA on all layers
|
| 33 |
+
- looping activated at frac=0.35 of training
|
| 34 |
+
|
| 35 |
+
## Opportunities for Improvement (ordered by expected impact)
|
| 36 |
+
|
| 37 |
+
### 1. In-Place TTT During Training (NOT just eval) β
β
β
β
β
|
| 38 |
+
**Current**: TTT only at eval time (score-first SGD adaptation)
|
| 39 |
+
**Novel**: Use In-Place TTT (arxiv 2604.06169) during TRAINING to improve learning.
|
| 40 |
+
- Repurpose W_down in MLP as fast weights
|
| 41 |
+
- Chunk-wise updates (512-1024 tokens)
|
| 42 |
+
- NTP-aligned objective (not reconstruction)
|
| 43 |
+
- Key insight: This effectively gives the model "memory" that adapts per-document DURING training, improving sample efficiency
|
| 44 |
+
- Zero extra stored params (W_down is already part of the model)
|
| 45 |
+
- At eval time, the model naturally does better TTT because it was trained with TTT objective
|
| 46 |
+
|
| 47 |
+
### 2. Multi-Resolution Recurrence (SpiralFormer) β
β
β
β
|
| 48 |
+
**Current**: Simple depth recurrence (loop layers 3-5 at same resolution)
|
| 49 |
+
**Novel**: Apply SpiralFormer multi-resolution schedule to the recurrent loops.
|
| 50 |
+
- Early loop iterations at coarsened resolution (e.g., r=0.5, L/2 tokens)
|
| 51 |
+
- Later iterations at full resolution
|
| 52 |
+
- Saves FLOPs on early passes β can afford MORE loop iterations in the same time budget
|
| 53 |
+
- Coarse-to-fine schedule naturally induces hierarchical processing
|
| 54 |
+
- SpiralFormer-L at 410M reduced FLOPs by 3-10% while IMPROVING perplexity
|
| 55 |
+
|
| 56 |
+
### 3. Multi-Token Prediction (MTP) Auxiliary Loss β
β
β
β
|
| 57 |
+
**Current**: Standard next-token prediction only
|
| 58 |
+
**Novel**: Add n=2 or n=4 multi-token prediction heads during training (arxiv 2404.19737)
|
| 59 |
+
- Shared trunk, independent output heads for predicting tokens t+1, t+2, ..., t+n
|
| 60 |
+
- At training: loss = avg(CE(head_i, token_{t+i})) for i=1..n
|
| 61 |
+
- At eval: discard extra heads, use only head_1
|
| 62 |
+
- ZERO extra params in artifact (heads discarded)
|
| 63 |
+
- 20-30% improved sample efficiency β more learning per training step
|
| 64 |
+
- "Reinforces choice points" - model learns to plan ahead
|
| 65 |
+
|
| 66 |
+
### 4. Sigma-MoE FFN Within Shared Block β
β
β
|
| 67 |
+
**Current**: Dense MLP in all layers
|
| 68 |
+
**Novel**: Replace MLP in the recurrent (shared) layers with Sigma-MoE
|
| 69 |
+
- Many small experts (e.g., 32 experts, top-2 active)
|
| 70 |
+
- Routing uses Sigma function for smooth gating
|
| 71 |
+
- Total params in MoE > dense MLP, but only top-K activated β same FLOPs
|
| 72 |
+
- Since shared layers are looped, the MoE weights are stored ONCE
|
| 73 |
+
- This multiplies effective parameter capacity of the recurrent core
|
| 74 |
+
- MoEUT (arxiv 2405.16039) showed MoE outperforms dense at same param count
|
| 75 |
+
|
| 76 |
+
### 5. Improved GPTQ with Hessian-Weighted Quantization β
β
β
|
| 77 |
+
**Current**: SDClip uses k * std(row) clipping
|
| 78 |
+
**Novel**: Use actual Hessian diagonal (H_diag = E[x_i^2]) to weight quantization
|
| 79 |
+
- GPTQ already uses Hessian; but SDClip approximates with std
|
| 80 |
+
- Full Hessian-aware quantization (AQLM/QuIP# style) could squeeze more bits
|
| 81 |
+
- Better rate-distortion tradeoff β lower BPB for same artifact size
|
| 82 |
+
|
| 83 |
+
### 6. Larger Vocabulary (SP16384 or SP32768) β
β
β
|
| 84 |
+
**Current**: SP8192 (moved from 1024 β 8192 was a huge win)
|
| 85 |
+
**Novel**: Continue the trend to SP16384 or SP32768
|
| 86 |
+
- More tokens per byte = fewer tokens per document = more text seen in 10 min
|
| 87 |
+
- Embeddings get more expensive but with int8 GPTQ they're compressed
|
| 88 |
+
- The BPB metric rewards efficient tokenization
|
| 89 |
+
- But: diminishing returns and embedding size grows linearly with vocab
|
| 90 |
+
|
| 91 |
+
### 7. Progressive Depth Recurrence Schedule β
β
|
| 92 |
+
**Current**: Fixed recurrence (3 loops of layers 3-5)
|
| 93 |
+
**Novel**: Progressive recurrence - start with no loops, gradually increase
|
| 94 |
+
- Early training: no recurrence (all 11 layers unique)
|
| 95 |
+
- Mid training: loop 1 time
|
| 96 |
+
- Late training: loop 2+ times
|
| 97 |
+
- Avoids early training instability from too-deep recurrence
|
| 98 |
+
- Already partially done (enable_looping_at=0.35), but could be more gradual
|
| 99 |
+
|
| 100 |
+
### 8. Curriculum Learning on Data Quality β
β
|
| 101 |
+
**Novel**: Start training on all FineWeb data, progressively filter to higher quality
|
| 102 |
+
- Similar to data annealing from Llama papers
|
| 103 |
+
- Easy to implement: just re-rank training shards by quality score
|
| 104 |
+
- Could improve BPB if val set favors high-quality text patterns
|
| 105 |
+
|
| 106 |
+
## Implementation Plan
|
| 107 |
+
|
| 108 |
+
**Phase 1: Core Innovations** (highest impact, 3 techniques)
|
| 109 |
+
1. Multi-Token Prediction auxiliary loss (n=2)
|
| 110 |
+
2. SpiralFormer multi-resolution recurrence
|
| 111 |
+
3. In-Place TTT during training (chunk-wise, NTP-aligned)
|
| 112 |
+
|
| 113 |
+
**Phase 2: Architecture Refinements**
|
| 114 |
+
4. Sigma-MoE in shared layers
|
| 115 |
+
5. SP16384 tokenizer exploration
|
| 116 |
+
6. Progressive recurrence schedule
|
| 117 |
+
|
| 118 |
+
**Phase 3: Compression Optimization**
|
| 119 |
+
7. Hessian-weighted GPTQ refinement
|
| 120 |
+
8. INT4/INT5 experiments for matrices (if artifact space allows)
|