-
Notifications
You must be signed in to change notification settings - Fork 290
Support Qwen3next and prefix cache. #1115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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.
79b6fe3 to
4af3ac5
Compare
Triton 3.0+ requires an explicit memory allocator for kernels using TMA features. Added _ensure_triton_allocator() in solve_tril.py and removed the ineffective triton.set_allocator reference in chunk_scaled_dot_kkt.py.
- Add readline support for proper Chinese character deletion handling - Display TTFT (Time To First Token) and Avg ITL (Inter-Token Latency) after each response - Show aggregated performance stats in parallel mode - Add graceful handling for EOF and keyboard interrupt 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add mamba_model_match_len based optimization for buffer insertion: - Only insert buffer at actual branch points instead of fixed intervals - Use threshold (chunked_prefill_size // 2) to decide strategy - Reduce buffer storage overhead while maintaining cache hit rate
30bde05 to
165ff09
Compare
Uh oh!
There was an error while loading. Please reload this page.