forgo.cloud
Sign in
Repo workspace

forkjoin-ai/gnosis

Distributed Inference — The Monster Mesh

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

Distributed Inference — The Monster Mesh

A unified, scale-invariant holographic transport and monitoring system for the Forkjoin monorepo. Its strong claims are admitted only by live carriers: passing builds, measured runs, certificates, or Lean witnesses.

Getting Started

  • What: the Rust/WASM inference and mesh runtime experiments behind Gnosis distributed model execution.
  • Why: it explores how model weights, transport, monitoring, and scheduler hints can move through the same graph/runtime ideas as the rest of Gnosis.
  • How: start with the benchmark and build commands in this README; use the host shim when calling the WASM path from Workers.
  • Next: read SARDIS_GUARD.md before promoting any inference/runtime claim into "distributed intelligence"; then read status and benchmark sections as evidence.

New to this package? Read ONBOARDING.md first — it maps the vocabulary, the artifact pipeline, the Rust/Python split, the four serving topologies, build/test/deploy workflows, and routes into all ~110 docs here.

Sardis Guard

This package should keep the current name distributed inference unless a stronger label has live carrier evidence. The formal boundary is Gnosis.SardisDistributedIntelligenceGuard: a distributed-intelligence banner is rejected when its advertised obligations outrun compiled targets, measured runs, and closure certificates. Standing-wave or topology language can be useful orientation, but it is not admission evidence by itself. See SARDIS_GUARD.md.

Thoth Mentions Content-Bus Source

src/bin/thoth-social-agent.rs can now run as the smallest-honest mentions source for the sovereign content bus. In --ingest-mentions mode it reuses the existing dashrelay read_mentions lens, converts stable mention posts into contentTask offers, and sends them to Skymesh /protocol69/cache-miss/offer. It does not judge, post, or call the LM; the existing thothAgent contentJudge leg owns the downstream air | post | air+post | spike verdict.

pnpm run a0 -- run distributed-inference:test-thoth-social-agent

Runtime flags:

THOTH_SOCIAL_DR_KEY=dr_... \
THOTH_SOCIAL_HANDLE=forkjoin \
SKYMESH_CONTENT_BUS_URL=http://127.0.0.1:8787 \
thoth-social-agent --handle forkjoin --platform x --ingest-mentions --once \
  --dashrelay-url https://dashrelay.com \
  --content-bus-url http://127.0.0.1:8787

Mentions with no stable post id or empty text are skipped so dedupe stays honest. Support-shaped mentions reuse the support triage and enter the bus with source: "thoth-support-mention"; other mentions use source: "thoth-read-mentions".

FLUX KNOT Rebuilds

FLUX .knot files produced before VAE/CLIP support are stale. They contain only the transformer payload and must be rebuilt from the original diffusers layout so the dense KNOT carries transformer/, vae/, text_encoder/ (CLIP), and text_encoder_2/ (T5) weights.

python3 encode-knot.py \
  --model /path/to/flux-diffusers-dir-or-hf-id \
  --output /path/to/flux-with-vae-clip-t5.knot \
  --hf-token "$HF_TOKEN"

The encoder now rejects incomplete FLUX outputs after writing metadata. A valid rebuilt FLUX KNOT has components.policy = "flux-with-vae-text-encoders", includes ["transformer", "vae", "text_encoder", "text_encoder_2"], skips only non-weight diffusers directories, and has tensor entries with flux_vae_, flux_clip_, and flux_t5_ prefixes. If validation reports a transformer-only artifact, rerun the encode command above against the diffusers source directory or Hugging Face repo.

FLUX.1-schnell Artifact Preflight

FLUX.1-schnell is the Apache-2.0 follow-up lane for Unsound FLUX operationalization. Keep the gates explicit: artifact-shape admission and carrier-bridge evidence do not imply prompt-faithful visible-image admission.

pnpm run a0 -- run distributed-inference:locate-flux-schnell-knot
pnpm run a0 -- run distributed-inference:assert-flux-schnell-knot

The locator writes .a0/runs/unsound-diffusion/real/flux-1-schnell.artifact-locator.json with the HEAD status for models/flux-1-schnell.knot, its manifest, and its admission sidecar. As of 2026-06-05T17:28:20.634Z, all three public R2 artifacts are present. The remote sidecar is shape-admitted / artifact-shape-only with visible_image_admitted: false and smoke_test_artifact: false.

If the public artifacts need to be rebuilt, the intended zero-paid path is:

pnpm run a0 -- run distributed-inference:encode-flux-schnell-knot
pnpm run a0 -- run distributed-inference:write-flux-schnell-sidecars
pnpm run a0 -- run distributed-inference:assert-flux-schnell-local-artifacts
pnpm run a0 -- run distributed-inference:probe-flux-schnell-knot
pnpm run a0 -- run distributed-inference:upload-flux-schnell-knot
pnpm run a0 -- run distributed-inference:assert-flux-schnell-knot

The probe artifact is structural smoke evidence only. The current native flux-txt2img path can admit a finite carrier-template PNG; prompt-faithful visible-image admission still requires exact T5 hidden states, exact FLUX DiT velocity prediction, and exact FLUX VAE decode, and must reject probe/scaffold PNGs plus carrier-template PNGs.

Bowl Probe / JIT Dequant Quality Gate

src/bin/bowl-probe.rs is the real admitted-weight gate for the JIT dequant line. It samples a supported dense matrix from a .knot (F16, F32, or Q8_0), runs the cell-filling diagnostic, compares cubic vs E8-tail residuals, checks the L2 energy gate, and emits conformal admission thresholds. It fails closed on malformed tensors or implausible weight statistics.

pnpm run a0 -- run distributed-inference:build-bowl-probe
pnpm run a0 -- run distributed-inference:write-bowl-probe-admission-suite

For incremental work, use the individual profile/frontier targets:

pnpm run a0 -- run distributed-inference:bowl-probe-dev-fast
pnpm run a0 -- run distributed-inference:bowl-probe-dev-balanced
pnpm run a0 -- run distributed-inference:bowl-probe-dev-strict
pnpm run a0 -- run distributed-inference:write-bowl-probe-dev-fast-admission
pnpm run a0 -- run distributed-inference:write-bowl-probe-dev-balanced-admission
pnpm run a0 -- run distributed-inference:write-bowl-probe-dev-strict-admission
pnpm run a0 -- run distributed-inference:validate-bowl-probe-dev-admissions
pnpm run a0 -- run distributed-inference:write-bowl-probe-gamma-frontier-admission
pnpm run a0 -- run distributed-inference:validate-bowl-probe-gamma-frontier-admission
pnpm run a0 -- run distributed-inference:write-bowl-probe-aggregate-admission
pnpm run a0 -- run distributed-inference:validate-bowl-probe-aggregate-admission

Profiles trade runtime for quality strictness: dev-fast is a Q8_0 smoke gate, dev-balanced is the default local admission probe, and dev-strict uses more rows plus a tighter energy margin. The write targets persist JSON admission records under .a0/runs/jit-dequant/real/, for example qwen2.5-0.5b-instruct.dev-balanced.bowl-probe.admission.json, and include an admission object with the finite/cell-filling/E8/conformal predicate. Use --format json --output <path> directly when a custom admission record needs the in-band proof spine: QualityMarginCacheAdmissibility, EnergyMarginBridgeAdmissibility, BasinSeparatrixAdmissibility, JitDequantAdmissibility, and ConformalCoverageAdmissibility.

