Reconciling AutoBayes’ with ImplicitREDDiff’s .
Sources: original to this vault (design and analysis; no single paper).
Theory (CT-ML wiki): Compact Closed Category · Bayesian Inversion · Open Model · Lens
The two trichotomies
AutoBayes (Definition 1) gives every model three spaces:
| AutoBayes name | role | |
|---|---|---|
| unobserved | inferred; the posterior is over this | |
| observed | clamped to data | |
| latent | internal scratch, revealed or marginalised |
ImplicitREDDiff gives every factor three diagonal selection matrices with and pairwise-zero products, assembling a precision-weighted projector
The names cross over — read this twice
AutoBayes’ unobserved is the thing you solve for, i.e. the note’s output . AutoBayes’ observed is the thing you clamp, i.e. the input .
The inversion runs input → output in the note’s sense. The forward kernel runs the other way. The mismatch is real, not a typo in either source: “observed” is a statistical word about data availability, “input” is an operational word about evaluation order, and in Bayesian inference those point in opposite directions.
Notation used in this vault
The rest of the vault uses one convention, the machine-learning one, because it is what most readers bring:
| symbol | role | polarity | selection | AutoBayes |
|---|---|---|---|---|
| , | the joint space of a factor, a point of it | — | ||
| , | inputs: clamped to evidence | Observed() | ||
| , | outputs: solved for | Unobserved() | ||
| , | latents: internal | Latent() | $\llbracket c | |
| rbracket$ | ||||
| the evidence: clamp values on , anchors elsewhere | ||||
| $ | ||||
| ho$ | per-coordinate precision; = hard clamp, = free |
So our is AutoBayes’ and our is AutoBayes’ . Notes that quote AutoBayes definitions use its letters and say so; everywhere else the table above holds. Papers with their own letters (RED-Diff’s and , ProxDM’s ) get a one-line notice in the note that discusses them, and are then translated. Where a family has an entrenched name for the joint state, such as the DEQ’s hidden state , it is the latent of this table when the DEQ is read as a relation.
Once that is said, the correspondence is exact, and has a clean reading: the precision with which each block is clamped. is a hard clamp (a cup); leaves the block free.
Why polarity must be dynamic
A Lux layer has a fixed direction. A Lenticulum factor is a relation and has none: the same factor can be asked for given , or given , or neither given nothing.
Categorically this is compact closure: the cup and cap let you
bend any leg from unobserved to observed and back. Operationally it means a factor’s
get/put pair does not exist until you choose. Hence:
Factor + Polarity ──► parametric lens ──► message
The data type
A channel is a named port of a factor with a space attached. A polarity is an assignment of one of three states to each channel:
abstract type ChannelPolarity end
struct Observed <: ChannelPolarity end # input X (AutoBayes Y) / P_in / clamped to data
struct Unobserved<: ChannelPolarity end # output Y (AutoBayes X) / P_out / inferred, posterior over it
struct Latent <: ChannelPolarity end # latent U (AutoBayes ⟦c⟧) / P_latent / internal, marginal or revealedwith Polarity a NamedTuple{names} of these. The type-level names means a polarised
factor’s lens type is known at compile time and Julia can specialise the assembled kernel —
this is the payoff for putting the polarity in the type domain rather than a runtime Dict.
Legality
Not every polarity is legal for every factor. A Gaussian(μ, σ) factor can be inverted
for μ given x and σ, but a factor whose forward kernel is a one-way hash cannot be
inverted at all. So a factor declares which polarities it supports:
supports_polarity(factor, pol)::Booland a graph compiles only if every scheduled message uses a supported polarity. The DAG restriction of Lux is replaced by a polarity-legality check. That is the concrete form the README’s “arbitrary connected graph” claim takes in the type system.
The three ways a polarity can be realised
| how the factor answers a polarity | model family | cost |
|---|---|---|
| closed form (conjugate, invertible map) | Gaussian/linear, normalising flows | cheap |
| root-finding on a residual | algebraic varieties, DEQ, NeuralODE | Newton/fixed point |
| proximal step on an energy | diffusion / RED-Diff | iterative denoising |
These are exactly the three families of Implicit Learners. Which one is available is a property of the factor; the graph does not need to know, which is the point of the abstraction.
Polarities are Prolog's modes, and Mercury checks them statically
A logic-programming predicate has no fixed direction either, and which arguments are bound at the call site is its mode. Mercury is Prolog with a statically-verified mode and determinism system — the precedent for making
supports_polaritydecided rather than declared. See Prolog and Logic Programming §2.
Related: Prolog and Logic Programming, Open Models and Latent Channels, Open Models and Latent Channels, Implicit Learners, ImplicitREDDiff, channels, The Table Revisited, Geometric Deep Learning and Physical Laws