LLM 如何在底层运作——从预测下一个词开始的新手拆解
本文用类比和概率分布图,把大语言模型拆解为“超大自动补全系统”。作者从 token 切分讲起,说明模型如何把文本切块并编号,进而解释预训练、有监督微调、人类反馈强化学习三阶段如何把原始统计机器打磨成助手。文章还剖析了“幻觉”的本质:不是 bug,而是模型只会生成符合概率分布、但未必符合事实的文本。最后给出实用 prompt 原则:提供丰富上下文、指定输出格式、迭代修改、重要信息必须验证。适合想理解 LLM 底层直觉、又想马上用好的非算法工程师。
You've used them. You've been amazed by them. You may have also been confused, annoyed, or even a little spooked by them. But do you actually know what a Large Language Model is doing when you type a question and it fires back a fluent, confident, paragraph-long answer?
Most people imagine a tiny genius living inside the computer. The truth is stranger — and far more interesting. By the end of this guide, you'll understand LLMs better than 95% of the people casually throwing the term around. Let's pull back the curtain.
你用过它们。你被它们惊艳过。也可能被它们搞糊涂过、惹恼过,甚至感到一丝不安。但你真的了解,当你输入一个问题,大语言模型(LLM)流利自信地回你一整段话时,它到底在做什么吗?
多数人想象电脑里住着一个小天才。真相其实更离奇——也更有趣。读完这份指南,你对 LLM 的理解将超过 95% 随口说着这个词的人。一起来揭开这层面纱。

LLM stands for Large Language Model. Let's break that down literally:
| Word | What it means | In plain English |
|---|---|---|
| Large | Hundreds of billions of internal settings ("parameters") | It's enormous — trained on a huge slice of the internet |
| Language | It works with text — words, code, symbols | Its whole world is language |
| Model | A mathematical pattern-finder | A super-powered statistical guessing machine |
Here's the part that surprises everyone: at its core, an LLM is essentially a fancy autocomplete. It does not "think," "know," or "understand" the way a human does. It's a system that has read an astonishing amount of text and learned, with eerie precision, what word tends to come next.
◆ MENTAL MODEL Think of an LLM as the autocomplete on your phone — but one that swallowed most of the internet, books, code, and Wikipedia, and then practiced predicting the next word a trillion times.

LLM 是 Large Language Model(大语言模型)的缩写。我们逐字拆解一下:
| 单词 | 含义 | 通俗说法 |
|---|---|---|
| Large(大) | 数百亿个内部设置(“参数”) | 规模庞大——在互联网的巨量数据上训练而成 |
| Language(语言) | 处理文本——单词、代码、符号 | 它的整个世界就是语言 |
| Model(模型) | 一个数学模式发现器 | 一台超级强大的统计猜测机器 |
接下来是让所有人都惊讶的部分:LLM 的核心本质上就是一个高级的自动补全。它不像人类那样“思考”、“知道”或“理解”。它只是一个系统,阅读了海量文本,并以惊人的准确度学会了哪个词更可能出现在后面。
◆ 思维模型 把 LLM 想象成你手机上的自动补全——不过它吞下了互联网、书籍、代码和维基百科的大部分内容,然后练习了数万亿次预测下一个词。
Everything an LLM does grows out of one humble skill: guessing what comes next.

Imagine I give you this sentence and ask you to finish it:
"The sky is ___"
Your brain instantly offers candidates: blue, cloudy, falling, clear. You also rank them — "blue" feels far more likely than "spaghetti." That ranking is exactly what an LLM does, except it does it for every possible word in its vocabulary, assigning each a probability.
What the model "sees" after: "The sky is…" (Illustrative probabilities the model might assign to the next word)
blue ████████████████████████████ 62%
clear ████████ 18%
cloudy █████ 12%
falling ██ 5%
spaghetti ▌ 1%
The model picks a word (usually a likely one, with a dash of randomness for variety), adds it to the sentence, and then repeats the whole process — predicting the next word, and the next, and the next. String thousands of these predictions together and you get essays, code, poems, and emails.
🧶 ANALOGY It's like knitting a scarf one stitch at a time. Each stitch (word) depends on the ones before it. The model never sees the "whole scarf" in advance — it just keeps adding the most sensible next stitch until you tell it to stop.
LLM 所做的一切都源于一项不起眼的技能:猜测接下来会是什么。

