Files
OBLITERATUS/docs/checkpoints/schemas/artifact-provenance-v1.schema.json

146 lines
6.3 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://obliteratus.dev/schemas/artifact-provenance-v1.schema.json",
"title": "OBLITERATUS Artifact Provenance v1",
"type": "object",
"additionalProperties": false,
"required": [
"schema_id",
"schema_version",
"artifact_id",
"record_digest",
"sources",
"converter",
"obliteratus_commit",
"configuration_digest",
"tokenizer",
"base_model",
"command",
"environment",
"source_topology",
"lineage",
"input_digests",
"output_digests",
"transformations",
"state",
"adapter",
"dataset",
"training",
"unknowns"
],
"properties": {
"schema_id": {"const": "obliteratus.artifact-provenance"},
"schema_version": {"const": "1.0.0"},
"artifact_id": {"type": "string", "pattern": "^artifact-sha256:[0-9a-f]{64}$"},
"record_digest": {"$ref": "#/$defs/digest"},
"sources": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"$ref": "#/$defs/artifactIdentity"}},
"converter": {"$ref": "#/$defs/toolIdentity"},
"obliteratus_commit": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
"configuration_digest": {"anyOf": [{"$ref": "#/$defs/digest"}, {"type": "null"}]},
"tokenizer": {"anyOf": [{"$ref": "#/$defs/artifactIdentity"}, {"type": "null"}]},
"base_model": {"anyOf": [{"$ref": "#/$defs/artifactIdentity"}, {"type": "null"}]},
"command": {"type": "array", "maxItems": 256, "items": {"type": "string", "maxLength": 4096}},
"environment": {
"type": "object",
"additionalProperties": false,
"required": ["packages", "platform", "python"],
"properties": {
"python": {"type": ["string", "null"], "maxLength": 128},
"platform": {"type": ["string", "null"], "maxLength": 256},
"packages": {"type": "object", "additionalProperties": {"type": "string", "maxLength": 128}}
}
},
"source_topology": {"type": "object"},
"lineage": {"type": "array", "uniqueItems": true, "items": {"$ref": "#/$defs/lineageEvent"}},
"input_digests": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"$ref": "#/$defs/digest"}},
"output_digests": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"$ref": "#/$defs/digest"}},
"transformations": {"type": "array", "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
"state": {
"type": "object",
"additionalProperties": false,
"required": ["classification", "observed_scopes", "lost_state"],
"properties": {
"classification": {"enum": ["weights_only", "model_and_optimizer", "exact_resume", "unknown"]},
"observed_scopes": {"type": "array", "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
"lost_state": {"type": "array", "uniqueItems": true, "items": {"$ref": "#/$defs/id"}}
}
},
"adapter": {"anyOf": [{"$ref": "#/$defs/adapterIdentity"}, {"type": "null"}]},
"dataset": {"anyOf": [{"$ref": "#/$defs/datasetIdentity"}, {"type": "null"}]},
"training": {"anyOf": [{"$ref": "#/$defs/trainingIdentity"}, {"type": "null"}]},
"unknowns": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1, "maxLength": 1024}}
},
"$defs": {
"id": {"type": "string", "minLength": 1, "maxLength": 512},
"digest": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"},
"artifactIdentity": {
"type": "object",
"additionalProperties": false,
"required": ["kind", "identity", "revision", "digest"],
"properties": {
"kind": {"enum": ["local", "hub", "generated"]},
"identity": {"$ref": "#/$defs/id"},
"revision": {"type": ["string", "null"], "maxLength": 256},
"digest": {"$ref": "#/$defs/digest"}
}
},
"toolIdentity": {
"type": "object",
"additionalProperties": false,
"required": ["name", "version", "commit"],
"properties": {
"name": {"$ref": "#/$defs/id"},
"version": {"$ref": "#/$defs/id"},
"commit": {"type": "string", "pattern": "^[0-9a-f]{40}$"}
}
},
"lineageEvent": {
"type": "object",
"additionalProperties": false,
"required": ["event_id", "event_type", "parent_artifact_ids", "tool", "transformations"],
"properties": {
"event_id": {"$ref": "#/$defs/id"},
"event_type": {"enum": ["consolidation", "reshard", "pretrain", "full_finetune", "adapter_train", "adapter_merge", "quantization", "dequantization", "surgery"]},
"parent_artifact_ids": {"type": "array", "uniqueItems": true, "items": {"type": "string", "pattern": "^artifact-sha256:[0-9a-f]{64}$"}},
"tool": {"$ref": "#/$defs/id"},
"transformations": {"type": "array", "uniqueItems": true, "items": {"$ref": "#/$defs/id"}}
}
},
"adapterIdentity": {
"type": "object",
"additionalProperties": false,
"required": ["adapter_type", "base_model", "config_digest", "key_map_digest"],
"properties": {
"adapter_type": {"$ref": "#/$defs/id"},
"base_model": {"$ref": "#/$defs/artifactIdentity"},
"config_digest": {"$ref": "#/$defs/digest"},
"key_map_digest": {"$ref": "#/$defs/digest"}
}
},
"datasetIdentity": {
"type": "object",
"additionalProperties": false,
"required": ["identifier", "revision", "digest", "split", "subset", "record_count"],
"properties": {
"identifier": {"$ref": "#/$defs/id"},
"revision": {"type": ["string", "null"], "maxLength": 256},
"digest": {"$ref": "#/$defs/digest"},
"split": {"type": ["string", "null"], "maxLength": 256},
"subset": {"type": ["string", "null"], "maxLength": 256},
"record_count": {"type": "integer", "minimum": 0, "maximum": 9223372036854775807}
}
},
"trainingIdentity": {
"type": "object",
"additionalProperties": false,
"required": ["method", "framework", "framework_version", "hyperparameters_digest"],
"properties": {
"method": {"enum": ["pretrain", "full_finetune", "adapter_train", "unknown"]},
"framework": {"type": ["string", "null"], "maxLength": 256},
"framework_version": {"type": ["string", "null"], "maxLength": 128},
"hyperparameters_digest": {"anyOf": [{"$ref": "#/$defs/digest"}, {"type": "null"}]}
}
}
}
}