Skip to content

[Model] Support IQuestCoder Model#16574

Closed
yxing-bj wants to merge 1 commit intosgl-project:mainfrom
yxing-bj:dev/loop_model
Closed

[Model] Support IQuestCoder Model#16574
yxing-bj wants to merge 1 commit intosgl-project:mainfrom
yxing-bj:dev/loop_model

Conversation

@yxing-bj
Copy link
Copy Markdown
Contributor

@yxing-bj yxing-bj commented Jan 6, 2026

Motivation

IQuest-Coder-V1 is a new family of code large language models (LLMs) designed to advance autonomous software engineering and code intelligence. We built a repo about IQuestCoder.

We had uploaded these models to Hugging Face, including IQuestCoder and IQuestLoopCoder. To make them easier for everyone to use, we support these models on sglang platform.

Modifications

Support IQuestCoder and IQuestLoopCoder.

At the same time, thanking for @attack204 efforts about PR

Tests

Firstly, we launch sglang server

  • For instruct model
python3  -m sglang.launch_server  --port 8000  --model-path IQuestLab/IQuest-Coder-V1-40B-Instruct  --tp 4  --trust-remote-code 
  • For LoopInstruct model
python3  -m sglang.launch_server  --port 8000  --model-path IQuestLab/IQuest-Coder-V1-40B-Loop-Instruct  --tp 4  --trust-remote-code 
  • For Thinking models with reasoning support:
python3  -m sglang.launch_server  --port 8000  --model-path IQuestLab/IQuest-Coder-V1-40B-Thinking --reasoning-parser qwen3 --tensor-parallel-size 4 --trust-remote-code

Benchmarking and Profiling

Checklist

Review Process

  1. Ping Merge Oncalls to start the PR flow. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments (/tag-run-ci-label, /rerun-failed-ci, /tag-and-rerun-ci) or contact authorized users to do so.
  4. After green CI and required approvals, ask Merge Oncalls to merge.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @yxing-bj, 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 IQuestCoder and IQuestLoopCoder models into the SGLang framework, expanding the range of supported code-focused large language models. The changes include adding specific model implementations for IQuestLoopCoder's unique multi-loop attention, adapting the KV cache handling for this architecture, and updating model configuration to correctly reflect its structure. This enables users to leverage these new models for autonomous software engineering and code intelligence tasks on the SGLang platform.

Highlights

  • IQuestCoder Model Integration: This pull request introduces support for the IQuestCoder and IQuestLoopCoder large language models within the SGLang platform, making these new code LLMs available for use.
  • IQuestLoopCoder Architecture Support: A new model definition (iquest_loopcoder.py) has been added to specifically handle the unique multi-loop attention mechanism of IQuestLoopCoder, which involves a combination of global and local attention with learned gating.
  • KV Cache Sharing for LoopCoder: The attention backend (flashinfer_backend.py) has been updated to support cross-layer KV cache sharing, allowing the LoopCoder model to efficiently read from the KV cache without recomputing attention in subsequent loops.
  • Model Configuration Updates: The model configuration logic (model_config.py) now correctly derives the number of attention layers for IQuestLoopCoderForCausalLM based on its loop_num parameter, ensuring proper resource allocation.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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
Copy Markdown
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 adds support for the IQuestCoder and IQuestLoopCoder models. The changes include a new model implementation for IQuestLoopCoder, which features a multi-loop attention mechanism with cross-layer KV cache sharing. The modifications to the model configuration and attention backend correctly accommodate this new architecture. The code is generally well-structured, but I have a couple of suggestions to improve code clarity and address a potential issue.

self.num_attention_layers = self.num_hidden_layers
if "LongcatFlashForCausalLM" in self.hf_config.architectures:
self.num_attention_layers = self.num_hidden_layers * 2
if "IQuestLoopCoderForCausalLM" in self.hf_config.architectures:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This if condition should likely be an elif. If hf_config.architectures could contain both LongcatFlashForCausalLM and IQuestLoopCoderForCausalLM, the current logic would have the calculation for IQuestLoopCoderForCausalLM overwrite the one for LongcatFlashForCausalLM. Using elif would make the choices mutually exclusive, which seems more correct for different model architectures.

Comment on lines +142 to +151
gate_logits = gate_logits.transpose(0, 1)
gate_logits = gate_logits.unsqueeze(-1)

# Apply sigmoid
gate = torch.sigmoid(gate_logits)

# Expand and reshape to match q shape: [num_tokens, num_heads * head_dim]
gate = gate.transpose(0, 1)
gate = gate.expand(-1, -1, head_dim)
gate = gate.reshape(num_tokens, num_heads * head_dim)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The logic to reshape gate_logits can be simplified. The current implementation uses a transpose, unsqueeze, and then another transpose which is a bit convoluted. You can achieve the same result more directly by removing the unnecessary transpositions.

Suggested change
gate_logits = gate_logits.transpose(0, 1)
gate_logits = gate_logits.unsqueeze(-1)
# Apply sigmoid
gate = torch.sigmoid(gate_logits)
# Expand and reshape to match q shape: [num_tokens, num_heads * head_dim]
gate = gate.transpose(0, 1)
gate = gate.expand(-1, -1, head_dim)
gate = gate.reshape(num_tokens, num_heads * head_dim)
gate_logits = gate_logits.unsqueeze(-1)
# Apply sigmoid
gate = torch.sigmoid(gate_logits)
# Expand and reshape to match q shape: [num_tokens, num_heads * head_dim]
gate = gate.expand(-1, -1, head_dim)
gate = gate.reshape(num_tokens, -1)

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.

1 participant