docs, tests: say what the branch does, and test what the docs say

Review found four places where the branch's prose had outrun its code:

  - docs/GUIDE.md 4.10 promised that an incompatible sidecar "stops startup" two
    sentences after promising it is "reported and skipped" (the code warns and
    serves without it), and claimed deployment-level bit-identity for a request
    without the vector, which the PR explicitly withdraws. Both now say what the
    engine does; the wording is core/cvec.h's, which already had it right.
  - cvec_test claimed discovery order and a range past the model in the PR, but
    neither case existed. Both are there now, reusing the file writer and load()
    the file already had, so discovery -- the branch's policy choice -- has
    coverage at all.
  - the libr4d row descriptions still said "experimental speed projection" after
    the naming commit, and pointed at the unit that no longer exists;
    ref_hc.cpp's comment had a duplicated clause.
  - /stats' `n_layers` reported the direction count (47 of 48 layers); it is the
    model's layer count now, with first/last carrying the range.

The alias is read before the field's own name, so a request that sends both is
read as `control_vector`, and engine.cpp's /server_info comment is back above
engine_info.
This commit is contained in:
C_Tamas authored and StillDeadcode committed 2026-10-21 09:26:17 +02:00
1 parent 6964d05f75
commit f3979aa538
6 files changed
+75 -20

No files matched your search

+7 -7
View File
@@ -480,8 +480,8 @@ static const RadOperandSpec oGdnConvRecurrentUpdate[] = {
/* The gated residual. `hc_enter` and `hc_write` share a parameter list; `hc_read` adds the two
* switches its operand list depends on: `inject` 0 is the final mixer and `group` 0 a read whose
* consumer wants bf16. Both default on, as every trunk connection uses both. */
/* The experimental speed projection (libr4d/r4d_hc_project.hip): a bf16 stream, one unit f32
* direction per layer, an int32 switch per row. */
/* The control vector's projection (r4d_hc_bf16.hip, with the other gated-residual kernels): a bf16
* stream, one unit f32 direction for every stream, an int32 switch per row. */
static const RadParamSpec pHcProject[] = { P_INT("M"), P_INT("n"), P_INT("hc"), P_F64("scale"),
P_STR("dtype") };
static const RadOperandSpec oHcProject[] = {
@@ -2945,11 +2945,11 @@ static const RadOpSchema kSchemas[] = {
"the mean of the gated streams -- plus the per-branch write gains and, optionally, "
"the block-scaled fp8 form of the block input and its Hadamard-rotated twin."),
SCHEMA("hc_project", pHcProject, oHcProject,
"the experimental speed projection (llama.cpp's `--cvec-mode project`): for each of the "
"the control vector's projection (llama.cpp's `--cvec-mode project`): for each of the "
"hc streams of a row whose `on` flag is 1, h[s] -= scale * (h[s] . v) * v, v that "
"layer's unit direction and scale its stored norm. A row whose flag is 0 is neither read "
"nor written, so an unprojected request is byte-identical to a deployment with no "
"vector loaded."),
"layer's unit direction -- the same v for every stream -- and scale its stored norm. A "
"row whose flag is 0 is neither read nor written, so an unprojected request's stream is "
"the stock model's."),
SCHEMA("hc_write", pHcPlain, oHcWrite,
"the write half: h[s] += inj[s] * y, into the UNNORMED stream."),
SCHEMA("mtp_enter", pMtpEnter, oMtpEnter,
@@ -6527,7 +6527,7 @@ R4D_WIN_PAIR(512, 1) R4D_WIN_PAIR(512, 2) R4D_WIN_PAIR(512, 4) R4D_WIN_PAIR(512,
r4d_shape_hc_write },
{ "hc_project_bf16", "hc_project", "norm",
"speed projection: h[s] -= scale * (h[s] . v) * v where the row's flag is on",
"control vector: h[s] -= scale * (h[s] . v) * v where the row's flag is on",
"any M, any n, hc 2..8",
"bf16 stream, f32 direction, i32 switch",
RAD_DOMAIN_DEVICE, R4D_PRIO_ONLY,