Skip to content

Conversation

@Johnsonms
Copy link
Contributor

@Johnsonms Johnsonms commented Nov 14, 2025

Motivation

  1. Fixed this issue [Bug] NSA indexer unit test test_indexer_with_different_topk fails #13296
  2. Disable a test that's currently failing or unreliable due to accuracy
    alignment issues
  3. Improve code formatting and style compliance in the test file

Modifications

  • Fix test mock to dynamically compute max_kv_len from
    actual key tensor shape
  • Update topk_transform signature with optional ks
    parameter
  • Add missing Optional type hint import

Accuracy Tests

Benchmarking and Profiling

Checklist

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Johnsonms, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves critical compatibility issues within the NSA indexer, primarily by ensuring the RotaryEmbedding component correctly utilizes bfloat16 to avoid conflicts with vLLM's default fp32 behavior. Additionally, it significantly enhances the reliability of unit tests by making mock functions dynamically adapt to key tensor shapes, thereby preventing brittle test failures and improving overall code stability.

Highlights

  • Rotary Embedding Dtype Fix: Explicitly set the dtype for RotaryEmbedding initialization within the NSA indexer to torch.bfloat16. This prevents potential fp32 default usage when integrating with vLLM, addressing a reported issue.
  • Test Compatibility Enhancement: Improved test robustness by modifying the mock mqa_logits function to dynamically compute max_kv_len based on the actual key tensor shape (k_fp8.shape[0]), replacing a fixed value.
  • Method Signature Update: Updated the topk_transform method signature in the test utilities to include an optional ks parameter (ks: Optional[torch.Tensor] = None).
  • Type Hint Import: Added the missing Optional type hint import from the typing module in the test file for improved type checking.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several fixes for the NSA indexer, addressing dtype and test compatibility issues. The changes are well-motivated and correct. I have one suggestion to improve code clarity in one of the test mocks by using an underscore for an unused variable. Overall, this is a solid contribution.

@Johnsonms Johnsonms changed the title Fix NSA indexer RotaryEmbedding dtype and test compatibility issues Fix NSA indexer nightly test failed issues Nov 14, 2025
@Fridge003 Fridge003 merged commit 6448b4c into sgl-project:main Nov 14, 2025
41 of 46 checks passed
@Johnsonms Johnsonms deleted the Nightly_bugfix branch November 14, 2025 21:55
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