data: ship the published qwen4exp vector in the plugin home

Discovery's third path, <home>/vectors/<arch>-control-vector.gguf, was the one an operator could
never rely on: it existed, but nothing filled it, so a deployment had to fetch Cudecnik's package
and rename two files before the switch was worth anything. The published file is small (483 KB),
specific to this architecture and width rather than to any one quant, and unchanged from upstream,
so it belongs with the other things the home ships next to architectures/ and kernels/.

CMake copies the GGUF and its JSON into the built home (and installs them under the data dir), which
means a missing file is a configure error rather than a silently missing feature. Discovery order is
unchanged, so the per-container and per-directory sidecar paths still win when an operator places one.

The directions are a derivative of Qwen3.8-Flash-Next and are not ours to relicense: they stay under
the Qwen Community License 1.0, whose text now sits beside them (data/vectors/LICENSE.qwen-community-1.0.txt),
is recorded in NOTICE, and is installed to share/doc/radiance/third_party/qwen-community.LICENSE. The
Apache-2.0 grant covers the loader and the kernels, not the directions.

The feature is still opt-in -- without --control-vector the file is never read -- and the request
default is still off, because what this particular vector removes is a safety behaviour.
This commit is contained in:
C_Tamas authored and StillDeadcode committed 2026-10-21 09:26:17 +02:00
1 parent f5cb4b8ff3
commit 4141988217
6 files changed
+91 -10

No files matched your search

