Skip to content

candidate-pipeline: sink non-finite ranking scores - #204

Open
thepriben wants to merge 1 commit into
xai-org:mainfrom
thepriben:candidate-pipeline-sink-non-finite-scores
Open

thepriben wants to merge 1 commit into
xai-org:mainfrom
thepriben:candidate-pipeline-sink-non-finite-scores

Conversation

@thepriben

@thepriben thepriben commented Sep 15, 2026

Copy link
Copy Markdown

Summary

partial_cmp returns None for NaN. The selector treated that as Equal, so a candidate with an invalid score could stay ahead of a valid one and consume a Top-K slot.

Concrete case, K = 2:

input:     NaN    0.90    0.80
old sort:  NaN    0.90    0.80
selected:  NaN    0.90          // 0.80 dropped

After this change, non-finite scores (NaN, +inf, -inf) rank below every finite score. Finite scores still sort descending:

input:     NaN    0.90    0.80
new sort:  0.90   0.80    NaN
selected:  0.90   0.80

Missing scores (None) were already mapped to -inf. This only changes Some(NaN) / Some(±inf).

Treat NaN and infinities as invalid so they cannot keep a Top-K slot over a finite score.
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.

1 participant