Scaling Zero-Order Pretraining through Model Sharding
Organizations: Stanford University
Abstract
Zero-order optimization (ZO) trains without backpropagation, making it relevant to forward-only hardware and non-differentiable loss, but its gradient variance grows with perturbed dimension, inhibiting large-model training. Sharded Optimization Mixture of Assemblies (SOMA) trains LSTM experts independently on data clusters using simultaneous perturbation stochastic approximation (SPSA), without exchanging gradients, activations or optimizer state. Its separable loss removes cross-expert perturbation noise at the cost of jointly learned representations across domains. Using 80,000 estimated RTX 5090 GPU-hours, we show modest sharding improves training compute efficiency over all tested monolithic ZO controls. At 8.44M parameters and 150 aggregate GPU-hours, SOMA with 64 perturbations reaches 1.76 test nats/byte, versus 2.00--2.11 for monolithic SPSA at 64, 256 or 1,024 perturbations and 2.21 for EGGROLL. On WikiText-103, these frozen checkpoints reach 2.07, 2.25--2.36 and 2.49, respectively. On a fixed separable objective with equal-size blocks, we prove independent losses reduce relative gradient variance to approximately of a shared-loss estimator's. Holding starting weights, data, perturbations and compute fixed, independent rather than summed losses lower SOMA test loss by 0.035 nats/byte after 1,000 updates across three seeds. Larger ensembles offer a separate inference benefit: at similar model size with top- routing (), SOMA achieves 2.36M tokens/s versus 257k for SOMA (, including routing), at lower test loss (1.68 versus 1.71), albeit using as much aggregate training compute. We release all training and evaluation code and checkpoints.
Figures & tables
Appendix figures & tables24 assets
Supplementary material from the paper’s appendix.
Appendix
| Quantity | Configuration |
|---|---|
| Training corpus / tokenizer | 100B FineWeb-Edu bytes / byte vocabulary |
| Context length | 1,024 tokens |
| Expert validation set | The 1% split within each expert’s shard. The other 99% is used for training. Expert validation loss controls learning-rate decay. |
| Ensemble validation set | 976 windows from 202 FineWeb-Edu documents, used for scaling curves. Scores are ensemble validation loss. |
| Test set | 4,096 FineWeb-Edu documents screened for training overlap. Each contributes one 1,025-byte window. Scores are test loss. Construction and exclusions are in Appendix L . |
| Evaluation protocol | On the ensemble validation and test sets, routing uses the first 256 input bytes and loss scores the next 768 targets. Both losses are mean cross entropy in nats/byte. |
| head per expert | ensemble parameters | expert body parameters | ||
|---|---|---|---|---|
| 1 | 509 | 8.19k | 8.33M | 8.33M |
| 2 | 361 | 8.19k | 8.41M | 4.20M |
| 8 | 181 | 8.19k | 8.55M | 1.06M |
| 256 | 32 | 8.19k (shared) | 8.44M | 32.9k |
| Accounting method | GPU-hours | Calculation or recorded field |
|---|---|---|
| Recorded expert mean times | 41.9k | |
| W&B-reported physical total | 49.6k | physical_gpu_hr |
| Fixed 0.168-second reference | 49.7k | |
| Fixed 0.140-second normalization | 41.4k |
| Configuration | Updates | GPU-hours | Test loss | |
|---|---|---|---|---|
| SOMA | 64 | 65.0k | 150 | 1.76 |
| Monolithic SPSA | 64 | 30.0k | 152 | 2.00 |
| Monolithic SPSA | 256 | 1.32k | 150 | 2.11 |
| Monolithic SPSA | 1024 | 839 | 148 | 2.00 |
| Monolithic EGGROLL | — | 7.40k | 141 | 2.21 |
| 50 GPU-hours | 75 GPU-hours | 100 GPU-hours | ||||
|---|---|---|---|---|---|---|
| SOMA | BPTT | SOMA | BPTT | SOMA | BPTT | |
| 1.0091 ∗ | ||||||
| 1.0535 | ||||||
| 1.1776 | ||||||
| Learning rate | Initial | ||
|---|---|---|---|
| Ensemble validation loss | |||
| 0.00125 | 0.00250 | ||
| 0.00250 | 0.00250 | ||
| 0.00500 | 0.00250 | ||
| 0.00125 | 0.00125 | ||
| 0.00125 | 0.00500 | ||
| Optimization seed | Monolithic SPSA | SOMA ( ) | Difference |
|---|---|---|---|
| 1 | 2.2641 | 2.2273 | 0.0368 |
| 2 | 2.2666 | 2.2204 | 0.0462 |
| 3 | 2.2576 | 2.2218 | 0.0358 |
| Mean | 2.2628 | 2.2232 | 0.0396 |
| Sample standard deviation | 0.0047 | 0.0036 | 0.0057 |
| Initialization | 10,000 updates | |||
|---|---|---|---|---|
| Batch size | Cosine distance | Batch size | Cosine distance | |
| 1 | 8000 | 0.00002 | 8000 | 0.01045 |
| 2 | 8000 | 0.00002 | 8000 | 0.00503 |
| 8 | 8000 | 0.00002 | 4000 | 0.00492 |
| 256 | 8000 | 0.00013 | 1600 | 0.00759 |
| Checkpoint | Training compute | Validation | Test |
|---|---|---|---|
| (GPU-hours) | (nats/byte) | (nats/byte) | |
| 8.44M parameters | |||
| SOMA , | 150 | 2.047 | 2.066 |
| Monolithic SPSA, | 152 | 2.240 | 2.254 |
| Monolithic SPSA, | 150 | 2.348 | 2.363 |
| Monolithic SPSA, | 148 | 2.271 | 2.290 |
| Compute (operations) | Estimated ensemble validation loss |
|---|---|
| 1.8046–1.8057 | |
| 1.7947–1.8000 | |
| 1.7848–1.7887 |
| Test loss (nats/byte) | ||
|---|---|---|
| 64 | 1024 | 2.376587 |
| 256 | 256 | 2.376575 |
| 1024 | 64 | 2.376625 |
| Model | Batch | Throughput (M tokens/s) | Batch latency (ms) | Peak GPU memory (GiB) |
|---|---|---|---|---|
| Monolithic SPSA | 768 | 0.555 | 1,060 | 16.5 |
| SOMA | 768 | 0.468 | 1,260 | 12.3 |
| SOMA | 1,024 | 0.257 | 3,060 | 15.0 |
| SOMA | 4,096 | 2.36 | 1,330 | 8.30 |
| Model | Parameters | Updates | Estimated training wall-clock hours | Aggregate training GPU-hours | Test loss |
|---|---|---|---|---|---|
| SOMA | 8.55M | 53.5k–70.0k | 104 | 700 | 1.71 |
| SOMA | 8.44M | 2.18M | 100 | 22.0k | 1.75 |
| SOMA | 8.44M | 4.16M | 191 | 41.9k | 1.68 |
Zeroth-Order Optimization
Zeroth-order optimization uses function values or comparisons, rather than gradients, to optimize objectives when differentiation is unavailable or costly.
See all 86 papers