radiance 1.0.1

- Up to 32 sequences a step on every model. The DSpark drafter (MiniCPM5) no longer rejects every
  draft from the tenth sequence on, and the step batch's block tables and media staging are
  charged to the VRAM budget instead of the headroom kernels load into.
- A tool parameter whose schema accepts no value ({"not": {}}, as TypeBox and Arktype export
  `never`) is an argument no call writes, instead of failing the request. oh-my-pi's task tool
  works.
- --served-model-name NAME and --override-chat-template PATH.
- The startup session count counts only the part of the KV pool that holds context.
- Compose files and README run --max-num-seqs 32 where it keeps a 200K-token request.
This commit is contained in:
Deadcode committed 2026-10-04 15:07:32 +02:00
1 parent ae74a8aebf
commit 8ddb77e03c
28 files changed
+595 -60

No files matched your search

+31
View File
@@ -885,6 +885,37 @@ TEST(a_declared_format_reads_and_constrains_like_the_derived_one) {
CHECK_EQ(g.text, b->prompt().grammar);
}
/* oh-my-pi's `task` tool in its batch form: `"model?": "never"`, which Arktype exports as
* `{"not": {}}`. A schema no value satisfies needs no arm, and the declared format and the derived
* one agree about that as they agree about everything else. Before, both refused the tool and the
* request with it. */
TEST(an_argument_no_value_satisfies_has_no_arm_in_either_grammar) {
const json tools = json::parse(R"([{"type":"function","function":{"name":"task",
"description":"Spawn subagents.","parameters":{"type":"object","properties":{
"context":{"type":"string"},"model":{"not":{}},
"tasks":{"type":"array","items":{"type":"object","properties":{
"agent":{"type":"string"},"task":{"type":"string"},"solutionSpace":{"type":"string"},
"model":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},
"required":["agent","solutionSpace","task"]}}},
"required":["context","tasks"]}}}])");
RadChatFormat c = qwen_abi();
ChatFormat declared;
std::string why;
CHECK_OK(chat_format_from_abi(&c, &declared, &why));
ChatGrammarRequest gq;
gq.tools = &tools;
ChatGrammar g;
CHECK_OK(chat_format_grammar(declared, gq, &g, &why));
CHECK(!g.text.empty());
CHECK(g.text.find("task-arg-model") == std::string::npos);
Bench* b = bench(models()[0], ChatRequest{}, tools);
if (!b) return;
gq.generation_prompt = b->prompt().generation_prompt;
CHECK_OK(chat_format_grammar(declared, gq, &g, &why));
CHECK_EQ(g.text, b->prompt().grammar);
}
/* THE STRUCT GROWS AT ITS END. A plugin built against a header with fewer fields reports a smaller
* struct_size, and the fields past it read as zero; one built against a larger header has its
* extra fields ignored. Nothing is read past what the plugin said it has. */
+5 -1
View File
@@ -198,7 +198,9 @@ TEST(the_paths_and_names_reach_their_fields) {
"--placement", "expert_tiered",
"--host", "0.0.0.0",
"--generation-config", "/g.json",
"--reasoning-effort", "medium" }, &c), RAD_OK);
"--reasoning-effort", "medium",
"--served-model-name", "qwen-coder",
"--override-chat-template", "/t.jinja" }, &c), RAD_OK);
CHECK_EQ(c.radiance_home, std::string("/rh"));
CHECK(c.weights_disk_tier);
CHECK_EQ(c.prefix_cache_dir, std::string("/kvdir"));
@@ -206,6 +208,8 @@ TEST(the_paths_and_names_reach_their_fields) {
CHECK_EQ(c.host, std::string("0.0.0.0"));
CHECK_EQ(c.generation_config, std::string("/g.json"));
CHECK_EQ(c.reasoning_effort, std::string("medium"));
CHECK_EQ(c.served_model_name, std::string("qwen-coder"));
CHECK_EQ(c.override_chat_template, std::string("/t.jinja"));
}
TEST(the_boolean_flags_are_off_until_they_are_given) {
+86
View File
@@ -764,6 +764,92 @@ TEST(gbnf_json_schema_grammars_agree_with_the_oracle) {
CHECK(t.masks > 1200);
}
/* A SCHEMA NO VALUE SATISFIES, which vendor/patches/0012 represents rather than refuses. oh-my-pi's
* `task` tool declares `"model?": "never"` in its batch form and Arktype exports that as
* `{"not": {}}`, the same schema as JSON Schema's `false`. Refused, it failed the tool-call grammar
* of every request that carried the tool. Represented, it is a key the object never holds. */
TEST(gbnf_a_property_no_value_satisfies_is_a_key_never_written) {
auto bv = bpe_like(23, 1500);
/* A whole value, from a fresh grammar: every byte taken and the parse at an end. */
auto whole = [&](const std::string& gbnf, const std::string& text) {
std::unique_ptr<GbnfGrammar> g;
std::string err;
if (GbnfGrammar::create(gbnf, "root", &bv->v, false, {}, {}, &g, &err) < 0) return false;
return g->accept_str(text) >= 0 && g->complete();
};
for (const char* never : { "{\"not\":{}}", "false" }) {
const std::string schema = std::string("{\"type\":\"object\",\"properties\":{"
"\"context\":{\"type\":\"string\"},\"model\":") +
never + "},\"required\":[\"context\"]}";
std::string gbnf, err;
CHECK_OK(grammar_from_json_schema(schema, "root", &gbnf, &err));
CHECK(whole(gbnf, "{\"context\": \"x\"}"));
CHECK(!whole(gbnf, "{\"context\": \"x\", \"model\": \"y\"}"));
CHECK(!whole(gbnf, "{\"model\": \"y\", \"context\": \"x\"}"));
}
/* additionalProperties must not readmit the key with a value of its own. */
{
std::string gbnf, err;
CHECK_OK(grammar_from_json_schema(
R"({"type":"object","properties":{"model":{"not":{}}},"additionalProperties":true})",
"root", &gbnf, &err));
CHECK(whole(gbnf, "{\"other\": 1}"));
CHECK(!whole(gbnf, "{\"model\": 1}"));
}
/* A union alternative of that kind contributes nothing to the union. */
{
std::string gbnf, err;
CHECK_OK(grammar_from_json_schema(R"({"anyOf":[{"type":"string"},{"not":{}}]})", "root",
&gbnf, &err));
CHECK(whole(gbnf, "\"a\""));
CHECK(!whole(gbnf, "1"));
}
/* Where a value is required there is nothing to write, and that is refused by name. */
for (const char* schema : {
R"({"type":"object","properties":{"model":{"not":{}}},"required":["model"]})",
R"({"not":{}})",
R"({"anyOf":[{"not":{}},false]})" }) {
std::string gbnf, err;
CHECK(grammar_from_json_schema(schema, "root", &gbnf, &err) < 0);
CHECK(!err.empty());
}
/* And the tool as oh-my-pi sends it, through each served template's tool-call grammar. */
const char* tools = R"([{"type":"function","function":{"name":"task",
"description":"Spawn subagents.","parameters":{"type":"object","properties":{
"context":{"type":"string"},"model":{"not":{}},
"tasks":{"type":"array","items":{"type":"object","properties":{
"name":{"type":"string"},"agent":{"type":"string","default":"task"},
"task":{"type":"string"},"solutionSpace":{"type":"string"},
"model":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},
"schemaMode":{"enum":["permissive","strict"]},
"tools":{"type":"array","items":{"type":"string"}}},
"required":["agent","solutionSpace","task"]}}},
"required":["context","tasks"]}}}])";
const ojson messages = ojson::array({ ojson{ { "role", "user" }, { "content", "hi" } } });
/* "auto" is the choice the server serves (it refuses "required"), with parallel calls on --
* the server's default -- and off. Under "auto" a template may leave the reply unconstrained
* and produce no grammar at all; what must not happen is a refusal. */
int built = 0;
for (const TemplateCase& tc : kTemplates) {
ChatTemplate ct;
REQUIRE(ct.load(slurp(fixture(tc.file)), tc.bos, tc.eos) >= 0);
for (int par = 0; par < 2; ++par) {
ChatOptions opt;
opt.tool_choice = "auto";
opt.parallel_tool_calls = par != 0;
ChatPrompt cp;
CHECK(ct.apply(messages, ojson::parse(tools), opt, &cp) >= 0);
if (!cp.grammar.empty()) ++built;
}
}
CHECK(built >= 3);
}
/* The grammars a chat template writes for its own tool-call syntax, from the three templates the
* engine serves: walked, and replayed over four agent calls wherever the syntax is the one the
* calls are written in. */