Research record

Asmodeus०

A time traveller on a chronal fluid.

A softmax decider that answers alone, and goes back to an era when it needs that era's knowledge.

Measured only. This page shows what was measured, proved or checked. Every figure names its seeds, its control and its source file, and the limits are stated in full below.

Named for Laplace's demon, the intellect that, knowing the present state, could read any past or future from it. It came out of two earlier projects, resolvent and caustic, together.

The mechanism

It answers alone, and it goes back

From the inventor's notes: the softmax “is smart alone, but when he needs knowledge of a particular era he goes back in time.” Below, the project's own code runs on a stream whose law changes and comes back. Each colour is one law, and the era that holds it.

Press play, or drag the slider.

era 1 era 2 era 3 era 4 window and BOCPD experts the traveller

Every frame is a recorded value from zero/research/e0 (bed, era bank, momentum decider, α = 0.003) on one made-up 3,000-token stream. Top: the law in force. Middle: the weight w_t (grey is the window and changepoint experts, which carry much of it until an era has seen enough of a law), with a numbered ring where an unseen law gets a new era and an arc back to the earlier stretch where a returning law was last seen. Bottom: each era's 16×16 table of transition counts, outlined by the weight it holds. The traveller answers alone when one era holds at least 0.99; on this stream that is 30.5% of the steps. Regret on this one stream: 0.0232 nats per token over the oracle (a single stream, not the benchmark below).

How it works

The architecture, one token at a time

An era is a small model of one law: a 16×16 table of transition counts with a Dirichlet prior (a = 0.2), so a new token is added to it and nothing else is touched. The traveller holds only a weight over eras and two tail experts, a short window and a changepoint model for laws no era has seen. It keeps no raw past. For each token x_t:

  1. Move

    A share α = 0.003 of the weight moves. Half spreads evenly, half follows a learned era-to-era kernel Q, so where the traveller came from predicts where it goes.

    v = (1-α)·w + (α/2)/|s|
          + (α/2)·w_eras·Q
    deciders.py:53-62
  2. Answer

    The answer is the weighted blend of the eras' predictions. If one expert holds at least 0.99 of the weight it answers alone, and no other table is consulted.

    p = Σ v(i)·P_i(x_t | x_t-1)
    deciders.py:21-22, 121-126
  3. Multiply, then normalise

    The token that arrived scales each weight by that era's likelihood of it, and the result is renormalised. This Bayes step is the whole memory of the traveller.

    w = v ⊙ P(x_t) / Σ v ⊙ P(x_t)
    deciders.py:24-29
  4. Credit and watch

    The token goes into the active era's table. A mixture e-detector watches that era, and by Ville's inequality its false alarms stay below δ = 0.05.

    S_t = (S_t-1 + 1/(n(n+1)))·e_t
    alarm if S_t + 1/(n+1) ≥ 1/δ
    arms.py:106-123, 187
  5. Jump or birth

    On an alarm, with at least 64 transitions of evidence, the recent window is scored under every stored era and under a fresh one. A stored era wins: jump, and the switch is counted into Q. A fresh era wins: birth, and every older table stays as it was.

    best = argmax prequential
           log-likelihood of window
    arms.py:196-228, deciders.py:79-81
  6. Merge

    Two eras that hold the same law fuse when the Dirichlet-multinomial Bayes factor favours one table. Their weights add.

    log BF = ML(C+D) - ML(C) - ML(D)
    merge if log BF > 0
    arms.py:236-242, deciders.py:36-38
What each piece buys
PieceWithout it, or with it
Era bankA returning law costs 0.084 nats over the oracle, against 0.693 for BOCPD.
Forward filterRegret 0.034, against 0.125 when the active era answers alone.
BOCPD novelty expertCost on streams where nothing recurs: 3.71× BOCPD without it, 1.18× with it.
Global merge, 64 transitions4 to 8 eras for 4 laws before; exactly 4 on 8 of 10 seeds after.
Momentum kernel Q−5.6% regret against fixed share, on 10 of 10 paired seeds.
Answer-alone thresholdOne era answers on 45.8% of steps, with no measurable loss.

What has been measured

Regret against an oracle that knows the regime

Streams of 20,000 tokens over 16 symbols, with 4 recurring order-1 laws. Regret is nats per token above an oracle that knows the true regime. Every bar was frozen by sha256 before its result existed, and each round ran on seeds no earlier round had touched.

11×lower regret than the best owned learner on recurring regimes: 0.0277 against 0.3056 (BOCPD)
10/10fresh seeds (20–29) clear the preregistered bar
0.084nats of excess when a seen law returns, against 0.693 for BOCPD
1.18×BOCPD's cost on streams where no law returns (0.0186 against 0.0159); the bar was 1.25×

