Primal: A Unified Deterministic Framework for Quasi-Orthogonal Hashing and Manifold Learning
Vladimer Khasia
TL;DR
Primal replaces stochastic random projections with a deterministic, prime-based encoding that leverages the Besicovitch property to generate quasi-orthogonal embeddings. Through the DynamicPrime and StaticPrime variants, it unifies manifold-learning and high-entropy hashing in a single framework controlled by a scalar $\sigma$, enabling both exact/invertible mappings (when $D\ge 2d$) and privacy-preserving, non-invertible projections (high $\sigma$ or small $D$). The approach achieves near Welch-bound optimality in coherence, provides multi-resolution spectral coverage via the ordered prime-root frequencies, and offers practical advantages for edge AI, hyperdimensional computing, and secure ML without RNG-based randomness. Experimental results demonstrate superior distributional tightness and reduced cross-correlation compared with Gaussian baselines, along with rich geometric interpretations (Clifford torus, ergodic flow) and clear regimes for manifold learning versus hashing. Overall, Primal delivers a scalable, deterministic, and mathematically principled alternative to stochastic feature maps with broad applications in ML, CS, and privacy-preserving computation.
Abstract
We present Primal, a deterministic feature mapping framework that harnesses the number-theoretic independence of prime square roots to construct robust, tunable vector representations. Diverging from standard stochastic projections (e.g., Random Fourier Features), our method exploits the Besicovitch property to create irrational frequency modulations that guarantee infinite non-repeating phase trajectories. We formalize two distinct algorithmic variants: (1) StaticPrime, a sequence generation method that produces temporal position encodings empirically approaching the theoretical Welch bound for quasi-orthogonality; and (2) DynamicPrime, a tunable projection layer for input-dependent feature mapping. A central novelty of the dynamic framework is its ability to unify two disparate mathematical utility classes through a single scaling parameter σ. In the low-frequency regime, the method acts as an isometric kernel map, effectively linearizing non-convex geometries (e.g., spirals) to enable high-fidelity signal reconstruction and compressive sensing. Conversely, the high-frequency regime induces chaotic phase wrapping, transforming the projection into a maximum-entropy one-way hash suitable for Hyperdimensional Computing and privacy-preserving Split Learning. Empirical evaluations demonstrate that our framework yields superior orthogonality retention and distribution tightness compared to normalized Gaussian baselines, establishing it as a computationally efficient, mathematically rigorous alternative to random matrix projections. The code is available at https://github.com/VladimerKhasia/primal