+24
View File
@@ -184,6 +184,30 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/data/kernels_moe.rkb)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/kernels_moe.rkb
DESTINATION ${CMAKE_INSTALL_DATADIR}/radiance)
endif()
# The published refusal-direction vector for qwen4exp, copied into the built home's vectors/ so a
# Flash-Next container offers the switch with nothing for an operator to install: core/cvec.cpp looks
# for <home>/vectors/<arch>-control-vector.gguf after the sidecar paths. The file is Cudecnik's,
# unchanged (huggingface.co/Cudecnik/Qwen3.8-Flash-Next-refusal-projection; the gguf is sha256
# ef0724c5b79297e4..., the json d4a3dd842506a6fb..., and that is what the measurements in
# docs/GUIDE.md 4.10 were made with). Refresh with:
#
# huggingface-cli download Cudecnik/Qwen3.8-Flash-Next-refusal-projection \
# Qwen3.8-Flash-Next-refusal-projection.{gguf,json}
#
# The directions are derived from Qwen3.8-Flash-Next's weights and stay under the Qwen Community
# License 1.0 (data/vectors/LICENSE.qwen-community-1.0.txt, NOTICE); radiance's Apache-2.0 grant
# covers the code that reads them, never the file. It ships loaded only when the deployment asks
# (--control-vector), and the request default is off, because what it removes is a safety behaviour.
file(MAKE_DIRECTORY ${RAD_PLUGIN_OUT}/vectors)
foreach(rrad_vector qwen4exp-control-vector.gguf qwen4exp-control-vector.json)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/vectors/${rrad_vector}
${RAD_PLUGIN_OUT}/vectors/${rrad_vector} COPYONLY)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/vectors/${rrad_vector}
DESTINATION ${CMAKE_INSTALL_DATADIR}/radiance/vectors)
endforeach()
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/vectors/LICENSE.qwen-community-1.0.txt
DESTINATION ${CMAKE_INSTALL_DOCDIR}/third_party RENAME qwen-community.LICENSE)
# The downloader behind `radiance --model <owner/name>` (core/hf_model.cpp). The engine looks in
# <bin>/../libexec/radiance/, so the build tree mirrors that layout.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/hfget.sh
+9
View File
@@ -76,3 +76,12 @@ LiquidAI/d1-3B repository): the prompt it renders, its question blocks, the opti
fallback codebook and the answer spellings, unchanged, in code rewritten in C++. That text is Liquid
AI, Inc.'s, under the LFM Open License v1.0, whose terms -- including its limit on commercial use --
apply to it; the license is in core/server/LICENSE.lfm.
data/vectors/qwen4exp-control-vector.gguf and data/vectors/qwen4exp-control-vector.json are the
published refusal-direction vector for Qwen3.8-Flash-Next, by Cudecnik
(huggingface.co/Cudecnik/Qwen3.8-Flash-Next-refusal-projection), copied unchanged. The directions
were measured out of Qwen3.8-Flash-Next's own residual stream, so they are Qwen's, under the Qwen
Community License 1.0 -- data/vectors/LICENSE.qwen-community-1.0.txt -- which carries the file and
every copy of it, including its condition that a Model-as-a-Service or AI-work-assistant business
needs a separate license from Qwen to use it commercially. radiance's Apache-2.0 grant covers the
code that loads and applies the file; it does not cover the file or its directions.
@@ -0,0 +1,16 @@
Qwen Community License 1.0
Copyright (c) 2026 Qwen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software, including the model weights, parameters, configuration files, inference code and associated documentation files (collectively, the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, sell, deploy, host, fine-tune, and create derivative works from (collectively, "Use" or "Using") copies of the Software; and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. If the Software (or any derivative works thereof) is Used for any of the licensee's commercial products or services that have more than 100,000,000 monthly active users or US$ 20,000,000 (or equivalent in other currencies) monthly revenue, respective model name must be prominently displayed on the user interface of such product or service; and,
2. If the licensee or any of its affiliates conducts a Model as a Service or AI Work Assistant business, the licensee shall obtain a separate license from Qwen before Using the Software or its derivative works for any commercial purpose. The foregoing requirement shall not apply to the licensee's internal Use of the Software, provided that such Use does not make the Software, its outputs, or its underlying model capabilities available to any third party.
"Model as a Service" means giving a third party access to language model inference or fine-tuning (e.g., via API or a hosted endpoint) in a manner that allows such third parties to exercise meaningful control over the inputs, parameters, or training data. This does not include the mere relaying of requests to models hosted by other third parties.
“AI Work Assistant” means an independent AI-powered product primarily designed for AI-assisted coding or office productivity (e.g., Qoder and QwenWork). It does not include: (a) a single-purpose AI tool (such as an AI translation tool); (b) an AI assistant primarily designed for a domain other than coding or office productivity (such as Taobao AI Shopping Assistant or AMap AI Chat); or (c) an AI assistant that is a feature of a product whose primary purpose is not AI-assisted coding or office productivity.
THE SOFTWARE AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL QWEN, ITS AFFILIATES OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE USE OF THE SOFTWARE MUST COMPLY WITH APPLICABLE LAWS AND REGULATIONS, AND MUST NOT INFRINGE THE INTELLECTUAL PROPERTY RIGHTS OF ANY THIRD PARTY.
For any questions regarding this license, please contact model-business@notice.qwencloud.com.
Binary file not shown.
+26
View File
@@ -0,0 +1,26 @@
{
"mode": "project",
"dir": "per-layer",
"scale": 1.0,
"layer_range": [
4,
44
],
"refusal_harmful_thinkoff": 2.0,
"refusal_harmful_thinkon": 2.0,
"refusal_harmless_thinkoff": 4.0,
"refusal_harmless_thinkon": 6.0,
"broken": 0,
"kl_mean": 0.18598,
"kl_max": 18.26549,
"kl_p99": 3.143571,
"decode_tps": 51.19,
"vector_file": "Qwen3.8-Flash-Next-refusal-projection.gguf",
"base_model_gguf": "unsloth/Qwen3.8-Flash-Next-GGUF UD-Q2_K_XL",
"base_model_sha256_shard1": "a4f3b21e77353999829f2f767e9ac21ce9c71d29a74f2cc9eda48c9bf23c8b86",
"worktree_commit": "37e026e3b",
"criterion_status": "PASS",
"dirty_direction": false,
"note": "projection ablation h -= s*(h.v)*v, v unit-normalized per layer. dir=per-layer",
"branch": "cvec-hooks (github.com/Cudila/llama.cpp)"
}
+16 -10
View File
@@ -1443,8 +1443,9 @@ runs, it moves every token's residual stream off that direction. radiance implem
package for Qwen3.8-Flash-Next was tuned for:
**One flag loads it: `--control-vector off` or `--control-vector on`** (explicit
`--control-vector disabled` is the same as no flag). Without it nothing is loaded: the graph declares no projection op (so an off request costs the stock model's launches), a
request that asks for the vector is refused by name, and `/admin/control-vector` answers 404. The
`--control-vector disabled` is the same as no flag). Without it nothing is loaded: the graph declares
no projection op (so an off request costs the stock model's launches), a request that asks for the
vector is refused by name, and `/admin/control-vector` answers 404. The
flag's value is the startup switch — `off` leaves requests off until one asks or the dashboard flips
the default, `on` starts them on. With the flag the engine looks, in order, at:
@@ -1452,15 +1453,20 @@ the default, `on` starts them on. With the flag the engine looks, in order, at:
2. `control-vector.gguf` in the container's directory (one file serves a directory of quants of
the family), then
3. `<home>/vectors/<architecture>-control-vector.gguf` for each `--radiance-home`, i.e.
`…/vectors/qwen4exp-control-vector.gguf`.
`…/vectors/qwen4exp-control-vector.gguf` — **and that one ships with radiance**
(`data/vectors/`, installed into every plugin home), so there is normally nothing to place.
So a deployment that starts with `--control-vector off` (or `on`) and drops the file beside its
Flash-Next container offers the Model-view switch and the `control_vector` request field; every
quantisation of the family shares it, because the file names the architecture and the width, not the
quant. The operation's parameters come from the package's own JSON (`layer_range`, `scale`, `mode`),
so there is no flag for them: a file that does not fit this container is reported and skipped, never
served. Only the startup switch is a flag, because it is the one decision that changes the declared
graph.
So a Flash-Next deployment does one thing: start with `--control-vector off` (or `on`). The
Model-view switch and the `control_vector` request field are then there, because the vector came with
the plugin home; the first two paths exist so an operator can override it per model or per directory,
which is also how every quantisation of the family shares one file — the file names the architecture
and the width, not the quant. The shipped copy is Cudecnik's published file unchanged and stays under
the **Qwen Community License 1.0** (`data/vectors/LICENSE.qwen-community-1.0.txt`, `NOTICE`): the
directions are Qwen's, derived from Flash-Next's own residual stream, and radiance's Apache-2.0 grant
covers the code that applies them, not the file. The operation's parameters come from the package's
own JSON (`layer_range`, `scale`, `mode`), so there is no flag for them either: a file that does not
fit this container is reported and skipped, never served. Only the startup switch is a flag, because
it is the one decision that changes the declared graph.
- **Only a compatible container accepts it.** The file must be a GGUF `controlvector` whose
`controlvector.model_hint` (when present) is this model's architecture (`qwen4exp`), whose