hv-chemical-memory

A NumPy-only toolkit for retention across four chemical substrates. One API. Four physics models. No training, no model artifact.

Size: ~15 KB source, no weights. Runtime: ~0.03 s for the full benchmark. Dependencies: NumPy only.

The four substrates

substrate protection mechanism protected quantity
Amber dielectric τ ladder of relaxations polarization fraction
Genome sequence Eigen error threshold master sequence identity
Topological invariant mod-2 writhe discrete knot class
Self-modifying genome adaptive μ tracks environmental drift

Each answers the same question — how long does a pattern survive? — with different physics.

Headline numbers

Amber dielectric (τ ladder: 3 yr → 300 kyr, 8 log-uniform modes):

time retention
1 year 0.955
100 years 0.628
1 kyr 0.452
10 kyr 0.278
100 kyr 0.112
1 Myr 0.005
10 Myr ≈ 0

50% retention after 536 years; 10% after 119 kyr; 1% after 758 kyr.

Eigen error threshold (L·μ_crit = 1/(1-1/σ), confirmed):

L σ μ_crit L·μ_crit
50 2 0.0400 2.000
100 2 0.0200 2.000
500 2 0.0040 2.000
1000 2 0.0020 2.000

The L·μ_crit column is the invariant — it depends only on σ.

Topological protection — writhe under Reidemeister moves:

move Δwrithe Δmod-2
R1 ±1 ±1
R2 ±2 0
R3 0 0

Mod-2 writhe is invariant under R2 and R3. This is the protected quantity.

Self-modifying genome — μ evolves with environment:

scenario μ_init μ_final predicted
static (drift=0) 0.010 0.000 0
constant drift=0.05 0.010 0.250 α·d/β = 0.25
linear drift 0.010 2.450 grows
sinusoidal drift 0.010 0.000 oscillates

Steady-state formula μ* = α·d/β confirmed exactly under constant drift.

21/21 consistency checks pass.

The retention ladder

From the source archive. This toolkit implements four of the seven rungs:

rung memory type mechanism implemented
1 agent trajectory fitness gradient no
2 population pattern mean-broadcast no
3 classical phase parameter region partial (amber)
4 genome sequence error threshold yes
5 quantum MBL eigenstate property no
6 topological invariant crossing count yes
7 self-modifying rule evolved μ yes

The ladder's claim: each rung replaces a decaying quantity with a more protected one. Amber sits between rungs 2 and 3 (rate-limited decay). Genome is rung 4 (sharp boundary). Topological is rung 6 (discrete protection). Self-modifying is rung 7 (tracks drift).

How to use

from hv_chemical_memory import (
    AmberMemory, ErrorThreshold, TopologicalMemory,
    SelfModifyingGenome, SubstrateOS,
)

os_ = SubstrateOS()

# Amber
r = os_.simulate_amber()
# r['retention_time_years'] = 536.1
# r['t_50pct_years'] = 536.1
# r['t_01pct_years'] = 757700

# Genome
r = os_.simulate_genome(L=100, sigma=2.0, mu=0.005)
# r['is_informational'] = True
# r['retention_estimate'] = fraction of master sequence preserved

# Topological
r = os_.simulate_topological(initial_writhe=0,
                              moves=('R3', 'R2_+', 'R1_+', 'R3'))
# r['protected_quantity'] = final mod-2 writhe

# Self-modifying
r = os_.simulate_selfmod(mu_init=0.01,
                          drift_schedule=lambda i: 0.05,
                          n_steps=500)
# r['mu_final'] = 0.25

# Or use the classes directly
amber = AmberMemory()
print(f"50% retention after {amber.retention_time(0.5):.0f} years")

et = ErrorThreshold(L=1000, sigma=5.0)
print(f"μ_crit = {et.critical_mutation_rate():.5f}")
print(f"informational at μ=0.001? {et.is_informational(0.001)}")

tm = TopologicalMemory(0)
tm.apply('R2_+')
print(f"writhe = {tm.writhe}, mod-2 = {tm.mod2_invariant()}")
Downloads last month
17
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support