Interactive LLM Demos
Demo 01

Token generation loop

i
Autoregressive generation

The model creates an answer one piece at a time. Each new piece is added to the input before the model chooses the next one.

Run the scripted response continuously or advance one model step at a time.

A

Set the context

B

Observe the output

Ready
Response will assemble here, token by token.
Autoregressive generation loopINPUTTOKENSCOMPUTEWEIGHTSSELECTTOKENSTOP?LOOP
Signal pathContext
Live debugger

Per-token execution trace

i
Autoregressive generation

The model creates an answer one piece at a time. Each new piece is added to the input before the model chooses the next one.

Scripted telemetry illustrates the operations an actual model performs for every generated token.

01 · EncodeWaitingUTF code points ·
02 · Forward passWaitingKV cache · 20 occupied slots
03 · ProjectWaitingHidden state → vocabulary scores
04 · SampleWaitingTemperature 0.7 · top candidate selected
StepDecoded pieceToken ID
i
Token ID

The vocabulary number assigned to a token. The model receives this number rather than the visible text.

Context pos.
i
Context position

The token’s numbered place in the full input and generated sequence currently visible to the model.

Logit
i
Logit

A raw score produced by the model for a possible next token. Larger scores become larger probabilities after normalization.

P(token)
i
Probability

The model’s estimated chance that a candidate should be selected next, expressed here as a percentage.

Σ log P
i
Cumulative log probability

A running score for the likelihood of the generated sequence. More negative values mean the full sequence is less likely.

Stop check
Run or step the loop to record its first token.

Token IDs, logits, and probabilities are deterministic teaching values; the control flow mirrors autoregressive inference.

Inside this moment

Four beats.
One continuous loop.

01

Context window

The prompt and everything generated so far become the model's working memory.

Explainwhytheskychangescoloratsunsetintwosentences.
20~ tokens in context
02

Candidate weights

The model ranks possible continuations. These bars illustrate the current choice—not hidden model logits.

58%
the21%
and13%
of8%
03

Select a token

Sampling turns a weighted possibility into the next concrete piece of the response.

Latest selection
0.7temperature
04

Stop or continue

If the answer is unfinished, the new token joins the context and the whole path runs again.

ContinueStop
0pieces buffered