Skip to content

Conversation

@sufubao
Copy link
Collaborator

@sufubao sufubao commented Nov 18, 2025

python -m lightllm.server.api_server --model_dir /dev/shm/Qwen3-Next-80B-A3B-Thinking --tp 4

| Tasks  | Version | Filter | n-shot | Metric      |     |  Value |     | Stderr |     |
| ------ | ------: | ------ | -----: | ----------- | --- | -----: | --- | -----: | --- |
| aime25 |       0 | none   |      0 | exact_match | ↑   | 0.8667 | ±   | 0.0631 |     |

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @sufubao, 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 integrates the Qwen3next model into the LightLLM framework, enhancing its capability to support advanced model architectures. A significant part of this integration involves a sophisticated hybrid prefix caching mechanism and a refactored memory management system tailored to Qwen3next's unique linear attention and shared expert layers. The changes also introduce several high-performance Triton kernels to ensure efficient execution of these new model components, alongside general improvements to model loading parallelism.

Highlights

  • Qwen3next Model Support: Introduced comprehensive support for the Qwen3next model architecture, including its unique linear attention mechanism and shared expert layers, by adding new layer inference and weight classes.
  • Hybrid Radix Cache for Prefix Caching: Implemented a new HybridRadixCache system that extends the existing radix cache to manage both token indices and state buffer indices, crucial for efficiently handling intermediate states in models like Qwen3next.
  • Memory Management Refactoring: Refactored the core memory management by introducing a BaseAllocator class and a specialized Qwen3NextMemoryManager to handle distinct cache types (KV cache, conv_state, ssm_state) required by the Qwen3next model's linear attention.
  • New Triton Kernels for Performance: Added several highly optimized Triton kernels, including causal_conv1d, gated_rmsnorm, gemma_rmsnorm, fused_gdn_gating, and a suite of Flash Linear Attention (FLA) operations, to accelerate Qwen3next's computational graphs.
  • Increased Weight Loading Parallelism: Increased the default number of workers for loading Hugging Face model weights from 1 to 16, which can significantly speed up model initialization.
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 support for the Qwen3Next model, which appears to be a hybrid model using both standard and linear attention mechanisms. The changes are extensive, touching upon memory management, request management, prefix caching, and the core model inference logic. A significant part of the work is the introduction of a HybridRadixCache that caches not only the KV state but also the state buffers required for the linear attention layers. A specialized backend for Qwen3Next is also added to handle caching intermediate states during chunked prefilling. The refactoring of MemoryManager into a BaseAllocator is a good improvement for code structure.

My review has identified one critical issue related to model selection logic that needs to be addressed. I've also provided suggestions to improve performance and maintainability in the new complex components. Overall, this is a substantial and well-engineered contribution to support a new, complex model architecture.

@ModelTC ModelTC deleted a comment from gemini-code-assist bot Nov 21, 2025
@ModelTC ModelTC deleted a comment from gemini-code-assist bot Dec 8, 2025
@ModelTC ModelTC deleted a comment from gemini-code-assist bot Dec 11, 2025
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