假设我给你这个句子,让你补全:
“天空是____”
你的大脑立刻给出候选词:蓝色的、多云的、塌下来的、晴朗的。你还会给它们排序——“蓝色的”感觉比“意大利面”的可能性大得多。这种排序正是 LLM 所做的,只不过它会针对词汇表中的每个可能词都做一遍,并给每个词分配一个概率。
模型“看到”的是:“天空是……” (模型可能为下一个词分配的概率示意)
蓝色 ████████████████████████████ 62%
晴朗 ████████ 18%
多云 █████ 12%
塌下来 ██ 5%
意大利面 ▌ 1%
模型选一个词(通常是一个可能性高的词,再加上一点点随机性来增加多样性),把它加到句子里,然后重复整个过程——预测下一个词,再下一个,再下一个。把数千次这样的预测串起来,你就得到了文章、代码、诗歌和电子邮件。
🧶 类比 这就像一针一针地织围巾。每一针(词)都取决于前面的针脚。模型事先看不到“整条围巾”——它只是一直添加最合理的下一针,直到你告诉它停下来。
Before predicting anything, the model chops text into "tokens."

Here's a subtle but crucial detail: LLMs don't read words the way we do. They break text into tokens — chunks that might be a whole word, part of a word, or even a single character. The model thinks entirely in these tokens and the numbers attached to them.
✓ WHY THIS MATTERS TO YOU "Context windows" and pricing are measured in tokens, not words. When a tool says it handles "128K tokens," that's roughly a 300-page book it can keep in mind at once. It also explains why LLMs sometimes miscount letters in a word — they don't see letters, they see tokens.
| Text | Approx. tokens | Notes |
|---|---|---|
cat |
1 token | Common short word = 1 chunk |
unbelievable |
3–4 tokens | Split into pieces like un · believ · able |
| 1 page of text (~500 words) | ~650 tokens | Rule of thumb: 1 word ≈ 1.3 tokens |
在预测任何内容之前,模型会将文本切分成“标记”。

这里有一个微妙但至关重要的细节:LLM 并不像我们那样阅读单词。它们将文本分解成标记——可能是整个词、词的一部分,甚至是一个字符的块。模型完全通过标记以及附加在它们上面的数字来思考。
✓ 这对你为何重要 “上下文窗口”和价格是按标记而非单词来衡量的。当一个工具声称支持“128K 标记”时,这大概相当于能同时记住一本 300 页的书。这也解释了为什么 LLM 有时会数错单词中的字母——它们看到的不是字母,而是标记。
| 文本 | 约标记数 | 说明 |
|---|---|---|
cat |
1 个标记 | 常见短词 = 1 个块 |
unbelievable |
3–4 个标记 | 拆分成片段,如 un · believ · able |
| 1 页文本 (~500 词) | ~650 个标记 | 经验法则:1 词 ≈ 1.3 标记 |
Training turns a blank statistical machine into a helpful assistant.

