forgo.cloud
Sign in
Repo workspace

forkjoin-ai/gnosis

Death #5 — Pleromatic Cross-Prefix Compression

distributed-inference/DEATH5_CROSS_PREFIX_COMPRESSION.md
forkjoin-ai/gnosis

Death #5 — Pleromatic Cross-Prefix Compression

This file is the status + falsifiability ledger for Death #5 of the Five Deaths TPS roadmap: cross-prefix wire compression via the bw-codec dictionary mode, fed by the Pleromatic Residual Atlas. It is the prediction ledger, not a results document. Every empirical claim is marked as a prediction (P*) or a falsification trigger (F*); nothing here is an observation.

Companion documents:

  • PLEROMATIC_RESIDUAL_ATLAS.md (same dir) — the substrate this wire consumes. The atlas captures BWMR records, the offline builder emits a .bwdict, and Death #5 plugs that dictionary into the encode path that the amplituhedron wire ships. Falsification chain: if the atlas doesn't shrink, Death #5 doesn't either (F1 propagated).
  • BOWL_MESH_FALSIFIABILITY.md (same dir) — canonical tone and pentad-discipline source. The *_runtime_oracle_* shape, the honesty boundary, the prediction-vs-observation discipline are inherited verbatim.
  • AMPLITUHEDRON_BITWISE_WIRE.md (same dir) — the BWAH envelope the dict-mode .bw payload ships inside. Untouched by Death #5; composition is at the inner-payload boundary.
  • AMPLITUHEDRON_PLAN.md (same dir) — the Death #2 prefix cache that composes multiplicatively with Death #5 (see §8).
  • Gnosis/Death5CrossPrefixCompression.lean (in open-source/gnosis-math/) — the five oracle theorems pinning the Death-number identification, the dict-flag set/clear bit semantics, and the key-disjointness contracts with Deaths #1 and #2.
  • src/amplituhedron_wire.rs — the encode-side wire integration on the Rust host.
  • apps/distributed-inference-host/src/amplituhedron-wire.ts — the TS host wrapper that consumes the Rust encode path through napi.
  • apps/distributed-inference-worker/src/index.ts — the worker endpoint that emits dict-mode payloads when its loader has populated the bw-codec dictionary slot.

1. Headline reframe

Death #5 closes the Five Deaths roadmap. Each prior Death caches at a distinct granularity — Death #1 (matVec memo) at the per-matmul intra-layer scale, Death #2 (Amplituhedron) at the full-prefix × layer-range scale, Death #3 (aeon-flow) at the per-hop framing scale, Death #4 (Octonion Fano / Pair X) at the adjacent-layer-overlap scale. Death #5 caches at a different scale again: reusable byte patterns inside the residual payload itself, via the bw-codec dict-mode substitution learned from production residual traffic. The five granularities are orthogonal by construction, and the Lean key-disjointness oracles (§4) pin the orthogonality at the identifier-set level. None of the Deaths is a different name for any other Death.

2. The Five Deaths table

# Name Status Granularity Key space Runtime kernel
1 matVec memo (ER=EPR) SHIPPED per-matmul intra-layer (W, bucketed x) matvec_memo.rs
2 Amplituhedron volume SHIPPED full-prefix × layer-range (prefix_hash, layer_range) amplituhedron.rs
3 aeon-flow framing IN-FLIGHT (WSStation) per-hop wire none (transform) TS station-ws.ts
4 Octonion Fano (Pair X) IN-FLIGHT (consume) adjacent-layer overlap none (timing) residual-seed-handler
5 Pleromatic cross-prefix compress THIS DOC byte-pattern via dict dictionary_entry_index residual_dict.rs + bw_codec dict-mode

Status semantics:

  • SHIPPED — landed in the runtime, has a Lean kernel, measurements exist downstream of the kernel.
  • IN-FLIGHT — code paths exist on at least one side of the wire but end-to-end production measurement is incomplete.
  • THIS DOC — wire integration is being landed in parallel across three agents (Rust encode, TS host wrap, worker endpoint); the Lean nomination is the parallel agent's drop. Status is "wired, not yet measured."

