Skip to content

Comments

[Bug] Fixes accuracy issues caused by incorrect use of rope#13439

Closed
Paiiiiiiiiiiiiii wants to merge 1 commit intosgl-project:mainfrom
Paiiiiiiiiiiiiii:indexer_acc
Closed

[Bug] Fixes accuracy issues caused by incorrect use of rope#13439
Paiiiiiiiiiiiiii wants to merge 1 commit intosgl-project:mainfrom
Paiiiiiiiiiiiiii:indexer_acc

Conversation

@Paiiiiiiiiiiiiii
Copy link
Contributor

Motivation

During our Ruler testing, we noticed a significant drop in the score of dsv3.2_exp compared to dsv3.1-terminus. We then conducted targeted testing on niah_multikey_3 and found that these cases were almost 100% correct on the DeepSeek official API, but scored low with sglang + dsv3.2.

To address this issue, we followed DeepSeek's advice and ran their inference demo released with the model, but the problem persisted.

After they modified the inference demo, the bad cases passed; https://huggingface.co/deepseek-ai/DeepSeek-V3.2-Exp/commit/1938e9df3dea7218cb36c21fe8287384b99acd96

We referenced their modifications and specifically changed the rope-related code in sglang nsa_indexer.py, and the bad cases also passed.

before

dataset_version metric mode opencompass.models.OpenAISDK_opencompass_Deepseek_V32_EXP
ruler_niah_multikey_3_4k score gen 100.00
ruler_niah_multikey_3_8k score gen 100.00
ruler_niah_multikey_3_16k score gen 87.50
ruler_niah_multikey_3_32k score gen 62.50
ruler_niah_multikey_3_64k score gen 25.00
ruler_niah_multikey_3_96k score gen 43.75
ruler_niah_multikey_3_128k score gen 0.00

after

dataset_version metric mode opencompass.models.OpenAISDK_opencompass_Deepseek_V32_EXP
ruler_niah_multikey_3_4k score gen 100.00
ruler_niah_multikey_3_8k score gen 100.00
ruler_niah_multikey_3_16k score gen 100.00
ruler_niah_multikey_3_32k score gen 100.00
ruler_niah_multikey_3_64k score gen 100.00
ruler_niah_multikey_3_96k score gen 100.00
ruler_niah_multikey_3_128k score gen 100.00

Modifications

Accuracy Tests

Benchmarking and Profiling

Checklist

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Paiiiiiiiiiiiiii, 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 addresses a critical bug that was causing significant accuracy degradation in dsv3.2_exp models, particularly when processing longer context lengths. By implementing a specific correction to the rope (Rotary Positional Embedding) configuration, the changes ensure that the model now performs as expected, restoring high accuracy across all previously affected test scenarios.

Highlights

  • Accuracy Fix: Resolves a critical accuracy regression in dsv3.2_exp models, specifically for niah_multikey_3 test cases, by correcting the rope implementation.
  • Rope Configuration Update: Modifies the nsa_indexer.py to correctly initialize rope with is_neox_style=True, aligning with DeepSeek's updated inference demo and addressing the root cause of the accuracy issues.
  • Significant Performance Improvement: Restores and significantly improves model accuracy, achieving 100% scores across various context lengths (e.g., 4k to 128k) for affected test cases, which previously showed scores as low as 0%.
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 addresses an accuracy issue in the DeepSeek-V3.2-Exp model by correcting the configuration of its rotary positional embeddings (RoPE). The change to set is_neox_style=True is appropriate for this model architecture. My review includes a suggestion to parameterize this setting to enhance the reusability and maintainability of the Indexer class for other models.

@HarryWu99
Copy link

HarryWu99 commented Nov 25, 2025

May I ask whether the above results is the v1/chat/completions or the v1/completions ?I want to reproduce it. 🙏 @Paiiiiiiiiiiiiii

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.

3 participants