Both charts: the REC bed, 10 seeds (20–29), synthetic order-1 laws, V = 16. Control: the project's own baselines, tuned on separate tuning seeds (BOCPD is the strongest). Source: research/e0/RESULTS_E0c.md lines 10–14, read by gen_data.py into data.js. The bar B1 passes on 10 of 10 seeds (line 45).

Which way the weight should move

Seven deciders over the same era bank, scored on seeds 40–49 (mean over four beds). The momentum decider beats fixed share on 10 of 10 paired seeds; two others fail the gate that nothing may be lost when no law recurs.

DeciderRECCYC-SNORECScoreGate
MOM0.02620.12300.01700.0486pass
MOM+GB0.02770.12150.01700.0489pass
SOFT0.02680.13070.01840.0515pass
HARD0.02700.13080.01830.0516pass
TEMP0.02760.12510.02300.0516fail
CTC0.02820.12450.02380.0520fail
GBAYES0.02830.13020.01920.0523pass

Against models that read the regime from context

The real competitor is in-context inference. The era bank keeps every regime's counts for the whole stream, while a transformer sees 512 tokens. On seeds 50–59 the era bank clears both frozen bars on 10 of 10 seeds. On recurring regimes it is at least 14.9× lower than the best neural arm on every seed (17× on the mean).

ArmParamsRECCYC-SNOREC
Asmodeus (era bank + MOM)counts0.02720.14760.0185
TF-META, meta-trained transformer862,9920.46260.70540.1822
GRU-ONLINE-L16,7840.68750.65960.7497
GRU-ONLINE-S1,9040.73990.71650.7759
GRU-META214,5441.02251.04830.7135

r3: TinyStories at matched size and budget

The Era LM (a tensor-train network with an era bank and the momentum decider) against a transformer, a state-space model, a mixture of experts and linear attention, each at 5.82–5.95M parameters, on the same 1,000,000 training tokens: 1,500 steps, context 128, batch 64, AdamW at 3×10−3. Scored on the first 100,000 validation tokens, in nats per token. Lower is better.

Validation NLL during training

One line per seed (the second seed is fainter). Only runs that finished are drawn.

Final validation NLL, per seed

Filled dot: seed 0. Hollow dot: seed 1. Dotted line: the order-3 n-gram fitted on the same tokens.

Seeds per arm: . Control: the order-3 Jelinek–Mercer n-gram on the same tokens (3.632). Source: zero/parity/results/ts_{arm}_s{seed}.json, setup frozen in parity/ts_bench.py; one RTX 4060 laptop GPU. Read this chart with its limits: a single TinyStories subset, 1,500 steps and at most 2 seeds; the GPT baseline's two seeds differ by 0.41 nats (3.883 and 4.293), so it is under-tuned at this budget and the gap to it says nothing about transformers in general; the mixture of experts ran in fp32 (bf16 broke its router), the others in bf16; the linear-attention run diverged to NaN in bf16 at step 750, the cause is fixed in code and it was not re-run in this pilot; the Asmodeus-native arm ran at context 32 and 300 steps and is not comparable, so it is not drawn.

r3: engineering checks reached

CheckResultSource
Lean gate43 modules: no sorry (exit 0), full build (exit 0), axiom audit (exit 0)lean/gate_r3.json
Regression ledgerexact test counts pinned: 188 tests over 15 test fileslm/regress.py, commit 83075fd
bf16 stability, E0 bed3 seeds, 100 steps each, every loss finite (final 2.714, 2.701, 2.728)docs/specs/findings/N3_stab_e0_bf16.json
Linear-attention bf16 NaNcause found (elu+1 is exactly 0 in bf16 for x ≤ −8, so 0/0); fix mutation-checked: old code 2 tests fail, fixed code 7 passRECONCILE.md “14:40”
Faster change alarm (behind a flag)median detection lag 12, 4, 5, 7, 5, 9 tokens on seeds 50–55, against 36, 40, 35, 50, 38, 30 for the legacy alarm; numpy parity kept (see Limits for what it costs)RECONCILE.md “14:57”
A bed today's read-out cannot fitKL floor 0.03856, 0.03854, 0.03861, 0.03859, 0.03859 nats per pair on seeds 0–4 (bar ≥ 0.03; entropy 4.9206): the gap the next arm targetsparity/results/pair_rank_floor.json

The reference code's 16 sanity tests pass (pytest -q test_e0.py, run for this page on the pinned commit). Wall time for one stream on a CPU: 7.8 s for the era bank.

What has been proved

The lemmas are in Lean, and the count is exact

Lean 4 v4.7.0 with a pinned Mathlib. Measured is not proved: a result is called proved here only when its lemma sits in the Lean tree.