3. The encode flow

Numbered, encoder side then decoder side:

  1. The Rust host on a layer station completes its post-RMSNorm forward and produces a residual byte payload.
  2. amplituhedron_wire::encode_replay_response(bytes, mime) is invoked to produce the BWAH-framed wire blob for the POST /amplituhedron/replay octet response.
  3. Internally, that function delegates the inner-blob encode to residual_dict::encode_residual_with_dict(bytes).
  4. encode_residual_with_dict checks whether the GNOSIS_RESIDUAL_DICT slot has been populated at process startup. The loader reads the env var, loads the .bwdict once, and parks it in a static OnceCell<BwdcDictionary>.
  5. If a dictionary is loaded, the path calls bw_codec::encode_bw(bytes, mime, Some(opts_with_dictionary)). The codec sets the DICT_FLAG (0x80) bit on the inner version byte; the on-the-wire version is 0x81.
  6. If no dictionary is loaded, the path calls bw_codec::encode_bw(bytes, mime, None). The codec emits the plain word-pack with the inner version byte 0x01.
  7. The BWAH envelope is wrapped around the inner blob unchanged. The amplituhedron wire format does not look at the inner version byte.

Decoder side:

  1. The receiving worker (or coordinator) parses the BWAH envelope, extracts the inner .bw payload, and calls bw_codec::decode_bw.
  2. decode_bw reads version byte 4 of the .bw blob.
  3. If version_byte & 0x80 != 0, the decoder consults its own GNOSIS_RESIDUAL_DICT slot. If the decoder has the same dictionary loaded (same env var pointing at the same file, or the file synced across worker hosts), substitution lookups reconstruct the original bytes; if the decoder has no dictionary, the decode returns BwError::DictionaryRequired and the caller surfaces a hard error rather than guessing.
  4. If version_byte & 0x80 == 0, the decoder runs the plain word-unpack path. No dictionary is consulted regardless of whether the slot is populated.

The flag bit is the only wire-level signal. Out-of-band dictionary state is not transmitted; both sides must have loaded the same dictionary, the same way every other content-addressed asset works in the mesh.

4. Lean → runtime oracles

Gnosis/Death5CrossPrefixCompression.lean exports five oracle theorems. The Rust kernel (amplituhedron_wire.rs, residual_dict.rs, plus the bw-codec it calls) MUST reproduce their value-level outputs on the same witnesses:

# Theorem Lean obligation Rust contract
1 death5_is_five deathNumber Death.crossPrefixCompress = 5 Internal constant DEATH5_NUMBER = 5 exposed via death_number()
2 version_byte_with_dict_has_flag The encoded version byte 0x81 satisfies 0x81 &&& 0x80 ≠ 0 encode_residual_with_dict(_, dict=Some(_)) emits inner version byte 0x81
3 version_byte_without_dict_has_no_flag The encoded version byte 0x01 satisfies 0x01 &&& 0x80 = 0 encode_residual_with_dict(_, dict=None) emits inner version byte 0x01
4 death5_key_disjoint_from_death2 The Death #5 key space (dictionary_entry_index) is structurally disjoint from the Death #2 key space (prefix_hash) KeyTag::Death5DictEntry ≠ KeyTag::Death2PrefixHash
5 death5_key_disjoint_from_death1 The Death #5 key space is structurally disjoint from the Death #1 key space (matvec bucket) KeyTag::Death5DictEntry ≠ KeyTag::Death1MatVecBucket

Oracles 1–3 are Bool/Nat exact contracts. Oracles 4 and 5 are disjointness contracts on a tagged-union key-tag enum; the Rust side mirrors the Lean KeyTag constructor distinct-injection automation via a derive(PartialEq) discriminant check, and the test harness asserts the inequality holds for every pair the Lean theorem rules out. Any deviation is a primitive-level failure under F5 below.

5. Predictions

