# NeuroGenesys emergence-audit

A pipeline-agnostic harness that runs four owned controls against a claim that
some structure X "emerges" from a trained network, and prints the differential.
Tooling, not a method: cite the owners of each control (listed at
https://neurogenesys.ai/research/tools/emergence-audit).

## Layout

Keep the files in this layout. The demo plugin imports `adsdl_lib` and
`einstein_residual` from the directory that holds `emergence_audit.py`.

    emergence-audit/
      emergence_audit.py
      adsdl_lib.py              AdS/DL reproduction (Hashimoto et al. 2018)
      einstein_residual.py      nearest-solution distance used by C2–C4
      demo_adsdl_audit.json     reference output of --demo
      plugins/
        adsdl_plugin.py

## Run

    pip install numpy torch
    python emergence_audit.py --demo                    # 3 seeds, full 60-epoch recipe, ~4 min
    python emergence_audit.py --plugin my_plugin.py --seeds 5 --out audit.json

`emergence_audit.py` itself needs only numpy; torch is for the demo plugin.
Compare your `--demo` run with `demo_adsdl_audit.json`.

## Plugin interface

    generators = {"real": f(seed)->data, "stateless": ..., "nonsolution": ...}   # 'real' required
    priors     = {"paper": spec, "alternative": spec}                              # first = the paper's
    def fit(data, prior, seed) -> (output, fit_quality)      # lower fit_quality = better
    def feature(output) -> np.ndarray                        # the summary of X
    def family_distance(output) -> float                     # optional
    def generator_distance(output, data) -> float            # optional
    condition_number = float | callable                      # optional
    fit_tolerance = 0.25                                     # "equal fit" tolerance for C3

`plugins/adsdl_plugin.py` is a complete worked example.

## Caveat

Run the paper's full training recipe. On the AdS/DL reproduction, cutting 60
epochs to 20 flipped the C2 and C3 verdicts. A quick audit is an unreliable
audit.
