Skip to content

docs(onnx) S4–S5: reuse BGZ/Helix/ndarray with identity-safe ONNX binding - #1749

Merged
AdaWorldAPI merged 6 commits into
mainfrom
research/d-onnx-relalg-s4-s5-20261023
Oct 23, 2026
Merged

AdaWorldAPI merged 6 commits into
mainfrom
research/d-onnx-relalg-s4-s5-20261023

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

S4–S5: reuse existing BGZ / Helix / ndarray, identity-safe ONNX admission, export and cold codegen

Status: documentation-only integration/falsification draft. Correction: Palette256, BGZ and SIMD tensor execution are not greenfield features.

Already implemented (inspected current sources)

Owner Existing assets
lance-graph/crates/bgz-tensor WeightPalette/calibrated codebooks, FisherZTable + FamilyGamma, 256² distance and ComposeTable
lance-graph/crates/helix RollingFloor, Fisher-Z aligned residue, DistanceLut linear/circular, 256² tables; circular metric checked across 256³ triples
lance-graph/crates/bgz17 Base17, layered distance and palette codebooks
AdaWorldAPI/ndarray Burn CompiledAttention (PR #42), CompiledLinear (PR #100), SIMD tanh, VNNI/scalar and NEON tiers, conventional MatMul fallback

bgz-tensor/src/fisher_z.rs reports ρ≥0.999 for 21 Qwen3-TTS roles at 5,000 sampled pairs each. This is scoped empirical quality evidence, not universal ONNX equivalence or a theorem. #1726/#1731 refute specific multi-hop LUT composition rules, not Palette256 as a whole. CI coverage gap EXO-137 and FisherZ out-of-family silent saturation EXO-139 remain separately owned gates.

P0: compiled-cache binding is insufficient for general ONNX

Actual Burn MatMul first attempts CompiledLinear selected by (m,k), then CompiledAttention selected by d_head=k, then ordinary GEMM. CompiledAttention ignores current Q/K operand values and uses prior palette assignments; CompiledLinear ignores current weight lhs and performs approximate centroid/quantized accumulation with incomplete zero-point correction.

Never transparently intercept arbitrary ONNX MatMul by shape. Require source-issued model/graph/node/layer/weight identity, original tensor/codebook digest, calibration version, assignments, dtype/shape/layout, frame/focus/scope and invalidation policy. Until approved and tested: conventional native numeric kernel or typed refusal. Approximate palette output must have an explicit opt-in quality/error contract.

Revised S4

Reuse, bind, classify and validate existing kernels, calibration and quantified numerical methods. Start with existing Burn float_tanh → ndarray::hpc::vml::vstanh independent ONNX Tanh parity. For model-specific compiled attention and centroid linear, pre-register same-shape/wrong-model, stale-codebook, wrong-Q/K and signed/quantization negative controls. Preserve Helix Overlap & Consolidation plan; do not create another codec, quantizer, neural AST or runtime executor. Learning/plasticity are typed state transitions, not theorem proofs.

Revised S5

Subset-scoped ONNX import/export; custom domain ≠ portable runtime support; reuse existing R2IL/ndarray SIMD and cold certification. #1742 retains egglog ProofStore/ProofId, but there is no independent proof checker. #1707/#1740 are bounded Boolean/Distinct laws/reuse, not general float certificates. LLVM/JIT and mixed graph execution remain separate research decisions based on #1748 measurements.

Gates: identity-safe registration, typed exact-vs-approx semantics, independent numerical oracle + held-out model quality, CI enforcement of applicable tests, prepared/cold cost accounting and cross-repo ownership. No new code, ABI change, or merge authorized.

Links and ownership

Plans: #1746 semantic dispatch, #1747 focus binding, #1748 four-lane differential quality/cost competition. S0 collision #1744 / #1745 / #1750: owner ruling via EXO-50.
Code: BGZ FisherZ, Helix Distance, Burn MatMul, ndarray tanh.
Known falsifiers: #1726, #1731, Linear EXO-129, EXO-132, EXO-137, EXO-139.


Separated Optimum cold frontend: #1751

#1751 now owns offline Optimum source inventory, model export/validation, calibration workflow reuse, optional sidecar/manifest and first BERT-layer conversion probe. THIS PR retains native existing BGZ/Helix/ndarray admission, identity-safe compiled-method selection, approximation contracts, ONNX export/codegen review. Do not duplicate Optimum exporter, Palette256 codec, AST or runtime. ORTQuantizer/ORT data reader do NOT automatically produce BGZ codebooks; CompiledAttention/CompiledLinear remain unsafe for arbitrary ONNX MatMul without strong model/layer/weight/codebook binding. S0 collision #1744/#1745/#1750, ONNX/protobuf fork and target-model decisions remain operator-owned.

⊘ Supersession — D-NFC (2026-10-23, operator-approved architecture correction)

Canonical dependency diagram and root assumptions: #1753 (d-native-first-dependency-correction-v1.md); shipped / lab / missing seams: d-native-repr-contract-v1.md there.

P0 invariants. (1) ONNX is an external mathematical compatibility specification; the existing R2IL polyfill is the native starting point; no ONNX graph, Tract runtime or Optimum dependency in the internal execution path. (2) Quack binding + DR64³ + Palette256³ is the intended native representation; existing R2IL, mask-risc, BGZ, Helix and ndarray primitives are reused; implemented components and unimplemented integration contracts are kept apart.

[1] R2IL router (once per ClassId; strategies SHIPPED, #1752) → [2] Quack binding (SHIPPED; store MISSING)
→ [3] DR64³ geometry (LAB; 3rd axis PROPOSED) → [4] Palette256³ (SHIPPED; DR binding MISSING)
→ [5] native execution: mask-risc + ndarray::simd (SHIPPED) → [6] egglog laws (LAB, Boolean only)
→ [7] ONNX conformance adapters (PROPOSED) → [8] Tract/ORT oracles, Optimum (OPTIONAL)

⊘ Layer [1] correction (2026-10-23, #1753 commit ace69d64c, #1752 plan §10). Layer [1] is the R2IL router, which resolves a route once per ClassId: DIRECT or COMPOSE onto ndarray::simd, LOWER to r2sleigh only for machine semantics, or REFUSE. lance-graph-r2il procedures + FoldDialect are one strategy beneath it, not the layer. No operation in this plan needs R2Sleigh.

For this PR:

  1. Quack binding + DR64³ + Palette256³ is the intended internal integration. GraphProto owns no internal representation (A1).
  2. Dispatch. Internally a native typed operation selects an existing kernel. "ONNX operator → existing method" is the external conformance adapter [7], not the internal contract (A1).
  3. Compiled-artifact identity is the native binding: Quack resolution under a sealed frame plus a codebook generation. Codebook runtime identity is MISSING today (D-NFR S15) and is the precondition for admitting any CompiledLinear / CompiledAttention; ONNX model / layer / node identity is external provenance (A7).
  4. OP-ONNX-2 (importer, protobuf fork) and O1 model selection gate only the optional external-file adapter, not native S4 (A2).
  5. Exact versus approximate is unchanged: approximate methods are opt-in with a named error contract and the exact native method as fallback.

Where this description or the plan says otherwise, it is superseded at the marked ⊘ points (plan commit af9eb0de3). Nothing is merged, no ABI or execution contract changes, and the #1744 / #1745 / #1750 S0 dispute is unchanged.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 07ab8775-5160-432d-bd8e-f15d415315e7
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

AdaWorldAPI and others added 2 commits October 23, 2026 22:24
Architecture correction approved by the operator on 2026-10-23. Adds one
marked supersession block under the title and inline markers on the
sentences that state a root assumption (A1-A7). Canonical text and the
representation seams are in #1753
(d-native-first-dependency-correction-v1.md, d-native-repr-contract-v1.md).
No other text in this plan changes; the #1744/#1745/#1750 S0 dispute is
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 23, 2026 22:13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T22:14:00.515252Z af9eb0d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…1754)

Marked supersession: 'R2IL polyfill' reads as the R2IL router
(D-MPF-4), and [7] is the lance-graph-onnx leaf facade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
@AdaWorldAPI
AdaWorldAPI merged commit f6e275a into main Oct 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants