Archived
server: a control-vector variant, MODEL:NAME, that runs with the vector on
A request turns the control vector on with the `control_vector` body field, or the deployment's default applies. A client that can only choose a model cannot send the field, and a gateway can allow or refuse a model by its name but not a field. --control-vector-variant NAME lists MODEL:NAME as a child of the model, the way an adapter is listed, and a request naming it runs with the vector on whatever the default; the model's own name keeps the default. Unset, the default, lists nothing. The key needs --control-vector off or on. NAME keeps the rule model names keep (no ':' or whitespace), and may not be a --lora adapter's name or the served model's own. The variant's name with "control_vector": false is refused, since the request asks for both. With adapters enabled the variant takes no adapter lookup, and /v1/load_lora_adapter refuses its name. config_test 68, fleet_config_test 18 and server_test 191 cases pass, and the host suite (ctest -LE 'gpu|oot') passes. On two R9700s at TP2 (Qwen3.8-Flash-Next IQR-V4 with the shipped vector), through the front: /v1/models lists MODEL:uncensored and GET /v1/models/MODEL:uncensored answers; a policy prompt to the variant is answered and to the model's own name refused; the variant with "control_vector": false is a 400.
This commit is contained in:
1 parent
aadabde0de
commit
157959fd80
10 files changed
+250
-10
No files matched your search
@@ -594,6 +594,7 @@ const std::map<std::string, std::vector<std::string>>& legal_values() {
|
||||
{ "--trusted-proxy", { "127.0.0.0/8" } },
|
||||
{ "--served-model-name", { "m" } }, { "--mm-max-patches", { "1024" } },
|
||||
{ "--control-vector", { "off" } },
|
||||
{ "--control-vector-variant", { "uncensored", "--control-vector", "off" } },
|
||||
{ "--generation-config", { "/g.json" } }, { "--override-chat-template", { "/t.jinja" } },
|
||||
{ "--temp", { "0.7" } }, { "--top-k", { "40" } }, { "--top-p", { "0.9" } },
|
||||
{ "--min-p", { "0.05" } }, { "--reasoning-effort", { "low" } },
|
||||
@@ -801,6 +802,37 @@ TEST(the_control_vector_flag_is_off_on_or_disabled) {
|
||||
}
|
||||
}
|
||||
|
||||
/* The variant is a name a request gives as `model`, so it keeps the rule names keep, and it needs a
|
||||
* loaded vector: with none it would answer as the stock model while the client asked for the
|
||||
* vector. A --lora adapter of the same name would make `base:name` mean two things. */
|
||||
TEST(the_control_vector_variant_needs_a_vector_and_a_plain_name_of_its_own) {
|
||||
{
|
||||
Config c;
|
||||
CHECK_EQ(parse({ "--control-vector", "off", "--control-vector-variant", "uncensored" }, &c),
|
||||
RAD_OK);
|
||||
CHECK_EQ(c.control_vector_variant, std::string("uncensored"));
|
||||
}
|
||||
{
|
||||
Config c;
|
||||
CHECK_EQ(parse({}, &c), RAD_OK);
|
||||
CHECK(c.control_vector_variant.empty());
|
||||
}
|
||||
auto refused = [](std::initializer_list<const char*> v) {
|
||||
Config c;
|
||||
int st = RAD_OK;
|
||||
const std::string log = stderr_of([&] { st = parse(v, &c); });
|
||||
CHECK_EQ(st, (int)RAD_E_INVAL);
|
||||
CHECK(has(log, "--control-vector-variant"));
|
||||
};
|
||||
refused({ "--control-vector-variant", "uncensored" });
|
||||
refused({ "--control-vector", "disabled", "--control-vector-variant", "uncensored" });
|
||||
refused({ "--control-vector", "off", "--control-vector-variant", "base:uncensored" });
|
||||
refused({ "--control-vector", "off", "--control-vector-variant", "two words" });
|
||||
refused({ "--control-vector", "off", "--control-vector-variant", "" });
|
||||
refused({ "--control-vector", "off", "--lora", "uncensored=/ad/u",
|
||||
"--control-vector-variant", "uncensored" });
|
||||
}
|
||||
|
||||
TEST(the_wire_mode_is_one_of_two_names) {
|
||||
Config c;
|
||||
CHECK_EQ(parse({ "--tp-wire", "exact" }, &c), RAD_OK);
|
||||
|
||||
Reference in new issue
Block a user