From c0320e54e53ac8a1c10c8de11d6172349f6c67f3 Mon Sep 17 00:00:00 2001 From: AdaWorldAPI Date: Sun, 25 Oct 2026 01:07:34 +0200 Subject: [PATCH 1/3] docs(research): NSL-Lance crosswalk and falsifiable brainstorming scratchpad --- .../2026-10-25/00-brainstorming-scratchpad.md | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 research/2026-10-25/00-brainstorming-scratchpad.md diff --git a/research/2026-10-25/00-brainstorming-scratchpad.md b/research/2026-10-25/00-brainstorming-scratchpad.md new file mode 100644 index 0000000..5c170d7 --- /dev/null +++ b/research/2026-10-25/00-brainstorming-scratchpad.md @@ -0,0 +1,95 @@ +# Research scratchpad: Neural Structured Learning × Lance-graph × ndarray + +**Date:** 2026-10-25 +**Status:** BRAINSTORMING / PROPOSED; not an implementation or a benchmark result. +**Working theory:** structured training signals (graph and adversarial perturbations) can potentially be retained as addressable, verifiable computational relations through inference, rather than discarded once a neural network is trained. An ONNX/TFLite interchange should be decoded at the adapter boundary, not force a persistent tensor object model into Lance-graph. The outcome must be measured, not presumed. + +## 1. Starting evidence, not mythology + +| Reference | Verified in reviewed PR/source | What it does **not** establish | +| --- | --- | --- | +| [TensorFlow NSL](https://www.tensorflow.org/neural_structured_learning) | Explicit graph and implicit adversarial structure improve training in supported workflows; standard inference does not require structure | NSL is not a general-purpose relational reasoning engine | +| [NSL build_graph.py](https://github.com/tensorflow/neural-structured-learning/blob/master/neural_structured_learning/tools/build_graph.py) | L2-normalized embeddings, cosine similarity, LSH-based candidate graph building | Does not imply an acos/cosine roundtrip is happening in every TFLite kernel | +| [NSL pack_nbrs.py](https://github.com/tensorflow/neural-structured-learning/blob/master/neural_structured_learning/tools/pack_nbrs.py) | Neighbor feature materialization into TFRecords with weights and deterministic selection rules | Does not imply such materialization is always the bottleneck | +| [NSL graph_regularization.py](https://github.com/tensorflow/neural-structured-learning/blob/master/neural_structured_learning/keras/graph_regularization.py) | Additional training objective for neighbor logits; direct base-model inference | Does not guarantee full train/export parity under ONNX/TFLite | +| [NSL adversarial_regularization.py](https://github.com/tensorflow/neural-structured-learning/blob/master/neural_structured_learning/keras/adversarial_regularization.py) | Perturbations by loss gradients, with feature configuration | No causal intervention semantics | +| [lance-graph #1758](https://github.com/AdaWorldAPI/lance-graph/pull/1758) | Merged native ULP-bounded ONNX aliases for Tanh/Exp | Not a complete model importer/runner | +| [lance-graph #1762](https://github.com/AdaWorldAPI/lance-graph/pull/1762) | Merged lab: sealed focus lease and gathered facet; no timings | Not DR³ nor production readiness | +| [ndarray #370](https://github.com/AdaWorldAPI/ndarray/pull/370) | Merged generic compile-time Codec8 scheme | Not a complete int8 inference engine | +| [ndarray #371](https://github.com/AdaWorldAPI/ndarray/pull/371) | Closed **unmerged** WASM rounding proposal | Must not treat draft optimizations as shipped | +| [ndarray #372](https://github.com/AdaWorldAPI/ndarray/pull/372), [#373](https://github.com/AdaWorldAPI/ndarray/pull/373) | Merged saturating narrow ladder, with #373 correcting the landing | Do not assume every revision of #372 landed | +| [ndarray #374](https://github.com/AdaWorldAPI/ndarray/pull/374) | Merged one-rounding FMA on backend paths | Do not assume every transcendental is correctly rounded | +| [ndarray #375](https://github.com/AdaWorldAPI/ndarray/pull/375) | Merged gemmlowp/TFLM fixed-point requantization, with independent golden data | No int8×int8 GEMM with zero points and no LUT activations in that PR | +| [tensorflow/rust](https://github.com/tensorflow/rust) | Archived March 17 2026; Rust TensorFlow C API bindings | Not a live dependency strategy | + +## 2. Hypothesis map / independent draft PRs + +| ID | Draft PR | Question | First falsifier / evidence | +| --- | --- | --- | --- | +| H1 | [#1: Graph focus](https://github.com/AdaWorldAPI/neural-structured-learning/pull/1) | Can sealed DR/SoA focus replace copied neighbor features without changing NSL neighbor semantics? | Exact neighbor selection/weights against unmodified NSL; stale seal refuses | +| H2 | [#2: Perturbation](https://github.com/AdaWorldAPI/neural-structured-learning/pull/2) | Can adversarial, geometric and intervention perturbations share a descriptor while retaining distinct meanings? | Coordinate seams, gradient comparison and explicit causal negative control | +| H3 | [#3: Persistent evidence](https://github.com/AdaWorldAPI/neural-structured-learning/pull/3) | Can graph evidence remain queryable at inference without altering neural output? | Identical disabled output, source de-duplication, stale replay refusal | +| H4 | [#4: Model DTO](https://github.com/AdaWorldAPI/neural-structured-learning/pull/4) | Can a pinned ONNX/TFLite graph lower into DR+SoA+RelAlg+SIMD on a restricted operator set? | Independent runtime parity with explicit unsupported-op refusal | +| H5 | [#5: Pairwise LUT](https://github.com/AdaWorldAPI/neural-structured-learning/pull/5) | Does directly tabulating a finite pairwise geometric operation outperform trigonometric or cosine baseline? | Full vs tiled LUT vs real baseline across error, latency and memory | +| H6 | [#6: DR³ hypercube](https://github.com/AdaWorldAPI/neural-structured-learning/pull/6) | Is a 3D address layout better than CSR/COO and SoA for sparse model/ontology/temporal relations? | Lossless addressing, worst-case memory, cache costs, update correctness | +| H7 | [#7: Baselines](https://github.com/AdaWorldAPI/neural-structured-learning/pull/7) | Are the comparisons reproducible and genuinely equivalent? | Frozen NSL Cora/MNIST and independent numerical oracles | + +All seven are DOCUMENTATION-ONLY research PRs, NOT merged code, deployed adapters or already validated performance gains. Implement in appropriate repository after design review; do not scatter speculative functionality across upstream TensorFlow repositories. + +## 3. The core synthesis, with deliberately hard boundaries + +```text +NSL explicit graph ---------------> weighted adjacency / evidence IDs +NSL adversarial examples ---------> gradient-perturbation descriptor +Geometry / sphere / Helix --------> charted coordinate perturbation (separate semantics) +ONNX / TFLite --------------------> pinned graph DTO: nodes, edges, dtypes, + shapes, constants, quantization contract + | | + +-------------+-----------+ + v + candidate substrate: DR64/DR256 mask/focus + SoA values + + RelAlg + ndarray SIMD + / | \ + model evaluation graph querying candidate logic + | | | + +---------- provenance ------------+ + | + temporal replay +``` + +**Important negative assertions:** a neural model graph is not itself a knowledge graph; graph similarity is not causality; a probability is not a proof; DR³ is not interchangeable with arbitrary tensor ranks; a LUT needs a mathematically specified operation and domain; a proof capsule is not independently certified merely because it has a digest. + +## 4. High-leverage experiments, ranked by information gain (not promised feasibility) + +**E0. Replicate truth.** Freeze NSL's Cora graph and MNIST adversarial tutorials (H7). Preserve Python/TF versions, seeds, tolerance and raw results. No large new code dependency yet. + +**E1. Graph adjacency vs gathered focus (H1).** Join `pack_nbrs` oracle to the #1762 lab's lease semantics. Track directed edges, top-K, weights, duplicate and missing neighbors, sealed revisions. Compare equivalent graph loss; run cold/warm focus memory and timing. + +**E2. Small ONNX and TFLite graph DTO (H4).** Reconstruct one micro-model (input → matmul/add → activation). Confirm exact or ULP-bounded output against pinned reference, and TFLM default double-rounding requant. Refuse unsupported op/dtype/version. Do NOT interpret safetensors/GGUF as executable models. + +**E3. Mathematical pair-LUT probe (H5).** On a defined, discrete sphere-direction operation, high-precision table generation and certification, 256² table vs focused/factorized table and real analytic baseline. 256² u8 entries are 64 KiB, frequently too large for small MCU RAM; separately measure ROM, RAM and cycles on named board. Compare multiple composition steps for accumulated drift. + +**E4. Disentangle perturbation (H2).** Contrast gradient-based adversarial NSL examples with coordinate perturbations and explicitly modeled interventions, including two deliberate confusion/negative tests. + +**E5. Evidence channel (H3).** Same neural output with evidence disabled; present proof/refusal states distinct from uncertain beliefs. Duplicate-source replay must not double count. + +**E6. Hypercube benchmark (H6).** 64³ = 262,144 logical cells, 32 KiB dense at one bit/cell; 256³ = 16,777,216 cells, 2 MiB dense. Compare to 2D planes (256² = 8 KiB). Values/indices/cache overhead separate. Try realistic skewed data where hypercube could lose badly. + +## 5. Decision gates and ownership + +- Do **not** merge implementation before an independent parity oracle and explicit refusal tests. +- Original upstream NSL is Python/TF. Proposed Rust experiment can be external, cross-repo, and benchmark-based. Never introduce a TensorFlow C API runtime dependency merely because tensorflow/rust exists; that repository is archived. +- Preserve numeric contracts: #1758 bounded transcendental aliases, #374 exact FMA, #375 TFLM quantization rounding mode, #370 Codec8 code spaces. Never replace these by undocumented approximations. +- No silent clinical validation claims. Synthetic data and public graph benchmarks first, then external clinical supervision and ethical review if pursued for MedCare-rs. +- Open draft hypotheses independently; once falsified, record rejection rather than rewriting history. Cross-repo implementations belong in lance-graph/ndarray only when validated. +- A Horizon healthcare AGI / community-infrastructure application can describe these as a **research agenda** with falsifiers, not a completed AGI system. + +## 6. What could make this original? + +NSL applies structure as a *training signal*. The proposed novelty is structure as a *persisting addressable computational object* across model execution, relational reasoning, perturbation experiments and provenance. This has not been demonstrated by the source repositories reviewed. + +A successful small demonstration would show: same trained neural model result, an independently useful relational neighborhood query, and an evidence-preserving temporal trace, under a documented overhead budget. If the overhead dwarfs the benefit, preserve NSL's simpler training-only approach. + +## 7. Evidence log + +2026-10-25: audited documentation, NSL graph/regularizer/packing source, and specified lance-graph/ndarray PRs. Opened seven draft documentation proposals; **no code compiled, no experiment executed, and no performance measured as part of this scratchpad**. From 821dbd2763443f623822404c70753c7dfbb1ca1b Mon Sep 17 00:00:00 2001 From: AdaWorldAPI Date: Sun, 25 Oct 2026 01:20:45 +0200 Subject: [PATCH 2/3] docs(research): steel-thread experiment linking graph, model, inference and provenance --- .../00a-steel-thread-demonstrator.md | 135 ++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 research/2026-10-25/00a-steel-thread-demonstrator.md diff --git a/research/2026-10-25/00a-steel-thread-demonstrator.md b/research/2026-10-25/00a-steel-thread-demonstrator.md new file mode 100644 index 0000000..84e889d --- /dev/null +++ b/research/2026-10-25/00a-steel-thread-demonstrator.md @@ -0,0 +1,135 @@ +# The steel thread: one falsifiable NSL → DR/SoA → inference → evidence demonstration + +**Status:** design-specification v0. No integrated implementation or new runtime benchmark is claimed. +**Related:** [central scratchpad](00-brainstorming-scratchpad.md), [#1 graph focus](https://github.com/AdaWorldAPI/neural-structured-learning/pull/1), [#3 evidence](https://github.com/AdaWorldAPI/neural-structured-learning/pull/3), [#4 model DTO](https://github.com/AdaWorldAPI/neural-structured-learning/pull/4), [#7 benchmark](https://github.com/AdaWorldAPI/neural-structured-learning/pull/7). + +## 1. The question worth betting a tiny experiment on + +> Can we process the **same identified relations** as NSL training neighbors, as queryable inference-time structure, and as provenance-bearing reasoning evidence, while evaluating one frozen neural model through a **separately verifiable** native operator pipeline? + +Three results would make this a useful experimental milestone: +1. The original TensorFlow NSL training neighbor semantics remain unchanged. +2. Native operator evaluation is numerically compatible with a pinned ONNX/TFLite (or TensorFlow) reference for a small, explicit subset. +3. An inference-time structural query and immutable evidence trace can be produced without changing the original neural prediction. + +The **combined result**, not the breadth of imported technologies, is the scientific claim. Failure to achieve all three still yields useful independent findings. + +## 2. A typed boundary, not a tensor-shaped mythology + +~~~text +SOURCE RECORDS (observations, IDs, metadata) + ├── NSL training graph edge: sample A -> neighbor C, weight 0.9 + ├── Computational dependency: MatMul -> Add -> Tanh + ├── Logical premise: an explicitly typed ontology relation + ├── Event lineage: output derived from model M, source S, revision V + └── Mechanistic causal arrow: ONLY when a structural model justifies it + │ + ▼ + typed identifiers + stable graph digests + declared semantics + │ + ▼ + candidate shared substrate: + DR64 / DR256 address/Boolean masks + SoA typed values; ndarray SIMD scalar/vector operators + RelAlg for relational queries + optional DR³ paging, only if H6 evidence supports it + │ + ┌────┴────────────┐ + ▼ ▼ + numeric inference structural/epistemic sidecar + │ │ + └──────┬──────────┘ + ▼ + typed result + provenance +~~~ + +**Non-equivalence constraints:** +- Data-neighbor graph edge ≠ executable neural graph edge. +- Executable neural edge ≠ causal/mechanistic arrow. +- Semantic ontology relation ≠ model-generated similarity weight. +- A high model score ≠ checked logical theorem. +- An authenticated event digest ≠ independent proof checker. +- Physical x/y/z coordinate axes ≠ arbitrary tensor rank dimensions. + +Addressing can unify access without erasing these distinctions. + +## 3. Frozen three-node toy experiment + +Declare three source examples with two f32 features: +- A = [1.0, 0.0], B = [0.0, 1.0], C = [1.0, 1.0]. +- Directed graph edges: A→C (0.9), A→B (0.5), B→C (0.4); C has no outgoing neighbors. +- max_nbrs=1, choose source-edge semantics **after** graph_utils duplicate-maximum canonicalization. +- Expected packed neighbor IDs: A→[C], B→[C], C→[]. +- NSL's packing copies C's features into two separate examples; a candidate SoA design can store C once and reference it twice. +- Freeze an independent *graph-construction* seed and input order. Do not assert the LSH candidate builder is deterministic without controlling NumPy seed/set iteration and bucket order. + +A deliberately tiny computational graph: +~~~text +f32[batch,2] --MatMul(identity f32[2,2])--> Add([0,0]) + --> Tanh --> output logits/embeddings f32[batch,2] +~~~ +Expected real-valued mathematical oracle: +- t = tanh(1) ≈ 0.7615941559557649 (round to f32 under the chosen reference evaluator). +- h(A)=[t,0], h(B)=[0,t], h(C)=[t,t]. +- A scalar **illustration**, not a claim about NSL's built-in reduction: define local edge score s(A,C)=0.9·||h(A)-h(C)||² = 0.9·t² ≈ 0.5220230925473764. +- Real NSL compatibility must use its configured DistanceConfig, transform, weights, axis and reduction, and compare to the pinned TensorFlow result. Do not hardcode this illustrative score as an NSL golden loss. + +A focused execution: +1. Build directed graph from the exact source fixture, no silent undirecting. +2. Return the exact two selected neighbor batches using the original NSL tie/dedup rules; verify copied NL_* representation. +3. Decode the small model into a typed DTO; reject unsupported operators, shape/dtype/dynamic dimension, and quantization. +4. Evaluate outputs with independent ONNX Runtime reference and only those native kernels whose contracts are established (#1758 Tanh bounded alias; numeric MatMul/Add capability to be verified). +5. Reuse the **same source identity** for C across both neighbor queries; a second reference to C must not create a second independent observation. +6. Emit separate output event and provenance sidecar. With the sidecar disabled, the base-model output must remain unchanged. +7. Change SourceId(index_seal) or model graph digest; stale cache and replay must refuse. + +### A minimal expected trace shape + +~~~text +PredictionEvent { sample: A, model_digest: M1, output: [t,0], + numeric_contract: UlpBounded(2) } +NeighborSelection { seed: A, target: C, weight: 0.9, + graph_source: S1, source_revision: V1 } +NeighborSelection { seed: B, target: C, weight: 0.4, + graph_source: S1, source_revision: V1 } +EvidenceGroup { family: S1, referenced_by: [A,C; B,C], unique_sources: 1 } +ReplayAttempt { source_revision: V2, cached_V1: true, status: REFUSE } +~~~ + +The pseudo-records illustrate expected *properties*, not existing API types, certified proofs or actual run output. The source family is deliberately the same in the duplicate-evidence case. + +## 4. Four independent checks, not one self-confirming harness + +| Gate | Reference/oracle | Outcome required | +| --- | --- | --- | +| Structural | Original NSL graph_utils + pack_nbrs | same directed edges, max-weight duplicate rule, descending (weight, ID), features | +| Numerical | ONNX Runtime / TensorFlow CPU and exact mathematical special-value fixtures | per-node dtype+shape+value compatibility under declared exact or ULP bound | +| Referential | Independent immutable source/version/map table | stale mapping refused, reused C not doubled | +| Epistemic | Independent rule/proof checker where applicable | candidate remains candidate; no proof claim without admissible law + checker | + +**Anti-vacuity mutants:** flip neighbor tiebreak, remove stale-seal check, replace FMA with a known double-rounding witness, double-count source C, promote a similarity edge to causal. Each should fail its relevant gate. A check that stays green under mutation is not evidence. + +## 5. Work packages and ordering + +- **W0: Independent fixtures and reproducible NSL oracle** from #7. Freeze scripts, input digests, build environment, seeds, datasets, and reference outputs. +- **W1: Neighbor crosswalk** from #1. Rust focus vs straight SoA hash map vs original packer. Correctness comes before throughput. +- **W2: Numeric DTO evaluator** from #4. One f32 graph first, then explicit int8/gemmlowp bridge after the missing i8×i8 zero-point accumulator is addressed. +- **W3: Optional structural sidecar** from #3. Keep plain inference fast and comparable, then measure evidentiary cost. +- **W4: Orthogonal excursions** from #2, #5 and #6: spherical perturbation and causal intervention, certified LUTs, DR³ tile layouts. They should not be prerequisites for W0-W3. + +Every work package can report REJECTED when its measured candidate loses to a simpler equivalent baseline. Cross-repo implementation should be assigned to the layer that actually owns it: NSL fork for reference examples, Lance-graph for relation/adapter experiments, ndarray for verified primitives. The *research docs* live together here; speculative production APIs do not. + +## 6. Questions that must remain open + +- Does retaining structure provide **measurable extra utility** at inference, beyond retrieval after inference? +- Are graph-neighbor feature copies material at our scales, or is graph-loss computation the true bottleneck? +- Can we preserve useful learnable structure without trusting similarity edges as mechanistic causes? +- Does DR³ have a density regime where it beats both dense plane and sparse adjacency baselines? +- Does the pair-LUT help on a named MCU **after** flash paging and codebook quantization error are included? +- Does a typed operator DTO survive ONNX/TFLite graph versions, broadcasting, dtypes and quantization without reinventing an opaque tensor runtime? + +If this thin slice succeeds, the next grant claim is modest but distinctive: *a tested relational execution and provenance bridge for structured biomedical AI*. It would not constitute AGI, clinical efficacy, or general tensor replacement. + +## 7. Progress honesty + +This page specifies an experiment. It contains no claim that the integrated run has been implemented, compiled, profiled or clinically evaluated. From 2b333d7b355cfc93c1384e0cbb33fdb64864edad Mon Sep 17 00:00:00 2001 From: AdaWorldAPI Date: Sun, 25 Oct 2026 01:21:07 +0200 Subject: [PATCH 3/3] docs(research): index deep-dives and steel-thread integration order --- .../2026-10-25/00-brainstorming-scratchpad.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/research/2026-10-25/00-brainstorming-scratchpad.md b/research/2026-10-25/00-brainstorming-scratchpad.md index 5c170d7..be2d2bc 100644 --- a/research/2026-10-25/00-brainstorming-scratchpad.md +++ b/research/2026-10-25/00-brainstorming-scratchpad.md @@ -1,5 +1,21 @@ # Research scratchpad: Neural Structured Learning × Lance-graph × ndarray +## Deep-dive index (25 October) + +The eight proposals now have companion, falsifiable specifications. Start with the [steel-thread demonstrator](00a-steel-thread-demonstrator.md): a three-node NSL graph, one tiny typed neural graph, one shared neighbor and an evidence/replay sidecar. This is an experiment design, **not** an implementation. + +| Proposal | Added contract | +| --- | --- | +| [#1 graph focus](https://github.com/AdaWorldAPI/neural-structured-learning/pull/1) | Exact NSL graph dedup/tie rules, directed edges, 12 compatibility fixtures, lease refusals | +| [#2 perturbations](https://github.com/AdaWorldAPI/neural-structured-learning/pull/2) | Gradient vs spherical geometry vs do-interventions, 9 falsifiers | +| [#3 evidence](https://github.com/AdaWorldAPI/neural-structured-learning/pull/3) | Referential, event-temporal and epistemic identity, optional inference sidecar | +| [#4 model DTO](https://github.com/AdaWorldAPI/neural-structured-learning/pull/4) | Typed node/port/shape/quantization contract, ONNX/TFLite refusal matrix | +| [#5 pair LUT](https://github.com/AdaWorldAPI/neural-structured-learning/pull/5) | Distinct cosine/angle/rotation tables, offline code certification, MCU memory accounting | +| [#6 DR³](https://github.com/AdaWorldAPI/neural-structured-learning/pull/6) | Flat and Morton address maps, sparse adversarial workloads, independent CSR baseline | +| [#7 benchmark](https://github.com/AdaWorldAPI/neural-structured-learning/pull/7) | Versioned oracle manifest, nine tasks, eight mutation/negative controls | + +**Execution spine:** #7 → #1 → #4 → #3, with #2/#5/#6 independent until needed. Do not declare a neural, causal or proof law on the strength of shared addressing alone. + **Date:** 2026-10-25 **Status:** BRAINSTORMING / PROPOSED; not an implementation or a benchmark result. **Working theory:** structured training signals (graph and adversarial perturbations) can potentially be retained as addressable, verifiable computational relations through inference, rather than discarded once a neural network is trained. An ONNX/TFLite interchange should be decoded at the adapter boundary, not force a persistent tensor object model into Lance-graph. The outcome must be measured, not presumed.