ct_segmentation_finetune_quality_v1
Purpose
- Audits
nv_segment_ct_finetune evidence packs for checkpoint integrity, training trajectory, baseline comparison, dataset-audit consistency, and label coverage.
- Use this after a finetune smoke, sanity, or user-data run has produced an evidence pack. Engineering verification only.
- Manifest I/O: inputs are
nv_segment_ct_finetune_evidence_pack; outputs are ct_segmentation_finetune_quality_report.
Instructions
- Run
scripts/grade.py on the finetune evidence-pack directory.
- If a host agent exposes
run_script, use run_script("scripts/grade.py", args=["RUNS/FINETUNE_PACK"]).
- Prefer the eval-engine command when you need a verifier evidence pack; use the direct Python command for quick local inspection.
Available Scripts
| Script |
Purpose |
Arguments |
scripts/grade.py |
Primary verifier entrypoint declared by skill_manifest.yaml. |
EVIDENCE_PACK_DIR |
Prerequisites
- The target pack must contain
manifest.json, validation_summary.json, and output.json.
- Recorded checkpoint paths must still resolve if checkpoint integrity should be assessed.
- Side effects: optional
--out writes a small JSON audit report to the caller-provided path.
Limitations
- CPU-only audit; it does not re-run training or load the MONAI network.
- Smoke mode is treated as a plumbing oracle, not a model-quality claim.
- Not for clinical validation, regulatory submission, or patient-care decisions.
Troubleshooting
| Error |
Cause |
Fix |
| Missing checkpoint |
The source pack did not preserve output.finetuned_ckpt. |
Keep checkpoint artifacts with the pack before auditing. |
| Empty training trajectory |
The source wrapper did not record epoch metrics. |
Inspect the finetune run output and stderr before trusting the pack. |
| Dataset audit failure |
Input labels/images violate recorded engineering assumptions. |
Review the input.dataset_audit block and rerun with corrected dataset metadata. |
Second-pass auditor for evidence packs produced by
skills/nv-segment-ct-finetune. The wrapper proves a finetune run completed,
emitted a checkpoint, and recorded a training trajectory plus a domain audit
of the training dataset. This verifier asks whether what was recorded crosses
an engineering floor:
- Checkpoint integrity. The path under
output.finetuned_ckpt resolves
to an on-disk file of plausible size. When torch is available the
verifier additionally loads the checkpoint with map_location='cpu' and
reports parameter count and key shape, without instantiating the model.
- Training trajectory.
output.val_dice_per_epoch is non-empty, runs the
full declared epoch budget, train_loss_finite==true, and oom==false.
Smoke mode skips the Dice floor because it is only a plumbing oracle. In
--sanity mode the floor is the manifest-declared sanity threshold; in real
runs it is set high enough to catch silent regressions but low enough to
avoid conflating with publication-quality numbers.
- Improvement over baseline. When both
output.baseline_val_dice and
output.best_val_dice are recorded, improvement_over_baseline must be
non-negative (>= 0). In sanity mode sanity_recovery_demonstrated==true
is the required signal.
- Dataset audit consistency. The recorded
input.dataset_audit block
must be internally consistent: when image_looks_like_ct==true the HU
range must include negative values; when anatomy is named and bounds are
declared, anatomy_volume_all_in_range==true; orientation across samples
is consistent.
- Label coverage. Every label declared in
input.label_mappings.default
must have shown up at least once in input.dataset_audit.label_uniques_sampled
unless the run is in smoke mode (smoke fixture sampling is intentionally
shallow).
The verifier is CPU-only, does not re-run training, does not require
GPU, and does not load the upstream MONAI bundle's network. A v2 that
re-runs the bundle's evaluate config against a held-out split is planned but
out of scope here.
python verifiers/ct_segmentation_finetune_quality_v1/scripts/grade.py \
runs/<finetune_pack_dir>
Engineering verification only. Not for clinical interpretation, regulatory
submission, or any decision about the suitability of the finetuned model for
patient care.
1---2name: ct-segmentation-finetune-quality-v13description: Deterministic verifier for nv_segment_ct_finetune evidence packs. Audits the finetuned checkpoint, training trajectory, and dataset audit signals already recorded by the wrapper. Engineering verification only.4license: Apache-2.05---67# ct_segmentation_finetune_quality_v189## Purpose10- Audits `nv_segment_ct_finetune` evidence packs for checkpoint integrity, training trajectory, baseline comparison, dataset-audit consistency, and label coverage.11- Use this after a finetune smoke, sanity, or user-data run has produced an evidence pack. Engineering verification only.12- Manifest I/O: inputs are `nv_segment_ct_finetune_evidence_pack`; outputs are `ct_segmentation_finetune_quality_report`.1314## Instructions15- Run `scripts/grade.py` on the finetune evidence-pack directory.16- If a host agent exposes `run_script`, use `run_script("scripts/grade.py", args=["RUNS/FINETUNE_PACK"])`.17- Prefer the eval-engine command when you need a verifier evidence pack; use the direct Python command for quick local inspection.1819## Available Scripts20| Script | Purpose | Arguments |21|---|---|---|22| `scripts/grade.py` | Primary verifier entrypoint declared by `skill_manifest.yaml`. | `EVIDENCE_PACK_DIR` |2324## Prerequisites25- The target pack must contain `manifest.json`, `validation_summary.json`, and `output.json`.26- Recorded checkpoint paths must still resolve if checkpoint integrity should be assessed.27- Side effects: optional `--out` writes a small JSON audit report to the caller-provided path.2829## Limitations30- CPU-only audit; it does not re-run training or load the MONAI network.31- Smoke mode is treated as a plumbing oracle, not a model-quality claim.32- Not for clinical validation, regulatory submission, or patient-care decisions.3334## Troubleshooting35| Error | Cause | Fix |36|---|---|---|37| Missing checkpoint | The source pack did not preserve `output.finetuned_ckpt`. | Keep checkpoint artifacts with the pack before auditing. |38| Empty training trajectory | The source wrapper did not record epoch metrics. | Inspect the finetune run output and stderr before trusting the pack. |39| Dataset audit failure | Input labels/images violate recorded engineering assumptions. | Review the `input.dataset_audit` block and rerun with corrected dataset metadata. |4041Second-pass auditor for evidence packs produced by42`skills/nv-segment-ct-finetune`. The wrapper proves a finetune run completed,43emitted a checkpoint, and recorded a training trajectory plus a domain audit44of the training dataset. This verifier asks whether what was recorded crosses45an engineering floor:4647- **Checkpoint integrity.** The path under `output.finetuned_ckpt` resolves48 to an on-disk file of plausible size. When `torch` is available the49 verifier additionally loads the checkpoint with `map_location='cpu'` and50 reports parameter count and key shape, without instantiating the model.51- **Training trajectory.** `output.val_dice_per_epoch` is non-empty, runs the52 full declared epoch budget, `train_loss_finite==true`, and `oom==false`.53 Smoke mode skips the Dice floor because it is only a plumbing oracle. In54 `--sanity` mode the floor is the manifest-declared sanity threshold; in real55 runs it is set high enough to catch silent regressions but low enough to56 avoid conflating with publication-quality numbers.57- **Improvement over baseline.** When both `output.baseline_val_dice` and58 `output.best_val_dice` are recorded, `improvement_over_baseline` must be59 non-negative (>= 0). In sanity mode `sanity_recovery_demonstrated==true`60 is the required signal.61- **Dataset audit consistency.** The recorded `input.dataset_audit` block62 must be internally consistent: when `image_looks_like_ct==true` the HU63 range must include negative values; when `anatomy` is named and bounds are64 declared, `anatomy_volume_all_in_range==true`; orientation across samples65 is consistent.66- **Label coverage.** Every label declared in `input.label_mappings.default`67 must have shown up at least once in `input.dataset_audit.label_uniques_sampled`68 unless the run is in smoke mode (smoke fixture sampling is intentionally69 shallow).7071The verifier is CPU-only, does **not** re-run training, does **not** require72GPU, and does **not** load the upstream MONAI bundle's network. A v2 that73re-runs the bundle's evaluate config against a held-out split is planned but74out of scope here.7576```bash77python verifiers/ct_segmentation_finetune_quality_v1/scripts/grade.py \78 runs/<finetune_pack_dir>79```8081Engineering verification only. Not for clinical interpretation, regulatory82submission, or any decision about the suitability of the finetuned model for83patient care.