All five are predictions, not observations. They will be falsified or upheld by running the wire-integration tests against a real captured residual stream from PRIORITY #0 Gemma4 inference or qwen-coder-7b smoke runs, with a .bwdict produced by the atlas build pipeline.

  • P1. A 256-token system-prompt corpus, captured across 100 sessions, yields a dictionary of top 4096 × 64-byte entries that shrinks a single layer's residual wire from ~14.3 KiB (AMPLITUHEDRON_BITWISE_WIRE.md §9 P1 ceiling) to ≤ 4 KiB on a fresh session drawn from the same prompt distribution — at least 3.5× shrink. Justification: identical to the Pleromatic Atlas P1. The dictionary built in the atlas IS the dictionary loaded by Death #5; if the atlas hits 3.5×, the wire hits 3.5× because the wire is the consumer side of the same compression path.

  • P2. Dict-mode encode latency at the post-RMSNorm call site on the host is ≤ 200 μs per residual at p50 on the qwen-coder-7b tail (3584 f32, 14336 raw bytes). The plain-mode baseline is ~100 μs per residual (the existing AMPLITUHEDRON_BITWISE_WIRE.md §9 P2 ceiling). A 2× latency overhead for ≥ 3.5× wire shrink is the predicted operational tradeoff. If encode dominates the wire we fall to F2.

  • P3. A cross-language round-trip harness — Rust encode → bytes over the wire → TS decode through napi — round-trips a synthetic dictionary's worth of test residuals with max_diff < 1e-6 per f32 lane and length-exact recovery. The fixture lives in cross-lang-dict-fixture.ts and runs in CI alongside the existing BWAH cross-lang fixture. Justification: dict-mode is a byte substitution lookup, not a lossy quantization; the f32 → bytes step is the same plain-mode pipeline, and the substitution is byte-for-byte exact when entry indices resolve.

  • P4. On a workload where both Death #2 and Death #5 fire — a 256-token system prompt repeated across sessions with a hot amplituhedron volume already crystallized — the observed end-to-end throughput uplift is approximately the product of Death #2's ~3.5× prefill-skip uplift (AMPLITUHEDRON_PLAN.md §7) and Death #5's ~3.5× wire-shrink uplift on the decode-loop residual traffic, yielding ≈ 12× compounded uplift relative to the no-cache baseline. The two effects compose multiplicatively because they operate on disjoint granularities (full-prefix prefill vs. per-residual wire bytes) and disjoint key spaces (oracles 4 and 5).

  • P5. Death #5 is no-op when GNOSIS_RESIDUAL_DICT is unset. The encoded byte stream emitted by encode_replay_response with the env unset is byte-equal to the encoded byte stream emitted by the pre-Death-#5 plain bw-codec path on the same input. The inner version byte is 0x01, the BWAH envelope is unchanged, and no dictionary slot is read. Justification: the encode path's dictionary branch is gated on the loaded-OnceCell check; when the cell is empty the branch trivially falls through to the pre-existing plain encode_bw call.

6. Falsification triggers

