Skip to content

Keep masked candidates out of underfilled retrieval responses - #56

Open
Robertboy18 wants to merge 1 commit into
xai-org:mainfrom
Robertboy18:fix/retrieval-topk-validity
Open

Keep masked candidates out of underfilled retrieval responses#56
Robertboy18 wants to merge 1 commit into
xai-org:mainfrom
Robertboy18:fix/retrieval-topk-validity

Conversation

@Robertboy18

Copy link
Copy Markdown

Hey! I was looking through the retrieval masking path and noticed a semantic discrepancy when fewer than large_k candidates remain eligible: top-k still fills the remaining slots with sentinel-masked entries, and those indices can reach response construction.

This keeps a Boolean validity tensor alongside the selected indices and checks it while building the response. Fixed JAX shapes stay the same, while underfilled requests now return only eligible candidates. I also added coverage for the underfilled top-k case and response filtering.

I ran the focused JAX/CUDA test, Ruff, Rust formatting/checks, and rechecked the corresponding TorchLean theorem.

I have the Lean/TorchLean formalization of the cardinality argument too and can attach it if useful :)

Copilot AI lite review requested due to automatic review settings August 14, 2026 22:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants