The loader stored a norm for every direction in the file, and the plugin declares
an op wherever a layer's scale is nonzero, so `layer_range` (4..44, the package's
own selection) reached only the range checks and the log line: the engine steered
all 47 directions -- 94 hc_project instances in the declared graph where the
sources and the docs say 41. The scale is zeroed outside the range now, which is
what RadControlVector documents ("a zero scale means this layer is not steered")
and what llama.cpp's patch does (its tensor is absent outside the range).
cvec_test asserts it for the default and for a JSON-stated range; --debug-graph
shows 41 a rank.
The direction table is also taken back out of the VRAM budget
(VramFacts::held_out). It is allocated in declare(), before vram_budget_resolve
reads free VRAM, so without the term the pools are planned around bytes the
program never sees. On this box the split came out identical either way
(claimable 12.92 GiB in both), so the term is a guarantee by construction rather
than a fix for an observed miss -- and it keeps a deployment that merely offers a
vector on the same plan as one that does not.
Reading the field's own name last made a null canonical value win over a
non-null alias (JSON null leaves the parsed bool untouched, so it became an
explicit off) and made a malformed alias fail a body whose canonical field was
valid. The loop now walks the field first, skips absent and null keys as the
rest of the parser does, and stops at the first one it finds: the field wins,
null means "the deployment's default", and the alias is only read when the field
is not.
server_test covers both -- a body with both spellings, and a null field with the
default on -- and cvec_test pins n_dirs, which the startup line now prints.
The direction table is indexed by layer (row 0 unused) and sized n_layers, so a
file carrying direction.<n_layers> passed the range check and then wrote one
row past `dir`, and a package JSON whose range ended at n_layers read one past
`scales`. Both bounds are exclusive now, and cvec_test covers each: direction.48
of a 48-layer model, and a JSON range 4..48 on the same model.
The startup line printed `n_layers - 1` as the direction count -- the published
file's count, but wrong for a file carrying fewer directions; the loader records
what it read and the line prints that. Also drops an unused <cstring>.
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.
A control vector is one unit direction per layer, applied to the residual stream while the model
runs (llama.cpp's --cvec-mode project). This is the loader and its ABI, with no configuration
surface: a vector is a property of the model family, so the engine looks for one beside the
container, in its directory or in $RADIANCE_HOME/vectors, and uses it when it fits the container.
The operation's parameters (layer range, scale, mode) come from the package's own JSON.
Validation is against the container, never the file's provenance: architecture hint, direction
width against n_embd, every layer in the range present, F32 rows. A discovered file that does not
fit is reported and skipped; the switch stays off until a request asks for it.
The ABI grows by one trailing, zero-defaulted field (RadBuildCtx::cvec), so an architecture plugin
that ignores it is unchanged, and the cache gains a salt (0 without a vector) that keeps blocks and
linear-state snapshots of one mode from being reused by the other.