Papers
Topics
Authors
Recent
Search
2000 character limit reached

Colored Markov polycategories and diagrammatic differentiation

Published 30 Apr 2026 in math.CT | (2604.27959v1)

Abstract: Many stochastic systems are built by wiring typed components together, but the wiring is often neither purely sequential nor type-homogeneous. This paper develops categorical semantics for such systems using ordered polycategories whose morphisms are Markov kernels. The basic operation is kernel slotwise composition, which connects one output slot of a many-output kernel to one input slot of another and marginalizes the internal wire. We prove its structural laws by assigning trace semantics to finite acyclic diagrams. We then introduce colored Markov polycategories, where objects and kernels carry colors and typed connections are realized by coherent interface kernels. This gives a colored kernel slotwise composition and trace semantics for typed stochastic diagrams. To describe systems whose structure changes, we co-index colored Markov polycategories and parameter spaces over an indexing category. Finally, for finite acyclic parameterized diagrams, we prove a diagrammatic differentiation result. The derivative of an expected scalar objective is obtained from local reverse-mode contributions at the parameterized vertices, with stochastic and deterministic kernels handled through admissible local gradient operators. The construction gives a typed, compositional language for finite acyclic stochastic systems and their parameter sensitivities.

Authors (1)

Summary

  • The paper introduces a categorical framework that unifies ordered polycategories with Markov kernels to model complex, acyclic, and type-sensitive stochastic systems.
  • It rigorously defines a reverse-mode differentiation procedure by locally computing gradients via admissible gradient operators and a diagrammatic sum over vertices.
  • The framework generalizes Bayesian-network marginalization by extending composition to typed systems using interface kernels for accurate probabilistic and structural semantics.

Colored Markov Polycategories and Diagrammatic Differentiation: Technical Summary

Introduction

The paper "Colored Markov polycategories and diagrammatic differentiation" (2604.27959) introduces a categorical framework for describing finite acyclic stochastic systems of locally parameterized Markov kernels with complex, type-sensitive wiring. The approach merges ordered polycategories with the semantics of Markov kernels, extends the expressivity of categorical probability formalism to typed systems, and rigorously defines a reverse-mode differentiation procedure for expected objectives evaluated on such structures.

Polycategorical Markov Kernel Semantics

The foundational construct is the ordered polycategory whose morphisms are Markov kernels between standard Borel spaces. Unlike multicategories (with many-input, single-output morphisms), polycategories support many-input, many-output morphisms, capturing the true wiring complexity of realistic stochastic systems composed of heterogeneous modules.

The basic composition operation is kernel slotwise composition (KSC), which wires the ii-th output of one kernel to the jj-th input of another, and marginalizes over the internal variable. The semantics of arbitrary finite acyclic diagrams—so-called KSC diagrams—is established via trace semantics, which iteratively integrates over all internal wires, yielding a unique marginal Markov kernel from the external inputs to outputs. The framework recovers standard Bayesian-network marginalization as a special case, but supports arbitrary acyclic, type-heterogeneous wiring diagrams.

Colored Markov Polycategories and Typed Interfaces

To model typed (heterogeneous) systems, colored Markov polycategories (CMPs) are introduced. Objects and morphisms in a CMP are assigned colors:

  • Object colors (organized as a category K) classify the types carried by wires
  • Morphism colors (in a polycategory M) type the "boxes" (kernels).

Slotwise composability is relaxed via admissible interface witnesses: two slots with compatible but not necessarily equal object colors may be composed, provided an interface kernel is supplied to translate between types at the probability-semantic level. These interface kernels must satisfy coherence with respect to color-category identities and composition.

The resulting colored KSC (CKSC) operation generalizes kernel composition to typed settings, ensuring that both the combinatorics of types and stochastic semantics are respected. The structural laws (associativity, interchange, unitality) are preserved at the typed level, and the semantics of arbitrary finite acyclic typed diagrams (CKSC diagrams) is again given by marginalizing via inserted interface kernels.

Co-Indexed CMPs and Dynamic Systems

