用这个模板做的 3 个案例
同一份提示词,不同的 [VARIABLES] 变量。点一个在上方预览。关于这个模板
这是一个单页长滚动讲解页,带读者一步步了解语言模型如何把一个未完成的句子变成它的下一个词。一个固定的绘图舞台位于一列简短说明卡片旁边,每张卡片滚动进入视野时,舞台只做一件事。句子会拆成带颜色的 token 芯片,下方标有数字;芯片飞入一张二维地图,相关词在那里聚成一簇;曲线显示每个 token 关注了哪些前面的词;柱状图列出下一个词的概率。最后一步给读者一个温度滑块和一个“再抽样”按钮,让他们看到一次带种子的掷骰如何选出不同的结尾。
它适合老师、通讯作者、课程创作者和产品团队,用来向那些永远不会读研究论文的人解释一个技术过程。说明文字用平实的语言写成,每张卡片只讲一个概念,每个概念配一个日常类比,以及一个点开即可展开的行内术语小标签。
视觉上是一个平静的编辑风格页面:暖调米白纸张底色,近黑色的 Fraunces 标题,Inter 用于正文阅读,JetBrains Mono 用于 token 和数字,一个朱红色强调色,以及几种柔和的色调用于区分词群。所有视觉元素都用 SVG 绘制,因此构建体积小,也没有图片授权需要跟踪。页面包含深色模式切换、移动端布局(舞台固定在卡片上方)以及一个减少动态效果的版本,该版本把每一步显示为静态图。
要改造成自己的内容,只需更换品牌、标题主题、示例句子和受众。所有文案和数据,从 token id 到地图坐标、注意力权重和概率,都放在一个内容文件里,因此同一个舞台可以用来讲解代码补全、手机键盘联想或其他分步过程。
模板提示词
在线演示就是用这份提示词原样做出来的,没有额外补充。其他案例只是改了 [VARIABLES] 变量的值。 提示词保持英文原版,国内常用的 AI 编程工具都能直接理解;下面附中文参考译文。
# How Large Language Models Work
Build this website exactly as described below. Replace the [VARIABLES] with your own values; keep everything else.
## Brief
A single long-scroll interactive explainer for [BRAND] titled "[TOPIC]". One unfinished example sentence, [EXAMPLE_SENTENCE], travels through a pinned SVG stage in eight steps while short caption cards scroll past: the sentence splits into token chips, the chips get numeric ids, the chips fly onto a 2D meaning map with labeled regions, curved attention arcs connect each word to the earlier words it relies on, a bar chart shows the top eight candidate next words, and a temperature slider with a seeded dice roll samples an ending the reader can re-roll. It closes with a five-icon recap strip, a glossary, a short FAQ and a footer. No model runs in the browser: every number is invented, illustrative and stored in one content file.
- Audience: [AUDIENCE]: people who use AI writing tools or hear about them at work and want an honest, visual picture of what happens inside, without math or code.
- Goal: By the end of the page the reader can explain in their own words the five stages (split, embed, attend, predict, sample) and has played with temperature long enough to see why the same prompt can give different answers.
- Tone: Calm, precise and friendly, like a good science magazine. Short sentences, one idea per card, an everyday analogy for each idea, no hype, no jargon without an inline definition. Never names real AI products, labs or people; always says "a language model".
## Stack
- Framework: Vite 5 + React 18 + TypeScript
- Styling: Tailwind CSS 3.4
- Libraries: react, react-dom 18 (MIT), vite 5, @vitejs/plugin-react (MIT), typescript 5 (Apache-2.0), tailwindcss 3.4, postcss, autoprefixer (MIT), gsap 3 (core + ScrollTrigger) (GSAP Standard License (free, commercial use allowed)), lucide-react (ISC), @fontsource-variable/fraunces (OFL-1.1), @fontsource-variable/inter (OFL-1.1), @fontsource-variable/jetbrains-mono (OFL-1.1)
- Build: `npm run build` → static files in `dist/`. No backend, no server code, no external APIs.
- Setup:
- Scaffold with the Vite react-ts template; single entry index.html with <title>[BRAND] · [TOPIC]</title> and <link rel="icon" href="./favicon.svg">.
- vite.config.ts: base './', build.sourcemap false, build.outDir 'dist', default minification.
- Import the three Fontsource variable packages once in src/main.tsx; register gsap ScrollTrigger once there with gsap.registerPlugin(ScrollTrigger).
- Define all colors as space-separated RGB CSS variables in src/index.css under :root (light) and [data-theme="dark"] (dark); map them in tailwind.config.ts theme.extend.colors as rgb(var(--x) / <alpha-value>). Tailwind darkMode: ['selector', '[data-theme="dark"]'].
- tailwind.config.ts fontFamily: display ['Fraunces Variable', 'Georgia', 'serif'], sans ['Inter Variable', 'system-ui', 'sans-serif'], mono ['JetBrains Mono Variable', 'ui-monospace', 'monospace'].
- Keep every piece of copy and data in src/content.ts: hero text, the eight step captions with analogies and glossary terms, the tokens array (text, id, category, mapX, mapY), ghost words, regions, attention rows, candidates (word, probability, continuation), recap labels, glossary, FAQ and footer text. Components only read from it. When the variable values change, rewrite the copy and regenerate all data in this file to fit the new example; keep the same shapes and counts.
- Put the sampler in src/lib/sampler.ts: mulberry32(seed) PRNG, applyTemperature(probs, T) computing softmax(ln(p_i) / T), and sample(probs, r) returning the index where the cumulative sum first exceeds r.
- Components: Header, Hero, Scrolly (StepCard list + Stage), Stage layers TokenLayer, MapLayer, AttentionLayer, BarsLayer, TemperatureControls, then Recap, Glossary, Faq, Footer. One useReducedMotion hook reading matchMedia('(prefers-reduced-motion: reduce)').
- Stage animation model: React state activeStep (0-7) set by one ScrollTrigger per StepCard (start 'top 60%', end 'bottom 60%', onToggle when isActive). Each step change runs a GSAP timeline that tweens SVG attributes and transforms from the current state to that step's target state (overwrite: 'auto'), so scrolling backwards works the same as forwards.
- Theme: on load read localStorage key 'theme' inside try/catch, fall back to prefers-color-scheme; set data-theme on <html>; the header toggle writes it back inside try/catch.
## Variables
- [BRAND] — Publication or series name (default: "Lantern Guides"). The invented publisher of the explainer, shown in the header wordmark, hero kicker and footer.
- [TOPIC] — Explainer headline (default: "How a language model picks the next word"). The question the page answers; used as the hero headline and in the <title>.
- [EXAMPLE_SENTENCE] — Unfinished example sentence (default: "After a rainy walk, the sleepy dog curled up by the"). The input that travels through every step. Pick one that splits into 12-16 tokens, contains at least one word that breaks into two pieces, and has an obvious but not certain next word.
- [AUDIENCE] — Who the page is for (default: "curious readers with no engineering background"). Sets the vocabulary and analogies of every caption.
- [CREDIT] — keep a small "Template by VibeFather" link to https://vibefather.ai/t/how-large-language-models-work in the footer (default: yes; delete this line to remove it)
The copy under Pages & Sections is written for the default values. If your values differ, rewrite every headline, paragraph, label and image for them — same length, tone and structure. Layout, colors, type and motion stay as described.
Keep all copy, image paths and links in one content file (for example `src/content.ts`), keyed by section, so the content can be swapped later without touching components.Pro 模板
解锁完整提示词和源码
- 完整提示词:设计、版块、动效、素材
- 每个在线演示的源码
- 商用授权
在线演示和 DESIGN.md 仍然免费。
DESIGN.md
单独的设计规范:配色、字体、间距和动效。可以把这套视觉用到你已有的项目上。
---
name: "How Large Language Models Work"
colors:
paper: "#F6F1E7"
surface: "#FFFCF6"
ink: "#1B1A17"
ink_muted: "#5E584D"
rule: "#DDD4C3"
accent: "#E4572E"
tint_animal: "#9DBFA8"
tint_home: "#E2C27A"
tint_action: "#B7A6D6"
tint_weather: "#9FC3D9"
tint_glue: "#D4CCBD"
dark_paper: "#16151A"
dark_surface: "#211F26"
dark_ink: "#EDE7DA"
dark_ink_muted: "#A39C8E"
dark_rule: "#38353E"
dark_accent: "#FF6B43"
typography:
display_hero_headline_72px_desktop_44px_mobile_weight_600_opsz_144_letter_spacing_0_02em_line_height_1_02_step_card_titles_28px_24px_weight_600_section_headings_44px_32px_weight_500_sampled_sentence_26px_italic_weight_400: { family: "Fraunces", weights: [400, 500, 600] }
text_hero_deck_21px_line_height_1_5_caption_body_17px_line_height_1_6_ui_labels_14px_weight_500_faq_and_glossary_16px: { family: "Inter", weights: [400, 500, 600] }
mono_token_chips_15px_weight_500_token_ids_11px_step_counters_like_03_08_12px_uppercase_letter_spacing_0_08em_percentages_temperature_value_dice_number: { family: "JetBrains Mono", weights: [400, 500, 600] }
spacing: "8px base unit. Content max-width 1200px with 32px side padding desktop, 16px mobile. Sections 128px vertical padding desktop, 80px mobile. Scrolly grid on desktop (>=1024px): caption column 38% on the left, 4% gap, stage column 58% on the right. Caption cards max-width 420px, padding 28px, each card in its own step wrapper with min-height 100vh and the card vertically centered; the last step wrapper is 160vh so the reader can play with the slider while the stage stays pinned."
radius: "Token chips 6px, caption cards and stage panel 14px, glossary pills and buttons fully rounded (999px), bars 4px on the right end only, map regions are soft ellipses."
---
# How Large Language Models Work — Design System
Apply this design system to an existing project. It describes the look and feel only; for the full site, use prompt.md.
## Colors
- **paper** `#F6F1E7` — Light page background
- **surface** `#FFFCF6` — Light caption cards, stage panel, FAQ items
- **ink** `#1B1A17` — Headlines, body text, chip labels
- **ink-muted** `#5E584D` — Secondary text, token ids, axis labels, captions under figures
- **rule** `#DDD4C3` — Hairlines, card borders, empty bar tracks, map frame
- **accent** `#E4572E` — The one saturated color: focus chip, attention arcs, top bar, progress bar, slider thumb, chosen word underline, links
- **tint-animal** `#9DBFA8` — Sage: chips, dots and map region for animals and living things
- **tint-home** `#E2C27A` — Sand: map region for home and warmth (candidate next words)
- **tint-action** `#B7A6D6` — Lavender: chips and region for actions and states (walk, sleep, curled)
- **tint-weather** `#9FC3D9` — Sky: chips and region for weather words
- **tint-glue** `#D4CCBD` — Warm gray: small glue words, word pieces and punctuation
- **dark-paper** `#16151A` — Dark mode page background
- **dark-surface** `#211F26` — Dark mode cards and stage panel
- **dark-ink** `#EDE7DA` — Dark mode text
- **dark-ink-muted** `#A39C8E` — Dark mode secondary text
- **dark-rule** `#38353E` — Dark mode hairlines
- **dark-accent** `#FF6B43` — Dark mode accent; tints keep their hex but chips use them at 85% opacity with dark-ink labels switched to #16151A
## Typography
- **Display: hero headline (72px desktop / 44px mobile, weight 600, opsz 144, letter-spacing -0.02em, line-height 1.02), step card titles (28px / 24px, weight 600), section headings (44px / 32px, weight 500), sampled sentence (26px italic weight 400)** — Fraunces (OFL), weights 400/500/600. Self-host the font files.
- **Text: hero deck (21px, line-height 1.5), caption body (17px, line-height 1.6), UI labels (14px weight 500), FAQ and glossary (16px)** — Inter (OFL), weights 400/500/600. Self-host the font files.
- **Mono: token chips (15px weight 500), token ids (11px), step counters like 03 / 08 (12px uppercase, letter-spacing 0.08em), percentages, temperature value, dice number** — JetBrains Mono (OFL), weights 400/500/600. Self-host the font files.
## Spacing & shape
- Spacing: 8px base unit. Content max-width 1200px with 32px side padding desktop, 16px mobile. Sections 128px vertical padding desktop, 80px mobile. Scrolly grid on desktop (>=1024px): caption column 38% on the left, 4% gap, stage column 58% on the right. Caption cards max-width 420px, padding 28px, each card in its own step wrapper with min-height 100vh and the card vertically centered; the last step wrapper is 160vh so the reader can play with the slider while the stage stays pinned.
- Radius: Token chips 6px, caption cards and stage panel 14px, glossary pills and buttons fully rounded (999px), bars 4px on the right end only, map regions are soft ellipses.
## Motion
- Discrete step transitions, not scrubbed: when activeStep changes, a GSAP timeline of 0.6-0.9s with ease power3.inOut moves the stage to the new state; elements stagger by 0.03-0.05s in reading order.
- Only the 2px progress bar under the header is scrubbed (ScrollTrigger scrub: true over the whole scrolly section, scaleX 0 to 1).
- Hero sentence types in once on load at 28ms per character with a blinking 2px accent caret (1s steps blink) that stays at the end.
- Attention arcs draw in with stroke-dashoffset from full length to 0 over 0.6s, heaviest arc first.
- Bars grow from width 0 with power2.out over 0.7s, stagger 0.05s; percentages count up in step with the bar.
- Temperature changes re-tween bars over 0.35s power2.out; the dice icon rotates 360 degrees over 0.5s on every sample; the chosen word fades in with a 6px rise.
- Caption cards fade from 40% to 100% opacity and lift 12px when their step becomes active; inactive cards rest at 40% opacity.
- Hover and focus micro-interactions: chips lift 2px and show a 1px accent outline, glossary pills invert to accent fill, buttons darken 6%.
- prefers-reduced-motion: no typing, no tweens and no pinning. The stage is not sticky; instead each step card is followed by a static SVG figure of that step's final state (same Stage component rendered with a fixed step prop). The temperature figure stays fully interactive, bars just update instantly.
## Imagery
No photographs or raster images. Every visual is flat 2D SVG drawn in code: rounded token chips tinted by word group, a framed map with soft tinted ellipse regions and small caps region labels, dots with labels, smooth quadratic attention arcs in the accent color, horizontal bars on hairline tracks, a cumulative probability strip with a triangle marker, and a hand-made SVG wordmark mark (a small circle inside a rounded square with a short flame-like teardrop, drawn with two paths). Lucide line icons at 1.75px stroke for UI and the recap strip.
## Tone
Calm, precise and friendly, like a good science magazine. Short sentences, one idea per card, an everyday analogy for each idea, no hype, no jargon without an inline definition. Never names real AI products, labs or people; always says "a language model".
---
— Prompt by VibeFather · https://vibefather.ai/t/how-large-language-models-work · CC BY-NC 4.0 (non-commercial; commercial use needs a VibeFather Pro license) · Request removal: https://vibefather.ai/takedown
改成你自己的
- 大学讲师:把 BRAND 设为你的院系,TOPIC 设为 transformer 如何读一个句子,AUDIENCE 设为需要在课前了解五个阶段的一年级学生。
- 开发者工具团队:保留舞台,但把 EXAMPLE_SENTENCE 设为一个写了一半的函数,TOPIC 设为代码补全如何为在职工程师建议下一行。
- 通讯作者:把 BRAND 设为你的刊物,AUDIENCE 设为普通订阅者,然后重写每张卡片的类比,让温度那一步读起来像一种写作习惯。
- 产品营销团队:把 TOPIC 设为搜索排序如何工作,把 token 地图的区域换成查询聚类,保留注意力弧线和柱状图。
大语言模型如何工作:常见问题
如何修改“大语言模型如何工作”模板里的示例句子?
“大语言模型如何工作”模板把未完成的句子作为 EXAMPLE_SENTENCE 放在一个内容文件里,同时存放 token、id、地图坐标、注意力行和候选词概率。选一个能拆成 12 到 16 个 token 的句子,其中包含一个会拆成两部分的词,并且下一个词明显但不确定,然后重写说明文字并重新生成数据来匹配它。
运行这个讲解页需要真实的 AI 模型或 API 吗?
不需要。“大语言模型如何工作”模板不在浏览器里运行任何模型,也不调用外部 API。每个 token id、注意力权重、地图坐标和下一个词概率都是虚构的、用于示意,并存储在内容文件里,因此页面用 Vite 构建成静态文件,可以托管在任何能提供 dist 文件夹的地方。
怎么用 AI 做一个大语言模型如何工作?
复制本页的完整提示词(Pro),或者运行 npx vibefather add how-large-language-models-work,把 [BRAND]、[TOPIC]、[AUDIENCE]、[EXAMPLE_SENTENCE] 换成你自己的内容,再粘贴到 Claude Code、Codex、Cursor 等 AI 编程工具里。在线演示就是用这份提示词原样做出来的。