LLM X-Ray

Every token, every layer, live. Watch attention shift, predictions sharpen, and confidence lock in as the model writes — an MRI for a language model, driven by your own prompt.

A look inside the scope

STREAMING QWEN3-1.7B · 28 LAYERS · CPU

»What's the capital of France?

REASONING

The user is asking a simple factual question about geography. France's capital is well known…

ANSWER · UNDERLINE = CONFIDENCE · HOVER A TOKEN

The·capital·of·France·is·Paris.

LOGIT-LENS TRAJECTORY · “·Paris” · HOVER A LAYER

L0 “the”
L7 “a”
L14 “located”
L21 “Paris”
L27 “Paris”
step 6 / 6 · greedy · 0.13s/token unsure warming locked

A static rendering of the live instrument — the real thing streams this from an actual forward pass on your prompt, token by token.

The pipeline

prompt chat template prime KV cache generate token read 28 layers stream live

What you see

01Architecture flow

The model's actual decoder stack, lit up block by block as each token is generated — click a block for its internal circuit (attention → residual → MLP → residual).

02Generation timeline

Reasoning and answer tokens as a running transcript, each underlined by confidence. Replay the whole run, scrub with the keyboard, or jump straight to the model's shakiest decisions.

03Logit-lens trajectory & heatmap

The model's best guess read off every layer for the selected token — watch the prediction sharpen from noise to a locked-in answer as depth increases.

04Next-token candidates

The real distribution behind the chosen token: what it picked, how sure it was, and the runner-up it almost said instead.

05Attention attribution

Which earlier tokens actually drove a decision — attention rollout across all layers, a single raw layer, or arcs drawn straight onto the timeline.

06Shareable card

One-click PNG of the current Q&A, branded and watermarked, plus dynamic OG images so shared links unfurl with the prediction.

Run it locally

The live app needs a running backend (Qwen3-1.7B on CPU) and frontend. The fastest path is Docker:

# clone & start
git clone https://github.com/baselhusam/llm-xray
cd llm-xray
make up          # build + start backend + frontend
# open http://localhost:3000

First boot downloads the Qwen3-1.7B weights once (~4 GB, cached afterwards). See the repo README for the two-terminal dev setup without Docker.