Phase-HDC: Replacing Optimizer History with Gradient Thresholds in Discrete Phase Learning
Organizations: Mathalyse Research
Abstract
Training a compact model often needs far more memory than storing it, because the optimizer keeps its own records of past gradients. For a hyperdimensional classifier whose learned parameters are low-bit angles, which we call a \emph{phase memory}, these records take several times more memory than the model itself. We ask whether such a model can be trained while storing nothing but the model. The proposed method, Phase-HDC, turns each stored angle by at most one step per update, against the sign of its current gradient, and only when that gradient is large enough. We show that this simple rule is the exact solution of a first-order loss model in which every changed parameter pays a fixed cost. When everything except the update rule is held fixed, Phase-HDC matches the accuracy of Adam with 6-bit moments while storing three times less. Across eleven image, tabular, and text datasets, it stores 16--23 less than standard float32 Adam and 4--6 less than 8-bit Adam. The price is an average loss of about five accuracy points against float32 Adam, while Phase-HDC is more accurate than 8-bit Adam on six of the eleven datasets, including byte-level text prediction, where 8-bit Adam collapses. Instrumented training runs explain these outcomes. Once parameters must sit on a discrete grid, Adam's moments mainly decide whether a parameter moves at all, a decision that a threshold on the current gradient can make without memory, and coarse quantization of the moments breaks this decision for inputs that the data rarely contain. The storage savings are logical state rather than measured hardware memory.
Figures & tables
| Study | Data and scale | Question | Selection; seeds |
|---|---|---|---|
| Controlled comparison ( Section 5.1 ) | digits; , | Does removing all optimizer history cost accuracy when parameters, head, and initialization are identical? | separate validation set; 5 |
| Screening studies ( Section 5.2 ) | digits; , 20 epochs | Where does Phase-HDC sit among float32, 8-bit, 6-bit, and hybrid training systems? Do generated item memories and fixed-point gradients work? | tuning seed on evaluation split; 5 |
| Six-dataset evaluation ( Section 5.3 ) | six public datasets; | How large are the accuracy cost and the state saving across tasks, and how does the phase width matter? | tuning seed on evaluation split; 3 |
| Character-level text ( Section 5.4 ) | five text corpora; , 64-symbol context | Does the trade-off carry over to next-symbol prediction with vocabularies of up to 256 symbols? | tuning seed on test windows; 3 |
| Instrumented replays ( Section 5.5 ) | digits; controlled runs | How often and how far does each method move each coordinate, and why? | replays of the final runs; 5 |
| Dataset | Train | Eval. | Epochs | Batch | ||||
|---|---|---|---|---|---|---|---|---|
| Letter | 14,000 | 6,000 | 16 | 16 | 26 | 128 | 25 | 256 |
| ISOLET | 5,457 | 2,340 | 617 | 32 | 26 | 256 | 25 | 256 |
| HAR | 7,352 | 2,947 | 561 | 32 | 6 | 256 | 25 | 256 |
| MNIST | 60,000 | 10,000 | 784 | 16 | 10 | 384 | 10 | 128 |
| Fashion-MNIST | 60,000 | 10,000 | 784 | 16 | 10 | 384 | 10 | 128 |
| CIFAR-10 | 50,000 | 10,000 | 1,024 | 64 | 10 | 384 | 10 | 64 |
| Method | Test accuracy (%) | State (KiB) | Ratio |
|---|---|---|---|
| Phase-HDC | 4.27 | ||
| Projected Adam, 6-bit moments | 12.80 | ||
| Projected Adam, 8-bit moments | 15.64 | ||
| Projected Adam, float32 moments | 49.77 |
| System | Accuracy (%) | Gap (pp) | State (KiB) | Ratio |
|---|---|---|---|---|
| Adam-fp32 | — | 113.62 | 1.0 | |
| Affine Adam-8 | 28.41 | 4.0 | ||
| Affine Adam-6 | 21.30 | 5.3 | ||
| Hybrid, | 26.30 | 4.3 | ||
| Hybrid, | 28.20 | 4.0 | ||
| Phase-HDC, | 4.27 | 26.6 |
| Dataset | Adam-fp32 | Affine Adam-8 | Affine Adam-6 | Phase-HDC-6 |
|---|---|---|---|---|
| Letter | ||||
| ISOLET | ||||
| HAR | ||||
| MNIST | ||||
| Fashion-MNIST | ||||
| CIFAR-10 |
| State (KiB) | Ratio to Phase-HDC-6 | ||||||
|---|---|---|---|---|---|---|---|
| Dataset | Adam-fp32 | Adam-8 | Adam-6 | Phase-HDC-6 | fp32 | 8-bit | 6-bit |
| Letter | 126.00 | 31.50 | 23.62 | 5.44 | |||
| ISOLET | 2103.00 | 525.75 | 394.31 | 126.56 | |||
| HAR | 1815.00 | 453.75 | 340.31 | 112.31 | |||
| MNIST | 3690.00 | 922.50 | 691.88 | 227.81 | |||
| Fashion-MNIST | 3690.00 | 922.50 | 691.88 | 227.81 | |||
| Corpus | Adam-fp32 | Affine Adam-8 | Phase-HDC-6 | ||
|---|---|---|---|---|---|
| Tiny Shakespeare | 65 | 1.5 | |||
| TinyStories | 70 | 1.4 | |||
| PTB | 49 | 2.0 | |||
| text8 | 27 | 3.7 | |||
| enwik8 | 256 | 0.4 |
| State (KiB) | Ratio to Phase-HDC-6 | ||||
|---|---|---|---|---|---|
| Corpus | Adam-fp32 | Adam-8 | Phase-HDC-6 | fp32 | 8-bit |
| Tiny Shakespeare | 388.5 | 97.1 | 18.2 | ||
| TinyStories | 411.0 | 102.8 | 19.1 | ||
| PTB | 316.5 | 79.1 | 15.2 | ||
| text8 | 217.5 | 54.4 | 11.1 | ||
| enwik8 | 1248.0 | 312.0 | 54.0 | ||
| Item memory | ||||
|---|---|---|---|---|
| Generated, flattened 1D index | 38 | 41 | 53 | 55 |
| Generated, row and column frequencies | 50 | — | — | 72 † |
| Dense table | 96 | 96 | 95 | 94 |
| Table bits | 4 | 6 | 8 | 10 | 16 |
|---|---|---|---|---|---|
| 4 | 65.7 | 94.2 | 97.7 | 97.8 | 97.8 |
| 8 | 68.1 | 94.3 | 99.6 | 99.8 | 99.9 |
| 16 | 68.1 | 95.8 | 99.6 | 99.9 | 100.0 |
| Softmax bits | Accuracy (%) |
|---|---|
| Float (control) | |
| 16 | |
| 12 | |
| 10 | |
| 8 | |
| 6 |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Symbol | Meaning |
|---|---|
| , | discretized input with values ; class label |
| , , , | number of positions, value bins, classes; representation dimension |
| , , , , | indices of position, value bin, class, dimension, and concatenated coordinate |
| , , | phase bit width, number of phase levels, angle of one notch |
| integers with addition modulo | |
| , , | position, value, and class phase tables |
| Dataset | Adam-fp32 | Affine Adam-8 | Affine Adam-6 | Phase-HDC-6 |
|---|---|---|---|---|
| Letter | ||||
| ISOLET | ||||
| HAR | ||||
| MNIST | ||||
| Fashion-MNIST | ||||
| CIFAR-10 |
| Dataset | ||||
|---|---|---|---|---|
| Letter | ||||
| ISOLET | ||||
| HAR | ||||
| MNIST | ||||
| Fashion-MNIST | ||||
| CIFAR-10 |
| Seed | Phase-HDC | Adam, 6-bit moments | Adam, 8-bit moments | Adam, float32 moments |
|---|---|---|---|---|
| 1 | 92.78 | 90.00 | 91.39 | 92.22 |
| 2 | 93.89 | 92.22 | 91.67 | 93.06 |
| 3 | 92.22 | 91.39 | 90.56 | 87.78 |
| 4 | 91.67 | 92.50 | 90.83 | 90.00 |
| 5 | 91.67 | 90.00 | 92.78 | 90.83 |
| Mean | 92.44 | 91.22 | 91.44 | 90.78 |
| Dataset | Adam-fp32 | Affine Adam-8 | Affine Adam-6 | Phase-HDC-6 |
|---|---|---|---|---|
| Letter | 86.8–89.3 | 77.7–86.6 | 70.2–86.1 | 64.2–80.5 |
| ISOLET | 77.1–93.5 | 62.9–92.5 | 51.8–88.6 | 54.7–78.4 |
| HAR | 90.3–94.2 | 69.8–89.7 | 13.8–72.0 | 75.5–90.0 |
| MNIST | 85.8–93.5 | 48.4–93.2 | 9.2–72.9 | 45.0–91.7 |
| Fashion-MNIST | 74.3–84.0 | 76.4–84.6 | 14.2–60.7 | 73.1–83.8 |
| CIFAR-10 | 23.5–38.7 | 10.1–28.1 | 10.0–13.9 | 21.7–31.7 |
| Corpus | Adam-fp32 | Affine Adam-8 | Phase-HDC-6 |
|---|---|---|---|
| Tiny Shakespeare | 23.6–27.7 | 7.8–16.7 | 18.1–24.4 |
| TinyStories | 32.1–35.6 | 6.0–22.3 | 26.4–32.2 |
| PTB | 28.1–31.7 | 10.6–23.1 | 24.1–29.7 |
| text8 | 25.7–27.8 | 24.3–27.4 | 23.7–26.0 |
| enwik8 | 22.4–25.1 | 0.0–12.6 | 14.4–21.0 |