A raw model fresh off the assembly line is useless — it's like a brain with no memories. Turning it into ChatGPT or Claude happens in three big stages.
-
Pre-training — "Read the internet" The model is fed an enormous amount of text (books, websites, code) and does one thing billions of times: predict the next token. This is where it absorbs grammar, facts, reasoning patterns, and writing styles. Expensive and slow — this is the "large" in LLM.
-
Supervised fine-tuning — "Learn to be an assistant" Humans write example conversations showing ideal answers. The model learns the format of being helpful: answering questions, following instructions, being polite.
-
Reinforcement learning from human feedback (RLHF) — "Learn what people prefer" Humans rate answers as better or worse. The model is nudged toward responses people like and away from harmful or unhelpful ones. This is the "polish" that makes it feel friendly and safe.
| Stage | Goal | Who's involved | Result |
|---|---|---|---|
| Pre-training | Learn language & facts | Mostly machines + data | Knows a lot, but rambles |
| Fine-tuning | Learn to answer | Human-written examples | Acts like an assistant |
| RLHF | Learn preferences | Human raters | Helpful, safe, polite |
◆ KEY INSIGHT The model's "knowledge" is frozen at the moment training ended. That's why an LLM may not know about events after its training cutoff — unless it's connected to live search or tools.
训练将一台空白的统计机器转变为一个有用的助手。

刚出厂的原生模型毫无用处——就像一个没有记忆的大脑。把它变成 ChatGPT 或 Claude 需要经过三个主要阶段。
-
预训练——“阅读互联网” 模型被喂入海量文本(书籍、网站、代码),并数十亿次地做同一件事:预测下一个标记。这是它吸收语法、事实、推理模式和写作风格的阶段。昂贵且缓慢——这就是 LLM 中“大”的体现。
-
监督微调——“学习成为助手” 人类编写示例对话,展示理想的答案。模型学习有用助手的格式:回答问题、遵循指令、保持礼貌。
-
基于人类反馈的强化学习 (RLHF)——“学习人们的偏好” 人类对答案进行优劣评分。模型被推向人们喜欢的回答,远离有害或无用的内容。这就是让它感觉友好且安全的“抛光”。
| 阶段 | 目标 | 谁参与 | 结果 |
|---|---|---|---|
| 预训练 | 学习语言与事实 | 主要是机器 + 数据 | 知道很多,但会东拉西扯 |
| 微调 | 学习回答问题 | 人类编写的示例 | 表现得像个助手 |
| RLHF | 学习偏好 | 人类评估员 | 有用、安全、礼貌 |
◆ 关键洞察 模型的“知识”在训练结束的那一刻就冻结了。这就是为什么 LLM 可能不知道训练截止日期之后的事件——除非它连接了实时搜索或工具。
There's no database of facts, no folder of answers, no little library. Instead, everything the model learned is compressed into parameters — billions of numerical "dials" (also called weights). During training, these dials are tuned ever so slightly, over and over, until the model gets good at prediction.
You can think of a trained LLM as a lossy, compressed summary of everything it read — like a blurry JPEG of the internet.
This is also why LLMs are sometimes described as black boxes: even the engineers who build them can't point to a specific dial and say "that's where it stores the capital of France." The knowledge is smeared across billions of numbers working together.
🎚️ ANALOGY Imagine a giant sound mixing board with 175 billion knobs. Training is the process of nudging every knob a hair at a time until the music (the predictions) sounds right. Nobody can tell you what any single knob "does" — but together they make beautiful music.
模型内部没有事实数据库,没有答案文件夹,也没有小图书馆。相反,模型学到的一切都被压缩到参数中——数十亿个数字“拨盘”(也称为权重)。在训练过程中,这些拨盘被一遍又一遍地微调,直到模型擅长预测。
你可以把一个训练好的 LLM 看作它读过所有内容的有损压缩摘要——就像互联网的一张模糊 JPEG 图片。
这也是 LLM 有时被描述为黑盒的原因:即使是构建它们的工程师,也无法指着某个特定的拨盘说“这里存储了法国的首都”。知识被分散在数十亿个协同工作的数字中。
🎚️ 类比 想象一个拥有 1750 亿个旋钮的巨大调音台。训练就是每次稍微推动每个旋钮的过程,直到音乐(预测)听起来正确。没人能告诉你任何一个旋钮是“做什么的”——但它们合在一起就能奏出美妙的音乐。
"Hallucination" is a feature of how prediction works — not a random bug.

Because an LLM's only true skill is generating plausible-sounding text, it will sometimes produce something that sounds perfectly confident but is completely wrong. This is called a hallucination.
The model isn't lying — it has no concept of truth. It's simply predicting words that "fit," and a wrong fact can fit just as smoothly as a right one. A fake book title or a made-up statistic is statistically shaped like a real one.
⚠ IMPORTANT Never trust an LLM blindly for facts, figures, citations, legal, or medical information. Treat it as a brilliant, fast, occasionally-overconfident intern — always verify anything that matters.
| ✅ Plays to its strengths | ⚠️ Verify carefully |
|---|---|
| Drafting, rewriting, summarizing | Specific facts, dates, statistics |
| Brainstorming & outlining | Citations and quotes (often invented) |
| Explaining concepts simply | Math & precise calculations |
| Translating & changing tone | Recent news after its cutoff |
| Writing & debugging code | Legal, medical, financial advice |
“幻觉”是预测工作方式的一个固有特性——而不是一个随机的错误。

因为 LLM 唯一真正的技能是生成听起来合理的文本,它有时会产生一些听起来完全自信但完全错误的内容。这就是所谓的幻觉。
模型并不是在撒谎——它没有“真理”的概念。它只是在预测“合适”的词,而一个错误的事实和正确的事实一样可以流畅地嵌入。一个假的书名或编造的统计数字,在统计形状上与真实的一样。
⚠ 重要提示 绝不要盲目相信 LLM 提供的事实、数字、引文、法律或医疗信息。把它当作一个才华横溢、速度快、偶尔过度自信的实习生——对任何重要的事情都要验证。
| ✅ 擅长领域 | ⚠️ 需仔细验证 |
|---|---|
| 起草、改写、总结 | 具体事实、日期、统计数据 |
| 头脑风暴、列提纲 | 引用和引语(经常被编造) |
| 简单解释概念 | 数学和精确计算 |
| 翻译和改变语气 | 训练截止后的近期新闻 |
| 编写和调试代码 | 法律、医疗、财务建议 |
Understanding the machinery makes you dramatically better at using it. A few principles that follow directly from how LLMs work:
-
Give rich context — Since the model only "knows" what's in the conversation plus its training, the more relevant detail you provide, the better its predictions.
-
Be specific about the output — Ask for the format, tone, length, and audience. "Explain like I'm 12, in 3 bullet points" beats "explain this."
-
Iterate, don't expect perfection — Treat it as a back-and-forth. Refine its answer the way you'd coach a junior teammate.
-
Verify the important stuff — Use it to draft and think — but fact-check anything with real-world consequences.
✓ PRO TIP: PROMPTING IS A SKILL The quality of your output is shaped massively by the quality of your input. Learning to "prompt" well is the single highest-leverage skill for getting value from AI — and it requires zero coding. (See the free guides below.)
理解其运行机制能让你更擅长使用它。以下是直接源于 LLM 工作原理的几个原则:
-
提供丰富的上下文——由于模型只“知道”对话内容加上它的训练数据,你提供的相关细节越多,它的预测就越好。
-
对输出提具体要求——说明需要的格式、语气、长度和目标受众。用“用 12 岁小孩能懂的语言,用 3 个要点解释”就比“解释一下”效果好。
-
迭代,不要期望一次完美——把它当作一个来回沟通的过程。像指导初级同事那样优化它的回答。
-
核实重要内容——用它来起草和思考——但对任何有实际后果的事情都要做事实核查。
✓ 专家提示:提示工程是一项技能 你得到的输出质量在很大程度上取决于输入的质量。学会“写好提示词”是从 AI 获取价值的最高杠杆技能——而且完全不需要写代码。(见下方免费指南。)
| # | Remember this |
|---|---|
| 1 | An LLM is a giant next-word predictor — a supercharged autocomplete. |
| 2 | It reads in tokens, not words or letters. |
| 3 | It's trained in 3 stages: pre-training → fine-tuning → human feedback. |
| 4 | Its "knowledge" lives in billions of numerical dials, not a database. |
| 5 | It can hallucinate — confidently wrong — so always verify facts. |
| 6 | Better context + clearer prompts = dramatically better results. |
📚 Want to Go Deeper? Recommended Reading
If this guide sparked your curiosity, these accessible books take you further without overwhelming you:
- Co-Intelligence: Living and Working with AI — by Ethan Mollick. The best non-technical book on actually using AI in daily life and work. Practical, friendly, and grounded.
- The Coming Wave — by Mustafa Suleyman. A big-picture look at where AI is heading and what it means for society — by a co-founder of DeepMind.
- You Look Like a Thing and I Love You — by Janelle Shane. A hilarious, genuinely beginner-friendly intro to how AI thinks (and gloriously fails). Perfect first read.
🎁 Keep Learning — Free Beginner Guides
Now that you understand how LLMs work, the next step is putting them to work — for your job, your studies, or your income. These free, beginner-friendly resources are a great place to start:
| Resource | What you'll get |
|---|---|
| Prompt Engineering for Beginners | No coding or tech background required |
| Prompt Engineering for Real Life (PDF) | Free PDF guide |
| 100 ChatGPT Prompts to Make Your Life Easier | Free e-book |
| 1000+ Powerful Prompts for Claude AI | Free PDF |
| ChatGPT for Students | Study smarter with AI |
| AI Tools for Job Seekers | Get hired faster |
| AI Skills Employers Want in 2026 | Beginner's action guide |
| 50 AI Income Ideas + 100 ChatGPT Prompts | Make money with AI |
| Make Money Using AI — No Skills Needed | Free beginner's guide |
| # | 记住这几点 |
|---|---|
| 1 | LLM 是一个巨大的下一词预测器——一个超级增强的自动补全。 |
| 2 | 它以“标记”为单位阅读,而非单词或字母。 |
| 3 | 训练分三个阶段:预训练 → 微调 → 人类反馈。 |
| 4 | 它的“知识”存在于数十亿个数字拨盘中,而非数据库。 |
| 5 | 它可能会产生幻觉——自信但错误——所以务必核实事实。 |
| 6 | 更好的上下文 + 更清晰的提示 = 显著更好的结果。 |
📚 希望深入了解?推荐阅读
如果这份指南激发了你的好奇,以下这些易于理解的书籍能带你走得更远,而不会让你感到吃力:
- 《协同智能:与 AI 共同生活和工作》——伊桑·莫里克 著。关于在日常生活中实际使用 AI 的最佳非技术类书籍。实用、友好且扎实。
- 《即将到来的浪潮》——穆斯塔法·苏莱曼 著。从宏观视角审视 AI 的发展方向及其对社会的意义——作者是 DeepMind 的联合创始人。
- 《你看起来像个东西,我爱你》——珍妮尔·沙恩 著。一本有趣且真正适合初学者的 AI 思考方式(及其精彩失败)入门书。完美的第一本读物。
🎁 继续学习——免费初学者指南
现在你了解了 LLM 的工作原理,下一步就是让它们为你所用——为你的工作、学习或收入。这些免费且对初学者友好的资源是很好的起点:
| 资源 | 你将获得什么 |
|---|---|
| 面向初学者的提示工程 | 无需编程或技术背景 |
| 现实生活中的提示工程 (PDF) | 免费 PDF 指南 |
| 100 个让生活更轻松的 ChatGPT 提示 | 免费电子书 |
| 1000+ 个强大的 Claude AI 提示 | 免费 PDF |
| 面向学生的 ChatGPT | 用 AI 更聪明地学习 |
| 面向求职者的 AI 工具 | 更快找到工作 |
| 2026 年雇主期望的 AI 技能 | 初学者行动指南 |
| 50 个 AI 赚钱点子 + 100 个 ChatGPT 提示 | 用 AI 赚钱 |
| 用 AI 赚钱——无需技能 | 免费初学者指南 |