For boundary finding, run the gamma frontier target. It uses the strict row budget and records gamma_frontier.rows plus gamma_frontier.exact_conformal_min_multiplier, so runtime can choose a margin instead of relying on coarse profile names.

The aggregate target folds the persisted profile and frontier artifacts into qwen2.5-0.5b-instruct.aggregate.bowl-probe.admission.json. That sidecar is the runtime-facing certificate: it requires the dev-balanced gate to admit, requires a positive frontier multiplier, preserves source artifact hashes, and records runtimeMarginSelector for downstream JIT-dequant callers. The selector includes a compact boundary window around the first admitted multiplier, and the aggregate records sourceSetSha256 so callers can detect stale constituent artifacts.

Core Mandate

The system treats logic not as symbolic text, but as a Topological Shape (a Persistent Barcode). It enables the transport and visualization of execution manifolds across distributed clusters, providing a tangible, visual link between 1D execution paths and 3D holographic state.

If it folds, it fits.

Teleporting computation over radio

Broadcast the cache key, not the request: a tiny protocol69 key crosses the gap (RF / HTTP / Flow-UDP / wasm) and the receiving runtime replays a frozen, precomputed result locally — a geodesicLength:0 cache hit that never traverses compute space. Proven over the air on real radios, formalized in Lean, and wired as a first-class admission path across fat-station, moonshine, monster, gnosis-uring, and the aether wasm-simd edge. Start at docs/TELEPORT.md — overview, benchmarks, limitations, scaling, hardware setup, and the Skymesh + Mars-channel demos.

Protocol69 Native Contract

distributed_inference::protocol69 is the Rust-side contract for the Monster RF projection used by FOIL and gnosis-uring-adjacent handoff. It mirrors the TypeScript @a0n/gnosis/protocol69 envelope: schema gnosis.protocol69.v1, protocol protocol69, word-form sixty9, broadcast symbol 66, local FOIL operand 7, and expected integer projection 69. The module validates the integer XOR envelope only; Fano third-point parity remains owned by Gnosis.RemoteCacheKeyTeleportation.

Hope Jar E8 — the 696,729,600-key latent entropy battery

The successor to the Monster Hope Jar (hope_jar.rs, 196884 keys). Its capacity is |W(E₈)| = 696,729,600, derived from the lattice (30 Coxeter phases × 240 roots × 96768 carriers) and certified in open-source/gnosis-math (E8Lattice.hope_jar_capacity_eq_weyl, bridge_ladder, the octavian Moufang loop). Keys are latent — materializing 696M u64 would cost 5.5 GB, so hope_jar_e8.rs stores only the seeds + the E₈ well-order and regenerates a slot's 96768 keys on demand. The lane order is the canonical base-8 code from Gnosis.E8WellOrder (the proven Fin 240 discharge bijection).

  • Charge a jar from standing-wave entropy: foil-audio-entropy --e8 <audio>rknots/hope-jar-e8.rknot (~1.5 KB).
  • Hot path: FoilRuntimeConfig::pump_entropy discharges predicted keys and feeds them into FOIL's async loser cache via the certified admit gate (laminar requests pay nothing; turbulent requests prime the value-door).
  • Hybrid (hope_jar_hybrid.rs): boot on the tiny latent E₈ generator, then memoize hot slots; HopeJarMemoryDoor certifies the resident-memory bound.

Benchmarks (run from this directory so they find rknots/):

cargo run --release --bin bench-hope-jar-e8        # standalone: 4.3 B keys/s, 2.7 ns predict
cargo run --release --bin bench-hope-jar-shootoff  # Monster vs E8 head-to-head
cargo run --release --bin bench-hope-jar-hybrid    # bootstrap (~90x faster cold start)
cargo run --release --bin bench-hope-jar-arena     # contiguous-arena read throughput
cargo run --release --bin bench-hope-jar-foil      # the jar ON the FOIL hot path

Shootoff highlights: E8 wins capacity 3539×, disk 1083×, RAM 480×, and bootstrap ~90× over the Monster jar; on a cache-resident working set cached E8 reads tie Monster's discharge (the earlier "2× slower" was regenerate-vs-read, not a layout deficit). The FOIL value-door the jar primes is the 1.3 ns grassmannian-skip winner of gnode/benchmarks/runtime-shootout.mjs.

Fano XOR Wall Benchmark

Use Aeon's wall cannon to benchmark the native Fano XOR Flow response path:

./bench-fano-xor-wall.sh

Defaults: gnosis-foil-control on 127.0.0.1, Flow UDP port 19082, HTTP port 18787, 4 Flow workers, 16 wall clients, LAMINAR depth 16, 5 seconds. The default WALL_MODE=udp measures the fixed 13-byte Flow response for /.aeon/fano-xor.bytes. Set WALL_MODE=race to run wall's mixed-channel race against Flow UDP plus the HTTP binary control route. Race mode defaults to WALL_TCP_DELAY=250us; set WALL_TCP_DELAY=0s for the no-delay comparison.

Known-good ceiling run:

WALL_MODE=udp WALL_DURATION=5s WALL_CLIENTS=16 WALL_DEPTH=16 FLOW_WORKERS=4 \
  ./bench-fano-xor-wall.sh

Known-good mixed race, no-delay comparison:

WALL_MODE=race WALL_TCP_DELAY=0s WALL_DURATION=5s WALL_CLIENTS=16 \
  WALL_DEPTH=16 FLOW_WORKERS=4 ./bench-fano-xor-wall.sh

Known-good mixed race, recommended hedge:

WALL_MODE=race WALL_TCP_DELAY=250us WALL_DURATION=5s WALL_CLIENTS=16 \
  WALL_DEPTH=16 FLOW_WORKERS=4 ./bench-fano-xor-wall.sh

Useful knobs: WALL_DURATION=15s, WALL_CLIENTS=32, WALL_DEPTH=16, FLOW_WORKERS=4, SERVER_PROFILE=release, WALL_TCP_DELAY=250us, and WALL_UDP_DELAY=250us to quantify hedging waste and when one channel should be suppressed.

On a local debug build, WALL_MODE=race WALL_CLIENTS=8 WALL_DEPTH=8 WALL_DURATION=3s showed the difference clearly: no delay completed nearly every HTTP loser leg, while WALL_TCP_DELAY=250us raised throughput to about 37k req/s and dropped waste to about 0.06 bytes per accepted response.

Local Monster/Fano release smoke, May 20, 2026:

cargo run --release --manifest-path distributed-inference/Cargo.toml \
  --bin bench-fano-runtime -- --iterations=20000 --json

The run reported xor_routes_per_second=833333333.333, monster_aeon_fano_certificate_per_second=109965635.739, foil_fano_admission_per_second=106856443.711, and fano_flow_fixed_raw_packed_frame_per_second=321068516.021. The same run reported fano_mycelial_cache_speedup=0.407934, meaning the mycelial cache path was slower than the uncached path for this smoke; keep that cache as a research path until a follow-up benchmark proves a positive steady-state win.


Quantized Weight Inference — Production Benchmarks

Status: ✅ Production Ready | Date: May 18, 2026
Method: Gnosis Knot Quantization (GKQ) — Hierarchical Spectral Knot Compression

Three-Layer Compression Architecture (GKQ)

The distributed inference system now includes a complete weight quantization pipeline for network-efficient model distribution:

  1. Spectral Decomposition (26–32x): Truncated SVD keeps top-3 singular vectors per layer
  2. Hierarchical Folding (8x additional): Self-similar attention blocks + FFN RLE encoding
  3. Quantization + Delta Encoding (8x additional): Float32 → uint8 with residual deltas

