SSGF (Self-Stabilizing Gauge Field)

July 7, 2026 · View on GitHub

The SSGF subsystem implements a two-timescale geometry control engine. It treats the coupling matrix $ (the "geometry") as a dynamic carrier field that self-organizes to minimize the free energy of the phase dynamics.

Gauged PGBO (Phase-Geometry Bidirectional Observer)

The Gauged PGBO is the primary observer for SSGF integration. It measures the alignment between the current phase-coherence manifold and the geometric coupling field $.

Unlike standard observers that measure linear correlation, the Gauged PGBO computes a scalar curvature proxy based on the rank-2 metric tensor {\mu\nu}$:

936898 h_{ij} = W_{ij} \cos(\theta_j - \theta_i) 936898

The curvature proxy $ represents how much the phase embedding "stretches" the underlying geometry:

936898 K_g = \frac{\sum_{i,j} h_{ij}}{\sum_{i,j} |W_{ij}|} 936898

Features

  • Curvature Detection: High $ indicates that the geometry is tightly wrapped around highly coherent phase clusters.
  • Topological Feedback: Provides the mathematical basis for Phase \rightarrow Geometry \rightarrow Phase bidirectional coupling.
  • Metric Invariants: Measures the structural integrity of the synchronization manifold.

::: scpn_phase_orchestrator.ssgf.pgbo

Topological Integration Observable (p_h1)

Measures the H1 persistent homology of the delay-embedded phase dynamics. It acts as a topological-integration gate, allowing higher-level director logic to engage only when topological integration exceeds the τh1>0.72\tau_{h1} > 0.72 threshold.

Features

  • Vietoris-Rips Filtration: Computes max $ lifetimes using the ripser algorithm (or Rust-native streaming PH).
  • Complexity Gating: Prevents the supervisor from acting on chaotic or topologically incoherent noise.

::: scpn_phase_orchestrator.ssgf.topological_integration

SSGF Costs

Computes the energy functional {total}$ that drives the geometric minimization:

  1. C1 (Sync Deficit): - R$
  2. C2 (Spectral Gap): hBc\lambda_2(L(W))$ (maximizing algebraic connectivity)
  3. C3 (Sparsity): regularizeronregularizer on
  4. C4 (Symmetry): Deviation from = W^T$

Boundary contract: compute_ssgf_costs rejects boolean aliases, complex-valued aliases, non-finite payloads, non-vector phases, non-square coupling matrices, invalid weights, and inconsistent optional Rust return tuples before accepting a cost snapshot. The direct PyO3 Rust binding applies the same finite-shape and non-negative-weight checks before entering the Rust cost kernel, so malformed buffers fail with ValueError instead of a kernel panic.

::: scpn_phase_orchestrator.ssgf.costs

Closure Diagnostics

Closure helpers track whether geometry and phase updates remain inside the configured SSGF stability envelope.

::: scpn_phase_orchestrator.ssgf.closure

Free-Energy Terms

Variational free-energy primitives shared by the SSGF monitors and predictive supervisor paths.

::: scpn_phase_orchestrator.ssgf.free_energy

Architecture & Theory

The SSGF (Self-Stabilizing Gauge Field) framework is built upon the theoretical foundation of treating synchronization as a field-theoretic phenomenon. In this view, the coupling matrix WijW_{ij} is not a static set of parameters but a dynamic carrier field that mediates interactions between oscillators.

The Two-Timescale Engine

SPO implements SSGF as a two-timescale system:

  1. Fast Scale (theta\\theta): Phase dynamics evolve according to the standard UPDE/Kuramoto equations.
  2. Slow Scale (WW): The geometry evolves to minimize a free energy functional Utotal(W,theta)U_{total}(W, \\theta).

The coupling is bidirectional: phases align based on WW (Fast Scale), and WW adapts to the observed alignment of phases (Slow Scale). This creates a self-stabilizing feedback loop that spontaneously discovers topologies optimal for the current dynamical task.

Variational Free Energy Minimization

The geometric evolution is driven by the gradient of the free energy: W˙ij=ηfracUtotalWij\dot{W}_{ij} = -\eta \\frac{\partial U_{total}}{\partial W_{ij}}

where η\eta is the geometric learning rate. The functional UtotalU_{total} includes terms for synchronization, spectral connectivity, sparsity, and symmetry, as detailed in `scpn_phase_orchestrator.ssgf.costs`.


Gauge Curvature in Synchronization

The concept of a Gauge-Theoretic metric in synchronization was pioneered to address the limitation of linear correlation measures. When we map the phases thetai\\theta_i to a point cloud in a delay-embedded space, the "distance" between oscillators is not merely their index separation but their phase divergence.

The Metric Tensor $h_{\mu

u}$

