Skip to content
ACS Infra

Run the workshop notebook

Run the workshop notebook to go from a first Completion to a steered Base model in one sitting. It samples Llama 3.1 8B, reads its token probabilities and its Activations, and builds a Steering vector that makes it write like a pirate.

Each section after Set up ends with an exercise to change and run again. You need the two shell variables of the Quickstart, and Python 3.14 for compression.zstd.

Open the notebook

  1. Download workshop.ipynb.

  2. In the folder of the file, in the shell that has ACS_API_BASE and ACS_API_KEY, start JupyterLab on Python 3.14 with NumPy and the openai SDK. With uv, one command does it:

    uvx --python 3.14 --with openai --with numpy --from jupyterlab jupyter-lab workshop.ipynb

    Without uv, install jupyterlab, numpy, and openai with pip on Python 3.14, then run jupyter lab workshop.ipynb.

  3. Run the cells in order, from the top. When ACS_API_KEY is not set, the first code cell, under Set up, asks for your key, and the notebook does not show it.

Each run of the notebook sends about 30 Completions to meta-llama/Llama-3.1-8B, and your monthly allowance or your Budget pays for their tokens. The file keeps no outputs, so each text that you see is your own sample.

Work through the sections

Each section of the notebook names the page of these docs that explains it.

SectionWhat it does
Set upReads the model's facts, and defines the decode helper from Decode the tensor.
Send your first promptSends one Completion, with the log probability of each token (Send a prompt).
Sample at different temperaturesRepeats a prompt at three temperatures with a fixed seed (Set the sampling fields).
Read token probabilitiesReads logprobs and prompt_logprobs, and scores two texts (Read token probabilities).
Read ActivationsReads the residual stream at two Layers, then at every Layer (Read Activations).
Steer the model to talk like a pirateBuilds a contrast vector at Layer 15, and steers with it at three scales. Its exercise checks that the steer arrived (Steer with a contrast vector).

Next steps

Steer with a contrast vector is the last section as one program to run. Choose a scale says how to pick a scale for another Layer. Ask for Activations in a Job reads the Activations of many prompts in the background.

On this page