These are the curves and points that would kill Death #5 as a TPS-roadmap claim. Triggers, not observations.

  • F1. Dict-mode shrink ≤ 1.5× on real captured residuals. This is the Pleromatic Atlas F1 propagated: the atlas predicts the dictionary, the wire predicts the shrink, both predictions stand on the same statistical-regularity claim about post-RMSNorm Luminary residuals. If F1 fires here it fires in the atlas too; the falsification action is the same — drop dict-mode entirely and ship the 14370-byte plain-wire ceiling. Death #5 reverts to "interesting collection" status; the four prior Deaths are unaffected because their key spaces and kernels are disjoint.

  • F2. Dict-mode encode latency > 1 ms per residual (10× the plain path) at p50. Indicates the dictionary lookup is dominating the codec, either because the entry-index search is naïve (linear scan over 4096 entries per 64-byte window when a hash table would work) or because the cross-FFI overhead has been miscounted. Falsification action: profile the entry-index path, fix the dominant cost, re-measure; if the latency is intrinsic to dictionary mode at this dictionary size, ship a smaller dictionary (max-entries 1024) and accept the lower shrink ratio.

  • F3. Cross-language fixture fails — max_diff > 1e-6 per lane, or length mismatch, or the decoder returns BwError::DictionaryRequired when the dictionary is loaded. Falsification action: this is a primitive-level break in the codec or the napi binding. File against open-source/bitwise/src/bw_codec/, pin the wire to plain-mode (GNOSIS_RESIDUAL_DICT unset on both sides) until the round-trip is restored, and re-discharge oracle 2 against the fixed implementation.

  • F4. Death #5 × Death #2 composition does NOT yield a multiplicative uplift. Either the two caches interfere (replaying a prefix volume invalidates the dictionary's entry-index assumptions, or the dictionary entries map to byte patterns that the Amplituhedron's KV-slab path never re-emits), or one of the two caches is doing less work than its single-Death prediction claimed. Falsification action: re-run the per-Death benches in isolation, identify which side's prediction broke first, and update either P4 here or the corresponding prediction in the failing Death's own ledger.

  • F5. With GNOSIS_RESIDUAL_DICT unset, the byte stream emitted by encode_replay_response differs from the byte stream emitted by the pre-Death-#5 plain bw-codec path on the same input. The no-op claim is then broken: Death #5 has changed the default-off behavior. Falsification action: the gating logic in encode_residual_with_dict is wrong (e.g. it always allocates an EncodeBwOptions even when no dictionary is loaded, and the codec treats the empty options as a non-default path). Fix the gate to a strict None-pass-through and re-discharge oracle 3.

Any of F1–F5 reverts Death #5 to "interesting wiring" status. None of them invalidates Deaths #1–#4: oracles 4 and 5 prove key-disjointness, so a Death #5 falsification cannot leak into the other kernels. The atlas-side F1 is the only trigger that propagates across documents.

7. Why this is Death #5 and not Death #6

The Five Deaths roadmap explicitly lists Death #5 as TBD in Gnosis/AmplituhedronAttention.lean line 7: the comment reads -- Death #5: TBD. (Verified at the time of this doc; line 6 similarly lists Death #4 as TBD.) The Pleromatic Atlas filled the substrate side of the wire — capture pipeline, offline dictionary build, BWMR/BWDC formats, the kernel-checked oracles in Gnosis/PleromaticResidualAtlas.lean. This wire-in connects the substrate to the emitted wire: the encoder branches on the loaded dictionary, the decoder branches on the DICT_FLAG bit, and the roundtrip ships across the existing amplituhedron-wire transport. The numbering closes the roadmap at five Deaths total; the identification is pinned by Lean oracle 1 (death5_is_five).

8. Composition with the previous waves

