Pure orchestration helpers for the D2 relevance-labeling pipeline.
This module bridges the JSON gold artifact and candidate-pool sidecar to the judge, safely prefills only test rows, and computes the bank-scoped calibration trust gate. Human-label ingestion and persistence remain separate concerns.
Summary
Functions
Join bank-scoped human and LLM calibration rows and evaluate the quadratic-kappa gate.
Convert every gold-artifact row to the atom-keyed pair shape accepted by Judge.
Build the complete judge set and retain only the requested splits.
Prefill successful LLM grades onto test rows without revealing calibration judgements.
Build the bulk train judge set from a query-pool sidecar.
Functions
Join bank-scoped human and LLM calibration rows and evaluate the quadratic-kappa gate.
The confusion matrix is a 4x4 nested list whose rows are human grades and columns are LLM grades. Undefined kappa always fails the gate.
Options:
:bank_id- restrict the report to one bank:threshold- pass threshold (default:0.6)
Convert every gold-artifact row to the atom-keyed pair shape accepted by Judge.
Calibration and test splits are preserved. Existing human grades are deliberately not copied into judge input.
Build the complete judge set and retain only the requested splits.
This supports correction passes that must replace calibration and train labels without touching held-out test labels.
Prefill successful LLM grades onto test rows without revealing calibration judgements.
The artifact is otherwise preserved. Test rows with no matching successful label remain
unchanged. Both a label list and the %{labels: labels} result returned by Judge are
accepted.
Build the bulk train judge set from a query-pool sidecar.
Every pair present in the gold artifact is excluded, and duplicate candidates are
collapsed by {query_ref, memory_ref}. All resulting pairs have the :train split.