API Reference

Artifact JSON schema

The artifact spec is normative about algorithms. This page is the document view: every field of the JSON, its type, whether it is required, and the invariant a reader must enforce. If you are writing an integration that only reads the artifact, this is the page you need.

Document root

Every artifact is a single JSON object with these top-level keys.

FieldTypeRequiredDescription
artifact_typestringyesAlways "compileml.decision_artifact".
schema_versionintegeryesDocument version. Current: 2.Invariant: Readers must reject versions they do not implement.
scaleintegeryesDisplay scale for the integer latent score and band edges.Invariant: Typically 1000.
modelobjectyesThe quantized integer tree ensemble.
calibrationobject | nulloptionalIsotonic latent → probability table. null means the artifact scores and bands but does not emit pd.
bandsobjectyesThe risk band ladder in display-scale integers.
featuresobjectyesFeature order, baseline values and missing-value policy.
reasonsobjectoptionalReason dictionary keyed by feature name.
runtimeobjectyesAttribution mode and display settings.
metadataobjectoptionalFree-form provenance (training run, recalibration lineage, owner).
artifact_hashstringyesSHA-256 hex over the canonical form of every other key.Invariant: Loaders verify this by default and reject a mismatch.

model

The scoring core. All payload values are integers in micro units.

FieldTypeRequiredDescription
model.kindstringyesAlways "tree_ensemble_int".
model.micro_scaleintegeryesInternal accumulation scale. 1_000_000.
model.base_microintegeryesBaseline latent in micro units, before any tree contribution.
model.n_featuresintegeryesInput arity.Invariant: Must equal len(features.names).
model.input_precisionstringyes"float64" or "float32" — how a conforming runtime must compare thresholds.
model.treesarray<object>yesOne entry per tree; all arrays share the node index space.
model.trees[].featurearray<int>yesSplit feature per node.Invariant: -2 marks a leaf.
model.trees[].thresholdarray<float>yesSplit threshold per node.Invariant: float64, must round-trip exactly through JSON.
model.trees[].leftarray<int>yesLeft child index; -1 at leaves.
model.trees[].rightarray<int>yesRight child index; -1 at leaves.
model.trees[].value_microarray<int>yesLeaf payload in micro units.Invariant: Interior nodes are 0.

calibration

An integer lookup table. No floating-point model is evaluated at decision time.

FieldTypeRequiredDescription
calibration.modestringyes"linear_int" (interpolated) or "step".
calibration.f_microarray<int>yesLatent knots in micro units.Invariant: Strictly increasing.
calibration.pd_ppmarray<int>yesProbability of default in parts per million.Invariant: Non-decreasing; same length as f_micro.

bands

The ladder, expressed in display-scale integers so band assignment is an integer comparison.

FieldTypeRequiredDescription
bands.edges_intarray<int>yesBand boundaries at display scale.Invariant: Strictly increasing.
bands.labelsarray<string>yesBand names in ascending order.Invariant: len(labels) == len(edges_int) - 1.
bands.boundarystringyes"left_closed_right_open" — an edge value belongs to the band above it.

features

Input contract. The order of names is the scoring order for every runtime and every export.

FieldTypeRequiredDescription
features.namesarray<string>yesFeature names in scoring order.
features.baselinearray<float>yesfloat64 reference row: imputation value and attribution reference.Invariant: Same length as names.
features.missing_policystringyes"baseline" imputes from baseline; "reject" raises instead.
features.display_namesobjectoptionalOptional human-facing labels keyed by feature name.
features.metaarrayoptionalOptional per-feature metadata carried for governance.

reasons

Policy language owned by the institution, not by the library.

FieldTypeRequiredDescription
reasons.<feature>.codestringyesReason code emitted in the payload.
reasons.<feature>.negativestringyesMessage shown when the feature increased risk.
reasons.<feature>.positivestringyesMessage shown when the feature decreased risk.
reasons.<feature>.suppressbooleanoptionalPolicy mask: compute the impact but never display it.

runtime

Declares how explanations are produced and how many are shown.

FieldTypeRequiredDescription
runtime.attributionstringyes"pairwise_interaction_int".
runtime.top_kintegeryesDefault number of reasons returned per direction.
runtime.whitebox_max_depthintegeryesMeasured depth of the compiled model.
runtime.exact_attributionbooleanyesRecorded claim.Invariant: true if and only if whitebox_max_depth ≤ 2.