The framework incorporates dynamics and system reconfiguration via co-indexed colored Markov polycategories (CCMPs). A CCMP is organized over an indexing category TT (e.g., for time, system states, or configuration changes), functorially assigning at each t∈Tt\in T a typed Markov polycategory PtP_t and a parameter space Θt\Theta_t. Morphisms in TT act via structure-preserving pushforwards—CMP-functors and differentiable maps on parameter spaces—enabling the description of dynamically evolving, reconfigurable stochastic systems (for example, dynamic probabilistic graphical models on graphs with mutable structure).

CMP-functors are required to strictly preserve object/morphism colors, interface kernels, and the semantics of typed diagrams.

Diagrammatic Differentiation

For learning and sensitivity analysis, the paper devises a reverse-mode differentiation theorem for finite acyclic parameterized CKSC diagrams. All diagram shape and interface witnesses are fixed; only vertex kernels are parameterized. The main results include:

  • Given a parameterized CKSC diagram, an expected scalar objective is defined by post-composing with a deterministic (measurable) objective kernel and integrating over external input/reference data.
  • Differentiation is accomplished locally: each non-interface vertex admits an admissible local gradient operator (supporting both likelihood-ratio and pathwise rules), and under mild measurability and regularity hypotheses, the gradient of the global objective with respect to all parameters is computed by the expectation over the trace law of a diagrammatic sum of local contributions, each depending only on local trace variables and the local objective downstream of the vertex.
  • The result generalizes categorical reverse-mode AD to typed, compositional, acyclic stochastic diagrams, respecting arbitrary wiring and interface transformations.

The framework also formalizes how parameter gradients transport through system transitions by functoriality—combining fiberwise diagrammatic differentiation with the chain rule for parameter pushforwards between states.

Strong Results and Contrasts

  • Compositionality: The semantics and differentiation are invariant (up to measurable isomorphism) under all orderings and bracketing patterns compatible with the diagram wiring (via associativity and interchange for polycategories).
  • Generalization: The theory supports arbitrary finite acyclic diagrams, general object/morphism typing, and interface kernels representing deterministic or stochastic type transformations.
  • Rigorous Trace Semantics: The uniqueness and measurability of the composite kernel resulting from a diagram are formally ensured under standard Borel and acyclicity assumptions—even in the presence of type-heterogeneous, non-sequential compositions.
  • Local Differentiability: The reverse-mode differentiation expression is provably reduced to local expectations at each vertex, under only local differentiability and regularity conditions—without requiring the entire system to admit a global density or differentiable factorization.

Implications and Future Directions

Practical Implications:

  • Provides a rigorous semantics for the design of compositional, modular, and type-safe probabilistic programming languages and differentiable programming frameworks.
  • Enables systematic sensitivity analysis and gradient-based learning for complex structured models where componentwise wiring and types do not fit the classical sequential or homogeneous assumptions.

Theoretical Implications:

  • Bridges Markov categories, polycategory theory, and modern differentiation theory, extending categorical probability to typed, compositional, and differentiable settings.
  • Lays categorical groundwork for further research into Bayesian learning, categorical probability inversion, decision theory, and compositional game theory.

Future Work:

  • Bayesian Extensions: Incorporating priors, posterior updates, and formal Bayesian inversion via string diagrams and Markov category conditioning.
  • Generalized Structure: Adapting the framework to cyclic (feedback) diagrams using advanced categorical constructions (e.g., traced or guarded categories) and extending structural morphisms for copying and discarding.
  • Comparative Semantics: Relating diagrammatic differentiation here to other categorical differentiation approaches, such as lenses, parametrized maps, and reverse derivative categories.
  • Learning Interface Kernels: Treating interface kernels themselves as parameterized objects to support more adaptive type conversions.

Conclusion

This work provides a rigorous, compositional, and extensible categorical foundation for the semantics and differentiation of typed stochastic systems, unifying wiring, typing, and sensitivity analysis in a polycategorical Markovian context. Its development of diagrammatic differentiation for finite acyclic typed diagrams broadens both the formal and practical horizons for differentiable programming and categorical probability theory.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 1 tweet with 34 likes about this paper.