Table of Contents
Fetching ...

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

Primal: A Unified Deterministic Framework for Quasi-Orthogonal Hashing and Manifold Learning

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 , enabling both exact/invertible mappings (when ) and privacy-preserving, non-invertible projections (high or small ). 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

Paper Structure

This paper contains 35 sections, 6 equations, 5 figures, 3 tables, 2 algorithms.

Figures (5)

  • Figure 1: Geometric evaluation of the proposed StaticPrime encoding (Right Column) versus the Random Gaussian baseline (Left Column).(Top Row) Log-probability density landscapes of cosine similarities. The proposed method exhibits a significantly sharper "ridge" at zero, corresponding to a $\approx 0.5\%$ improvement in distributional tightness (measured by RMS reduction). (Bottom Row) RMS Error surfaces across dimensions $d$ and sequence lengths $N$. The proposed method maintains a consistently $\approx 1.8\%$ lower global error profile compared to the baseline.
  • Figure 2: Population Statistics of Welch Optimality. We visualize the kernel density estimates (KDE) for the Optimality Ratio (Left) and Excess Coherence (Right) across all permuted $N$ and $d$. The dashed black lines represent the theoretical physical limits (Welch Bound). Cyan (StaticPrime) exhibits a significantly sharper peak closer to the theoretical ideal compared to Red (Gaussian), indicating that StaticPrime deterministically generates vector sets that exhibit repulsive spectral properties, resulting in coherence distributions that empirically approach the theoretical Welch bound bounds more closely than Gaussian baselines.
  • Figure 3: Manifold Topology vs. Orthogonal Hashing. A comparison of the DynamicPrime embedding across different operating regimes on Spiral and Circular datasets with increasing noise levels (Rows). Columns 1-3 (Low Frequency, $\sigma=0.007$): The method acts as a kernel map, preserving local topology. The Latent space (Col 2) unrolls the manifold, allowing for near-perfect linear reconstruction (Col 3, MSE $\approx 0$). Columns 4-5 (High Frequency, $\sigma=1.0, D=4$): The phase wraps rapidly, destroying local structure and creating a chaotic, high-entropy projection. Reconstruction fails (High MSE). Columns 6-7 (High Frequency, $\sigma=1.0, D=128$): Increasing the dimension restores the spherical distribution. The latent space becomes a quasi-orthogonal Gaussian blob (Col 6), maximizing capacity for Hyperdimensional Computing tasks.
  • Figure 4: Classification capabilities at Output Dimension 4. The figure displays Cosine Similarity matrices (left) and visual overlays of the reconstructions (right) for three scaling factors. In this constrained dimension, the deep linearized regime ($s=0.007$, top row) struggles the most to maintain high intra-class similarity in the presence of noise, as evidenced by the lower diagonal values in the matrix. However, distinct geometric signatures are visually preserved across all scales.
  • Figure 5: Classification capabilities at Output Dimension 128. With sufficient dimensionality, the model excels at classification. Notably, the linearized regimes ($s=0.007$ and $s=0.02$) demonstrate superior class separation compared to the full reconstruction regime ($s=1.0$). The linearized outputs (top two rows) abstract the geometry into linear manifolds, causing Clean and Noisy versions of the same shape to overlap almost perfectly (Sim $\approx 1.0$). The perfect reconstruction (bottom row), while visually accurate, retains noise, resulting in slightly lower intra-class similarity metrics.