By defining the metric tensor hij=Wijcos(hetajhetai)h_{ij} = W_{ij} \cos( heta_j - heta_i), we treat the coupling strengths as the "volume" or "density" of connections, and the phase cosine as the "stretching factor."

If thetaiapproxthetaj\\theta_i \\approx \\theta_j, then cosapprox1\cos \\approx 1, and the metric volume is preserved. If thetai\\theta_i and thetaj\\theta_j are out of phase, the metric volume collapses toward zero (or becomes negative), indicating a high-curvature region of the manifold.

Curvature Proxy KgK_g

The scalar curvature proxy KgK_g implemented in `PGBO` provides a single number representing the "flatness" of the synchronization manifold. A flat manifold (Kgapprox1K_g \\approx 1) implies that the physical coupling topology WW perfectly matches the phase alignment theta\\theta. Lower values (or high gradients in KgK_g) signal the presence of Topological Defects or Chimera States.


Technical Reference: PGBO Snapshot

The `PGBOSnapshot` dataclass returns the following telemetry for every observation:

  • `R`: Global order parameter.
  • `psi`: Mean global phase.
  • `costs`: A breakdown of the four SSGF cost terms (Sync, Spectral, Sparsity, Symmetry).
  • `phase_geometry_alignment`: The legacy linear correlation between phase diffs and WijW_{ij}.
  • `gauge_curvature`: The new rank-2 tensor curvature proxy.
  • `step`: The current simulation step index.

Usage Example: Closed-Loop Geometry Control

from scpn_phase_orchestrator.ssgf.pgbo import PGBO
from scpn_phase_orchestrator.upde.engine import UPDEEngine

# Initialize observer and engine
pgbo = PGBO()
engine = UPDEEngine(n_oscillators=32, dt=0.01)

# Main Loop
for step in range(1000):
    # Step phases
    phases = engine.step(phases, omegas, W, zeta, psi, alpha)

    # Observe phase-geometry alignment
    snapshot = pgbo.observe(phases, W)

    # Adaptive control based on curvature
    if snapshot.gauge_curvature < 0.6:
        # Manifold is collapsing/stretching too much
        # Adjust geometry learning rate or modulator
        modulator = 2.0
    else:
        modulator = 0.5

Integration with Layer 16 Director

In the full SCPN stack, the SSGF curvature metrics are exported to the Layer 16 Director, which uses them to calculate the global Geometric Coherence Index (GCI). When KgK_g drops below critical levels, the director triggers a "Geometry Reset" or shifts the regime of the `ActiveInferenceAgent`.

The Gauged PGBO thus serves as the sensory organ for the topological stability of the entire intelligence system.


SSGF Cost Terms: Detailed Breakdown

Each cost term in `SSGFCosts` represents a distinct architectural pressure on the evolution of the geometry WW.

C1: Synchronization Deficit ($1 - R$)

The primary pressure is to achieve coherence. If the oscillators are desynchronized, RR is low, and C1C1 is high. This pressure drives the geometry toward configurations that foster phase-locking.

C2: Negative Spectral Gap (λ2(L(W))-\lambda_2(L(W)))

In graph theory, the second smallest eigenvalue of the Laplacian matrix, λ2\lambda_2, is known as the Algebraic Connectivity or the Fiedler Value. It measures how difficult it is to partition a graph into two disconnected components.

By minimizing C2C2 (and thus maximizing λ2\lambda_2), the SSGF engine ensures that the coupling topology is globally integrated. It prevents the emergence of fragmented islands that would otherwise desynchronize the system.

C3: Sparsity (W1/N2||W||_1 / N^2)

A fully connected network (all-to-all) is computationally expensive and biologically unrealistic. The L1L_1 regularizer C3C3 acts as a "cost of cabling." It forces the engine to achieve the target synchronization using the minimum number of connections. This pressure spontaneously generates Small-World or Hierarchical topologies.

C4: Symmetry Deviation (WWTF/N||W - W^T||_F / N)

Physical coupling in most natural systems (gap junctions, power lines) is symmetric. C4C4 enforces this symmetry by penalizing directed couplings. In certain domains (e.g., neural information flow), this weight may be reduced to allow for directed causal interactions.


Topological Integration Gate: Implementation Details

The `TopologicalIntegrationObserver` implements persistent homology using the Vietoris-Rips filtration. This is a topological method that captures the "holes" in the point-cloud embedding of the phases.

Why H1 Persistence?

While H0H_0 (connected components) measures simple clusters, H1H_1 (one-dimensional holes) measures cycles. Synchronization is a cyclical phenomenon. The presence of long-lived H1H_1 cycles in the phase space indicates that the network has formed a stable, integrated topological loop — a persistent first-homology cycle within the SCPN framework.

The 0.72 Threshold

