Skip to content

[Refactor] rename set_index_k_and_scale_buffer to set_index_k_scale_b…#12956

Merged
Fridge003 merged 1 commit intosgl-project:mainfrom
edwingao28:fix-rename-set-index-method
Nov 10, 2025
Merged

[Refactor] rename set_index_k_and_scale_buffer to set_index_k_scale_b…#12956
Fridge003 merged 1 commit intosgl-project:mainfrom
edwingao28:fix-rename-set-index-method

Conversation

@edwingao28
Copy link
Contributor

Motivation

The method name set_index_k_and_scale_buffer was inconsistent with get_index_k_scale_continuous and other similar methods. This change renames it to set_index_k_scale_buffer for naming consistency.

Modifications

  • Renamed set_index_k_and_scale_bufferset_index_k_scale_buffer
  • Updated 2 call sites in nsa_indexer.py
  • Removed outdated TODO comment

Accuracy Tests

No functional changes — only refactor/rename. Verified all references updated.

Checklist

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @edwingao28, 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 focuses on a minor refactoring to enhance code consistency and readability. It renames a method to align its naming convention with similar functions, ensuring a more uniform API. The change is purely cosmetic and does not introduce any functional modifications, ensuring no impact on existing behavior or performance.

Highlights

  • Method Renaming: The method set_index_k_and_scale_buffer has been renamed to set_index_k_scale_buffer for improved naming consistency across the codebase.
  • Call Site Updates: Two call sites within nsa_indexer.py have been updated to reflect the new method name.
  • Code Cleanup: An outdated TODO comment related to the method renaming has been removed from memory_pool.py.
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 refactors a method name from set_index_k_and_scale_buffer to set_index_k_scale_buffer for consistency, updating its definition and two call sites. While the change is implemented correctly, I have raised a concern that the new name is less descriptive than the original. The old name clearly indicated that both k and its scale are set, whereas the new name is more ambiguous. I've suggested reverting to the original name to improve code clarity and maintainability.


# TODO rename later (currently use diff name to avoid confusion)
def set_index_k_and_scale_buffer(
def set_index_k_scale_buffer(
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While the goal of achieving naming consistency is good, this change may introduce a different kind of inconsistency. The new name set_index_k_scale_buffer is intended to be consistent with get_index_k_scale_continuous. However, get_index_k_scale_continuous only retrieves the scale component, while this function sets both index_k and index_k_scale.

The original name set_index_k_and_scale_buffer was more explicit about setting two distinct components. The new name is more ambiguous and less descriptive of the function's behavior.

For better clarity and long-term maintainability, I'd suggest using a name that clearly indicates that both K and its scale are being set. Reverting to the original name seems like a good option.

Suggested change
def set_index_k_scale_buffer(
def set_index_k_and_scale_buffer(

@Fridge003 Fridge003 merged commit d1be60c into sgl-project:main Nov 10, 2025
3 checks passed
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

Comments