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
-
Download
workshop.ipynb. -
In the folder of the file, in the shell that has
ACS_API_BASEandACS_API_KEY, start JupyterLab on Python 3.14 with NumPy and theopenaiSDK. Withuv, one command does it:uvx --python 3.14 --with openai --with numpy --from jupyterlab jupyter-lab workshop.ipynbWithout
uv, installjupyterlab,numpy, andopenaiwith pip on Python 3.14, then runjupyter lab workshop.ipynb. -
Run the cells in order, from the top. When
ACS_API_KEYis 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.
| Section | What it does |
|---|---|
| Set up | Reads the model's facts, and defines the decode helper from Decode the tensor. |
| Send your first prompt | Sends one Completion, with the log probability of each token (Send a prompt). |
| Sample at different temperatures | Repeats a prompt at three temperatures with a fixed seed (Set the sampling fields). |
| Read token probabilities | Reads logprobs and prompt_logprobs, and scores two texts (Read token probabilities). |
| Read Activations | Reads the residual stream at two Layers, then at every Layer (Read Activations). |
| Steer the model to talk like a pirate | Builds 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.