Use the Playground
The App's Playground runs a Base model in the browser. It opens in the Merged layout, which grows a tree of continuations from a text that you start. The Stacked layout runs one prompt at a time, with the settings of POST /v1/completions.
Choose a layout
Layout, at the right end of the Playground's header, lists the layouts. Select one to change the page. The browser keeps your choice, so the Playground opens in that layout the next time.
| Layout | What it does |
|---|---|
| Merged, marked Default | Grows a tree of continuations in a playground (Grow a text in the default layout). |
| Loom | Opens the Loom page on the playground that is open (Use the Loom page). |
| Stacked | Runs a prompt, with the output under it (Run a prompt). |
| One document, Run feed, Branches, Cells, Side by side, and the Production layout | Arrange the sessions and Runs of Stacked in other ways. |
A playground in Merged is a Loom, so Merged and Loom show the same Looms. The other layouts work on sessions and Runs. Merged lists each session too, and makes a playground from it when you open it (Open a session as a tree).
Grow a text in the default layout
- Open Playground. Under What comes next?, write the start of a text.
- In Next branches, on the right, select lane A to choose its model. Under the lanes, choose the settings of the next Nodes, such as Length and Temperature.
- Select Continue. The App makes a playground with your text as its first Node, and grows one Node after it. Start and branch grows more than one Node, and Nodes, beside it, says how many.
- Select a Node in the tree to read the text of its path. Continue grows one Node under it and moves to it. Branch grows more Nodes under it.
A lane is one model with its settings. Compare adds a lane, and one Branch then grows Nodes from every lane, so you compare models or settings in one tree. Nodes, beside Branch, is the number of the selected lane. Continue grows one Node from each lane, and moves to the Node of the selected lane.
Each lane's button names its model and the settings that you changed, such as temp 0.8 · 24 tok · seed 7. Select the button to choose the lane's model. The list shows each model's context, Layers, and hidden size, and whether the model is ready. A model that is not ready needs a start first, which takes minutes. The lane's button then says how far the start is.
To see what a Node was made with, open its menu and select Settings used for this Node. Each setting has a cell, and a value that differs from a new lane's has its default beside it. Use these settings for lane A copies them to the selected lane.
The text above the tree is the text of the path, and each Node goes on where the Node before it stopped. Select a token of any Node to see its probability and the likeliest tokens at its place. Branch here grows Nodes from the text before the token, and Continue here grows one Node from each lane after it. Both split the Node at the token, and so does another token from the list. Another token grows one Node that starts with that token. The model writes it with the settings of the Node that you picked the token in, not with the settings in Next branches. Its first token has the probability that the list showed. For a token of an earlier Node, Jump to this part of the tree moves you to that Node.
Each slider in Next branches covers what a Branch takes, such as 1 to 128 Nodes and 1 to 32,000 tokens of Length. A slider moves in small steps at its low end and in larger steps after that. The box beside it takes any number in the range. Steering adds a Steering vector to a lane. Turn on Steer this lane, then set Layer, Scale, and Vector (Steer the new Nodes).
API key, in the header, chooses which of your API keys the runs of the playground are billed to (Count the App's Branches for a key). Usage then counts them for that key. The runs spend your tokens a month either way. When the key is revoked or paused, the runs go on with no key, and a line under the header says so.
API, in the header, shows the next Branch as requests to POST /v1/completions, one for each lane, as curl, Python, JavaScript, or JSON. Each request has the text of the path as its prompt, then the lane's settings without the ones at the API's defaults. The page cuts a long prompt short, and Copy copies all of it. A lane that the page would not send has no request, and the panel says why. A lane whose Length is above 15,600 has none either, because only a streamed request can write that much. The code reads your API key from ACS_API_KEY (Send the key), and names the key that you chose in API key beside it. In a Node's menu, Show the request that made it shows the request for that Node, with its seed.
Beside the code, the panel names the request's field for each setting, the base URL, the header, and each model's id. Next steps links the Quickstart and Tapestry Loom (Use a desktop program).
While API is open, point at a setting in Next branches, or move to it with the keyboard, and the code marks the line of that setting in its lane's request. The model, Blue noise, Stop sequences, Steering, and Nodes have a line too. A setting at its default has no line, and a note under the code says that the request leaves it out. Whole vocabulary for your text has no line either, because it belongs to the request of Your text, and the note says so.
View has two switches for the text. Whitespace marks shows each space, line break, and tab. Token boundaries marks the end of each token with a line.
Read a token's rank
The popup of a token gives its rank among every token that the model knows, such as rank 1,144 of 128,256. Rank 1 is the likeliest token. A high rank means that the model found many other tokens likelier.
The App knows that rank when the likeliest tokens of the Node settle it. A Node keeps only the likeliest tokens at each place, as many as Top logprobs per token asked for. When the token is not among them, the popup says so, and says that its rank among every token is not known.
Get its rank then scores the text with the model that wrote the Node, as Score your own text does. The popup says what the request sends and counts before you select it. After the answer, the popup gives the rank and says that it comes from the score. The selected lane must have the model that wrote the Node. A steered Node gets no rank this way, because a score reads the text without the steering.
Score your own text
The heatmap colors the tokens that a model wrote. To see how likely a model finds a text that you wrote, score it:
- Select the Node at the end of the text that you want to score.
- In View, select Your text. Under the text, the App says what a score sends, and that its tokens count against your tokens for the month.
- Select Score your text.
The App sends the text of the path to the model of the selected lane. The request is one Completion with prompt_logprobs (Get log probabilities for the prompt). It generates one token and adds no Node. It counts the tokens that the model reads, which are the text's and one start token on most models, and that one new token. It counts them for the API key of the playground when it has one.
The heatmap then colors your text too, and the App names the model that scored it. Select a token of your text to see its probability and the likeliest tokens at its place. The popup also gives the token's rank among every token that the model knows. On a model that puts no start token before the text, the first token has no probability, because nothing comes before it. A token that crosses two Nodes has none either.
The scores stay until you reload the page. A score holds for a Node while its text, and the text before it, are the text that the model scored. After you split a Node or add one, score the text again.
To get every token of the vocabulary at each place, turn on Whole vocabulary for your text in Next branches, and score the text again. The box above the list in the popup then finds any token by its text. The whole vocabulary takes much longer, and the App takes it for a short text only. For a model with a vocabulary of 128,256 tokens, that is about 13 tokens. The API takes 256 tokens (Get the whole vocabulary).
Read a Node's Activations
To read the residual stream of a model for the text up to a Node:
- Open the menu of the Node, in the List or in the Graph, and select Activations.
- In Layers, type the Layers to read, such as
0, 16, 31or4-8. The dialog names the model of the selected lane and the Layers that it has. - Select Read activations.
The App sends the text of the path to the model of the selected lane. The request is one Completion with output_residual_stream (Read Activations). It generates one token and adds no Node, and it counts its tokens as a score does. One read holds a limited number of Layers × tokens, which the dialog gives for the model (Size caps).
Download .npy saves the numbers as a NumPy file of float32 numbers. Its shape is [layers, tokens, hidden size]. The Layers are in ascending order, and each token that the model read has one row, the start token included.
import numpy as np
activations = np.load("activations-llama-3.1-8b-layers-0_16_31.npy")
print(activations.shape)Under the button, each square is the length of the residual stream at one Layer and token, for the last 36 tokens of the text. A stronger square is a longer vector. The Activations stay until you reload the page. They are of the text that the model read, so read them again after the text changes.
Your playgrounds, on the left, lists your playgrounds, the pinned ones first. A playground from the old platform has a label: v1 loom for one of its Looms, and v1 workbench for one of its Workbench sessions. New playground starts another. The menu on a playground's row has Pin, Rename, and Delete. Delete deletes the playground and every Node of it, after you confirm, and you cannot undo it. The address keeps the open playground, so a reload opens it again.
History, in the header, lists each run that grew Nodes, newest first. A run is one press of Branch or Continue, with one lane for each Lane that it sent, also after a reload. Each run shows the tokens that it added, and each of its Nodes shows its seed. A tail that a split made is not a run. A Node from the old platform shows seed not known when the old platform kept no seed that a Loom can keep.
Each Node is a Completion that the API runs on its server, so it goes on when you close the tab (Loom Nodes). To grow the same tree from a script, read Make a Loom.
Open a session as a tree
Your playgrounds also lists the sessions that you made in the other layouts, each with the label Session.
- Select a session. The App reads its Runs and makes a playground from them.
- Read the tree. The session's prompt is the first Node, and the text of each Run is a Node under it. A Run that went on from the text of another Run is under that Run's Node.
- Select Branch or Continue under any Node to grow the playground, as in a playground that you started.
Each Node of a Run keeps the Run's model, settings, seed, tokens with their log probabilities, and the time at which the Run started. History shows each Run as one run, and the Runs of one Run all as one run with a lane for each Column. A Column keeps its lane's letter when another Column of its Run all still runs. A stopped Run keeps the text that it had. A Run without text is left out.
The playground has the label From a session. A session has one playground, so the session is no longer in the list, and the playground opens from its own row. The session and its Runs stay as they are in the other layouts. If you delete the playground, the session is in the list again.
The playground does not keep these parts of a session:
- The Activations of a Run, and its Steering vector. A Loom's Node has neither.
- Runs before the newest 100 of the session.
- A Run that still runs when you open the session, and Runs that you start in the session later.
- For a session whose Runs hold more than about 6 MB, the likely tokens at each place, and then the tokens themselves. The playground keeps the text of every Run.
Export the tree
- Open the playground, and select Export in the header. Export is off until a playground is open.
- Choose a file:
| File | What it holds |
|---|---|
| JSON (the whole tree, as a Loom file) | Every Node of the playground, as the Loom file that Export on the Loom page writes |
| JSONL (one line per Node a model wrote, with its prompt) | One line for each Node that a model wrote, with its prompt, request, status, and text |
| Text (every path) | The text of each path, from the first Node to a Node that has no Node under it |
| Path as text (the text so far) | The text of the path to the selected Node |
The browser downloads the file.
In a line of the JSONL file, prompt is the text of the path before the Node. request has the settings that the Node ran with. A Node that you wrote has no line. A Node that does not keep its settings has no line either. In the text of every path, a line of --- separates the paths.
The App also tries to copy the text of each file but the JSON file.
Find the keyboard shortcuts
Select the question mark beside API key in the header, or press ?, to open Keyboard shortcuts. In the same dialog, Terms says what a Node, a Branch, a lane, and a token are.
Run a prompt
This section and the ones after it describe the Stacked layout, with the settings of POST /v1/completions: the model, sampling, log probabilities, Activations, and Steering vectors. Each Completion that you start there is a Run, which the API runs on its server and keeps.
- Open Playground, select Layout, and choose Stacked.
- Write the prompt. In an empty prompt box, Tab puts in the gray example.
- In Settings, on the right, choose the Model and the settings, such as Max tokens and Temperature. Each setting is a field of the request, as Completions lists them. Choices is
n, Top logprobs shown islogprobs, Read Layers reads Activations, and Steer adds a Steering vector. Hover over a model in the model list to see its id, and use that id asmodelin the API. - Select Run. The text appears in the output as it grows, and the prompt stays as you wrote it. To stop the Run, select Stop.
Each Run says how it ended, as Finished, Stopped, or Failed, in the output's header and after its text.
Go on from a Run
Continue is at the end of a finished Run. It adds the Run's text to its prompt and starts a new Run with the settings on screen. A Run with more than one choice has Continue at each one.
To have each finished Run add its text to the prompt, turn on Add each Completion to the prompt beside Run. The switch is off at first, and it works in Single only, for a Run of one choice. A session keeps it on or off.
After either change, a line above the prompt says which Run's text it added, with Undo. The line goes when you type, select Use these settings or Restore, run on from another token, or open another session. A Run that still streams when you open another session ends in its own session, and adds its text to no other prompt.
To read what a setting does, select the (i) beside its name, or press Enter on it. The help says what low and high values do, and gives the setting's limits. Escape closes it. The model's Context, Layers, and Hidden size have an (i) too.
Read Layers takes Layers and ranges of Layers, such as 21-45, 49, and sends them as one sorted list of output_residual_stream. The field marks a Layer that the model does not have as you type, and Run refuses it before anything runs. The Layer of the Steering vector does the same. The (i) of each names the model's Layers, such as 0 to 31 for Llama 3.1 8B.
A Steering vector has as many numbers as the model's hidden size. The (i) of Vector gives that length, such as 4,096 numbers for Llama 3.1 8B. Vector marks a vector of another length as you type, with its count, such as 4,090 of 4,096 numbers. Run refuses it before anything runs.
Read Layers and Steer need Choices 1. While Choices is above 1, both are off, and Activations says why. When Choices is 1 again, both come back as you left them.
Blue noise, at the end of Sampling, sends blue_noise: true, which spreads out the unlikely tokens of a text (Blue noise sampling). For a model that does not take it, Blue noise is off, and a line under it says so. When it is on for such a model, for example after you choose another model, the switch is marked, and the API refuses the Run. Turn it off, or choose a model that takes it.
The prompt is at the top of the page, the output is under it, and Settings are on the right. The panel button at the right end of the header hides Settings and shows them again. The Loom's pages keep the same choice. Sessions in the header folds the list of sessions and opens it again.
In a window narrower than 1,440 pixels, Sessions opens over the page. Below 1,280 pixels, the settings open over the page too, from the panel button. Below 1,024 pixels, the navigation does the same. On a phone, Single and Compare are beside Prompt.
Sampling and Activations start folded. Steering vector shows only while Steer is on. Select a section's name to open or fold it. A folded section opens by itself when one of its settings changes from its default, such as a Seed or Steer. Each section stays as you left it until you reload the page.
Top p and the three penalties have a slider beside their box. The other settings are number boxes. An empty Top k box reads All, and keeps every token, as 0 does. Under the slider of each penalty, Off sets its neutral value: 0 for Presence penalty and Frequency penalty, and 1 for Repetition penalty. A number out of range is marked as you type, with its range. For example, Top p is more than 0 and at most 1. Temperature takes any value from 0 to 100. Reset to default, in the menu ⋮ at the top of the settings, puts every setting but the model back to your defaults.
Save your own defaults
The App starts each new Playground with its own defaults, such as a Max tokens of 200. To start from your own settings instead, choose them, and select Save as default in the same menu.
A new Playground then starts from your saved default, and so does a model that you add in Compare. Reset to default returns to it. Your saved default keeps every setting but the model and the Steering vector, and it never keeps a prompt. This browser keeps them for you, so another browser starts with the App's defaults.
To start from the App's defaults again, select Clear default in the same menu.
Wait for a model to start
A new Playground starts on a Warm model when one is Warm. A Run of a model that is not Warm waits while the model starts. One line above the output says how far the start has got and about how long is left. The Run then goes on by itself, also when you close the tab. Cold starts and long requests explains the starts.
If the API refuses to start a Run, for example because this month's tokens cannot hold it, the output says why, and nothing runs. When a setting is at fault, such as a Layer that the model does not have, the App marks that setting until you change it.
Share your settings
The page's address has the settings of each model, Single or Compare, and the Heatmap. Copy the address to share them. The address never has the prompt, a Run, or a Steering vector.
The address also names the session that is open. Playground in the navigation opens the address that this browser used last, so your session and its settings come back after you visit another page. When you sign out, the App forgets that address, and the prompts that this browser kept.
Work in sessions
A session is one line of work, with its prompt, its settings, and its Runs. Sessions, on the left of the page, lists them.
- Write a prompt and select Run. The first Run starts a session, which takes the first line of the prompt as its name.
- To start again from an empty prompt, select New session. The new session keeps the settings on screen.
- To go back to a session, select it in Sessions. Its prompt, its settings, and its Runs come back, and its Runs show in Runs, under the output. The output shows its newest Run, or every Run of its newest Run all in Compare.
The session saves its prompt and settings as you change them, so another browser opens it as you left it. A new session's prompt stays in this browser until its first Run.
Sessions lists your newest 100 sessions. The pinned ones come first, then the others, with the session that ran or changed name last at the top. Type part of a name in Find a session to list only the sessions that match.
The menu at the end of a session's row has Pin (or Unpin), Rename, and Delete. Delete asks first, and then deletes the session with its prompt, its settings, and every Run in it. You cannot undo it. The Runs that you started before the Playground had sessions are in one session, Earlier runs.
Compare models and settings
- Select Compare. Settings lists the Models first. When you had one model, Compare starts with a copy of it.
- Select Add model to add a model, up to 6. Each model has its own settings, and all of them share the prompt. Each model has buttons to show its settings under the list, duplicate it, or remove it.
- Select Run all. The Playground starts one Run for each model. To stop them, select Stop all.
Each Run shows its model, its text, and the settings in which it differs from the others. Compare leaves out the Token probability table. To read a Run's tokens, select it in Runs. Runs with the same prompt and with log probabilities also say how many of their first tokens match the first Run's. When a model's Run cannot start, for example because this month's tokens cannot cover it, that model's place says why.
Find your Runs again
The API runs each Run on its server and keeps it until you delete it. A Run goes on when you close the tab or open another page, and the Playground follows it again when you come back. When the API restarts says what happens to a Run that is running then.
Each Run has a number, in the order that you started your Runs, and keeps it. When you come back to the page, the output shows the newest Run.
Runs, under the output, lists the open session's newest 100 Runs, newest first. Each row gives the Run's number, its time, and the start of its text. Under them are its status, its model, and the settings that differ from the defaults. The time is in UTC, such as Nov 3, 20:19 UTC. When the 100 cut the Runs of one Run all, the list has the rest of them too.
- To read a Run again, select it in Runs. The output shows it, with its tokens and Activations in their tabs.
- To compare Runs, choose two or more with their boxes. The button Compare runs then counts them, as in Compare 2 runs. Select it to see them side by side.
- To delete a Run, open the menu at the end of its row, select Delete, then Delete run. Its text, tokens, and Activations go, and you cannot undo it.
Each row of Runs ends with a menu of the Run's actions:
| Action | What it does |
|---|---|
| Show | Shows the Run, as a select on its row does |
| Use these settings | Puts the Run's model, settings, and prompt back into the form |
| Copy settings | Copies the model, max_tokens, and each setting that differs from the API's default as JSON, with the field names of POST /v1/completions |
| Copy prompt | Copies the prompt |
| Copy output | Copies the text of the Run, each choice under its number. A Run without text does not have it. |
| Copy as API request | Copies a curl command that sends the Run's request to POST /v1/completions, without the fields at the API's defaults |
| Delete | Deletes the Run after you confirm |
The curl command reads your API key from $ACS_API_KEY (Send the key). Its request streams, as the Run did, so curl prints the events as they arrive. When the browser does not let the App copy, the App shows the text selected. Copy it by hand.
The Runs of one Run all stay together under a row that names them, such as Comparison of runs 4 and 5. To bring a comparison back, select Restore on that row. The Playground switches to Compare and makes a model of each Run's settings, with its seed. It puts the prompt back in the box, and shows the Runs side by side. The Runs start when you select Run all. Restore waits until no Run of the page is running.
The API erases a deleted Run 14 days later. It keeps a Run's Activations for 7 days after the Run ends. After that, the Run shows its text and tokens without them. Kept data lists how long the API keeps each thing.
A Run that you stop keeps the text that it wrote, and you pay the tokens that it used (How a Hold ends).
Read tokens and the heatmap
When a Run asks for log probabilities (Top logprobs shown above 0), each token of its text is a button.
- Select a token, or move to it with the arrow keys and press Enter. The Playground shows the likeliest tokens at that place, with their probabilities.
- To try another token there, select it. When you point at a token or move to it with Tab, it shows Run from here. The Playground cuts the text at that place, puts the token in, and runs on from it in a new Run.
A Run in the output has three tabs: Text, Tokens, and Activations. The output keeps the tab that you chose when you show another Run.
Tokens has the Token probability table. It gives each token's log probability, its probability, and the likeliest tokens at its place. Where the output is narrow, such as on a phone, the likeliest tokens are under each token. A table of more than 20 tokens starts folded. Activations shows the Activations that the Run read.
The Heatmap colors each token by its probability, in five bands of the ACS cyan, from 90% or more to Under 1%. The stronger the cyan, the more likely the token was. The heatmap marks a line break with ⏎ and a tab with ⇥. When you copy the text, the marks stay out of it. The small (i) beside the output's title, About the output, shows the bands, the marks, and the hint to select a token. Turn the Heatmap on or off in the settings.
Copy copies The text of a Run, or The prompt and the text. When the browser does not let the App copy, as on a page over plain HTTP, the App shows the text selected. Copy it by hand.
Use these settings puts a Run's settings and its prompt back into the form. Next to it, the Run says how the settings on screen differ from its own. A Run from before a range narrowed keeps its value, such as a Min p of 2, and the form marks it.
Export Runs
These steps export the Runs of Stacked. For a playground of Merged, read Export the tree.
- To export the Runs in view, select Export at the head of the output. To export the Runs that you chose in a session, select Export chosen. To export every Run that you kept, in every session, select Export every run at the end of Sessions. Its file has each Run's text and log probabilities, oldest first, without the Activations.
- Choose a file:
| File | What it holds |
|---|---|
| JSON | One object for each Run, with its request, its Completion, its usage, and its status |
| JSONL | One line for each choice, for pandas.read_json(path, lines=True) |
| Text | The text of each choice, with its prompt, to read |
The request and the Completion keep the API's own shapes, so code that reads the answers of POST /v1/completions reads them too. The Activations keep the encoding that Decode the tensor reads.