This is a version that's trying to stay minimal in scope, while showcasing the use cases. The algebraic formulation is the one that seems the most straight-forward to understand and immiediately useful (as you can see from the example implementations), but the same generic idea seems to work all the way up to category theory (at least in practice, the solutions based on that work on real data). It's a one person project with heavy Google Gemini usage, any corrections, bug fixes, etc. are welcome.
This was used to extract the geometric shapes iniside LLMs, allowing for in-process better hallucination detection and aligment. It also work for analyzing open scientific data sets.
This repository contains the mathematical theory, Lean 4 formalisations, unified CPU/CUDA Python packages, interactive scientific workbenches, and official OpenProblems.bio v2 method submissions for Multi-Observer Algebra (multiobserver).
Whenever an underlying state
cross-observer covariance separates shared signal from observer-private noise in closed form, without ground-truth labels or neural-network SGD.
.
βββ justfile # Root launcher for all UIs, servers, Marimo notebooks & tests
βββ papers/ # Core papers, companion papers, build scripts & Lean 4 proofs
β βββ minimal_core_essay.{typ,pdf}# Accessible essay + self-contained ordered-field core
β βββ minimal_core.{typ,pdf} # Self-contained algebraic core & Four Hard Limits
β βββ lean/ # Zero-dependency Lean 4 Core proofs (0 sorry, 0 custom axioms)
β βββ extras/ # Applied companion papers (usability & LLM alignment)
βββ code/
β βββ packages/ # Unified uv Python workspace (core math, workbenches & LLM tools)
β β βββ multiobserver/ # Single-source CPU (NumPy) + GPU (PyTorch CUDA) math engine
β β βββ observer-lab/ # Scientific workbench CLI (`observer`) + Vue 3 / WASM Typst UI
β β βββ unbundle/ # Epistemic provenance store, gates & subspace-protected quantization
β β βββ statedrive/ # Cross-model state algebra, biorthogonal dials & voice enactment
β β βββ observer-llm/ # Multi-observer LLM onboarding, spherical steering & OpenAI /v1 server
β β βββ llm-cartography/ # Category-blind all-layer LLM tomography & 7-tab WebGPU workbench
β βββ openproblems-submission/ # 6 Viash method components across 13 OpenProblems.bio v2 benchmarks
βββ visualizations/ # Standalone interactive 5-step geometric visual companion
Defines the exact algebraic laws and hard identifiability limits implemented across code/:
| File / Folder | What It Does |
|---|---|
papers/minimal_core_essay.pdf |
Plain-language introduction + complete ordered-field derivation of how three imperfect views calibrate each other without a gold standard. |
papers/minimal_core.pdf |
Formal derivation of the Matrix Three-Cornered Hat, rational corrective glasses (zero square roots), precision fusion, Regime vs. Conflict OOD decomposition, solo deployment, and theFour Hard Limits (unanchored coordinates, the |
papers/lean/ |
Zero-dependency Lean 4 Core proofs ( MinimalCore.lean βInit only,0 sorry ,0 custom axioms). |
papers/extras/ |
Applied companions: usability_guide.pdf (sensors & clinical monitors) andalignment_cartography.pdf (LLM output-masking tomography). |
Single-source library (code/packages/multiobserver/README.md) implementing every estimator against a unified ArrayBackend (NumPyBackend on CPU with zero scipy/ sklearn/ torch imports; TorchBackend inside torch.inference_mode() on CUDA GPUs, including matrix-free cuSPARSE CSR operators for max_dim=None full-transcriptome count matrices):
| Module / Class | What It Does |
|---|---|
Observer ,Linear ,Log1p ,Periodic (RAD ,DEG ,TURN ) |
Explicit physical sensor wrappers ( multiobserver.units ). TransformsPeriodic ontoLog1p +exposure ("none" ,"row_sum" ,"cp10k" )once on ingest in |
audit_observers |
Step-1 epistemic audit using the Wachter Jacobi-ensemble edge to verify |
MinimalCoreAlgebra |
Exact closed-form Three-Cornered Hat separating common signal from dense private noise covariances |
MultiObserverCalculus |
General EM / Two-Level Laird-Ware ( groups=batch ) multi-observer latent state & uncertainty estimator (max_dim=None matrix-free sparse/chunked ops,.infer_aligned() Fisher-metric + Product-of-ExpertsSigma_PoE Bures-Wasserstein group covariance calibration, Student-$t_\nu$ glitch downweighting,nan_policy="marginalize" ). |
SupervisedMultiObserver &ClassificationMultiObserver |
Closed-form Bayesian Errors-in-Variables (EIV) continuous and multi-class readouts that propagate posterior latent covariance |
Harmonic* (HarmonicSupervisedMultiObserver ,HarmonicClassificationMultiObserver ) |
Algebraic H4 : Li (1992) Stein canonical |
MultiObserverStructure &MultiObserverDynamics |
Multi-environment EIV causal graph discovery + Pearl do() interventions (structure ), and Kalman/RTS smoothing + Weak-SINDy ODE discovery + RK4 rollouts (dynamics ). |
ForwardRuntime (multiobserver.deploy ) |
Single-file ( stdlib +numpy only) standalone edge inference runtime .save_npz() archives across CPU/GPU boundaries. |
CLI and web application (code/packages/observer-lab/README.md) wrapping multiobserver with automated diagnostics, declarative .toml configs, and an interactive browser UI:
observer CLI & 1-Line SDK (observer_lab/cli.py, observer_lab/convenience.py): Commands observer doctor ,observer presets ,observer inspect ,observer init (MAR-grouped & count-awarestudy.toml scaffolding),observer audit ,observer audit-preset ,observer explain (native-unit channel attributions),observer predict ,observer translate ,observer denoise , andobserver ui --port 8770 , plus 1-lineol.audit(...) /model.explain(...) supporting in-memory DataFrames, liveAnnData objects, zero-copy.h5ad CSR matrices, and automatic$M=1 \to M=3$ wide-matrix partitioning. #
Declarative study.toml / project.toml (StudyConfig in observer_lab/spec.py): Configures mode ,enforce_raw_data ,allow_joint ,allow_harmonic ,target_unit ,target_exposure , and per-observer[observer_specs.<name>] (unit ,scale_policy ,exposure ,scrub_sink ). #
14 Deterministic Validity Checks (V00β V13 in observer_lab/checks/): Audits raw-data hygiene & synced clones (V00 ,V06 ), row alignment (V01 ), entity/clock leakage (V02 ), circular seams + partial-panel exposure / sparse channel-scale / raw-count sensor physics (V03 ), foundation-model attention sinks (V04 ), batch-target confounding + automatic PoE-Bures frame alignment on single-batch variance bursts (V05 ,V08 ), Corollary 2 over-identification (V07 ), H4 / Student-$t$ gates (V09 ,V10 ), honest baselines (V11 ), conformal 95% intervals + 2-axis Regime/Conflict OOD (V12 ), and.npz runtime parity (V13 ). #
5-Workspace Vue 3 + ECharts + WebAssembly Typst UI (observer_lab/ui/): Interactive data onboarding, validity scorecard, SNR/Solo-Glasses explorer, unseen holdout scorer, and browser WebAssembly Typst PDF preview (just observer ).
Self-contained, PR-ready Viash method components (observer_algebra, code/openproblems-submission/README.md) evaluated across 6 official OpenProblems.bio v2 tasks (13 held-out benchmarks):
| Component / Script | What It Does |
|---|---|
prepare_local_submission.py |
Verifies no vendored multiobserver/ source exists intask_*/src/methods/observer_algebra/ , validatesconfig.vsh.yaml (Git pull ofmultiobserver ) +project.toml , and simulates isolatedviash test against.h5ad slot contracts. |
run_official_benchmarks.py |
Executes all 6 Viash script.py components as isolated subprocesses across 13 official OpenProblems splits under both--profile best (results/openproblems_official_results.json ) and--profile strict (results/openproblems_strict_zero_peeking_results.json , universal zero-peeking & strictly inductive |
build_report.py |
Stdlib-only generator producing global, dual-profile & per-task SVG figures, README summaries, and report/openproblems_observer_report.pdf . |
task_predict_modality |
Cross-modality translation ( GEX <-> ADT ,GEX <-> ATAC ) on 100% unmodified rawlayers["counts"] (max_dim=None ), persisted via.save_npz() before mapping predicted counts to OpenProblems' output evaluation slot (clr ,log_cp10k ,atac_tfidf ). |
task_spatially_variable_genes |
Spatial characteristic-function H4 variance-fraction test across isotropic physical tissue coordinates obsm["spatial"] and raw spot counts (layers["counts"] ). |
task_label_projection |
Donor-invariant Stein-H4 cell-type transfer across all 27kβ30k raw genes ( max_dim=None , up to 330k cells and 17 organs). |
task_batch_integration |
Strictly unsupervised Two-Level Laird-Ware + PoE-Bures infer_aligned integration across all 30,561 raw genes (groups=batch ), achieving#5 / 20 (0.5512 , beatingfastMNN ,ComBat ,scANVI , andscVI ) without altering counts. |
task_foundation_models |
Training-donor consensus across unreduced Geneformer-V2 (768-D),scGPT (512-D),ESM-2 (480-D), and all 30,561 raw count genes (#1 / 9 overall,0.7514 , zerosolution.h5ad access). |
task_perturbation_prediction |
Cross-cell-type compound (OP3 + SMILES) and CRISPRi ( PIE_replogle_nadig ) transcriptome response prediction withaudit_observers layer pruning and optional transductive H4id_map refinement (--disable_pseudolabel toggle). |
See code/packages/README.md for details on each companion package, and code/packages/MULTI_LLM_GUIDE.md for a complete cookbook on calibrating and using multiple frozen LLMs together (.npz sidecar glasses, zero-label cross-model probe transfer, StateBus state translation & 1 Large + 2 Small fleet calibration):
unbundle: Separates LLM reasoning from static facts via intact-unit provenance indexing (ProvenanceStore), hidden-state epistemic gates (ThreeBandGate,HorizonGate), and subspace-protectedINT2/INT3/INT4weight surgery.statedrive: Common-mode-deconfounded stance banks (StanceBank), biorthogonal control dials (DialBank), cross-modelStateBustransfer, and LLM-to-voice prosody enactment.observer-llm: GPU-native multi-observer LLM onboarding, VJP-calibrated spherical steering (SteerPlan), lossless suffix speculative decoding, and an OpenAI-compatible/v1server (just observer-llm).llm-cartography: All-layer (L0 .. L_max) category-blind LLM representation tomography, alignment/masking scanner, and 7-tab Vue 3 + WebGPU workbench (just cartography).
Across observer-lab and openproblems-submission, callers never pre-normalize, HVG-filter, or PCA-truncate raw measurements (layers["normalized"] and obsm["X_pca"] are dropped on input; Observer.data is never mutated). Instead, sensor physics is declared explicitly on each Observer (or in project.toml):
| Setting | Options | Meaning |
|---|---|---|
unit |
"linear" ,"log1p" ,"deg" ,"rad" ,"periodic:<P>" |
Sensor chart: additive Linear , multiplicative count/absorbanceLog1p ((1) ofminimal_core.pdf ), or circularPeriodic lifted onto |
scale_policy |
"per_channel" ,"isotropic" ,"poisson_shot" |
Internal channel standardization: per-channel variance ( per_channel ), uniform observer-wide scalar RMS (isotropic , avoiding rare-channel noise inflation whenmax_dim=None ), or Negative-Binomial shot scale (poisson_shot ). |
exposure |
"none" ,"row_sum" ,"cp10k" |
Row-wise total-exposure scaling applied once on ingest in row_sum normalizes to training mean depth;cp10k normalizes to10,000 counts per row). |
From the repository root:
just
just observer # Observer Lab Scientific Workbench + WASM Typst Preview (:8770)
just cartography # LLM Cartography 7-tab Workbench (:8787)
just observer-llm # Multi-Observer LLM OpenAI /v1 Server + Chat UI
just marimo # Central Marimo hub with interactive notebooks (:2718)
just test-all
just test-marimo
cd papers && ./build.sh && lean lean/MinimalCore.lean
cd code/openproblems-submission
just prepare # Validate pull-based PR dirs & test all 6 Viash contracts offline
just benchmark # Run all 13 official OpenProblems benchmarks
just report # Regenerate all SVGs, Typst source & PDF report
just lint # Verify zero ruff lint warnings
- Code, scripts & Lean 4 formalisations (
code/**,visualizations/**,papers/lean/**,papers/*.sh,justfile):Apache-2.0 Β© 2026 Robert BΔ k β seeNOTICE for attribution notices that must be preserved in redistributions. - Papers, essays, reports & figures (
papers/**/*.typ,papers/**/*.pdf,papers/**/*.svg, and generated benchmark reports/figures):CC BY 4.0 Β© 2026 Robert BΔ k. - Citation: SeeCITATION.cff (or GitHub's*"Cite this repository"* button).
- Contact: Robert BΔ k βrobert_d_bak@pm.me
Pre-built front-end bundles checked into this repository embed third-party code (Vue, naive-ui β MIT; ECharts, typst.ts and the Typst WASM compiler β Apache-2.0). See THIRD_PARTY_NOTICES.md for the required attribution, and for the data-use terms of the public and credentialed-access datasets used in the examples and benchmarks.