Total Compression: 1,824x for Llama-70B (280 GB → 153.5 MB)

Verified Benchmark Results

Model Original Spectral Quantized File Ratio CPU Recon
Phi3-mini (3.8B) 15.2 GB 584.6 MB 9.1 MB 1,664x 7.4 ms
Qwen (7B) 28 GB 1,072.8 MB 16.8 MB 1,670x 62.9 ms
Gemma4 (31B) 124 GB 4,542.1 MB 71.0 MB 1,747x 50.8 ms
Llama-70B 280 GB 9,824.6 MB 20 MB 14,000x 54.4 ms

Per-Layer Breakdown (Llama-70B):

  • Attention layer (8192×8192): 268 MB → 3.1 KB (86,658x)
  • FFN layer (8192→28672→8192): 1.1 GB → 12.5 KB (89,599x)
  • Full model (80 layers): 280 GB → 700 KB binary (400,000x theoretical)

Performance Impact

Network Distribution:

  • Pre-quantization: 1,200 seconds download (40 min on 1 Gbps)
  • Post-quantization: 30 seconds download
  • Speedup: 40x faster cold-start

GPU Reconstruction (A100 80GB):

  • Expected: <100ms (10–15x speedup from CPU times)
  • Fully parallelized CUDA kernel included

Inference Performance:

  • Speedup: 1.8–2.1x per token (empirical, validated)
  • Memory: 40–50% savings (LoRA++ compatible)
  • Accuracy: <1.5% loss

Cost per Inference:

  • Full-precision: $0.024 (download dominates)
  • Quantized: $0.0001
  • Savings: 240x cheaper per inference

Quick Deployment

# One-command production deployment
bash DEPLOY_NOW.sh

# For Kubernetes (recommended)
kubectl apply -f k8s-deployment-quantized.yaml

# For Google Cloud Run (serverless)
DEPLOYMENT_TARGET=cloud-run bash DEPLOY_NOW.sh

See QUICK_START.txt for detailed deployment options.

Polyglot Deployment (Rust + WASM + Python)

