{
 "artifacts": [
  {
   "name": "bench_report.json",
   "url": "https://synthcore.org/code/1051/bench_report.json"
  },
  {
   "name": "bench_stage2.py",
   "url": "https://synthcore.org/code/1051/bench_stage2.py"
  },
  {
   "name": "experiment.py",
   "url": "https://synthcore.org/code/1051/experiment.py"
  },
  {
   "name": "implicit_layer.py",
   "url": "https://synthcore.org/code/1051/implicit_layer.py"
  },
  {
   "name": "report.md",
   "url": "https://synthcore.org/code/1051/report.md"
  },
  {
   "name": "report_bench_2026-09-01T225642.md",
   "url": "https://synthcore.org/code/1051/report_bench_2026-09-01T225642.md"
  },
  {
   "name": "results.json",
   "url": "https://synthcore.org/code/1051/results.json"
  }
 ],
 "category": "dynamics",
 "description": "Use a neural network to predict an operating point or latent state, then pass it through a sparse differentiable implicit layer that solves governing nonlinear equilibrium equations. This replaces soft physics penalties with an exact or tightly solved equality projection and can be combined with primal-dual inequality handling and deterministic restoration.",
 "download_zip": "https://synthcore.org/download/1051",
 "formulas_latex": [
  "$$F(z^\\star;u)=0,\\qquad \\frac{\\partial z^\\star}{\\partial u}=-\\left(\\frac{\\partial F}{\\partial z}\\right)^{-1}\\frac{\\partial F}{\\partial u}$$",
  "$$P_i=V_i\\sum_jV_j\\left(G_{ij}\\cos(\\theta_i-\\theta_j)+B_{ij}\\sin(\\theta_i-\\theta_j)\\right)$$",
  "$$Q_i=V_i\\sum_jV_j\\left(G_{ij}\\sin(\\theta_i-\\theta_j)-B_{ij}\\cos(\\theta_i-\\theta_j)\\right)$$",
  "$$\\mathcal{L}=f(z)+\\lambda^\\top g(z;u)+\\frac{\\beta}{2}\\|[g(z;u)]_+\\|_2^2,\\qquad \\lambda\\leftarrow[\\lambda+\\eta_\\lambda g(z;u)]_+$$"
 ],
 "id": 2741,
 "implementation": "1. Integration point: attach the layer to a graph encoder that predicts voltage magnitudes, angles, generator outputs, or the state of another differentiable physical system. Construct $F$ from the supplied topology and parameters. During training, solve the equality system with damped Newton or sparse nonlinear least squares; during inference, use a fixed small number of sparse Newton iterations followed by deterministic inequality restoration. 2. Pseudocode: encode $(u,A)$ to produce $\\hat z$; initialize $z_0=\\hat z$; repeat $z\\leftarrow z-\\tau(J_F^\\top J_F+\\epsilon I)^{-1}J_F^\\top F(z;u)$; return converged $z$; for backward propagation solve $J_F^\\top v=\\partial\\mathcal{L}/\\partial z$ and apply the implicit derivative; update multipliers with $\\lambda\\leftarrow[\\lambda+\\eta_\\lambda g(z)]_+$. 3. Computed quantities are $F$, its sparse Jacobian, Newton residual, and the implicit backward linear solve. Estimate damping $\\tau$, regularization $\\epsilon$, Newton tolerance, and multiplier step $\\eta_\\lambda$ empirically. Monitor $\\sigma_{\\min}(J_F)$ because ill-conditioning predicts gradient amplification and solver failure. 4. First cheap experiment: compare a plain MLP or GNN, penalty-only physics training, and the implicit model on 14-bus AC power-flow data with random loads and line outages. Measure $\\|F\\|$, inequality violations, objective gap, solver iterations, and runtime. The prediction is that equality residual reaches the Newton tolerance largely independently of neural predictor error, while penalty-only residual remains dependent on penalty weight. As operating points approach an ill-conditioned regime, gradient norms should scale approximately as $1/\\sigma_{\\min}(J_F)$; failures should cluster when $\\sigma_{\\min}(J_F)$ approaches the regularization scale $\\sqrt{\\epsilon}$.",
 "math_summary": "Let $u$ denote exogenous inputs such as loads, topology, and limits, and let $z$ denote predicted decision variables. Define the equality residual $F(z;u)=0$. For AC power flow, at bus $i$, $P_i=V_i\\sum_jV_j(G_{ij}\\cos(\\theta_i-\\theta_j)+B_{ij}\\sin(\\theta_i-\\theta_j))$ and $Q_i=V_i\\sum_jV_j(G_{ij}\\sin(\\theta_i-\\theta_j)-B_{ij}\\cos(\\theta_i-\\theta_j))$. The implicit layer returns $z^\\star(u)$ satisfying $F(z^\\star;u)=0$. If $J_F=\\partial F/\\partial z$ is nonsingular, implicit differentiation gives $\\partial z^\\star/\\partial u=-J_F^{-1}\\partial F/\\partial u$. For inequalities $g(z;u)\\leq0$, use $\\mathcal{L}=f(z)+\\lambda^\\top g(z;u)+(\\beta/2)\\|[g(z;u)]_+\\|_2^2$ and projected multiplier updates. The smallest singular value of $J_F$ controls conditioning and gradient amplification.",
 "math_tags": [
  "control-theory",
  "dynamical-systems",
  "optimization",
  "linear-algebra",
  "numerical-analysis",
  "graph-theory"
 ],
 "ml_areas": [
  "graph-nn",
  "optimizer",
  "training-dynamics",
  "world-model"
 ],
 "paper": {
  "arxiv_id": "2608.25784",
  "arxiv_url": "https://arxiv.org/abs/2608.25784",
  "summary_what_math_gives_to_ml": "UNION contains transferable mechanisms beyond ordinary graph prediction: scalar-gated message aggregation with an explicit consensus correction, and a sparse differentiable implicit layer that enforces nonlinear AC power-flow equations. These mechanisms suggest neural architectures whose representations remain coherent when graph topology changes and whose outputs are projected onto a physics-defined equilibrium manifold rather than merely penalized for violating it. The strongest transfer is to topology-varying graph models and constrained predictors, where the paper makes falsifiable predictions about constraint residuals, zero-shot topology generalization, and restoration success. A practical implementation can combine a consensus-corrected GNN with a differentiable nonlinear-equilibrium solver.",
  "title": "UNION: A Unified AC-OPF Framework for Topology-Varying Real-Time Grid Operation",
  "year": "2026"
 },
 "ratings": {
  "difficulty": 7,
  "novelty": 5,
  "usefulness": 9
 },
 "solves": [
  "stability",
  "accuracy",
  "generalization"
 ],
 "title": "Differentiable Physics-Equilibrium Projection",
 "url": "https://synthcore.org/idea/2741/differentiable-physics-equilibrium-projection",
 "verification": {
  "benchmark": {
   "track": "dynamics",
   "model": "rnn_small",
   "n_seeds": 8,
   "metric_direction": "lower is better",
   "comparison": {
    "baseline_mean": 0.00027095018594991416,
    "idea_mean": 0.000008354870317361929,
    "delta_mean": -0.00026259531563255223,
    "per_seed_diffs": [
     -0.00032114667556015775,
     -0.00033902876612046384,
     -0.0003235416015741066,
     -0.0003325191282783635,
     -0.00037630887072737096,
     -0.00017978340656554792,
     -0.00007066479281340688,
     -0.00015776928194100037
    ],
    "idea_wins": 8,
    "n_pairs": 8,
    "p_value": 0.0081,
    "mde": 0.00009240409757793939,
    "mde_rel_pct": 34.10370827088508,
    "verdict": "idea better (significant)",
    "system_worked": true
   },
   "baseline": {
    "best_cfg": {
     "epochs": 25,
     "lr": 0.012,
     "steps": 0
    },
    "sweep": [
     {
      "cfg": {
       "epochs": 25,
       "lr": 0.003,
       "steps": 0
      },
      "mean": 0.0008186178019968793
     },
     {
      "cfg": {
       "epochs": 25,
       "lr": 0.006,
       "steps": 0
      },
      "mean": 0.0005262107733869925
     },
     {
      "cfg": {
       "epochs": 25,
       "lr": 0.012,
       "steps": 0
      },
      "mean": 0.0003371372222318314
     }
    ],
    "full": {
     "mean": 0.00027095018594991416,
     "std": 0.00010329659269599283,
     "per_seed": [
      0.0003306560392957181,
      0.0003460621228441596,
      0.00033211964182555676,
      0.0003397110849618912,
      0.0003853111120406538,
      0.00018891783838625997,
      0.00007910988642834127,
      0.00016571376181673259
     ],
     "n": 8
    }
   },
   "idea": {
    "mean": 0.000008354870317361929,
    "std": 8.429703290269694e-7,
    "per_seed": [
     0.000009509363735560328,
     0.000007033356723695761,
     0.000008578040251450147,
     0.000007191956683527678,
     0.000009002241313282866,
     0.000009134431820712052,
     0.000008445092134934384,
     0.000007944479875732213
    ],
    "n": 8
   },
   "mechanism_signature": {
    "best_idea_cfg": {
     "epochs": 25,
     "lr": 0.003,
     "steps": 1
    },
    "idea_config_sweep": [
     {
      "cfg": {
       "epochs": 25,
       "lr": 0.003,
       "steps": 1
      },
      "mean": 0.000008078179348558479
     },
     {
      "cfg": {
       "epochs": 25,
       "lr": 0.006,
       "steps": 2
      },
      "mean": 0.000008078180940174207
     },
     {
      "cfg": {
       "epochs": 25,
       "lr": 0.012,
       "steps": 3
      },
      "mean": 0.000008078180940174207
     }
    ],
    "mechanism": {
     "claim": "implicit equality projection removes the measured equilibrium residual",
     "confirmed": true,
     "residual_ratio": 0,
     "trained_model_projected_residual_mean": 0,
     "trained_model_raw_residual_mean": 0.7149586826562881
    },
    "track_match": "dynamics: controlled pendulum rollout"
   },
   "custom_track": null
  },
  "mechanism_confirmed": false,
  "peer_reviewed": false,
  "practical_verdict": "helps",
  "stage1_mechanism_check": {
   "worked": true,
   "confidence": 9,
   "verdict": "Built a differentiable cubic-equilibrium projection with fixed-step Newton forward solving and an analytic implicit backward pass. The mechanism manifested: the least-squares iteration matched the predicted contraction factor |1-tau*a^2| and switched from contraction to divergence at the predicted boundary tau*a^2=2; implicit sensitivities matched finite differences, including 1/sigma_min(J) growth from 10 to about 999 as sigma_min(J) decreased from 0.1 to 0.001. Projection reduced the test residual to 3.93e-12 versus 0.109 for penalty training and 0.286 for direct prediction, while projected state MSE was 8.46e-16.",
   "metrics": {
    "baseline": "Direct predictor: mean test |F|=0.285812, MSE=0.009461. Penalty predictor: mean test |F|=0.109087, MSE=0.001355.",
    "idea": "Newton-projected penalty predictor: mean test |F|=3.929e-12, MSE=8.456e-16. Contraction ratios matched theory within about 6e-8 in the sweep; stability held for tau*a^2\u003c2 and failed at 2.1. Implicit autograd derivative max absolute error was 0.0."
   },
   "how_to_run": "python3 experiment.py",
   "files": [
    "experiment.py",
    "implicit_layer.py",
    "results.json"
   ],
   "limitations": "This is a scalar cubic toy system, not a sparse AC 14-bus network, GNN, inequality restoration, or a wall-clock/FLOP comparison. The experiment does not test large-scale sparse linear solves, multiple equilibria, solver failures under realistic topology outages, or robustness to noisy/extrapolating inputs."
  },
  "status": "beats_baseline",
  "status_label": "Beats tuned baseline",
  "updated_at": "2026-09-01T22:56:42",
  "verdict_source": "deterministic test code (paired-seed permutation statistics)"
 }
}
