You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Experiment 3: multi-channel PE flips the picture, branch pivots
4-channel positional encoding with squared-L2 lookup, L = 8 → 200.
Harmonic primes [7, 11, 13, 17] vs sinusoidal periods [8, 64].
The single-channel L=48 harmonic "win" from experiment 2 was a metric
artefact, exactly as flagged. With multi-channel vectors and L2
similarity:
L=48: harmonic 21/48 vs sinusoidal 48/48
L=64: harmonic 22/64 vs sinusoidal 64/64
L=200: harmonic 34/200 vs sinusoidal 72/200
Harmonic saturates at 22 unique vectors by L=64 and stays there.
Sinusoidal stays perfectly distinct up to L=64 then saturates at 64
unique. Sinusoidal wins everywhere ≥ L=16.
The cumulative read across experiments 0-3: at every fair comparison
so far, standard transformer building blocks (softmax, sinusoidal PE)
beat the harmonic alternatives. Drop-replacement is the wrong play.
Branch pivots accordingly. The harmonic substrate's documented wins
(structural-anomaly detection per the credential-stuffing benchmark)
are real but live in a different computational regime than next-token
prediction. The new roadmap (experiment 4) builds a harmonic
structural-anomaly head as an AUXILIARY signal on top of a standard
transformer, rather than substituting for its components.
Both engines audit byte-identical (1972 bytes).
| 0 | Copy task, exact-match query, 100 trials | OmniWeight 82/100, softmax 82/100, 0 disagreements. Confirms both scorers agree on exact match (the 18 "misses" are duplicate-value trials, both tie-break to first occurrence). |
87
-
| 1 | Perturbed query (query = true_val + noise), 200 trials per noise level | Softmax wins everywhere. noise=1: 189 vs 170. noise=7: 118 vs 99. noise=50: 42 vs 33. OmniWeight's |k|-normalised denominator pulls predictions toward smaller attractors regardless of perturbation direction, which hurts on a "recover the original value" metric. |
88
-
| 2 | Single-channel positional-encoding distinctness + lookup at L = 8 / 14 / 24 / 48 | At small L sinusoidal wins (8/8 vs 6/8 at L=8). **At L=48 harmonic overtakes: 38/48 vs 26/48.** Despite harmonic having only 10 unique codes across 48 positions, its monotonic-saturating failure mode beats sinusoidal's clean periodic wraparound under a "closest integer code" lookup metric. |
89
-
90
-
### What experiment 2 actually shows
91
-
92
-
Two failure modes, both interesting:
93
-
94
-
-**Sinusoidal PE (period 17):** crisp at L ≤ 17 (perfect distinctness),
95
-
then wraps. At L=48 every position k ≥ 17 collides exactly with
96
-
position `k mod 17`, and the lookup confidently returns the wrong
97
-
token. Failure is *periodic* — predictable and recoverable if you
98
-
know the period.
99
-
-**Harmonic PE (`phi.fold(pos*7 + 1)`):** collides early (first
100
-
collision at pos=5), saturates once `pos*7+1` exceeds the largest
101
-
Fibonacci attractor in range. Failure is *monotonic and clustered*
102
-
— positions land in attractor "basins" of growing size. Within a
103
-
basin, the lookup tie-breaks to the first member; across basins,
104
-
ordering is preserved. At long L this preserved ordering gives the
105
-
harmonic scheme a surprising 79% retrieval rate vs sinusoidal's 54%.
106
-
107
-
**Caveat — metric dependency.** The lookup uses "closest by absolute
108
-
integer code". That favours monotonic encodings (harmonic) over
109
-
periodic ones (sin) at long L. With a cosine-similarity-style metric
110
-
over a multi-channel vector, the comparison flips. Experiment 3 makes
111
-
this explicit by giving both schemes multi-channel encodings and a
112
-
proper vector-similarity lookup.
113
-
114
-
### Concrete pivot
115
-
116
-
Experiment 1 said: don't use OmniWeight at the per-head attention
117
-
scorer. Experiment 2 says something more nuanced: **the harmonic
118
-
substrate's "preserved monotonic structure under saturation" is a
119
-
real positional-encoding property**, not just marketing copy. The
120
-
right comparison is multi-channel harmonic vs multi-channel
121
-
sinusoidal (matching what the transformer paper actually uses) on a
122
-
length-extrapolation task that needs the encoding to stay
123
-
distinguishable past the trained range.
87
+
| 1 | Perturbed query (query = true_val + noise), 200 trials per noise level | Softmax wins everywhere. noise=1: 189 vs 170. noise=7: 118 vs 99. noise=50: 42 vs 33. OmniWeight's |k|-normalised denominator pulls toward smaller-magnitude attractors regardless of perturbation direction, which hurts the "recover the original value" objective. |
88
+
| 2 | Single-channel PE distinctness + lookup at L = 8 / 14 / 24 / 48 | Sinusoidal wins at short L (8/8 vs 6/8). At L=48 harmonic appears to overtake: 38/48 vs 26/48 (79% vs 54%). Flagged as a likely metric artefact — single-int "closest code" lookup favours monotonic over periodic encodings. |
89
+
| 3 | 4-channel PE (harmonic primes 7/11/13/17, sin/cos periods 8/64), L2 lookup, L = 8 → 200 |**Sinusoidal regains its lead decisively at every L ≥ 16.** L=48: 48/48 vs 21/48. L=200: 72/200 vs 34/200. Harmonic saturates at 22 unique vectors by L=64; sinusoidal stays perfectly distinct up to L=64 then saturates at 64. The single-channel L=48 harmonic "win" was a metric artefact, exactly as suspected. |
90
+
91
+
### Cumulative read across experiments 0–3
92
+
93
+
The four experiments converge on a single picture:
94
+
95
+
> **At every fair comparison so far, the standard transformer
96
+
> building blocks (softmax attention scoring, sinusoidal positional
97
+
> encoding) beat the harmonic alternatives on the specific tasks
98
+
> tested.** The harmonic substrate's only apparent wins have been
99
+
> traceable to metric artefacts that vanish under proper vector
100
+
> similarity.
101
+
102
+
This doesn't mean OMC's harmonic primitives are useless — the
103
+
project's documented wins (the credential-stuffing detector beating
104
+
IsolationForest at multi-dim structural anomalies, README's
105
+
benchmark table) are real and reproducible. But it does mean:
106
+
107
+
1.**Drop-replacing transformer components with harmonic ones is the
-**3** Multi-channel positional encoding: harmonic = `[phi.fold(pos*7), phi.fold(pos*11), phi.fold(pos*13), phi.fold(pos*17)]`, sinusoidal = `[sin(pos/p_0), cos(pos/p_0), sin(pos/p_1), cos(pos/p_1)]` with geometric `p_i`. Lookup by L2 distance over the vector. Re-run the length-extrapolation comparison.
131
-
-**4** Extend `examples/lib/torch.omc` with embedding, softmax, layer-norm, cross-entropy. Port the winning experiment-3 PE to a *learned* tiny-transformer setting (requires torch in the host env).
132
-
-**5** Hybrid: standard softmax attention with an OmniWeight-based attention-entropy regulariser. Loss = CE + λ · (1 − mean(OmniWeight of attention peaks)). Test whether nudging attention toward harmonic peaks helps small models.
151
+
-**3** Multi-channel PE with L2 lookup — fair comparison. ✓ done
152
+
-**4***Pivot.* Stop trying to substitute transformer components.
153
+
Build a harmonic structural-anomaly head as an auxiliary signal:
154
+
given a sequence of intermediate activations from a tiny
155
+
transformer, flag tokens whose `harmonic_index` score against a
156
+
reference distribution is anomalous. Re-use the credential-stuffing
157
+
detector machinery (`harmonic_anomaly.omc`) over activation vectors
158
+
instead of request features. Pure-OMC first, torch port second.
159
+
-**5** With torch available: train a 2-layer transformer on a tiny
160
+
char-level corpus. Add the experiment-4 anomaly head as an
161
+
auxiliary loss term and measure whether it improves loss curves,
0 commit comments