Trace · Guide
Diff a fine-tune's neurons
Use a registry diff to compare two neuron registries of the same architecture, neuron by neuron, and gate CI on it before new weights ship. A typical pair is the public base model and your private registry build of the fine-tune.
A diff works on registries that are already stored, so it needs no GPU and never calls the trace backend.
Before you begin: export the sandbox Enterprise key.
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
1. Start a diff
Send the two model versions to POST /. This example diffs the sandbox model against itself, which passes; in your pipeline, target is your fine-tune's build.
curl -s $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 }' | tee diff.json
import { Provenance } from "@provenanceauth/sdk";
const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const diff = await prov.trace.diffs.create({ base: "qwen2.5-0.5b-instruct@7ae55760", target: "qwen2.5-0.5b-instruct@7ae55760", tau: 0.25 });
import os
from provenanceauth import Provenance
prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
diff = prov.trace.diffs.create(base="qwen2.5-0.5b-instruct@7ae55760", target="qwen2.5-0.5b-instruct@7ae55760", tau=0.25)
{
"id": "tjob_01M5Q0RAFRE0B5RWBJM4FSWGE9",
"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-10-24T13:14:13.368Z",
"updated_at": "2026-10-24T13:14:13.368Z",
"expires_at": "2026-11-23T13:14:13.368Z",
"poll_url": "/v1/trace/diffs/tjob_01M5Q0RAFRE0B5RWBJM4FSWGE9"
}
| Field | Accepted |
|---|---|
base, target | A model version ID or slug you can see: a public model or one of your builds. Both must share an architecture. |
canary_ | The families to check (default: every family on either model) |
tau | The drift tolerance, 0–1 (default 0.25). A family that drifts more fails the diff. |
2. Read the report
Wait for the diff with GET /:
export DIFF_ID=$(jq -r .id diff.json)
until [ "$(curl -s $PROVENANCE_API/v1/trace/diffs/$DIFF_ID -H "Authorization: Bearer $PROVENANCE_KEY" | jq -r .status)" != "pending" ]; do sleep 1; done
curl -s $PROVENANCE_API/v1/trace/diffs/$DIFF_ID -H "Authorization: Bearer $PROVENANCE_KEY"
const done = await prov.trace.diffs.wait(diff.id);
import time
while (done := prov.trace.diffs.get(diff["id"]))["status"] in ("pending", "running"):
time.sleep(1)
The response, trimmed to the report's summary and coverage:
{
"id": "tjob_01M5Q0RAFRE0B5RWBJM4FSWGE9",
"object": "registry_diff",
"status": "completed",
"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 },
"summary": { "label_changes": 0, "new_unexplained": 0, "families_checked": 2, "families_drifted": [], "families_not_comparable": [], "pass": true }
},
"report_hash": "5fd269c40d07786310881c240376c890492f401e22c84d14488a0a2174ffd031"
}
| Section | What it measures |
|---|---|
coverage | Neurons in each registry and how many are shared |
label_ | Shared neurons labeled differently; a label is an estimate, so a change is a prompt to look |
new_ | Neurons unexplained in the target that were explained in the base, or are new |
ablation_ | Mean, p95 and max change in each shared neuron's measured ablation effect, plus the top 50; this is the measurement |
canary_ | One row per canary family (below) |
summary | families_, families_ and pass |
Each canary family is compared like with like:
| Family on the two models | Compared by |
|---|---|
| Your own set on both | Membership: drift = 1 − Jaccard, with members added and removed |
| Curated on both | Member counts and Jaccard; curated members are never listed |
| Curated on one, yours on the other | Measured precision and recall, never membership, so an overlap can't reveal curated members; without stats it is not_ |
| Missing on one side | drift = 1, so the diff fails, as a policy naming it would |
Lists hold up to 200 entries with complete totals, and numbers are rounded to four decimals, so the report is deterministic.
3. Gate CI on the signed manifest
Each completed diff carries an ES256 manifest (typ: provenance-trace-diff+jwt) that binds the report's hash, the verdict, the tolerance and both models. Verify it offline against the JWKS, then fail the build when it doesn't pass:
import { Provenance, fetchJwks, verifyTraceDiffManifest } from "@provenanceauth/sdk";
const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const created = await prov.trace.diffs.create({ base: process.env.BASE_MODEL!, target: process.env.TUNED_MODEL!, tau: 0.25 });
const d = await prov.trace.diffs.wait(created.id);
const v = await verifyTraceDiffManifest(d.manifest!, await fetchJwks(process.env.PROVENANCE_API!), d.report);
if (d.status !== "completed" || !v.valid || !v.reportMatches || !v.claims!.pass) {
console.error("Neuron-CI failed:", d.report?.summary.familiesDrifted, v.reason ?? "");
process.exit(1);
}
import os
import sys
from provenanceauth_verify import fetch_jwks, verify_trace_diff_manifest
result = verify_trace_diff_manifest(done["manifest"], fetch_jwks(os.environ["PROVENANCE_API"]), done["report"])
if done["status"] != "completed" or not result.valid or not result.report_matches or not result.claims["pass"]:
sys.exit(f"Neuron-CI failed: {done['report']['summary']['families_drifted']}")
A completed diff also fires the trace.registry_diff.completed webhook.
Limitations: a diff compares what each registry build measured on its corpus and evaluation sets, not how either model behaves on your traffic. A pass means no family drifted beyond your tolerance on the measured stats.
Errors you might see
| Symptom | Cause | Fix |
|---|---|---|
404 resource_ on base or target | An unknown model, or another account's build | Use a model from GET /. |
400 parameter_ on target | The architectures differ (n_ × d_) | Diff a fine-tune against its own base. |
A family in families_ | A mixed family with no measured stats on one side | Measure your set. |
402 plan_ | Diffs are Enterprise | See plans and usage. |