Metric-Affine Elastic (EMA) extends Metric-Affine primarily with chunked bundling (bounded depth). The algebra stays the same (XOR bind and normalized L1 similarity), but capacity degrades more slowly under large superpositions because EMA avoids “bundle-of-bundles” gray drift.

In AGISystem2 terms, geometry = D (the number of byte channels per vector, i.e. `Uint8Array(D)`). EMA supports configurable `D` just like Metric-Affine; it does not auto-grow `D` during a session.

1. Why Elastic? The Gray-Convergence Problem

Problem: Mean Bundling Drifts Toward Gray

Metric-Affine bundles by arithmetic mean. When many vectors are superposed, the mean drifts toward ~128 in each byte, reducing contrast against the random baseline. Deep incremental updates (bundle of bundles) accelerate this drift.

Intuition: If you keep averaging colors, you eventually get a uniform gray. EMA keeps multiple means (chunks) instead of a single gray average.
Mean Bundling Drift vs. Chunked Bundling Classic Mean (single bundle) Many items → single average Gray drift (low contrast) EMA (chunked bundles) chunk A chunk B chunk C Max-similarity picks best chunk

2. Geometry: Byte Channels (D)

Definition: EMA Vector

EMA uses a configurable number of byte channels D:

V = [b0, b1, ..., b(D-1)] where bi in {0..255}

Default D matches Metric-Affine (32 bytes). You can run with 8/16/32/64/128+ bytes depending on the speed/capacity trade-off you want.

Prefix Stability Across D (manual configuration) D=32B example D=64B example (prefix kept) new D=128B example (prefix stable) new V(name, 32B) == first 32 bytes of V(name, 64B/128B)

3. Operations (Same Algebra, Different Bundle)

// Bind (byte-wise XOR) (A XOR B)[i] = A[i] XOR B[i] // Similarity (normalized L1) sim(A, B) = 1 - (sum(|Ai - Bi|) / (D * 255)) // Bundle (EMA) Bundle = [mean(chunk1), mean(chunk2), ...] sim(Bundle, X) = max_j sim(mean_j, X)
Important: EMA never bundles a bundle into a single mean. It keeps chunks as first-class parts of the bundle and uses max similarity across chunks.

4. Chunked Bundling in Practice

Chunked Bundle Layout KB bundle chunk 1 (mean) chunk 2 (mean) chunk 3 (mean) Similarity = max of chunk matches

5. Strategy Comparison

Feature Metric-Affine Metric-Affine Elastic
Bind XOR (byte-wise) XOR (byte-wise)
Similarity Normalized L1 Normalized L1 (max over chunks)
Bundle Single mean Chunked mean (no bundle-of-bundles)
Geometry (D bytes) Configurable (default 32B) Configurable (default 32B; no auto-growth)
Best Use Small to mid KBs Large KB superpositions

6. Usage

Initialize EMA
// Initialize metric-affine-elastic strategy
initHDC('metric-affine-elastic');
Environment Variable
export SYS2_HDC_STRATEGY=metric-affine-elastic
node your-script.js

Key Properties of EMA