ster vector train
Train one steering direction per selected model layer from positive and negative prompts, then save a validated Ster steering artifact.
Invocation and purpose#
ster vector train --model <MODEL> --output <OUTPUT> [--pairs <PAIRS>] [--revision <REVISION>] [--device <DEVICE>] [--layers <LAYERS>] [--method <METHOD>] [--chat-template <auto|off>] [--precision <f32|f16|bf16>]Loads a model of a supported family, captures the final-token residual activation for both prompts in every contrastive pair, trains one unit-normalized direction at each selected layer, and scores each direction on the training pairs.
Inputs and options#
| Input | Required | Meaning |
|---|---|---|
--model <MODEL> | yes | Hugging Face model id or local model directory. |
--pairs <PAIRS> | no* | JSON file with trait_name and a non-empty pairs array of non-empty positive and negative prompts. Omit it to use the active pair set accepted by ster workspace import-pairs; without either source Ster refuses before loading a model. |
--output <OUTPUT> | yes | Destination for the steering artifact; missing parent directories are created. |
--revision <REVISION> | no | Immutable Hugging Face revision; Hub resolution defaults to main. |
--device <DEVICE> | no | cpu (default), metal, or cuda. |
--layers <LAYERS> | no | all (default), comma-separated indices, or half-open ranges such as 8..16. |
--method <METHOD> | no | caa (default), pca, or logistic. |
--chat-template <auto|off> | no | auto by default. auto reads both prompts of every pair through the model's own chat template when the checkpoint publishes one, and reads them as raw text when it does not; off reads raw text always (chat template). A direction is fitted in whatever space the pairs were read in and added in whatever space generation runs in, so a direction fitted off and applied under auto is measured in one space and steers another. The artifact records which of the two this run did. |
--precision <f32|f16|bf16> | no | f32 by default. The dtype the base weights are mapped at: f32, f16, or bf16. bf16 is refused on cpu at load with `bf16 has no CPU matmul kernel in this Candle build; use --precision f16 for half precision on cpu, or --device metal for bf16` (precision). A direction is fitted in whatever space the prompts were read in, so two artifacts trained at different precisions are not interchangeable. |
Output and state#
Writes a schema-1 Ster steering artifact containing the model identity, trait, method, hidden width, the precision and chat_template this run read the pairs in, and every selected layer's vector and training scores. Stdout is the summary document: the same identity fields, metadata, and one layer, width, norm, train_accuracy, and train_margin record per layer, with no vector values, plus the run's own chat_template decision at the top level. Stderr carries one line naming what the run decided about the template, then one line per pair read.
Refusals#
- A missing, invalid, empty, or partly blank pair file is refused, including
pair set <PATH> contains no pairsandpair set <PATH> contains an empty positive or negative prompt. - Unknown methods are refused with
unknown training method <VALUE>; expected caa, pca, or logistic. - Empty, malformed, reversed, or out-of-range layer selections are refused, including
no layers selected,layer range <RANGE> must have start < end, andlayer <N> is outside the model's 0..<LAST> range. - Unknown devices and unavailable compiled GPU backends are refused; a
model_typeSter has no decoder for is refused asmodel architecture <TYPE> is unsupported by this Ster build; use a Hugging Face checkpoint whose model_type is one of <FAMILIES>(model resolution). --chat-templatetakesautooroffand nothing else; any other value is refused asunknown chat template mode "<VALUE>"; expected auto or off. A template the checkpoint publishes but MiniJinja cannot compile or render is refused at load, before a pair is read (chat template).