Ster/Docs

Runnable offline examples

These files are the exact inputs used for the recorded CPU walkthroughs. They exercise the real Llama/Safetensors path without a download or GPU. The model has seeded random weights, so generated text is deterministic but meaningless.

Overview#

These files are the exact inputs used for the recorded CPU walkthroughs. They exercise the real Llama/Safetensors path without a download or GPU. The model has seeded random weights, so generated text is deterministic but meaningless.

Files#

  • `make-toy-model.py` — stdlib-only generator for a tiny four-layer, hidden-width-64 Llama-shaped checkpoint with tokenizer and F32 Safetensors weights.
  • `pairs.json` — the eight calm/stormy contrastive pairs used by train, optimize, evaluate, and ster request, and by ster tune dpo and ster tune reward as a preference set.
  • `examples.json` — eight prompt/completion examples, the set ster tune sft trains on and ster tune evaluate scores.
  • `grpo-prompts.json` — the six prompts ster tune grpo samples completions from.
  • `prompts.json` — the two prompts used by extract.
  • `chat-examples.json` — the same eight examples with the question : and answer : markers taken back out, so a chat template supplies them rather than the data.
  • `chat-template/tokenizer_config.json` — a chat template written in the toy checkpoint's own vocabulary, to copy beside a copy of the toy model. The toy model itself deliberately publishes none, which is what makes it the test for the --chat-template auto fallback (chat template).

Run the CLI sequence#

From a checkout with target/release/ster already built:

bash
WORK=$(mktemp -d)
cd "$WORK"
python3 <repo>/docs/examples/make-toy-model.py toy-llama
cp <repo>/docs/examples/pairs.json .
cp <repo>/docs/examples/prompts.json .
STER=<repo>/target/release/ster

$STER train --model toy-llama --pairs pairs.json --layers 1..3 \
  --method caa --output calm.ster.json
$STER optimize --model toy-llama --pairs pairs.json --layers all \
  --output calm.best.ster.json
$STER evaluate --model toy-llama --pairs pairs.json --vector calm.ster.json
$STER generate --model toy-llama --prompt "describe the evening lake ." \
  --max-new-tokens 12
$STER generate --model toy-llama --vector calm.ster.json --strength 1.0 \
  --prompt "describe the evening lake ." --max-new-tokens 12
$STER extract --model toy-llama --input prompts.json --layers 0,3 \
  --output activations.json
$STER inspect calm.best.ster.json

Recorded output and interpretation: train/select/steer walkthrough.

Run the desktop request sequence#

ster request runs the same operations the way Ster Desktop runs them: one process per operation, the body on stdin, NDJSON on stdout. Run it from the work directory so relative input and output paths resolve there:

bash
cd "$WORK"
echo '{"model":"toy-llama","pairs":"pairs.json","output":"requested.ster.json","layers":"2","method":"caa"}' \
  | $STER request vector/train
echo "exit $?"
echo '{"model":"toy-llama","prompt":"describe the evening lake .","steering":[{"vector":"requested.ster.json","strength":1.0}],"maxNewTokens":12,"temperature":0,"seed":7}' \
  | $STER request generate
echo "exit $?"

Each process prints its reading pair progress as log events, then one result event whose json is the document the matching CLI command prints, and exits with that event's status. echo '{}' | $STER request vector/train shows a refusal instead: one result with status 2 and no log before it. Event and status reference: desktop request reference.

Replacing the toy model#

For useful representation work, replace every --model toy-llama with one existing local Safetensors directory or Hub model id of a supported family. Use an immutable --revision for Hub reproducibility, design pair columns to differ only in the trait, keep a separate evaluation set, and calibrate strength on baseline-versus-steered outputs. The toy artifacts are bound to toy-llama and hidden width 64; they must not be applied to a real checkpoint. A real instruct checkpoint publishes its own chat template, so the fixture template is only needed to exercise that path offline; with a downloaded instruct model, --chat-template auto finds the real one.