FluxEM
Deterministic embeddings where algebraic operations become vector operations.
encode(a) + encode(b) = encode(a + b)
No training. No weights. Structure by construction.
Quick Start
pip install fluxem
from fluxem import create_unified_model
model = create_unified_model()
model.compute("12345 + 67890") # → 80235.0
model.compute("144 * 89") # → 12816.0
model.compute("10 m/s * 5 s") # → 50.0 m
What This Is
FluxEM encodes typed domain values into fixed-dimensional vectors where selected operations map to linear algebra:
- Addition/subtraction:
encode(a) + encode(b) = encode(a + b) - Multiplication/division:
log_encode(a) + log_encode(b) = log_encode(a × b)
This extends across eleven domains—each with encoders that preserve algebraic structure.
| Domain | Example | Operations |
|---|---|---|
| Physics | 9.8 m/s² |
Unit conversion, dimensional analysis |
| Chemistry | C6H12O6 |
Stoichiometry, mass balance |
| Biology | ATGCCGTAG |
GC content, melting temp, translation |
| Math | 3 + 4i |
Complex numbers, matrices, vectors, polynomials |
| Logic | p ∧ q → r |
Tautology detection, satisfiability |
| Music | {0, 4, 7} |
Transposition, inversion, Forte numbers |
| Geometry | △ABC | Area, centroid, circumcenter |
| Graphs | G = (V, E) | Connectivity, cycles, shortest path |
| Sets | A ∪ B | Union, intersection, composition |
| Number Theory | 360 = 2³·3²·5 | Prime factorization, modular arithmetic |
| Data | [x₁, x₂, ...] | Arrays, records, tables |
What This Is Not
- Not symbolic math. Won't simplify
x + x → 2x. Use SymPy for that. - Not semantic embeddings. Won't find "king − man + woman ≈ queen". Use text embeddings.
- Not learned. No parameters, no training, no drift.
Domain Examples
Polynomials as Vectors
Adding two embedding vectors is equivalent to adding the polynomials they represent:
from fluxem.domains.math import PolynomialEncoder
enc = PolynomialEncoder(degree=2)
# P1: 3x² + 2x + 1
# P2: x - 1
vec1 = enc.encode([3, 2, 1])
vec2 = enc.encode([0, 1, -1])
# The vector sum IS the polynomial sum
sum_vec = vec1 + vec2
print(enc.decode(sum_vec))
# → [3, 3, 0] (which is 3x² + 3x)
Music: Harmony as Geometry
In pitch-class set theory, transposition is vector addition:
from fluxem.domains.music import ChordEncoder
enc = ChordEncoder()
# Encode a C Major chord
c_major = enc.encode("C", quality="major")
# Transpose by adding to the vector
f_major = enc.transpose(c_major, 5) # Up 5 semitones
root, quality, _ = enc.decode(f_major)
print(f"{root} {quality}")
# → "F major"
Logic: Tautologies by Construction
Propositional logic encoded such that valid formulas occupy specific subspaces:
from fluxem.domains.logic import PropositionalEncoder, PropFormula
p = PropFormula.atom('p')
q = PropFormula.atom('q')
enc = PropositionalEncoder()
formula_vec = enc.encode(p.implies(q) | ~p)
print(enc.is_tautology(formula_vec))
# → True
Where this idea comes from
In the early twentieth century, Schoenberg and the Second Viennese School developed atonal theory—a framework that treated all twelve chromatic pitches as mathematically equal. This led to pitch-class set theory: reduce notes to numbers 0–11, analyze chords as sets.
Something unexpected emerged. The math revealed hidden structure in tonality itself.
Consider major and minor triads:
C major: {0, 4, 7} intervals: 4, then 3
C minor: {0, 3, 7} intervals: 3, then 4
These are inversions of each other—the same intervals, reversed. Their interval-class vector is identical: (0, 0, 1, 1, 1, 0). In pitch-class set theory, they're the same object under a group action.
Paul Hindemith (1895–1963) took this further. He didn't reject atonality—he used its mathematical tools to rebuild tonal theory from first principles. The dichotomy dissolved: tonality and atonality were the same structure, viewed differently.
When you encode pitch-class sets into vector space with the algebra intact:
- Transposition becomes vector addition
- Inversion becomes a linear transformation
- The relationship between major and minor is geometric
The embedding doesn't represent the structure. It is the structure.
This extends across domains. The cyclic group of pitch transposition (Z₁₂) is isomorphic to clock arithmetic. The lattice of propositional logic mirrors set operations. If domains are embedded with their algebra intact, a model could recognize when structures are the same—not similar, but algebraically identical.
Read the full story: Where this comes from
Reproducibility
git clone https://github.com/Hmbown/FluxEM.git && cd FluxEM
pip install -e ".[jax]"
python experiments/scripts/compare_embeddings.py
Outputs TSV tables comparing FluxEM to baselines:
table=accuracy_by_encoder
approach dataset exact_match numeric_accuracy
FluxEM id 1.000000 1.000000
FluxEM ood_magnitude 1.000000 1.000000
Character ood_magnitude 0.000000 0.012000
Installation
pip install fluxem # Core (NumPy)
pip install fluxem[jax] # With JAX
pip install fluxem[mlx] # With MLX (Apple Silicon)
pip install fluxem[full-jax] # Full with HuggingFace
Precision
| Operation | Relative Error (float32) |
|---|---|
| Add/Sub | < 1e-7 |
| Mul/Div | < 1e-6 |
Edge cases: log(0) → masked, division by zero → signed infinity, negative base with fractional exponent → unsupported.
See ERROR_MODEL.md and FORMAL_DEFINITION.md.
Related Work
| Approach | Method | Difference |
|---|---|---|
| NALU | Learned log/exp gates | FluxEM: no learned parameters |
| xVal | Learned scaling | FluxEM: deterministic, multi-domain |
| Abacus | Positional digits | FluxEM: algebraic structure |
Citation
@software{fluxem2026,
title={FluxEM: Algebraic Embeddings for Deterministic Neural Computation},
author={Bown, Hunter},
year={2026},
url={https://github.com/Hmbown/FluxEM}
}
License
MIT
Metadata
Release files for fluxem 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fluxem-1.0.1.tar.gz | 747.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fluxem-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 971.7 kB
Release files / fluxem-1.0.1.tar.gz
| Download URL | fluxem-1.0.1.tar.gz |
|---|---|
| Size | 747.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50e75f6e9760a2e0664b1ab29a9b9bdf68dab8627db4f58838893044254eef80
|
|
BLAKE2b-256 checksum How to use checksums |
8a50292beda46624e67aa8b44b7f2eab07c682107823529021d4dbed443f6d99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 5, 2026.
Transparency logRelease files / fluxem-1.0.1-py3-none-any.whl
| Download URL | fluxem-1.0.1-py3-none-any.whl |
|---|---|
| Size | 224.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
05beb59ca409cc4ea33111e5a189db2151aed3ebc4448988a9be6c706103227b
|
|
BLAKE2b-256 checksum How to use checksums |
4afeae8f412db03bac229c84fcc479cbe751e425fea9fda59ac2766cb0d7848d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 5, 2026.
Transparency log