Skip to content

fix(export): derive the ONNX output contract from num_out - #360

Merged
jayhesselberth merged 1 commit into
mainfrom
fix-multiclass-export-contract
Sep 25, 2026
Merged

jayhesselberth merged 1 commit into
mainfrom
fix-multiclass-export-contract

Conversation

@jayhesselberth

Copy link
Copy Markdown
Member

Closes #357. The export sidecar always described the output as a single BCE logit, so a multiclass checkpoint shipped a contract telling consumers to apply a sigmoid to a [batch, num_out] softmax. The output block now comes from the checkpoint: binary exports keep the old block byte for byte; multiclass exports get [batch, num_out], a softmax convention, class order from label_map, and the calibration method when calibration.json sits beside the checkpoint. Export refuses to write a contract whose width disagrees with the graph, or whose label_map does not index exactly 0..num_out-1.

A multiclass checkpoint with no label_map still exports, with classes: null and a warning, since training can produce that shape and the column order is still correct.

https://claude.ai/code/session_01JDZiRc4dgzaA7nYFijxGbz

@jayhesselberth
jayhesselberth merged commit a64514d into main Sep 25, 2026
3 checks passed
@jayhesselberth
jayhesselberth deleted the fix-multiclass-export-contract branch September 25, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

export: ONNX contract hardcodes a single BCE logit, wrong for multiclass checkpoints

1 participant