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

+6
View File
@@ -101,6 +101,7 @@ ABI_FIELD(RadBuildCtx, max_out_rows)
ABI_FIELD(RadBuildCtx, max_audio_frames)
ABI_FIELD(RadBuildCtx, max_mixed_tok)
ABI_FIELD(RadBuildCtx, kv_quant)
ABI_FIELD(RadBuildCtx, cvec)
ABI_STRUCT(RadAudioGenBatch)
ABI_FIELD(RadAudioGenBatch, n_lane)
ABI_FIELD(RadAudioGenBatch, lane)
@@ -169,6 +170,11 @@ ABI_FIELD(RadAudioGenDecl, prompt_whole)
ABI_FIELD(RadAudioGenDecl, first_frame)
ABI_FIELD(RadAudioGenDecl, voc_chunk)
ABI_FIELD(RadAudioGenDecl, voc_context)
ABI_STRUCT(RadControlVector)
ABI_FIELD(RadControlVector, dir)
ABI_FIELD(RadControlVector, scales)
ABI_FIELD(RadControlVector, n_embd)
ABI_FIELD(RadControlVector, n_layers)
ABI_STRUCT(RadAudioFormat)
ABI_FIELD(RadAudioFormat, struct_size)
ABI_FIELD(RadAudioFormat, audio_open)