View as Markdown

Trace · Guide

Diff a fine-tune's neurons

Available on Enterprise

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 /v1/trace/diffs. 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
{
  "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"
}
FieldAccepted
base, targetA model version ID or slug you can see: a public model or one of your builds. Both must share an architecture.
canary_setsThe families to check (default: every family on either model)
tauThe 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 /v1/trace/diffs/{id}:

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"

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"
}
SectionWhat it measures
coverageNeurons in each registry and how many are shared
label_changesShared neurons labeled differently; a label is an estimate, so a change is a prompt to look
new_unexplainedNeurons unexplained in the target that were explained in the base, or are new
ablation_delta_driftMean, p95 and max change in each shared neuron's measured ablation effect, plus the top 50; this is the measurement
canary_member_shiftOne row per canary family (below)
summaryfamilies_drifted, families_not_comparable and pass

Each canary family is compared like with like:

Family on the two modelsCompared by
Your own set on bothMembership: drift = 1 − Jaccard, with members added and removed
Curated on bothMember counts and Jaccard; curated members are never listed
Curated on one, yours on the otherMeasured precision and recall, never membership, so an overlap can't reveal curated members; without stats it is not_comparable
Missing on one sidedrift = 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);
}

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

SymptomCauseFix
404 resource_missing on base or targetAn unknown model, or another account's buildUse a model from GET /v1/trace/models.
400 parameter_invalid on targetThe architectures differ (n_layers × d_mlp)Diff a fine-tune against its own base.
A family in families_not_comparableA mixed family with no measured stats on one sideMeasure your set.
402 plan_requiredDiffs are EnterpriseSee plans and usage.

See also