core: a control vector loaded from a controlvector GGUF, discovered per model family

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.
This commit is contained in:
C_Tamas authored and StillDeadcode committed 2026-10-21 09:26:17 +02:00
1 parent aa12f79579
commit 64adee3ece
10 files changed
+859 -2

No files matched your search

+7 -1
View File
@@ -80,7 +80,7 @@
{ "RadBufDecl", "domain", 60, 4 },
{ "RadBufDecl", "derive", 64, 8 },
{ "RadBufDecl", "kv", 72, 4 },
{ "RadBuildCtx", "", 0, 112 },
{ "RadBuildCtx", "", 0, 120 },
{ "RadBuildCtx", "rank", 0, 4 },
{ "RadBuildCtx", "world_size", 4, 4 },
{ "RadBuildCtx", "max_tok", 8, 8 },
@@ -98,6 +98,7 @@
{ "RadBuildCtx", "max_audio_frames", 88, 8 },
{ "RadBuildCtx", "max_mixed_tok", 96, 8 },
{ "RadBuildCtx", "kv_quant", 104, 4 },
{ "RadBuildCtx", "cvec", 112, 8 },
{ "RadAudioGenBatch", "", 0, 264 },
{ "RadAudioGenBatch", "n_lane", 0, 8 },
{ "RadAudioGenBatch", "lane", 8, 8 },
@@ -166,6 +167,11 @@
{ "RadAudioGenDecl", "first_frame", 204, 4 },
{ "RadAudioGenDecl", "voc_chunk", 208, 8 },
{ "RadAudioGenDecl", "voc_context", 216, 8 },
{ "RadControlVector", "", 0, 32 },
{ "RadControlVector", "dir", 0, 8 },
{ "RadControlVector", "scales", 8, 8 },
{ "RadControlVector", "n_embd", 16, 8 },
{ "RadControlVector", "n_layers", 24, 8 },
{ "RadAudioFormat", "", 0, 72 },
{ "RadAudioFormat", "struct_size", 0, 4 },
{ "RadAudioFormat", "audio_open", 8, 8 },