FluxEM: Algebraic Embeddings for Deterministic Neural Computation

Hunter Bown Shannon Labs
January 2026

Abstract

Neural networks often struggle with arithmetic because they treat numbers as arbitrary tokens. FluxEM maps arithmetic operations to geometry: addition becomes vector addition, and multiplication becomes addition in log-space. The result is systematic generalization from algebraic structure without learned parameters, with accuracy bounded by floating-point precision.

1. Problem

Large language models can describe calculus but still fail on arithmetic like 1847 × 392. Prior work (NALU, xVal, Abacus) focuses on training models to learn arithmetic more reliably.

The issue is representation: embed numbers as arbitrary token vectors and arithmetic relationships must be inferred from data, which often fails to generalize beyond the training distribution.

2. Approach

Encode numbers so arithmetic operations are geometric operations in embedding space.

For addition, embed numbers along a fixed direction. Vector addition in embedding space equals arithmetic addition:

embed(a) + embed(b) = embed(a + b)

For multiplication, embed in log space. Addition in log space corresponds to multiplication in linear space:

log_embed(a) + log_embed(b) = log_embed(a × b)

These are algebraic identities over the reals for the magnitude component; under IEEE-754, they hold within floating-point precision bounds.

3. Formal Definition

3.1 Linear Embedding

For addition and subtraction:

e_lin(n) = (n / scale) · v

where v ∈ ℝd is a fixed unit vector. The homomorphism property e_lin(a) + e_lin(b) = e_lin(a + b) follows directly from linearity.

3.2 Logarithmic Embedding

For multiplication and division:

e_log(n) = (log|n| / scale) · v_mag + sign(n) · v_sign

where v_mag and v_sign are orthogonal unit vectors. Magnitude and sign are tracked separately, and the sign component is recombined in the operator definition.

Zero is handled explicitly outside the log embedding via a masking branch.

3.3 Embedding Layout

FluxEM uses a unified 128-dimensional embedding format:

IndicesPurpose
[0:8]Domain tag (identifies encoder)
[8:72]Domain-specific content (64 dims)
[72:96]Shared semantic features (24 dims)
[96:128]Cross-domain composition (32 dims)

4. Domains

FluxEM is not a single numeric embedding, but a family of deterministic encoders that share a common 128-dimensional layout. The first 8 dimensions identify the domain; the remaining regions store domain-specific content and optional cross-domain features.

The current implementation includes eleven domains. Each domain is designed around an algebra (or a small set of algebraic invariants) so that basic operations correspond to predictable geometric operations in embedding space.

DomainExamplesEncodes / supports
Physics9.8 m/s², [M L T^-2]Units, dimensions, quantities, constants; conversion and dimensional analysis
ChemistryH2O, 2H2 + O2 → 2H2OElements, formulas, bonds, reactions; stoichiometry and mass-balance structure
BiologyATGCCGTAG, proteinsDNA/RNA/protein sequences, pathways, taxonomy; simple sequence statistics and structure
Mathematics3 + 4i, matricesReals, complex numbers, rationals, vectors, matrices, polynomials; arithmetic closed under float precision
Logicp ∧ q → rPropositional and predicate logic, type structure; satisfiability-oriented features
Music{0,4,7}Pitch, chords, scales, rhythm, atonal set theory; transposition/inversion (TnI) structure
Geometrypoints, trianglesPoints/vectors, transforms, shapes; distances and geometric invariants (e.g. area, centroid)
GraphsG=(V,E)Directed/undirected graphs; adjacency structure, connectivity, cycles, shortest paths
SetsA ∪ BFinite sets, relations, functions; union/intersection/composition-style operations
Number Theory360 = 2³·3²·5Integers, primes, modular arithmetic; factorization and arithmetic invariants
Dataarrays, tablesArrays, records, tables; typed structure and summary statistics

5. Precision

The magnitude homomorphism is defined over the reals. Under IEEE-754 float32/float64, precision is bounded by log()/exp() function rounding.

OperationRelative Error (float32)
Addition / Subtraction< 1e-7
Multiplication / Division< 1e-6

"Closed under operations" means the result of any supported operation on valid inputs is a valid output, not that results are mathematically exact.

6. Limitations

CaseBehavior
ZeroExplicit flag; log(0) masked to zero vector
SignTracked separately from magnitude
Negative base + fractional exponentUnsupported; returns real-valued surrogate
Division by zeroReturns signed infinity

7. Usage

pip install fluxem

from fluxem import create_unified_model

model = create_unified_model()
model.compute("1847 * 392")    # → 724024.0
model.compute("123456 + 789")  # → 124245.0
model.compute("2 ** 16")       # → 65536.0

8. Related Work

ApproachMethodDifference
NALU (Trask 2018) Learned log/exp gates FluxEM: no learned parameters
xVal (Golkar 2023) Learned scaling direction FluxEM: deterministic, multi-domain
Abacus (McLeish 2024) Positional digit encoding FluxEM: algebraic structure, not positional

References