Ster/Docs

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#

text
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#

InputRequiredMeaning
--model <MODEL>yesHugging 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>yesDestination for the steering artifact; missing parent directories are created.
--revision <REVISION>noImmutable Hugging Face revision; Hub resolution defaults to main.
--device <DEVICE>nocpu (default), metal, or cuda.
--layers <LAYERS>noall (default), comma-separated indices, or half-open ranges such as 8..16.
--method <METHOD>nocaa (default), pca, or logistic.
--chat-template <auto|off>noauto 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>nof32 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 pairs and pair 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, and layer <N> is outside the model's 0..<LAST> range.
  • Unknown devices and unavailable compiled GPU backends are refused; a model_type Ster has no decoder for is refused as model architecture <TYPE> is unsupported by this Ster build; use a Hugging Face checkpoint whose model_type is one of <FAMILIES> (model resolution).
  • --chat-template takes auto or off and nothing else; any other value is refused as unknown 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).