Skip to content

UPSTREAM PR #20653: Models: Add control vector functions to qwen3.5 and qwen-next models - #1264

Open
loci-dev wants to merge 1 commit into
mainfrom
loci/pr-20653-feat-add-qwen3x-cvector-support
Open

UPSTREAM PR #20653: Models: Add control vector functions to qwen3.5 and qwen-next models#1264
loci-dev wants to merge 1 commit into
mainfrom
loci/pr-20653-feat-add-qwen3x-cvector-support

Conversation

@loci-dev

Copy link
Copy Markdown

Note

Source pull request: ggml-org/llama.cpp#20653

This PR adds control vector support to Qwen3.5, Qwen3.5-MoE and Qwen3-next (Qwen3-coder-next).
It was missing before but was present for Qwen3-vl and so on.
Control vector PR for reference: ggml-org/llama.cpp#5970

The PR resolves ggml-org/llama.cpp#20541

AI disclaimer: I had Claude point me at the missing parts and help me understand the correct position for the two lines added in each file.
I tested the changes myself and made sure it doesn't break things where I could. The local CI pipeline shows no problem with the new code.

@loci-review

loci-review Bot commented Mar 17, 2026

Copy link
Copy Markdown

Overview

This PR adds control vector support to Qwen3.5 and Qwen3Next models with negligible performance impact. Out of 120,579 total functions analyzed, only 4 were modified (0 new, 0 removed). The single function exceeding the 2% threshold shows +342ns (+0.225%) response time increase during graph construction—a one-time initialization cost that does not affect per-token inference performance.

Power Consumption Changes:

  • build.bin.libllama.so: -0.08%
  • All other binaries (build.bin.llama-cvector-generator, build.bin.llama-tts, build.bin.libmtmd.so, build.bin.llama-bench, build.bin.llama-quantize, build.bin.llama-qwen2vl-cli, build.bin.llama-tokenize, build.bin.llama-gemma3-cli, build.bin.llama-gguf-split, build.bin.llama-llava-cli, build.bin.llama-minicpmv-cli, build.bin.libggml.so, build.bin.libggml-base.so, build.bin.libggml-cpu.so): 0.00%

Function Analysis

llm_build_qwen3next (build.bin.libllama.so)

  • Response time: 151,935ns → 152,278ns (+342ns, +0.225%)
  • Throughput time: 470ns → 483ns (+12ns, +2.6%)
  • Source changes: Added 3 lines in src/models/qwen3next.cpp to call build_cvec(cur, il) after FFN layer construction, enabling control vector transformations per layer
  • Impact assessment: Non-critical path (graph construction during initialization, not inference loop). The 342ns overhead is distributed across all model layers and occurs once per session, not per token. CFG analysis shows the new build_cvec call adds ~383ns per layer with minor improvements in existing calls (-39ns, -18ns) partially offsetting the overhead.

Other modified functions showed changes below the 2% threshold.

🔎 Full breakdown: Loci Inspector
💬 Questions? Tag @loci-dev

@loci-dev
loci-dev force-pushed the main branch 12 times, most recently from 88f82d8 to 8c39ead Compare March 25, 2026 02:17
@loci-dev
loci-dev force-pushed the main branch 10 times, most recently from f6c9b75 to 6c480d8 Compare April 1, 2026 02:18
@loci-dev
loci-dev force-pushed the main branch 5 times, most recently from 3655621 to fd3ce9d Compare April 6, 2026 02:18
@loci-dev
loci-dev force-pushed the main branch 7 times, most recently from 55afbee to ef0eff4 Compare April 12, 2026 02:18
@loci-dev
loci-dev force-pushed the main branch 9 times, most recently from 63ab8d1 to 7638ab4 Compare April 19, 2026 02:19
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