Interactive How LLMs Work Explainer as a Claude Artifact

Get a live one-page explainer: a toy tokenizer that splits your own sentence into ID-numbered chips, then step-by-step next-word probability bars.

Text prompt for Claude and ChatGPT

The prompt

Prompt
You are a front-end developer who explains AI to curious non-technical readers. Build a one-page interactive explainer, "How LLMs work, in two small steps", answering: How does an AI chatbot read and write text?

Section 1, "Step 1: text becomes tokens": an input prefilled with "The cat sat on the warm windowsill." and a live toy tokenizer. Spaces attach to the next word, punctuation is its own token, and words over 7 letters split into a common chunk plus remainder (window + sill). Show coloured chips with hash-based made-up IDs, live character, word and token counts, and a note that real tokenizers learn vocabularies of tens of thousands of pieces.

Section 2, "Step 2: guess the next word, again and again": start from "Once upon a" with 8 hard-coded original story steps, each with 5 candidate words and invented scores.

Rules:
- Horizontal HTML/CSS bars, percentages summing to 100, chosen word highlighted.
- Next word, Back and Restart buttons; a labelled Temperature slider (0.2 to 1.5, live value) applying softmax; a most likely / sample toggle using a seeded random.
- Probabilities are invented; show a visible badge: "Made-up numbers for illustration, not from a real model".
- A caption names the chosen word, its probability and what temperature did.
- End with "What this toy leaves out": learned weights, attention over all context, huge vocabularies.
- System fonts, calm light theme plus dark mode, keyboard accessible, no network requests.

Output: one complete HTML file in one code block, then 3 short extension ideas.

Example output

One HTML file. Save it and open it in any browser.Open full screen (opens in a new tab)

Example: How LLMs work, in two small steps, a toy tokenizer plus next-word bars.

Type in the sentence box and watch it split live into coloured token chips, each with a made-up ID number; 'windowsill' becomes 'window' + 'sill'. In Step 2, press Next word to grow the story from 'Once upon a'. Drag Temperature low to see the top word dominate, high to flatten the bars, and switch to sample for a repeatable random pick. Use Back and Restart to compare.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • One idea per section: first text becomes tokens, then tokens are picked one at a time, so readers never face both concepts at once.
  • Softmax over fixed scores makes the temperature slider reshape bars honestly, and a seeded random keeps sampling repeatable.
  • The made-up-numbers badge and the 'what this toy leaves out' box set clear limits without claims about any real model.

Paste into Claude and open the result as an artifact: preview it, then share the artifact link. It also works in ChatGPT canvas or Gemini Canvas, or save the code as an .html file and open it in any browser.

Common edits

  • Swap the story steps for a classroom example sentence, such as a science fact, keeping 5 candidate words and invented scores per step.
  • Add a 'top-k' slider beside temperature that zeroes out all but the k highest-scoring words before the softmax.

Reuse it: Use in a workflowTurn into a skillAdapt in the builder

More in AI Research
AI ResearchClaude

Audit Qualitative Interview Transcripts for Researcher Bias

Get a turn-by-turn bias audit of your interview transcript, a list of contaminated participant quotes to exclude from coding, and neutral rewrites for every leading question.

AI ResearchGemini

Red-Team a Research Proposal for Confounders and Failure Modes

Get a severity-ranked validity audit table that exposes confounding variables, sampling biases, and failure modes in your research proposal with concrete fixes.

AI ResearchClaude

Literature Review Matrix From Pasted Paper Abstracts

Turns a set of abstracts into a comparison matrix of methods, samples, findings and limits, then maps where studies agree, conflict and leave gaps for your review.

AI ResearchPerplexity

AI Paper Explainer with Evidence Table and Practical Takeaways

Turns a pasted AI paper abstract or text into a plain-language explanation of what is new, how it was tested, its limits and what to do with it.

AI ResearchGemini

Build a Citation-Verified Policy Brief From Pasted Primary Sources

Turn pasted primary documents into a strict policy brief where every claim carries a verbatim-checked source tag, an evidence grade, and a log of unsupported gaps.

AI ResearchGemini

Turn a Broad Strategic Question into a Falsifiable Research Plan

Convert a vague strategic question into competing hypotheses, disconfirming tests, minimum-viable data sources, and pre-committed decision thresholds.