Death #5 is the final wave in a layered stack. Each preceding wave is intact and orthogonal:

  • Mesh Consumption Wave (Amplituhedron coordinator) — the full-prefix prefill-skip cache (Death #2). On a cache hit, the coordinator skips the entire prefill stream and seeds the decode loop with the cached tail residual. Death #5 operates on the bytes that get emitted for the per-token residual traffic during the decode loop that follows; it cannot conflict with the prefill-skip because it runs at a different stage.

  • Bitwise Binary Wire — the BWAH envelope format described in AMPLITUHEDRON_BITWISE_WIRE.md. Death #5 produces an inner .bw payload with the DICT_FLAG set on its version byte; the BWAH header, the capture suffix, the fp48 integrity packing are all untouched. The envelope cannot tell whether its payload is dict-mode or plain-mode and does not need to.

  • Pleromatic Residual Atlas — the substrate. Captures the residuals, builds the .bwdict, exposes the OnceCell slot Death #5 loads at startup. The atlas runs offline; Death #5 is the online consumer.

  • Death #5 — Pleromatic Cross-Prefix Compression — uses the dictionary on the wire. The amplituhedron capture endpoint, the amplituhedron replay endpoint, the residual seed handler — all three encode through encode_residual_with_dict and all three decode through the same bw_codec::decode_bw. The composition table for the wire is:

    Layer Death #5 ON Death #5 OFF
    BWAH envelope unchanged unchanged
    Inner .bw version byte 0x81 0x01
    Inner .bw payload size ≤ 4 KiB (P1) 14336 B (raw)
    Total wire (qwen-coder-7b) ≤ 4030 B 14370 B
    Death #2 prefill-skip unchanged unchanged
    Death #1 matvec memo unchanged unchanged

    This is the same table shape as PLEROMATIC_RESIDUAL_ATLAS.md §8 ("Composition with the existing wave"). The atlas and Death #5 share the same row contract because they share the same encode path; Death #5 is the live-wire half of what the atlas built.

9. Honesty boundary

Nothing in §5 has been measured. The Lean theorems referenced in §3 and §4 exist and are kernel-checked under Init; the empirical predictions they motivate do not. The wire integration survives or falls on the dictionary-build pipeline running against a real workload, not on the algebraic argument.

The dictionary build pipeline requires actually capturing residuals during real inference. The natural workload is PRIORITY #0 Gemma4 distributed inference once it produces correct output, or the qwen-coder-7b smoke runs that already pass on the distributed-inference mesh. Until the capture corpus exists, P1–P5 are claims about a corpus we have not built and a dictionary we have not measured. Empirical clustering on Luminary-basin residuals may not reveal exploitable regularity at 64-byte window granularity. The wire compression ceiling is whatever statistical structure exists in the residuals, not what we wish to be there.

F1 is propagated directly from the Pleromatic Atlas F1: if the atlas doesn't shrink, the wire doesn't either. The two falsification triggers are not independent and cannot be discharged independently. The wire-side P3 (cross-lang round-trip) is the only prediction that can be exercised before a real dictionary exists, because a synthetic dictionary is enough to test the codec path.

P4's multiplicative-uplift claim is the single load-bearing composition claim across the Five Deaths. If F4 fires, the roadmap's "compounding TPS uplift" framing is weaker than advertised even if every individual Death holds — Death #5 would still shrink the wire, Death #2 would still skip prefill, but the total uplift would only equal the larger of the two rather than their product. That outcome is still a win, just a smaller win than the closing-the-roadmap framing claims.

10. Pointers

Three wire-integration surfaces, one Lean module, one cross-language fixture, plus the atlas dependency this wave plugs into:

  • src/amplituhedron_wire.rs — Rust host encode/decode path. encode_replay_response, encode_capture_payload, and the shared inner-blob delegate that calls residual_dict::encode_residual_with_dict. Cited by §3 and P2 / P5 / F5.
  • apps/distributed-inference-host/src/amplituhedron-wire.ts — TS host wrapper around the Rust encode path through napi. Calls into the Rust binding and surfaces the encoded bytes to the coordinator's fetch-handler stack. Cited by §3 and P3.
  • apps/distributed-inference-worker/src/index.ts — worker endpoint that consumes capture/replay traffic. Calls decode_bw on inbound payloads and emits dict-mode payloads from outbound when the worker's loader has populated GNOSIS_RESIDUAL_DICT. Cited by §3 and P5 / F5.
  • Gnosis/Death5CrossPrefixCompression.lean — the five oracle theorems (death5_is_five, version_byte_with_dict_has_flag, version_byte_without_dict_has_no_flag, death5_key_disjoint_from_death2, death5_key_disjoint_from_death1). Cited by §4 and §7.
  • apps/distributed-inference-host/test/cross-lang-dict-fixture.ts — cross-language round-trip fixture for dict-mode encode/decode. Cited by P3 and F3.
  • PLEROMATIC_RESIDUAL_ATLAS.md — the substrate Death #5 plugs into. The atlas oracles (BWMR header, BWDC magic, dict-flag bit) underwrite the encode path Death #5 ships across the wire. Cited throughout.
  • This doc — open-source/gnosis/distributed-inference/DEATH5_CROSS_PREFIX_COMPRESSION.md.