43Lean files in lean/FCPA/, plus the index FCPA.lean
292theorem and lemma declarations
0sorry, by the repo's own checker and by grep
0axiom and native_decide

admit appears 6 times, all as the name of an ordinary function in L25_Grounding.lean that keeps only grounded data. It is not the tactic.

The era lemmas, the part specific to Asmodeus
LemmaClaimStatusDecls
L38Regret of the filter over a bank that grows by births and shrinks by merges, for any linear deciderproved, pathwise34
L39The merge rule is the address rule applied to a whole era; the Bayes factor is an e-valueproved21
L39clog BF = −Div + Gain ± K: divergence linear in evidence, Occam gain logarithmicproved; sampling bridge cited23
L39dMerging at BF ≥ (j+1)(j+2)/δ bounds false merges by δ; no uniform guarantee existsproved14
L40No forgetting for count eras, for settled tokens; the unconditional form is falseproved18
L41Momentum is an HMM forward filter; a switch costs −log((α/2)Q)proved11
L41bThe learned kernel stays within (k−1) log(n+1) of the best fixed kernelproved; rate cited7
L42The log-space filter is exact; answering alone costs at most log(θ + (1−θ)/ε) a stepproved8
for every token sequence, every birth/merge schedule, every path c_t: Σ −log p_t ≤ Σ −log P_t(c_t) + log( |s_0| / (1−α+ρ) ) + Σ cost_t SOFT: ρ = α, K = 0 MOM: ρ = α/2, K = (α/2)·Q switch cost ≤ log(N/ρ)
  • The free-when-nothing-recurs gate is a theorem. It holds for α ≤ 0.0039 (fixed share) and α ≤ 0.0078 (momentum). The chosen α = 0.003 is inside both.
  • The bound is nearly tight. With nothing recurring, momentum measured 0.0012–0.0015 nats per token over BOCPD, and the bound is 0.0016.
  • One token cannot swing the weight far. It moves log w(i) by at most log(max P / min P).
  • Cited, not proved: L10, L12, L18 (Ky Fan) and TT-1, the sampling bridge of the merge rule, and the convergence rate of the learned kernel. Mathlib v4.7.0 lacks the tools, and none is hidden behind a sorry.

Limits

Where it stands, and what is not shown

  • 0frame
  • 1theory
  • 2toy beds
  • 3ablations
  • 4controls
  • 5Lean, in progress
  • 6GPU engine, in build
  • 7real text, next
  • The mechanism evidence is synthetic. Every win on regret and re-entry is on order-1 Markov streams built to favour eras. No real regime-switching dataset has been run.
  • The context-reading control is small. The best was a 0.86M-parameter transformer; the meta-trained GRU barely learned (validation loss 2.69 against the oracle's 1.78). A larger in-context model belongs to phase 2 and could close part of the gap.
  • The TinyStories chart is one subset, 1,500 steps and at most 2 seeds. The GPT baseline is under-tuned (its seeds differ by 0.41 nats), the mixture of experts ran in fp32 and the rest in bf16, linear attention was not re-run in this pilot, and the result is parity, not superiority.
  • On text, the era bank adds little. The same network scored without the bank is worse by only 0.0055 (seed 0) and 0.0068 (seed 1) nats per token, so the parity on TinyStories comes from the tensor-train network. Whether the bank helps on text with real regime changes is untested.
  • The Asmodeus-native arm does not reach parity. At context 32 and 300 steps it scored 7.0217 validation NLL at 857 tokens per second, about 7× slower per token than the mixture of experts (5,979), and on the toy recurring bed (one seed) its regret is 1.124 against 0.406 for the state-space model. Its quantitative bars on an independent generator (LK1) also failed and stay open.
  • The detector repair is open. The faster alarm raises switch events from 16 to 28–37 per stream; on seeds 50–55 it ends with 9–13 eras (bound 4) and purity 0.59–0.71, and the learned-prior and retrospective-split repairs (DR3, DR4) are blocked.
  • Lean proves the mathematics, not the Python. Property tests are meant to pin the code's constants to each lemma's hypotheses; the proofs do not. L10, L12, L18, TT-1, the sampling bridge of the merge rule and the rate of the learned kernel are cited, not proved.
  • Some choices sit on the edge. The tuned δ = 0.05, window 32 and 64 transitions of evidence lie on the edges of their frozen grids, momentum's 50/50 split was fixed rather than tuned, and the oracle and every count model share the generating prior a = 0.2.
  • There is no CUDA code yet. The repository holds no CUDA source at the pinned commit. The GPU engine is stage 6, in build behind a frozen interface, and the reference filter runs one token at a time.