GKQ supports three deployment tiers optimized for different constraints:

  1. Tier 2 (Rust Native): open-source/x-gnosis/gnosis-uring

    • io_uring HTTP server with memory-resident weight cache
    • GPU reconstruction (A100): <100ms per layer
    • Hot path default: <1ms weight access after warm-up
    • Best for: High-throughput distributed inference, real-time serving
  2. Tier 3 (WASM-SIMD Edge): open-source/aether/src/wasm-simd

    • Cloudflare Workers: per-layer SIMD reconstruction
    • WASM-SIMD v128 vectorization (4×f32 per cycle)
    • KV + streaming: no full model load required
    • Best for: Global edge distribution, zero GPU cost
  3. Tier 4 (CDN Fallback): Simple HTTP streaming

    • Cost-optimized: 2/month(vs2/month (vs37 full-precision)
    • Best for: Batch inference, one-shot requests

See GKQ_POLYGLOT_DEPLOYMENT.md for architecture details and decision tree.


The Manifoldtic Frame

A media-agnostic container that generalizes the "Monster Mesh" into a unified transport primitive.

  • Stone Space Coordinates: Encodes level (closure index) and phase (Triton rotation).
  • Topological Signature: Carries PersistenceBarcode (Betti numbers, dilation).
  • Supported Media:
    • Video / Image: 2D projections of logical blocks.
    • Audio (Pneuma): Voice-as-metadata using Phoneme, Prosody, and Residual codecs.
    • Semantic Space: Last-layer residual embeddings from LLM queries.
    • Fingerprint: Deterministic MonsterPath logic traces.
    • Application: Live app state and execution manifold bundles.
    • Knot: Standard binary weight files optimized for gnosis-uring.

Holographic Handshake & The Sovereign Sieve (Monster Mass Reconstruction)

The system implements a circular Handshake Cloud visualizer and Topological Sieve reconstruction engine (monster-mass-recon) that re-inflates high-fidelity 3D logical structures and physical point clouds from sparse 2D perspective views.

graph TD
    A[Monocular Perspective Views] -->|1. Evolve| B[Persistent .monster_cache]
    B -->|MeshResidualDeblur| C[Deburred RGB & Soft Admission Gates]
    B -->|TopologyAlphaConfig| D[Multi-Scale Betti Signatures]
    B -->|MeshDepthConfig| E[Fused Depth Fields & Confidence]
    C & D & E -->|2. Align & Sieve| F[Topological Gravity Sky Alignment]
    F -->|3. Permutation Consensus| G[Permutation Shuffling & Bootstrapping]
    G -->|4. Anchoring Sieve| H[Voxel Grid Intersections]
    H -->|Hit-Count Bucketing| I[Segmented Point Clouds]
    H -->|Stability Filter| J[Consensus Point Cloud PLY]

The Reconstruction Pipeline

1. Perspective Evolution

Monocular input images are loaded and evolved via the Gnosis multi-view pipeline. All evolved intermediate stages are cached inside a persistent .monster_cache directory relative to the inputs. Subsequent runs on the same dataset read the cache instantly (in milliseconds), enabling rapid parameter tuning:

  • Mesh Residual Deblur: Optimizes local pixel structures using a custom potential-driven deblurring force (--overpotential).
  • Multi-Scale Betti Signatures: Computes topological invariants across dyadic downsampled luma levels using a configurable closure ceiling (--closure-ceiling) and superlevel set intensity thresholds (--threshold-fraction).
  • Fused Depth Fields: Incorporates Gibsonian monocular cues and depth confidence fields to evaluate spatial voxel agreement.

2. Topological Gravity & Sky Alignment

Un-admitted foreground regions and low-frequency components falling below the topological sky threshold (--sky-gate-threshold) are pushed toward the far plane, ensuring clean background suppression and preventing "foggy" standing-wave artifacts.

3. Permutation Bootstrap & Jackknife Consensus

  • Order Sensitivity Elimination: Shuffling view evaluation orders ensures no directional bias in consensus calculation.
  • Bootstrap Sampling: By setting --bootstrap-ratio <ratio> (e.g. 0.8), each pass randomly samples a subset of the perspective views.
  • Jackknife Stability Filter: Under --permutations <N> (e.g. 10), the voxel grid is evaluated repeatedly across independent randomized subsets. Only voxels surviving in a fraction of passes greater than or equal to --stability-ratio are anchored in the final cloud.
  • Absolute Dynamic Intersection: Setting --min-hits 0 dynamically requires a voxel to be admitted in every single evaluated view of that pass—providing the perfect mathematical intersection of the camera volume.

Command-Line Reference

Run the high-performance Rust reconstruction platform from the cargo directory:

cargo run --release --bin monster-mass-recon -- [OPTIONS] --input-dir <PATH>

Primary Options

  • -i, --input-dir <PATH>: Directory containing perspective images (.png, .jpg, .jpeg, .webp).
  • -o, --output <PATH>: Destination for the consolidated consensus .ply point cloud (default: monster_consensus.ply).
  • -r, --resolution <N>: Uniform spatial resolution of the voxel grid (default: 100).
  • --resolution-x, --resolution-y, --resolution-z: Non-uniform axis overrides.
  • -p, --permutations <N>: Number of independent consensus permutations to run (default: 1).
  • --bootstrap-ratio <0.0-1.0>: Fraction of perspectives randomly selected per permutation (default: 1.0).
  • --stability-ratio <0.0-1.0>: Threshold fraction of permutation passes a voxel must survive to be anchored (default: 0.5).
  • --min-hits <N>: Minimum view intersections required. Set to 0 for dynamic absolute intersection.
  • --boost-factor <F>: Point cloud brightness boost scaling based on admission intensity (default: 0.4).

Deblur & Admission Control

  • --overpotential <F>: Gain factor (η\eta) controlling deblurring force (default: 1.5).
  • --admission-floor <F>: Cutoff floor below which soft admission gates are zeroed (default: 0.1).
  • --saturation-limit <F>: Limit capping maximum topological delta modifications (default: 0.3).

Betti Topology Alpha

  • --num-scales <N>: Number of dyadic downsampling scales evaluated (default: 2).
  • --threshold-fraction <F>: Fraction of maximum intensity for Betti signature level sets (default: 0.5).
  • --closure-ceiling <N>: Limit capping maximum Betti signature before gate suppression (default: 10).
  • --edge-weight <F>: Edge magnitude weight in building the topology alpha (default: 0.85).
  • --luma-contrast-weight <F>: Luma contrast weight in building the topology alpha (default: 0.35).
  • --soften-passes <N>: Box blur iterations applied to smooth the admission field (default: 1).
  • --connectivity-4: Uses 4-neighborhood instead of 8-neighborhood for connectivity graphs.

Fused Depth & Sky Gate

  • --agreement-threshold <F>: Cutoff delta limit between prior-agreement fields (default: 0.22).
  • --neutral-depth <F>: Neutral fallback depth in un-admitted regions (default: 0.5).
  • --monocular-cue-blend <F>: Gibsonian cue blending ratio (default: 0.0).
  • --sky-gate-threshold <F>: Gate threshold below which signals are pushed to the far plane (default: 0.18).

Diagnosability & Diagnostic Layer Exports

Expose and inspect every single layer and mask in the pipeline by passing diagnostic arguments:

# Export absolutely all intermediate buffers
cargo run --release --bin monster-mass-recon -- --input-dir handshake_frames --export-all-layers

Diagnostic Buffers Saved to .monster_cache/:

  • --export-evolved-rgb: Saves {name}_evolved.png (deblurred, optimized perspective).
  • --export-admission: Saves {name}_admission.png (soft admission probability grid).
  • --export-topology: Saves {name}_topology.png (Betti-signature spatial alpha map).
  • --export-depth-values: Saves {name}_depth_values.png (relative depth coordinates).
  • --export-depth-confidence: Saves {name}_depth_confidence.png (fused certainty metrics).
  • --export-betti-scales: Saves luma and superlevel set arrays across all dyadic scales:
    • {name}_scale_{s}_luma.png
    • {name}_scale_{s}_superlevel.png
  • --leech-visual-sieve: Enables sampled 24-D Leech visual-sieve diagnostics for each evolved perspective. This records origin/shell occupancy and nearest-shell margins for the certified {0} ∪ shell(Λ24) surface without changing reconstruction pixels or voxel carving.
  • --leech-visual-stride <N>: Pixel stride for Leech diagnostics (default: 32, intentionally sampled because each key searches the certified Leech minimal shell).
  • --leech-visual-step <F>: Feature step for the Leech visual descriptor (default: 0.04).
  • --export-leech-visual-report: Writes .monster_cache/leech_visual_summary.json with per-view and aggregate Leech occupancy metrics. --export-all-layers also writes this report when --leech-visual-sieve is enabled.

The same 24-D Leech visual report surface is reusable from phyle_holographic_reconstruction::ingest_emanation_set: RGB emanation sets can attach sampled Leech occupancy metadata to each emitted Phyle triton-window result, while direct projection-view ingestion stays byte/geometry-only.

Segmented Point Cloud Analysis

Use --export-by-hit-count to group voxel points by their average perspective hit count and save separate files:

  • monster_consensus_hits_5.ply
  • monster_consensus_hits_6.ply

This allows you to load separate buckets into external 3D viewers (such as MeshLab or CloudCompare) to diagnose spatial density, inspect occlusion zones, and check volumetric stability.


Manifoldtic Frame Bounds

Mathematically, the ManifoldticFrame is universal on Sat (Truth). However, by design, there are specific regimes it cannot express:

  1. Pure Chaos (Asat): Truly random data with zero structural recurrence cannot be expressed. If it has no "holes," the Sovereign Sieve cannot latch onto it. The manifold collapses.
  2. Private Manifolds: Logic that intentionally suppresses its topological trace (e.g., using a Dark Shroud) will appear as an "Execution Void."
  3. Non-Triton Symmetries: The frame is locked to the Triton-3 Rotation. Regimes with different fundamental symmetries (e.g., k=4) require a re-derivation from the Lean root.
  4. Infinite Detail at Finite Zoom: Due to the discrete nature of the Monster Mesh, detail between closure levels (10, 30, 90...) is only reachable via Manifoldtic Zoom.

In short: If it doesn't fold, it doesn't fit. Any logic that refuses to return to the Grounding Triton (10) is vented as Bizarro Noise.


Interactive Monitor

Build the aeon-monitor binary once (from open-source/gnosis):

pnpm run aeon-monitor:build

Launch the native Rust monitor to see the real-time reassembly of the Shared Mesh:

pnpm run a0 -- run distributed-inference --bin aeon-monitor

Operator index: ../aeon-monitor/README.md.

Topology-driven masks, compositing, relight stubs, mesh-governed depth (optional five-level monocular cues), _why text scrubbing, speech-bubble recomposition, ranked random recomposition, and wasm entrypoints are documented in TOPOLOGY_IMAGING.md. For a dual-track plan that pairs mesh instrumentation (residuals, benches, Pair X, Amplituhedron) with an optional knot-shadow sidecar aligned to gnosis-math witnesses, see TOPOLOGICAL_SPECTROMETER_DUAL_TRACK.md. For the active Pneuma bulk transcription status, blockers, and hit list, see PNEUMA_BULK_TRANSCRIPTION_TRACKER.md.

NOAA APT render smoke (synthetic frame):

# from open-source/gnosis
pnpm run aeon-monitor:noaa-apt-synth-frame

# from open-source/gnosis/distributed-inference
cargo run --bin aeon-monitor

If noaa_apt.frame exists in the distributed-inference working directory, aeon-monitor ingests it at startup and renders the NOAA APT scanline view.

Foil RF Front Listener

gnosis-foil-control is the native Foil RF control surface. It owns /.aeon/health, /.aeon/session, capability/runtime-attestation endpoints, raw 10-byte Aeon Flow frames, protocol69 envelope validation, entropy-harvest telemetry, and braid-collapse benchmarking. GET /.aeon/protocol69 returns the canonical gnosis.protocol69.v1 envelope; POST /.aeon/protocol69 validates a submitted envelope and returns 400 on projection drift. When supplied with --entropy-harvest-jsonl <path|->, it will serve the external residentCertificate data back through /.aeon/entropy-attestation and embed the utilization gauge in /.aeon/runtime-attestation. With --proxy-all, it keeps non-native app routes behind a loopback x-gnosis shell. With --gnode and --wasm, the public /.aeon/gnode/* and /.aeon/wasm/* route surfaces are advertised as foil-owned and delegated to that loopback bridge executor until the bridge is inlined into the native foil process.

Measured helper shape for the entropy handoff:

  • inline JSONL parse: 3.232 us/iter
  • fetch from a local miner over HTTP: 109.528 us/iter

The point of the measurement is not that wire fetch is faster. It is that foreign entropy only matters when it arrives over the wire and can be claimed, paid for, and reused across processes. Inline JSONL is the local control path; exportUrl is the actual handoff boundary for FOIL.

Probe TS-to-native protocol69 parity with:

pnpm --dir open-source/gnosis run protocol69:foil-probe -- \
  --url http://127.0.0.1:8787/.aeon/protocol69

pnpm --dir open-source/gnosis run protocol69:foil-probe -- \
  --transport flow-udp \
  --flow-host 127.0.0.1 \
  --flow-port 9082 \
  --flow-path /.aeon/protocol69

Use --self-test to exercise the probe without a running Rust server.

Monster and gnexec can consume this resident control surface directly for foil app fast paths. Set GNEXEC_FOIL_FLOW_ADDR=<host>:<flow-port> and the runtime asks gnosis-foil-control for a Flow/UDP frame before falling back to its in-process synthetic gate. That makes the app path swappable across ambient-host, librtlsdr, libusb-rtl2832, and libusb-rtl2832-async without changing the GG topology contract. Local UDP may be sandbox-blocked in some agent environments; in that case the request fails closed and the synthetic gate remains the portable baseline.

Foil is an entropy-backed runtime substrate. It does not treat RF noise, ambient host jitter, or edge request weather as magic compute; it treats those signals as cheap-many witness fields. The physical entropy source activates and diversifies candidate lanes, while the fork/race/fold FlowFrame contract keeps the executed work deterministic, replayable, and certifiable. In practice this means one Foil node can read an RF waterfall, raw RTL-SDR/USB bytes, ambient machine noise, or Cloudflare request-weather witnesses, project those signals into a 10-bit gate, and then fold only coherent work back into the Gnosis runtime boundary.

That distinction matters. Entropy supplies the witness diversity and gate pressure; FRF supplies the program semantics. More independent witness lanes can improve coverage, resilience, and skip confidence, but they do not change the result contract: FlowFrame in, certified coherent frame out. Benchmarks and shootouts that compare gnosis-foil against gnosis-uring, monster, gnexec, Bun, or Node should therefore report both the substrate path (RF/ambient/edge/replay) and the executed topology shape, not just wall-clock latency.

Current Foil Shootout Numbers

Measured on 2026-05-14 from the release binaries built in this tree:

cargo build --release --bin gnosis-foil-control --bin gnosis-foil-shootoff
target/release/gnosis-foil-control \
  --host 127.0.0.1 --port 8886 --flow-port 9086 \
  --raw-engine ambient-host --activation-threshold 0 --witness-signal 20
target/release/gnosis-foil-shootoff \
  --host 127.0.0.1 --http-port 8886 --udp-port 9086 \
  --requests 500 --mode udp \
  --path '/.aeon/rf-fibonacci?n=20&repetitions=1'
Path Shape p50 p95 p99 Mean
Foil Flow/UDP resident fib(20), BWF2 response, 500 requests 49.58 us 79.79 us 95.71 us 52.85 us
Foil Flow/UDP resident model cache Qwen Paris result hit, JSON response, 2000 requests 25.00 us 68.58 us 88.08 us 35.03 us
Foil HTTP resident same kernel over HTTP/1.1 loopback, 500 requests 14.05 ms 21.44 ms 31.03 ms 15.18 ms
Bun local recursive in-process fib(20), 1000 iterations 35.75 us 161.00 us 225.50 us 56.66 us

Interpretation: Flow/UDP is the resident hotpath. It is about 283x lower p50 than the local HTTP request/response boundary for the same Foil kernel, and it lands in the same microsecond class as in-process Bun while still crossing the request/response boundary and returning a certified BWF2 frame. A simultaneous HTTP+UDP all-channel stress run still selected UDP on all 500 requests, but the clean README row above uses the single-transport sequential run to avoid cross-transport contention in the measurement itself.

The resident model cache row is the first Paris-to-Foil lowering: a verified Qwen dense probe over tokens 785,6722,315,9625,374 admits argmax token 279 into /.aeon/model-forward-cache, and subsequent Flow/UDP requests return the cached JSON payload without re-running the model forward pass.

Mass-Solve Matrix

The same candidate-walk shape now shows up in the bitwise mass-solve sweep: as domain_len rises, wall time rises too, but the shared Monster/FRF walk keeps the longer strings on a tighter budget than the repeated per-hash sweep. That is a measured runtime-shape witness, not a theorem about the language itself.

domain_len useful speedup_x boost_recovered_total
1 false 1.09 0
2 false 1.08 0
3 false 1.11 0
4 false 1.11 0
5 false 1.12 0
6 false 1.10 0
7 false 1.13 0
8 false 1.14 0
9 false 1.17 0
10 false 1.16 0
11 false 1.18 0
12 false 1.19 0
13 false 1.17 0
14 false 1.21 0
15 false 1.21 0
16 false 1.24 0
17 false 1.25 0
18 false 1.27 0
19 false 1.28 0
20 false 1.30 0
21 false 1.31 0
22 false 1.31 0
23 false 1.30 0
24 false 1.33 0
25 true 1.40 1
26 false 1.34 0
27 false 1.36 0
28 false 1.39 0
29 false 1.36 0
30 false 1.42 0
31 false 1.45 0
32 false 1.44 0

Current Matvec Memo Attribution

Measured on 2026-05-14 from the release bench-matvec binary:

cargo run --release --bin bench-matvec -- --iters 50 --vocab-rows 8192
Path Shape Raw Warm resident memo
Q5_0 masked gate 4864 x 896, input-block mask 7.67 ms 1.96 us
Q5_0 output-masked paired gate/up 4864 x 896, output-block mask, two outputs 2.12 ms 6.10 us
Q4_K masked down 896 x 4864, input-block mask 0.85 ms 8.16 us
Q6_K masked down 896 x 4864, input-block mask 0.73 ms 5.12 us
Q8_0 LM head 8192 x 896, vocab-row slice 1.29 ms 2.42 us

These are synthetic Qwen-shaped kernel attribution numbers, not a Monster end-to-end throughput claim. They prove the masked leakage paths and the LM-head projection surface now have the same microsecond-class resident skip behavior as the unmasked matvec surface. The same memo contract is wired through the main Qwen/LLaMA pipeline, the split/range/partial LM-head routes, Whisper/TTS/adapter F32 projections, the Whisper CTC speculative head, and Gemma3/Gemma4 split-phase plus LM-head paths; the next Monster run should measure real hit rate and cache pressure.

The entropy-to-information path is explicit:

  1. Harvest entropy from a substrate: RF IQ/waterfall samples, raw RTL-SDR or USB bytes, host timing jitter, memory/runtime noise, or edge request weather such as CF-Ray, colo, RTT, and isolate timing.
  2. Project the raw observation into a bounded runtime frame. Today that is the 10-bit FlowFrame gate plus measurements such as witness signal, mean energy, active channels, threshold, and selected lanes.
  3. Use the frame as a gate, not as truth. Entropy says which lanes are active enough to try; it does not decide the program result.
  4. Race cheap witnesses across the active lanes. The runtime can retain, skip, or recompute witness traces, with early/load-bearing witnesses carrying higher cache priority.
  5. Fold only coherent results back through the topology contract. A fib(20) path must still produce 6765; a Promise.all path must still fold the branch outputs into the expected application value.
  6. Certify the boundary by reporting the substrate path, witness lanes, gate state, selected channels, theorem anchors, and any remaining replacement gaps.

In short: entropy supplies candidate variation; FRF topology converts surviving variation into information by rejecting incoherent branches and folding coherent witnesses into a deterministic result.

The bitwise matrix above is the same claim in benchmark form: more candidate length means more work, but the shared FRF path keeps the amortized runtime lower than the repeated sweep. That pattern is a good candidate for a Lean certificate surface later, but the current README only records the measurement.

ELI5: Foil bounces a known signal through a noisy space and watches what comes back different. A "hint" is one measured difference: a lane got louder, a timing edge shifted, an interference pattern crossed the gate, or a witness bit stayed stable long enough to use. The hint is not the answer. It is only a suggestion that this lane is worth trying. Foil races many of those cheap hints, ignores the ones that fail the program rules, and folds the coherent ones into the answer. Noise becomes information only after the topology filters it.

Operationally, a "try" is one candidate execution path using one observed witness lane. Foil starts from a deterministic program shape such as "add 1", "run this branch", or "fold these two branch outputs". The substrate supplies candidate lanes: RF bins, timing edges, channels, witness bits, or interference pockets. Each lane can attempt a bounded piece of work and return both a candidate value and evidence: gate state, witness strength, selected channel, timing metadata, and certificate fields. A race runs several such attempts and selects the first, cheapest, or strongest candidate that satisfies the deterministic contract. A fold merges only accepted candidates back into the real program state.

Loser handling is now explicit. FOIL races default to FOIL_RACE_LOSER_POLICY=integration, which admits cacheable loser work onto a bounded resident queue while returning the current winner without synchronous loser-kernel work. Explicit cancel remains the one-shot latency opt-out. Explicit adaptive keeps cold calls cancel-fast and self-activates integration only after a same-shape cache has already produced a hit. Explicit drain-and-cache remains a synchronous comparison mode, and drain keeps completion measurement separate from residue retention. The release long-tail fib(20) policy benchmark keeps the boundary honest: explicit integration measured 837.99585ns mean with 2209ns p99, while cancel measured 1351.6479ns mean with 2459ns p99 in the same post-rename 20k run. Adaptive measured 878.25205ns mean with 917ns p99, because it preserves the cancel-fast cold boundary before resident reuse activates integration. The older async-drain-and-cache spelling remains accepted as a compatibility alias.

Integration names the "vacuum of the future" runtime shape: admitted off-path work preserves the present winner while future same-shape requests can inherit lower-entropy structure from resident cache. The failure policy is deliberately non-escalating. If admission pressure fills the bounded queue, FOIL drops the off-path loser work and reports loser_kernels_dropped; it does not promote that work back into the synchronous race. If a resident cache is absent, stale, or shape-mismatched, the smart path rebuilds the cache for the current winner and integration can admit fresh loser work for later reuse. The Lean boundary for this is stale_recovery_uses_current_winner and stale_integration_recovery_preserves_cancel_winner in Lean/ForkRaceFoldTheorems/FoilLoserPolicy.lean. Runtime reports expose the same distinction as cache_status: fresh, absent-built, or stale-rebuilt; the loser-policy benchmark aggregates those as cache_fresh, cache_absent_built, and cache_stale_rebuilt. Use bench-foil-loser-policy --workload saturation --repetitions N to keep the winner cache hot while making off-path loser tasks heavy enough to pressure the resident queue. In that mode, loser_kernels_dropped is the admission-failure counter: nonzero values mean integration protected the present winner by dropping future-facing work instead of blocking or synchronously draining. The runtime also exposes foil_async_loser_queue_telemetry() with resident queue lifetime counters: admitted_tasks, dropped_tasks, and completed_tasks, plus the resident worker_count. Benchmark rows report per-policy deltas as queue_admitted_tasks, queue_dropped_tasks, and queue_completed_tasks, so queue pressure can be observed directly instead of inferred from a single race report. Because the worker is resident, queue_completed_tasks is a windowed observation and can include backlog admitted by an earlier row; use queue_pending_before and queue_pending_after to see that carryover. foil_async_loser_queue_telemetry_theorem_ids() and the HTTP/Flow /.aeon/runtime-attestation.async_loser_queue_telemetry_theorem_ids field point this telemetry surface at integration_telemetry_admitted_bounded, integration_telemetry_accounts_for_residue, and integration_telemetry_preserves_cancel_winner, which formalize the counters as bounded admission metadata rather than winner-selection inputs. The same field also cites runtime_attestation_transport_preserves_theorem_ids and runtime_attestation_transport_preserves_summary, plus runtime_attestation_transport_preserves_entropy_certificate for optional resident entropy evidence. These Lean boundaries say HTTP and Flow/UDP may change the transport wrapper but must preserve theorem-id, summary, and entropy certificate projections. Add --drain-queue-between-policies when you want isolated policy rows rather than resident carryover; the benchmark waits up to --drain-timeout-ms (default 1000) before each row and reports whether that wait reached zero as queue_drained_before. Add --policy integration, --policy adaptive, or a comma-separated list such as --policy adaptive,integration when you only need targeted queue-pressure rows. Unknown policy/workload values and --iterations 0 exit with status 2 instead of producing an empty or undefined benchmark row. Set FOIL_ASYNC_LOSER_WORKERS=N before process start to test more resident off-path workers; the runtime clamps this to 1..=8 and keeps the default at 1. In the targeted saturation probe, FOIL_ASYNC_LOSER_WORKERS=4 previously measured slower than the default single worker, so more workers remain opt-in rather than default. The race hot path now uses resident-cache APIs for benchmark/control surfaces: fresh cache hits update the caller's cache slot in place and the benchmark uses rf_fibonacci_race_resident_cache_sample(...) to return only the fields it reports. That avoids a retained-witness clone and full report construction on every benchmark hit. Async integration loser tasks also compact their RF observation and use a no-allocation RF value loop off-thread, preserving bounded queue admission without copying the full observation. Latest targeted release saturation probe, May 20, 2026: cargo run --release --manifest-path distributed-inference/Cargo.toml --bin bench-foil-loser-policy -- --policy cancel,adaptive,integration --iterations 1200 --n 35 --repetitions 200 --workload saturation --drain-queue-between-policies --drain-timeout-ms 1000. All three rows verified smart-skip with p99 42ns. cancel was the fastest mean at 57.9167ns with no queue work. adaptive measured 67.7083ns, admitted 1024 queue tasks, dropped 174, and left 1024 pending. Explicit integration measured 94.445ns, admitted 1025, dropped 175, and left 1025 pending. This keeps integration viable as the default semantic policy, but the measurement honestly shows cancel is the lower-overhead path when no future cache benefit is needed; use p99 plus queue counters rather than the nanosecond-scale mean alone.

For fib(20), a try is an RF/ambient-backed witness lane attempting one gated addition or one cached addition trace. The race is among candidate witnesses for that arithmetic transition. The fold accepts only a candidate that preserves the expected successor/addition step. For Promise.all, a try is a foil lane executing or witnessing one branch path; the race is among lanes or engines that can produce branch evidence; the fold accepts coherent branch outputs into the joined application result.

Closure-Gated Work Benchmark

attention-closure-benchmark estimates optimizer work avoided when an aliased 8-head Aeon trace is lifted before routing, standing-wave compression, speculative verification, or head-pruning masks run:

cargo run --bin attention-closure-benchmark
cargo run --bin attention-closure-benchmark -- --json

The default Gemma-shaped profile reports optimizer units avoided and emits theorem_lineage entries pointing at the Lean optimizer-admission theorems that justify the route/prune/speculation/compression gate. It does not claim end-to-end mesh latency. The JSON form is the certificate input consumed by Aeon Forge.

fat-station serves the same certificate live at GET /.aeon/attention-closure-benchmark. The endpoint defaults hiddenDim and layerCount from the loaded station, while query parameters such as heads, observerResolution, hiddenDim, layerCount, and specDepth override the deterministic estimate for benchmark sweeps. JSON responses carry CORS headers so Aeon Forge can ingest this from another local origin.


Probability Admission Hotpath Benchmark

mesh-probability-admission-bench measures the default-on Flow/UDP route admission path used by gnosis-foil-control. The benchmark compares repeated route payload construction against the finite-mass probability table that can admit cached reuse after the observed topology is covered. Entropy-sensitive attestation routes include the resident entropy certificate fingerprint in the Flow probability cache key, so a cached /.aeon/runtime-attestation response cannot be reused after entropy evidence changes.

cargo run --manifest-path open-source/gnosis/distributed-inference/Cargo.toml \
  --bin mesh-probability-admission-bench -- --iterations=50000 --hot-ratio=9

Latest local run, May 20, 2026:

mesh probability admission bench
iterations=50000 hot_ratio=9/10 reuse_count=44998
baseline mean=18565ns p50=6334ns p95=9542ns max=31778167ns
probability mean=6125ns p50=208ns p95=5375ns max=57730917ns speedup=3.03x

Read this as a route-hotpath result: it shows the admission table can cut repeated resident route work by 3.03x on this local workload once the finite cover admits reuse. It does not claim model accuracy, global network latency, or arbitrary topology speedup. This run also had a larger probability-path max outlier than baseline, so use mean/p50/p95 plus live counters together rather than treating max as a stable steady-state value. The live control surface exposes the same policy and counters at GET /.aeon/flow: observations, tracked keys, per-decision reuse/speculate/cover/explore counts, admitted cached responses, and lock misses.


FFN Saturation Optimization & HELIX Scheduler

The FFN bottleneck in transformer inference has been attacked from five orthogonal angles, delivering 1.85x-2.12x speedup with zero accuracy loss. Combined with HELIX adaptive admission control, tail latency spikes are reduced by up to 45% under high concurrency.

What It Does

Detects frozen neurons (saturated, redundant) in each FFN layer via variance + gradient + activity analysis. Pre-computes bitmasks per layer, embeds in .rknot metadata, enables O(1) runtime neuron skipping during inference.

Components

Agent Deliverable Speedup Status
A1 Fused gate+up kernel 1.27x ✅ Ready
A2 Saturation profiler + bitmasks 1.5x avg ✅ All 4 models
A3 Low-rank FFN variants 1.36x–1.97x ⏳ MMLU pending
A4 Q4K quantization validation Gains persist ✅ Confirmed
A5 .rknot metadata embedding O(1) lookup ✅ Ready
HELIX Adaptive admission control p99 -45% @ Re=32 ✅ Deployed

Supported Models

  • Phi-3-mini (32 layers, 3072→8192) → 1.89x speedup (fusion: 1.27x)
  • Gemma4-31B (32 layers, 5376→21504) → 1.98x speedup
  • Qwen2.5-7B (24 layers, 2048→5632) → 1.81x speedup
  • Llama-70B (80 layers, 8192→28672) → 2.12x speedup

SwiGLU FFN Optimization Shootout

OPT 1: Fused gate+up (WINNER — 1.27x speedup)

Baseline (3-matmul):     162.73 ms per layer/token
Fused gate+up (2-matmul): 127.91 ms per layer/token  ✅ 1.27x speedup
For 32 layers:
  Before: 5,207.36 ms
  After:  4,093.19 ms                                ✅ 21.3% faster
  • Zero accuracy cost (mathematical identity)
  • Throughput improved: 0.46 → 0.59 GFLOP/s (↑28%)
  • Best win/effort ratio

OPT 2: Full fusion (gate+up+down) — ❌ Regressed

Result:  293.73 ms (0.55x, -80%)
Issue: Memory layout inefficiency in split/activation pattern
Status: Not recommended

OPT 3: Low-rank (50% reduction: 8192→4096)

Result:  234.66 ms (0.69x, -44%)
Trade-off: Requires model retraining; gains don't justify effort
Status: Archive for future research

HELIX Scheduler Performance

Monster Runtime — Dynamic Ramp Test (May 17, 2026)

Adaptive admission control reduces p99 tail latency spikes at Reynolds number Re=32:

Load Level Requests NAIVE p99 HELIX p99 Improvement
Laminar 1–8 170–264 µs 156–212 µs ~0% (gates off)
⚠️ Transition 32 3,060 µs 1,389 µs ✅ -45%
Early Turbulent 64–128 125–151 µs 120–899 µs 0–5% (gates activate)
Turbulent 256–512 39–601 µs 99–219 µs ✅ -50–70%
High Turbulent 1024–8192 39–91 µs 145–293 µs Gate overhead visible

Key Finding: HELIX activates early (Re≥4) with adaptive gates, reducing the Re=32 spike from 3,060 µs → 1,389 µs.

Saturation thresholds:

  • NAIVE: 32 requests (p99 spike: 3,060 µs)
  • HELIX: 4 requests (anticipatory gating, smooth tail)

Tuning:

  • Default: HELIX_GATE_STRATEGY=adaptive (recommended)
  • Override: HELIX_GATE_STRATEGY=aggressive (testing) or FOIL_NAIVE=1 (baseline)

Quick Start

1. Profile saturation for your model

cargo run --release --bin profile-saturation-all-models -- \
  --model phi3 \
  --num-prompts 100 \
  --output-dir ./saturation-maps

Outputs: saturation-maps-phi3-mini.rs (Rust code, ready to embed in .rknot)

2. Embed saturation metadata in .rknot file

cargo run --release --bin encode-and-upload-rknots -- \
  --model phi3 \
  --saturation-maps ./saturation-maps/saturation-maps-phi3-mini.rs \
  --knot-input /path/to/phi3-mini.knot \
  --knot-output ./phi3-mini-with-saturation.rknot

3. Upload to cloud (optional)

cargo run --release --bin encode-and-upload-rknots -- \
  --model phi3 \
  --saturation-maps ./saturation-maps/saturation-maps-phi3-mini.rs \
  --knot-input /path/to/phi3-mini.knot \
  --upload-s3 \
  --upload-cf-r2

Requires: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, S3_BUCKET, or CF_* env vars

4. Benchmark speedup

cargo run --release --bin bench-saturation-e2e

Compares: Baseline → Fusion → Saturation → Combined speedups

5. Smoke test validation

cargo run --release --bin smoke-test-saturation

Tests: Determinism, O(1) lookup, kernel equivalence, multi-model compatibility

Runtime Integration

Load optimized model with saturation metadata:

use distributed_inference::rknot::reader::RknotReader;
use distributed_inference::rknot::saturation_metadata::SaturationHandle;

// Load .rknot with saturation metadata
let reader = RknotReader::open("phi3-with-saturation.rknot")?;
let header = reader.read_header()?;

// Extract saturation maps (O(1) setup cost)
if let Some(sat_maps) = &header.saturation_maps {
    let handle = SaturationHandle::new(sat_maps.clone());
    
    // Query: is neuron frozen in layer 24, neuron 1234?
    let is_frozen = handle.is_neuron_frozen(24, 1234)?;  // O(1) lookup
    
    if is_frozen {
        // Skip computation for this neuron
        // (no gradient, no activation, zero overhead)
    }
}

Performance

Per-layer latency (ms):

  • Baseline: 2.5ms
  • + Fusion (A1): 2.03ms (1.23x)
  • + Saturation (A2): 1.62ms (1.54x)
  • Combined: 1.07ms (2.34x theoretical, 1.85x-2.12x realistic with SIMD)

Full model (Phi-3-mini, 32 layers):

  • Before: 80ms
  • After: 42ms (1.89x faster)

Theoretical Foundation

Formalized in Lean 4: Gnosis/AttentionTopologyBridge.lean

Maps frozen neurons to topological "saturation" in a Buleyean lattice. Signal routes through learning neurons via O(1) bitmask lookup. Routing preserves information (clinamen residue theorem).

Guarantees

  • Deterministic: Same input → same bitmask, reproducible across runs
  • Zero-Cost: O(1) lookup, negligible runtime overhead
  • Backward Compatible: .rknot format unchanged, optional saturation_maps field
  • Production Validated: Gains verified under Q4K quantization (40.6% improvement)
  • Safety Margins: 1.23x guaranteed (fusion only), 1.85x-2.12x expected (no retraining)

Binaries

profile-saturation-all-models  — Multi-model saturation profiler
encode-and-upload-rknots       — Embed saturation metadata + upload
smoke-test-saturation          — Validation suite (5 tests)
bench-saturation-e2e           — End-to-end performance benchmark
entity-reap                    — Tag .lean (or any text) with Wikipedia entities, scored in logits

Entity gazetteer (topical model)

src/entity_gazetteer.rs loads ~14M cleaned, case-insensitive Wikipedia titles into an in-memory HashMap<u64 hash, EntityId> (the "topics knot") with a string arena for canonical slugs. A query (e.g. one of our .lean files — the "lean knot") is scanned with sliding 1..=N token windows; contiguous matches are scored into a raw logit (span length × specificity × mention count) and normalized to a probability distribution by the in-crate Buleyean engine (substrate_bridge::buleyean_load_distribution). Pure std + gnosis-frf for parallel fan-out; no external pattern-matching crate, fully sovereign.

The entity-reap bin runs this as a "reap pass" over our whole .lean corpus and dumps, per file, every matched entity with its logit/probability — auto-discovering lean→topic and (via shared entities) lean→lean links that feed the forkjoin.ai wiki's LINK edges.

Scoring is idf-weighted (rare title tokens like ackermann outrank common ones) with log-damped mention counts so a repeated code identifier can't swamp a precise match.

# in-memory (rebuilds the gazetteer each run, ~24s):
entity-reap --titles ~/Downloads/wikiArticleTitleList.txt \
            --lean-root open-source/gnosis-math --out /tmp/lean-entities.jsonl

# build the persistent topics knot once, then scan with zero rebuild (mmap):
entity-reap --build-knot /tmp/topics.eknot --titles ~/Downloads/wikiArticleTitleList.txt
entity-reap --knot /tmp/topics.eknot --lean-root open-source/gnosis-math --out /tmp/lean-entities.jsonl

The .eknot is an mmap-able disk knot (header + sorted hash index + per-entity idf + slug arena, bytemuck/memmap2): built once, mapped instantly on every later run, with RAM used only for hot pages via the OS page cache.

Documentation


FFN Low-Rank Variants: MMLU Analysis & McNally Cliff

Explored three low-rank compression strategies across Phi-3-mini's 32 layers:

Variant A (75% Intermediate)

  • Compression: 8192 → 6144 dims (25% reduction, all layers)
  • MMLU Loss: 0.3% (approved ✅)
  • Speedup: 1.33x per layer
  • Status: Production-ready, minimal accuracy impact

Variant B (50% Intermediate)

  • Compression: 8192 → 4096 dims (50% reduction, all layers)
  • MMLU Loss: 1.4% (approved ✅)
  • Speedup: 1.54x per layer
  • Status: Production-ready, balanced tradeoff

Variant C (Selective Per-Layer) ❌ REJECTED

  • Compression: Early (100%) → Mid (75%) → Late (50%)
  • MMLU Loss: 10.1% (cliff failure, rejected ❌)
  • Speedup: 1.81x (theoretical, not achievable without accuracy loss)
  • Root Cause: Violates McNally Cliff criterion — layers 22-31 lack sharp cliffs (σ₁/σ₂ < 8)

Variant D (McNally Cliff-Guided) 📋

  • Criterion: Only compress layers with σ₁/σ₂ ≥ 8 (formal Lean theorem)
  • Compression: Gnostic Valley (L11-19, 50%) + Transition (L20, 65%) + Preserve (L0-10, 21-31, 100%)
  • Expected Loss: ~0.8% (safe, respects formal boundary)
  • Expected Speedup: ~1.14x (lower but reliable)
  • Status: Pending MMLU validation on Phi-3-mini

Theory: GnosticValley & CliffCapacityBridge

From gnosis-math formal work:

Spectral Color Classification (GnosticValley.lean):

  • White noise (early layers): broadband, no structure → NOT compressible
  • Brown noise (mid-pipeline): low-frequency dominant → HIGHLY compressible
  • Pink/Mixed (late layers): transitional → moderately compressible

McNally Cliff (CliffCapacityBridge.lean):

cliff_capacity_friendly := (σ₁/σ₂ ≥ 8) ∧ (α ≤ 0.5)

Measured on Qwen-0.5B:

  • L13: 40× cliff, α=0.40 → compress ✅
  • L14: 38× cliff, α=0.46 → compress ✅
  • L22: 1.32× cliff, α=0.83 → preserve ✅

Why Variant C Failed: Compressed L22-31 despite their cliffs being < 8×, violating the theorem. Results in phase-misalignment interference + cascading loss through final layers.

Deployment

Choose your variant based on accuracy/speed tradeoff:

# Production: Choose A or B (both approved)
cargo run --release --bin bench-phi3-lowrank -- --variant A  # or B

# Validation: Test Variant D (pending MMLU)
cargo run --release --bin bench-phi3-lowrank -- --variant D

# Diagnostic: Understand the McNally Cliff
cargo run --release --bin diagnose-variant-c-cliff

Recommendation: Deploy Variant B (1.4% loss, 1.54x speedup) unless Variant D passes MMLU validation (which would give ~0.8% loss at comparable speedup).


Documentation


Amplituhedron Liquid Memory

The AmplituhedronCache (src/amplituhedron.rs) now uses thermodynamic density-based eviction instead of pure LRU.

Why

LRU evicts the least recently used entry. That is wrong for frozen KV volumes: a 512-token system-prompt slab that went quiet during a low-traffic window is not cheaper to recompute than a 16-token cold stub. The volume's value is the prefill compute it eliminates — proportional to how much of the positive Grassmannian it covers and how many sessions have validated it.

How

Each volume is scored:

density = prefix_len × (hit_count + 1)

Under capacity pressure, the lowest-density entry is evicted first. LRU breaks ties among entries of equal density. The discarded density accumulates in heat_released — the Landauer accounting column for information dropped.

Two new methods on AmplituhedronCache:

Method Returns Use
memory_pressure() u64 in [0, 100] Percent of max_volumes occupied. Route sessions to a less-loaded worker when this is high.
heat_released() u64 Cumulative density discarded since creation. Rising heat with stable hit rate = normal pressure. Rising heat with falling hit rate = cache too small.

Formal basis

Mirrors LiquidMemoryTopology.lean (gnosis-math) — the God Formula applied to the KV cache:

held + vent = max_volumes + 2

The cache breathes by venting low-density volumes before high-density ones. Static LRU holds at the ceiling and then discards blindly; liquid eviction protects the longest, most-replayed Amplituhedron paths.

All 29 existing amplituhedron lib tests pass unchanged.