Data schemas¶
This page describes the files gridfm-trustlayer reads and writes: their row layout, the columns it uses, and how it interprets them. Predictions from a model other than GridFM work if they follow the same layout.
Scope¶
This page covers:
- graphkit prediction artifacts used as trustlayer inputs
- datakit raw ground-truth parquets used as trustlayer inputs
- the derived
line_loadingcomputation path - the calibrated parquet and CSV artifacts produced by trustlayer
Before version 1.0, these layouts may change between minor versions; changes are listed in the Changelog.
Artifact families¶
Trustlayer works with five kinds of files.
Prediction artifacts¶
Produced by graphkit.
Examples:
- PF-style bus parquet:
<grid>_predictions.parquet - OPF bus parquet:
<grid>_predictions.parquet - OPF generator parquet:
<grid>_gen_predictions.parquet
Scenario embedding artifacts¶
Consumed by compute and calibrate when cp_type: kernel is requested.
Example:
*_bus_embeddings.parquet
Ground-truth artifacts¶
Produced by datakit.
Examples:
raw/bus_data.parquetraw/branch_data.parquet
Trustlayer calibration artifacts¶
Produced by gridfm_trustlayer compute.
Example:
*.trustlayer
Trustlayer calibrated and screening outputs¶
Produced by gridfm_trustlayer calibrate and gridfm_trustlayer screen.
Examples:
- calibrated voltage parquet
- calibrated line-loading parquet
- trust-analysis CSVs
- trust-summary CSVs
- trust-screen CSVs
Prediction artifacts¶
Common row layout¶
The bus prediction parquet is long-form: one row per (scenario, bus), with every scenario carrying the same buses.
Common bus-level fields¶
Typical fields used by trustlayer include:
scenariobusVm_targetVa_targetPg_targetQg_targetVm_predVa_predPg_predQg_predPQPVREF
Additional task-specific or evaluation columns may also be present, such as:
PdQdVm_minVm_maxQg_minQg_maxactive res. (MW)reactive res. (MVar)PBE
PowerFlow semantics¶
Interpretation:
Vm_target,Va_target,Pg_target, andQg_targetare direct targets exposed in the prediction parquetVm_pred,Va_pred,Pg_pred, andQg_predare raw graphkit prediction outputsPQ,PV, andREFencode bus-type masks
Important note:
- graphkit computes PF residual metrics from a clamped evaluation tensor
- the exported
*_predcolumns remain the raw model outputs - trustlayer applies PF-specific correction rules behind the task adapter rather than assuming the exported predictions are already clamped
When loading PowerFlow predictions:
Vmis replaced byVm_targetonPVbuses, andVabyVa_targeton theREFbus: these are the set-points of a power flow, given to the model as inputs in graphkit's power-flow mask (which treatsVmat the reference bus as unknown)- the same values are needed by
applyfor new scenarios; graphkit writes them for every scenario it predicts Pg_predandQg_predremain available as raw direct-output channels inPredictionSet.channels
OptimalPowerFlow semantics¶
OPF predictions differ from PF ones and are not clamped like them.
Files:
- one bus parquet:
<grid>_predictions.parquet - one generator parquet:
<grid>_gen_predictions.parquet
Interpretation:
- bus
Pg_predis generator-derived, not an independent raw bus target - bus
Qg_predis not a free PF-style direct head - OPF generator prediction rows are long-form per scenario
- generator
idxis not assumed to be a stable cross-scenario physical generator identifier
Trustlayer therefore preserves the OPF generator artifact as a first-class input instead of forcing it into a rectangular bus-only schema.
Scenario embedding artifacts¶
Used only by cp_type: kernel, and read from inputs.calibration.embeddings (compute) and inputs.test.embeddings (calibrate).
Required columns:
| Column | Type | Description |
|---|---|---|
scenario |
integer | Scenario id, matching the predictions parquet. |
bus |
integer | Entity id within the scenario. |
emb_* |
float | Embedding dimensions. Any number of columns carrying the emb_ prefix; they are read in sorted name order. |
Graphkit produces this layout with gridfm_graphkit predict --get_embeddings, where the embedding width is the model's hidden size times its attention-head count.
Requirements:
- The table must be rectangular: every scenario must carry the same number of entities. A ragged table is rejected rather than silently pooled over differing entity counts.
- It must cover every scenario present in the predictions parquet.
Trustlayer reduces this to one vector per scenario using embedding_pooling, then standardizes it per dimension with statistics fitted on the calibration set, and finally projects onto the unit sphere when distance: cosine is requested. Only the pooled, standardized vectors are stored in the artifact; the source parquet is not embedded.
Ground-truth artifacts¶
Ground truth is read from the raw parquets written by datakit.
Examples:
data_out_pf/<grid>/raw/bus_data.parquetdata_out_pf/<grid>/raw/branch_data.parquetdata_out_opf/<grid>/raw/bus_data.parquetdata_out_opf/<grid>/raw/branch_data.parquet
Bus data¶
One row per (scenario, bus). Columns used:
scenariobusPdQdPgQgVmVaPQPVREFvn_kv
Interpretation:
VmandVaare loaded as rectangular(n_scenarios, n_buses)arraysPdis summed per scenario to derivesystem_loadforsystem_load_binstratificationPgandQgare preserved as direct ground-truth channels where relevant- bus-type masks are preserved as rectangular arrays
vn_kvis used to derive base voltage for loading computation
Angle convention:
- datakit raw
Vamay be stored in degrees - graphkit prediction artifacts use radians
- trustlayer normalizes degree-scale raw
Vato radians insideload_ground_truth()
Branch data¶
One row per (scenario, idx). Columns used:
scenarioidxfrom_busto_busrate_abr_statusYff_rYff_iYft_rYft_iYtf_rYtf_iYtt_rYtt_i
Interpretation:
idxdefines the rectangular branch axisbr_status != 1marks inactive branchesn_outagesis derived per scenario from both inactive-branch counts and inactive-generator counts when a siblinggen_data.parquetis availablefrom_bus,to_bus, andrate_aare taken from the first scenario as topology and rating reference columns- the complex admittance coefficients are kept as aligned rectangular arrays
Derived line_loading¶
line_loading is computed by gridfm_trustlayer.compute_line_loading, which delegates the AC branch flows to datakit's gridfm_datakit.utils.power_balance.compute_branch_powers_vectorized:
- build a bus dataframe from aligned
VmandVa - build a branch dataframe from topology, status, ratings, and admittances
- delegate AC branch-flow computation to datakit
- compute loading as
max(|S_from|, |S_to|) / rate_a - set inactive or unrated branches to
-1
Scale convention:
0.5means 50% of the branch rating1.0means 100% of the branch rating> 1.0means overload relative torate_a
Behavioral reference:
gridfm_datakit.validationremains the semantic reference for loading rules- trustlayer reuses the datakit branch-power helper rather than copying the loading math locally
Trustlayer runtime objects¶
load_predictions() returns a PredictionSet containing:
task_namechannel_namesscenario_idsbus_idsVmVachannelsbus_type_masks
load_ground_truth() returns a GroundTruthSet containing:
scenario_idsbus_idsbranch_idsn_outagesoutage_typesystem_loadremoved_maskVmVachannelsadmittancesf_bust_busrate_abase_kvsn_mvabus_type_masks
Trustlayer produced artifacts¶
.trustlayer artifact¶
Produced by compute.
Contains:
- one calibrator for voltage targets, or
- one calibrator for line-loading targets, or
- a bundle containing separate calibrators for each target family in a mixed run
Two on-disk encodings exist, selected by cp_type. load_interval_artifacts detects the encoding from the file's magic bytes, so both are read through the same path and the file extension does not change.
cp_type |
Encoding | Stored state |
|---|---|---|
element |
JSON | per-entity residual quantiles, optional per-stratum quantiles, stratification metadata, bin edges, fingerprint of the calibration predictions |
kernel |
compressed binary container (npz) with a __meta__ JSON entry |
everything above plus the calibration residual bank, per-entity valid masks, standardized calibration embeddings, embedding standardization statistics, per-stratum fallback quantiles, and the kernel settings (distance, bandwidth, k_nn, n_eff_target, n_eff_min, embedding_pooling), plus a tuning record (candidates, selection reason, folds) when n_eff_target: auto was used |
Kernel artifacts are therefore much larger than element artifacts, because they retain the calibration residuals and embeddings rather than reducing them to a quantile table.
Calibrated voltage parquet¶
Produced by calibrate when bus-level targets are present.
Typical columns include:
- original prediction parquet columns
Vm_pi_lower,Vm_pi_upperwhenVmis calibratedVa_pi_lower,Va_pi_upperwhenVais calibratedVm_known,Va_known: the set-points, see Known values- optional stratification columns such as
outage_type,outage_type_label,system_load_bin,system_load_bin_label,pred_bins_vm,pred_bins_vm_label,pred_bins_va, andpred_bins_va_label - kernel diagnostic columns
kcp_n_eff,kcp_bandwidth_sq, andkcp_fallbackwhencp_type: kernel
Calibrated line-loading parquet¶
Produced by calibrate when line_loading is requested.
Typical columns include:
scenariobranchfrom_busto_busrate_aline_loading_predline_loading_targetline_loading_pi_lowerline_loading_pi_upper- optional stratification columns such as
outage_type,outage_type_label,system_load_bin,system_load_bin_label,pred_bins_line_loading, andpred_bins_line_loading_label - kernel diagnostic columns
kcp_n_eff,kcp_bandwidth_sq, andkcp_fallbackwhencp_type: kernel
Coverage reports¶
Produced by calibrate in outputs.coverage_dir (default: coverage/ next to the calibrated parquets):
summary.mdcoverage_by_stratum.csv: one row per variable and stratumcoverage_by_group.csv: one row per variable, stratum and group (bus_type=...orrate_a=...)coverage_by_element_voltage.csv,coverage_by_element_line_loading.csv: one row per variable, stratum and bus or linefigures/
The stratum column reads all for the whole test set, or the stratum label:
n_outages=2,outage_type=branch_only;system_load_binlabels are percentile ranges with cut-point hints, e.g.system_load_bin=p20-p40 [1450, 1620);pred_binslabels are per variable, e.g.pred_bins_vm=p00-p50 (<1.0)orpred_bins_line_loading=p50-p100 (>=0.82).
Widths are in the model's units (Va in radians); summary.md and the figures show Va in degrees. Every column is explained in Reading the results.
Screening reports¶
Produced by screen in outputs.screen_dir:
summary.mdscenarios.csv: one row per operating scenario, with its statusesstatus_by_stratum.csv: one row per level (scenario,element), variable, stratum, method (interval,point) and statusscreening_by_stratum.csv,screening_by_group.csv,screening_by_element_voltage.csv,screening_by_element_line_loading.csv: one row per screened side (lower,upper,anyforVm;upperforline_loading)screening_detail_voltage.parquet/,screening_detail_line_loading.parquet/(partitioned datasets): one row per screened valuefigures/
See Reading the results.
Status reports of apply¶
Produced by apply in outputs.status_dir when screen_bounds is set: summary.md, scenarios.csv and status_by_stratum.csv, with the columns of screen's except the true status (true_status, truly_violated). The applied datasets gain <variable>_status and <variable>_point_status. See Reading the results.
Known values¶
Vm_known and Va_known (boolean) in the calibrated and applied voltage parquets mark the set-points: Vm at PV buses and Va at the reference bus for PowerFlow, Va at the reference bus for OptimalPowerFlow. Their bounds equal the set-point, and every report leaves them out and counts them in n_known.
Known limits¶
- Kernel artifacts embed the calibration residuals and embeddings, so their size grows with the calibration set and the embedding width, unlike element artifacts.
- OPF generator predictions are identified per scenario only: a generator index is not assumed to refer to the same physical generator across scenarios.