Skip to content

Repository files navigation

spacetime-verifier

DOI

An independent curvature evaluator for machine-learned spacetimes — offered in the hope that it is useful.


Neural networks are increasingly used to find approximate solutions of the Einstein field equations. Their quality is usually reported through the same loss function that trained them. This small library provides a second opinion: it measures curvature directly from any callable that returns a metric, using plain finite differences, and it shares no code with the systems it evaluates.

It was built for one specific audit and is released so that others can check that audit — and, hopefully, so that anyone working on machine-learned metrics can point an outside instrument at their own results with an afternoon's effort. Corrections and criticism are very welcome; issues and pull requests will be read with gratitude.

What it measures

Quantity Module
Christoffel symbols, Riemann and Ricci tensors, Ricci scalar, Kretschmann scalar verifier/geometry.py
Weyl tensor, orthonormal tetrad, Petrov speciality index S verifier/petrov.py
Areal radius, Ξ = h^ab ∂ₐR ∂ᵦR, null expansions, trapped-surface classification verifier/horizon.py
Independent r(T, X) for the Schwarzschild Penrose chart (Lambert-W) verifier/penrose.py
Isolation boundary: stencil recording and batched export from a foreign environment verifier/interface.py

Everything works on a plain function g(x) -> 4×4 array, in float64, with the finite-difference step chosen by convergence sweep rather than by default.

How much to trust it

The instrument's own error floor is measured and published before it is used on anything (details in verifier/CALIBRATION.md and the note):

  • Ricci residual ≈ 1e-10 on analytic Schwarzschild; Kretschmann matches 48M²/r⁶ to 1e-9.
  • Speciality index S = 1 to within 4e-16 on a type-D metric — and to 1.7e-6 on a trained network imitating one, which is the floor that matters when judging networks.
  • The Schwarzschild apparent horizon is recovered exactly on an analytic control and to within 0.009 on a trained-network control.
  • Deliberately corrupted metrics are detected and localised; float32 metric storage was measured to inflate residuals 203-fold, so everything insists on float64.

Known-answer tests ship with the package:

pip install numpy scipy pytest
pytest verifier/ -q

The case study

The audit/ directory and docs/RELEASE_REPORT.md contain a complete reproducibility audit of the black-hole configuration published with the AInstein project (arXiv:2607.05489). In five retrainings that differ only in random seed, the algebraic type and the trapped region reproduced five times out of five, while the vacuum condition held in two of five — and the training loss did not indicate which runs were which. Full numbers, including every failed run, are in results/processed/; the pass thresholds were frozen and version-tagged before any candidate existed, and proof/ contains per-stage attestations with SHA-256 checksums of every artifact behind every claim.

Two things the case study is not: it is not a verdict on the AInstein authors' own results (their trained models are not published; we audited the published configuration, and we would be glad to be corrected on any point of their setup), and it is not peer-reviewed. The paper's authors were contacted before anything here was made public.

A plain-language summary for non-specialists is in docs/one-pager.html; the short technical note is in paper/note.pdf.

Using it on your own model

import numpy as np
from verifier.geometry import ricci_tensor, kretschmann_scalar
from verifier.petrov import petrov_invariants

def g(x):                       # your metric: point (4,) -> metric (4, 4), float64
    ...

x = np.array([0.0, 8.0, 1.1, 0.3])
print(np.max(np.abs(ricci_tensor(g, x))))     # how vacuum is it, pointwise
print(petrov_invariants(g, x)["S"])           # 1 = algebraically special

If your model lives in an environment you would rather keep separate (a different TensorFlow, a GPL codebase), verifier/interface.py shows the pattern used here: record the stencil, export metric values as plain arrays through a subprocess, evaluate on the tabulated result. The evaluator never imports the evaluated code.

AI disclosure

The code and experiments were produced by an AI agent under human direction, with the constraint that the agent may never mark its own work as verified — every pass/fail above is computed from hashed artifacts, and the attestations in proof/ invalidate themselves if an artifact changes. The full statement is in AI_DISCLOSURE.md.

Citation and licence

MIT. If this is useful in your work, please cite:

Pluzhnik, A. (2026). spacetime-verifier: an independent curvature evaluator for machine-learned spacetimes (v0.1.1). Zenodo. https://doi.org/10.5281/zenodo.21915627

The audited upstream code remains under its own licence and is not included here.

About

An independent curvature evaluator for machine-learned spacetimes

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages