Add attn_logit_softcapping config, plumbed to TE and local attention - #6590
Open
nvegesna-netizen wants to merge 1 commit into
Open
Add attn_logit_softcapping config, plumbed to TE and local attention#6590nvegesna-netizen wants to merge 1 commit into
nvegesna-netizen wants to merge 1 commit into
Conversation
Expose tanh logit softcapping so models like Gemma2 can run on the fused TransformerEngine flash path. - Add TransformerConfig.attn_logit_softcapping (Optional[float], None disables). - TEDotProductAttention: map it to TE's flash `softcap` kwarg via a signature capability probe (inspect.signature on te.pytorch.DotProductAttention) rather than a version gate, since patched TE builds may add softcap without a version bump; assert clearly when the field is set but the TE build lacks support. - Local DotProductAttention: apply cap*tanh(logits/cap) pre-softmax for CPU/no-TE parity with the fused path. When attn_logit_softcapping is None, behavior is unchanged. Signed-off-by: Nitin Vegesna <nvegesna@nvidia.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
svcnvidia-nemo-ci
marked this pull request as draft
August 17, 2026 21:15
Contributor
|
This PR has been automatically converted to draft because all PRs must start as drafts. When you are ready for review, click Ready for Review to begin the review process. This will:
See the contribution guide for more details. |
nvegesna-netizen
marked this pull request as ready for review
August 17, 2026 21:31
Contributor
Author
|
@NVIDIA/mcore-oncall can you review? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exposes tanh logit soft-capping as a first-class config field so models with this attention variant (e.g. Gemma2) can run on the fused TransformerEngine flash-attention path instead of an unfused fallback.
Companion PRs:
softcapkwarg this maps toWhat changed
TransformerConfig.attn_logit_softcapping: Optional[float] = None—Nonedisables softcapping, default behavior unchanged.TEDotProductAttentionmaps this to TE'ssoftcapkwarg via a signature capability probe on the installed TE build, rather than a version gate — this lets it work against TE builds that addsoftcapsupport ahead of a version bump, and asserts clearly if the field is set but the installed TE build doesn't support it.DotProductAttentionapplies the equivalent cap pre-softmax, for parity with the fused path when TE isn't in use.Validation
Exercised end-to-end via the companion TransformerEngine and Megatron-Bridge changes above — multi-step training runs confirmed numerically consistent with the prior unfused path.