Skip to content

perf: compute selected token logprobs directly - #3930

Open
CarlosGomes98 wants to merge 2 commits into
NVIDIA-NeMo:mainfrom
CarlosGomes98:cgomes/optimize-selected-logprobs
Open

perf: compute selected token logprobs directly#3930
CarlosGomes98 wants to merge 2 commits into
NVIDIA-NeMo:mainfrom
CarlosGomes98:cgomes/optimize-selected-logprobs

Conversation

@CarlosGomes98

@CarlosGomes98 CarlosGomes98 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

What does this PR do ?

Compute the selected logprobs directly instead of subsequently masking. Doesn't materialize the full vocabulary-sized logprob tensor. This reduces memory use and unnecessary computation.

Issues

List issues that this PR closes (syntax):

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

Additional Information

  • ...

@CarlosGomes98
CarlosGomes98 requested review from a team as code owners August 31, 2026 13:56
@copy-pr-bot

copy-pr-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@CarlosGomes98

Copy link
Copy Markdown
Contributor Author

/ok to test 7cfd947

@CarlosGomes98 CarlosGomes98 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

From the /review-pr skill, as requested:
Core logprob math verified equivalent to the log-softmax path; one blocking issue in the new TP-shard test.

Comment thread tests/unit/distributed/test_model_utils.py
Signed-off-by: Carlos Gomes <cgomes@nvidia.com>
@CarlosGomes98
CarlosGomes98 force-pushed the cgomes/optimize-selected-logprobs branch from 7cfd947 to ec226ec Compare September 1, 2026 22:17
@CarlosGomes98 CarlosGomes98 added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label Sep 1, 2026
@CarlosGomes98

Copy link
Copy Markdown
Contributor Author

/ok to test 7cfd947

@copy-pr-bot

copy-pr-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

/ok to test 7cfd947

@CarlosGomes98, there was an error processing your request: E2

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/

@CarlosGomes98

Copy link
Copy Markdown
Contributor Author

/ok to test ec226ec

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-customer Waiting on the original author to respond label Sep 2, 2026
Signed-off-by: Carlos Gomes <cgomes@nvidia.com>
@CarlosGomes98

Copy link
Copy Markdown
Contributor Author

/ok to test 7ed8ac3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) waiting-on-customer Waiting on the original author to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants