# Registry diffs

Neuron-level comparisons between two registries, for CI.

Related guide: [Neuron-CI diffs](https://provenanceauth.com/docs/trace/guides/registry-diffs.md)

## Endpoints

- `POST /v1/trace/diffs`: [Create a registry diff](#post-v1-trace-diffs)
- `GET /v1/trace/diffs/{id}`: [Retrieve a registry diff](#get-v1-trace-diffs-id)
- `GET /v1/trace/diffs`: [List registry diffs](#get-v1-trace-diffs)

## The registry diff object

### Attributes

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Unique identifier for the object. |
| `object` | enum | yes | The type of object. One of `registry_diff`. |
| `status` | string | yes | The object's current status. |
| `base` | string | yes | The base model version. |
| `target` | string | yes | The target model version. |
| `canary_sets` | any \| null | yes | Canary sets. |
| `tau` | number | yes | The drift threshold, from 0 to 1. |
| `pass` | boolean \| null | yes | Whether the check passed. |
| `report` | object \| null | yes | The report. |
| `report.base` | string | yes | The base model version. |
| `report.target` | string | yes | The target model version. |
| `report.tau` | number | yes | The drift threshold, from 0 to 1. |
| `report.coverage` | object | yes | How many neurons each registry describes. |
| `report.coverage.base_neurons` | integer | yes | Neurons in the base registry. |
| `report.coverage.target_neurons` | integer | yes | Neurons in the target registry. |
| `report.coverage.shared` | integer | yes | Neurons in both. |
| `report.label_changes` | object | yes | Neurons whose label changed. |
| `report.label_changes.total` | integer | yes | The total. |
| `report.label_changes.items` | array of anys | yes | The items. |
| `report.new_unexplained` | object | yes | Neurons that lost their label. |
| `report.new_unexplained.total` | integer | yes | The total. |
| `report.new_unexplained.items` | array of anys | yes | The items. |
| `report.ablation_delta_drift` | object | yes | How much neurons' ablation changes moved. |
| `report.ablation_delta_drift.n` | integer | yes | The number of samples it's based on. |
| `report.ablation_delta_drift.mean_abs_drift` | integer | yes | The mean absolute drift. |
| `report.ablation_delta_drift.p95_abs_drift` | integer | yes | The 95th-percentile absolute drift. |
| `report.ablation_delta_drift.max_abs_drift` | integer | yes | The largest absolute drift. |
| `report.ablation_delta_drift.top` | array of objects | yes | The neurons that drifted most. |
| `report.ablation_delta_drift.top.neuron_ref` | string | yes | The neuron, as an ID or masked ID. |
| `report.ablation_delta_drift.top.masked` | boolean | yes | Whether the neuron is masked in this view. |
| `report.ablation_delta_drift.top.base` | number | yes | The base model version. |
| `report.ablation_delta_drift.top.target` | number | yes | The target model version. |
| `report.ablation_delta_drift.top.drift` | integer | yes | The drift, from 0 to 1. |
| `report.canary_member_shift` | array of objects | yes | How each canary family changed. |
| `report.canary_member_shift.family` | string | yes | The canary family. |
| `report.canary_member_shift.scope` | string | yes | What the object applies to. |
| `report.canary_member_shift.status` | string | yes | The object's current status. |
| `report.canary_member_shift.measure` | string | yes | How the family was compared: by `members`, or by `validation` when the two sides are curated and your own. |
| `report.canary_member_shift.base_member_count` | integer | yes | Members in the base. |
| `report.canary_member_shift.target_member_count` | integer | yes | Members in the target. |
| `report.canary_member_shift.kept` | integer | yes | Members in both. |
| `report.canary_member_shift.added` | integer | yes | Members only in the target. |
| `report.canary_member_shift.removed` | integer | yes | Members only in the base. |
| `report.canary_member_shift.jaccard` | integer | yes | The members' Jaccard similarity, from 0 to 1. |
| `report.canary_member_shift.validation` | object | yes | The family's measured precision and recall. |
| `report.canary_member_shift.validation.base` | object | yes | The base model version. |
| `report.canary_member_shift.validation.base.precision` | number | yes | Measured precision, from 0 to 1. |
| `report.canary_member_shift.validation.base.recall` | number | yes | Measured recall, from 0 to 1. |
| `report.canary_member_shift.validation.base.eval_set` | string | yes | The evaluation set it was measured on. |
| `report.canary_member_shift.validation.base.n` | integer | yes | The number of samples it's based on. |
| `report.canary_member_shift.validation.base.grade` | string | yes | How the measurement was graded. |
| `report.canary_member_shift.validation.target` | object | yes | The target model version. |
| `report.canary_member_shift.validation.target.precision` | number | yes | Measured precision, from 0 to 1. |
| `report.canary_member_shift.validation.target.recall` | number | yes | Measured recall, from 0 to 1. |
| `report.canary_member_shift.validation.target.eval_set` | string | yes | The evaluation set it was measured on. |
| `report.canary_member_shift.validation.target.n` | integer | yes | The number of samples it's based on. |
| `report.canary_member_shift.validation.target.grade` | string | yes | How the measurement was graded. |
| `report.canary_member_shift.validation.precision_delta` | integer | yes | The change in measured precision. |
| `report.canary_member_shift.validation.recall_delta` | integer | yes | The change in measured recall. |
| `report.canary_member_shift.drift` | integer | yes | The drift, from 0 to 1. |
| `report.canary_member_shift.exceeds_tau` | boolean | yes | Whether the family drifted past `tau`. |
| `report.summary` | object | yes | A one-line summary. |
| `report.summary.label_changes` | integer | yes | Neurons whose label changed. |
| `report.summary.new_unexplained` | integer | yes | Neurons that lost their label. |
| `report.summary.families_checked` | integer | yes | Families compared. |
| `report.summary.families_drifted` | array of anys | yes | Families that drifted past `tau`. |
| `report.summary.families_not_comparable` | array of anys | yes | Families that couldn't be compared. |
| `report.summary.pass` | boolean | yes | Whether the check passed. |
| `manifest` | string \| null | yes | The signed manifest, an ES256 JWS. |
| `report_hash` | string \| null | yes | SHA-256 of the canonical report, bound into the manifest. |
| `error` | any \| null | yes | An error, when one occurred. |
| `created_at` | string | yes | When it was created. |
| `updated_at` | string | yes | When it last changed. |
| `expires_at` | string | yes | When it expires. |
| `poll_url` | string | yes | The URL to poll for the result. |

### Example

```json
{
  "id": "tjob_01M6VQCBTFETQSMQAXME9R1PQ7",
  "object": "registry_diff",
  "status": "pending",
  "base": "qwen2.5-0.5b-instruct@7ae55760",
  "target": "qwen2.5-0.5b-instruct@7ae55760",
  "canary_sets": null,
  "tau": 0.25,
  "pass": null,
  "report": null,
  "manifest": null,
  "report_hash": null,
  "error": null,
  "created_at": "2026-11-07T19:22:18.319Z",
  "updated_at": "2026-11-07T19:22:18.319Z",
  "expires_at": "2026-12-07T19:22:18.319Z",
  "poll_url": "/v1/trace/diffs/tjob_01M6VQCBTFETQSMQAXME9R1PQ7"
}
```

## Events

Sent to your [webhook endpoints](https://provenanceauth.com/docs/integrate/webhooks.md) when they subscribe:

- `trace.registry_diff.completed`

## Create a registry diff

`POST /v1/trace/diffs`

*Available on Enterprise.*

Compares two registries of the same architecture, such as a model and its fine-tune: label changes, new unexplained neurons, ablation drift and canary drift. Poll the diff for a pass or fail.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `base` | body | string | yes | model_version_id or slug (public, or your private build) |
| `target` | body | string | yes | The target model version. |
| `canary_sets` | body | array of strings | no | Families to check (default: every family on either model). |
| `tau` | body | number | no | A family whose drift exceeds tau fails the gate. |

### Returns

The diff, now queued. Poll it for the report. See [the registry diff object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`plan_required`](https://provenanceauth.com/docs/platform/errors.md#plan_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X POST "$PROVENANCE_API/v1/trace/diffs" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "base": "qwen2.5-0.5b-instruct@7ae55760",
    "target": "qwen2.5-0.5b-instruct@7ae55760",
    "tau": 0.25
  }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/diffs`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
  body: JSON.stringify({
    "base": "qwen2.5-0.5b-instruct@7ae55760",
    "target": "qwen2.5-0.5b-instruct@7ae55760",
    "tau": 0.25
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/trace/diffs", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
    "base": "qwen2.5-0.5b-instruct@7ae55760",
    "target": "qwen2.5-0.5b-instruct@7ae55760",
    "tau": 0.25
}).json()
```

### Response 202

```json
{
  "id": "tjob_01M6VQCBTFETQSMQAXME9R1PQ7",
  "object": "registry_diff",
  "status": "pending",
  "base": "qwen2.5-0.5b-instruct@7ae55760",
  "target": "qwen2.5-0.5b-instruct@7ae55760",
  "canary_sets": null,
  "tau": 0.25,
  "pass": null,
  "report": null,
  "manifest": null,
  "report_hash": null,
  "error": null,
  "created_at": "2026-11-07T19:22:18.319Z",
  "updated_at": "2026-11-07T19:22:18.319Z",
  "expires_at": "2026-12-07T19:22:18.319Z",
  "poll_url": "/v1/trace/diffs/tjob_01M6VQCBTFETQSMQAXME9R1PQ7"
}
```

## Retrieve a registry diff

`GET /v1/trace/diffs/{id}`

Returns a diff's status and, when finished, its report and signed manifest.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The object's ID. |

### Returns

The diff. See [the registry diff object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X POST "$PROVENANCE_API/v1/trace/diffs" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "base": "qwen2.5-0.5b-instruct@7ae55760",
    "target": "qwen2.5-0.5b-instruct@7ae55760",
    "tau": 0.25
  }' > step.json
export DIFF_ID=$(jq -r '.id' step.json)
sleep 8
curl "$PROVENANCE_API/v1/trace/diffs/$DIFF_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/diffs`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
  body: JSON.stringify({
    "base": "qwen2.5-0.5b-instruct@7ae55760",
    "target": "qwen2.5-0.5b-instruct@7ae55760",
    "tau": 0.25
  }),
})).json();
const diffId = step1.id;
await new Promise((ok) => setTimeout(ok, 8000));
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/diffs/${diffId}`, {
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();
```

**Python**

```python
import os
import time
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/trace/diffs", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
    "base": "qwen2.5-0.5b-instruct@7ae55760",
    "target": "qwen2.5-0.5b-instruct@7ae55760",
    "tau": 0.25
}).json()
diff_id = step1["id"]
time.sleep(8)
data = httpx.get(f"{api}/v1/trace/diffs/{diff_id}", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()
```

### Response 200

```json
{
  "id": "tjob_01M6VQCBTGQ2QBX38EQMR8XGKH",
  "object": "registry_diff",
  "status": "completed",
  "base": "qwen2.5-0.5b-instruct@7ae55760",
  "target": "qwen2.5-0.5b-instruct@7ae55760",
  "canary_sets": null,
  "tau": 0.25,
  "pass": true,
  "report": {
    "base": "qwen2.5-0.5b-instruct@7ae55760",
    "target": "qwen2.5-0.5b-instruct@7ae55760",
    "tau": 0.25,
    "coverage": {
      "base_neurons": 128,
      "target_neurons": 128,
      "shared": 128
    },
    "label_changes": {
      "total": 0,
      "items": []
    },
    "new_unexplained": {
      "total": 0,
      "items": []
    },
    "ablation_delta_drift": {
      "n": 128,
      "mean_abs_drift": 0,
      "p95_abs_drift": 0,
      "max_abs_drift": 0,
      "top": [
        {
          "neuron_ref": "L0.4600.neg",
          "masked": false,
          "base": 0.0622,
          "target": 0.0622,
          "drift": 0
        },
        {
          "neuron_ref": "n_99b82b3862f920ae",
          "masked": true,
          "base": 0.042,
          "target": 0.042,
          "drift": 0
        },
        {
          "neuron_ref": "L13.1053.pos",
          "masked": false,
          "base": 0.2459,
          "target": 0.2459,
          "drift": 0
        },
        "… 47 more"
      ]
    },
    "canary_member_shift": [
      {
        "family": "credential_exfiltration",
        "scope": "curated",
        "status": "compared",
        "measure": "membership",
        "base_member_count": 1,
        "target_member_count": 1,
        "kept": 1,
        "added": 0,
        "removed": 0,
        "jaccard": 1,
        "validation": {
          "base": {
            "precision": 0.8889,
            "recall": 0.8,
            "eval_set": "python/trace-worker/eval_sets/credential_exfiltration.jsonl#odd-pairs",
            "n": 20,
            "grade": "fixture"
          },
          "target": {
            "precision": 0.8889,
            "recall": 0.8,
            "eval_set": "python/trace-worker/eval_sets/credential_exfiltration.jsonl#odd-pairs",
            "n": 20,
            "grade": "fixture"
          },
          "precision_delta": 0,
          "recall_delta": 0
        },
        "drift": 0,
        "exceeds_tau": false
      },
      {
        "family": "prompt_injection",
        "scope": "curated",
        "status": "compared",
        "measure": "membership",
        "base_member_count": 2,
        "target_member_count": 2,
        "kept": 2,
        "added": 0,
        "removed": 0,
        "jaccard": 1,
        "validation": {
          "base": {
            "precision": 0.5625,
            "recall": 0.9,
            "eval_set": "python/trace-worker/eval_sets/prompt_injection.jsonl#odd-pairs",
            "n": 20,
            "grade": "fixture"
          },
          "target": {
            "precision": 0.5625,
            "recall": 0.9,
            "eval_set": "python/trace-worker/eval_sets/prompt_injection.jsonl#odd-pairs",
            "n": 20,
            "grade": "fixture"
          },
          "precision_delta": 0,
          "recall_delta": 0
        },
        "drift": 0,
        "exceeds_tau": false
      }
    ],
    "summary": {
      "label_changes": 0,
      "new_unexplained": 0,
      "families_checked": 2,
      "families_drifted": [],
      "families_not_comparable": [],
      "pass": true
    }
  },
  "manifest": "eyJhbGciOiJFUzI1NiIsInR5cCI6InByb3ZlbmFuY2UtdHJhY2UtZGlmZitqd3QiLCJraWQiOiJmNzY1YTk5YWQwNTQzZDk5In0.eyJpc3MiOiJwcm92ZW5hbmNlLWF1dGhvcml6ZSIsImlhdCI6MTc5NDA3OTMzOCwiZGlmZl9pZCI6InRqb2JfMDFNNlZRQ0JUR1EyUUJYMzhFUU1SOFhHS0giLCJiYXNlX21vZGVsIjoicXdlbjIuNS0wLjViLWluc3RydWN0QDdhZTU1NzYwIiwidGFyZ2V0X21vZGVsIjoicXdlbjIuNS0wLjViLWluc3RydWN0QDdhZTU1NzYwIiwidGF1IjowLjI1LCJwYXNzIjp0cnVlLCJmYW1pbGllc19kcmlmdGVkIjowLCJyZXBvcnRfaGFzaCI6IjVmZDI2OWM0MGQwNzc4NjMxMDg4MWMyNDAzNzZjODkwNDkyZjQwMWUyMmM4NGQxNDQ4OGEwYTIxNzRmZmQwMzEifQ.-nYWpg1RZfH1kPRM02SIzrmdQwi68pGxXfgk5NkLAmSXc_5BNAA76LKW9F7dh9xgb7oNPvDTlf4JzOxpR2oQBQ",
  "report_hash": "5fd269c40d07786310881c240376c890492f401e22c84d14488a0a2174ffd031",
  "error": null,
  "created_at": "2026-11-07T19:22:18.320Z",
  "updated_at": "2026-11-07T19:22:18.410Z",
  "expires_at": "2026-12-07T19:22:18.320Z",
  "poll_url": "/v1/trace/diffs/tjob_01M6VQCBTGQ2QBX38EQMR8XGKH"
}
```

## List registry diffs

`GET /v1/trace/diffs`

Lists your account's registry diffs.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

No parameters.

### Returns

The diffs, newest first. Fetch one for its report.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/trace/diffs" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/diffs`, {
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/trace/diffs", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()
```

### Response 200

```json
{
  "object": "list",
  "data": [],
  "has_more": false,
  "next_cursor": null
}
```