The threshold auh1=0.72 au_{h1} = 0.72 is derived from empirical studies of metastable synchronization. Below 0.72, the cycles are transient and noisy. Above 0.72, the topological structure is resilient enough to support higher-order cognitive processing or stable control logic.


Summary of Metric Parity (Rust vs Python)

The following table summarizes the implementation status of SSGF metrics across the two backends.

MetricPython (`src/`)Rust (`spo-kernel`)Notes
Order Parameter RFullFull7.3us (Rust) vs 45us (Py)
SSGF CostsFullPlannedCrucial for real-time W evolution
Gauged PGBOFullFullCurvature proxy implementation
Topological integration (H1)FullIn ProgressMoving to streaming Rust engine
Plasticity (Hebbian)FullFullSub-microsecond inner loop
Geometry CarrierFullFullsoftplus decode (Python NumPy faster for N>16)
Ethical Cost (C15)FullFullSEC + CBF, 5.7x at N=8, Jacobi eigenvalues

Future Roadmap: SSGF v2.0

The next phase of SSGF development will focus on the Self-Stabilizing Gauge Field (SSGF) Hardware Kernel. This will offload the entirety of the free energy minimization to an FPGA-based solver, enabling nanosecond-scale geometry adaptation for high-frequency plasma control and quantum error correction.

  • Metric Evolution: Moving from scalar curvature proxies to full tensor-field gradients.
  • Geometric Jitter: Adding stochastic noise to the W-evolution to escape local minima in the free energy landscape.
  • Layer 12 Coupling: Synchronizing the SSGF geometry across distributed nodes in the Gaian mesh.

Troubleshooting & Diagnostics

Integrating SSGF into a domain simulation can be mathematically delicate due to the bidirectional feedback between phases and geometry.

Common Issue: Geometry Explosion

If the geometric coupling values WijW_{ij} increase toward infinity, it usually indicates that the Sparsity Weight (w3w_3) is too low relative to the Sync Weight (w1w_1).

Solution: Increase w3w_3 in `SSGFCosts` or implement a hard saturation limit using the `ImprintModel`.

Common Issue: Curvature Collapse (Kg<0K_g < 0)

If the Gauged PGBO reports negative curvature, the phase manifold has become topologically inverted — the geometry is actively pushing oscillators away from their natural synchronization targets.

Solution: Check for Phase Lags (alpha\\alpha) that are inconsistent with the geometry WW. High transport delays without compensatory lag-modeling in the engine will cause curvature collapse.

Diagnostic: Spectral Gap Monitoring

Always monitor the `c2_spectral_gap` term. If lambda2\\lambda_2 drops to zero, the network has fragmented into disconnected components. The `RegimeManager` should be configured to trigger a "Topological Recovery" action when this occurs.


Configuration Reference: SSGF Weights

The `SSGFCosts` constructor takes a `weights` tuple that defines the priority of geometric evolution.

ParameterMeaningDefaultImpact
`w1_sync`Synchronization deficit pressure1.0Higher values force rapid sync at the cost of topology.
`w2_spectral`Global integration pressure0.5Critical for preventing network fragmentation.
`w3_sparse`L1 sparsity pressure0.1Controls the "cabling cost" and hierarchy depth.
`w4_symmetry`Reciprocity pressure0.1Ensures WW remains close to a symmetric manifold.

Technical Appendix: Metric Tensor Derivation

The derivation of the synchronization metric tensor hmunuh_{\\mu\\nu} follows the logic of embedding the N-dimensional torus TNT^N into a higher-dimensional Euclidean space.

Let mathbfXi=[costhetai,sinthetai]\\mathbf{X}_i = [\\cos \\theta_i, \\sin \\theta_i] be the coordinate of the ii-th oscillator on the unit circle. The pairwise Euclidean distance is dij2=22cos(thetajthetai)d_{ij}^2 = 2 - 2 \\cos(\\theta_j - \\theta_i).

The SSGF framework treats the coupling strength WijW_{ij} as the Gauge Field Connection that modifies the local metric. The effective distance on the synchronization manifold is weighted by the interaction strength, leading to the definition of hijh_{ij} used in the PGBO curvature calculation.


Benchmarking SSGF Metrics

The following performance benchmarks were measured on a reference Linux workstation (Intel Core i5-11600K @ 3.90GHz).

MetricN=32N=256N=1024
Cost Computation (Py)120us1.2ms8.5ms
PGBO Curvature (Py)85us0.9ms6.2ms
Hebbian Plasticity (Rust)0.8us15us145us
Sparse UPDE Step (Rust)4.2us42us210us

These results demonstrate that while the observers (PGBO) are sufficiently fast in Python for monitoring, the inner integration and plasticity loop MUST remain in the Rust kernel to maintain sub-millisecond control frequencies at high N.