AI 术语,一次讲清

现在聊 AI,满屋子都是大家用得很顺、定义却很含糊的词:token、RAG、智能体、MCP。这一页给每个词一句白话定义、一个真实例子,再点出那个需要改掉的误解。十分钟看完,开会时你就是那个真正知道这些词什么意思的人。

🎙️ 发布并录制于: ·

01Token:模型的音节

模型不看字母,也不看单词。文本会先被切成 token,一个 token 大约相当于四分之三个英文单词。unbelievable 可能被切成 un · believ · able。模型的一切都用 token 计量:价格、速度、能一次看多少内容。它是 AI 世界里的公斤。

"The quick brown fox" → ["The", " quick", " brown", " fox"]   // 4 tokens
"unbelievable"        → ["un", "believ", "able"]            // 3 tokens
"你好世界"             → often 1 token per character or less

// rule of thumb: 1,000 tokens ≈ 750 English words
// API bills you per token, in AND out
为什么值得在意
token 能解释两件日常怪事。第一,账单为什么把发过去的长文档也算进去:输入 token 一样要付钱,不是只有回答收费。第二,模型为什么在「strawberry 里有几个 r」这种问题上蠢得离谱:它看到的是 str·aw·berry 这类的块,不是一个个字母。它在数你根本看不见的音节。

02Prompt 与 system prompt:输入,和岗位说明

Prompt 是你发给模型的全部内容,不只是那句问题,还包括围绕它的指令、示例和文档。System prompt 是一条用户永远看不到的首条消息,等于模型的岗位说明:「你是 Acme 的客服,任何时候都不要谈竞品」。一个产品里的 AI 表现出某种性格,那基本就是 system prompt 在说话。

// what actually gets sent to the API:
{
  "system": "You are a terse code reviewer. Point at lines. No praise.",
  "messages": [
    { "role": "user", "content": "Review this function: ..." }
  ]
}
需要改掉的误解
所谓「prompt 工程」不是念咒语,「请你扮演世界顶级专家」那一套没什么用。真正经得住测试的手法都很朴素:给两三个示例说明你要的输出长什么样,把输出格式明确写出来,再允许模型说「我不知道」。示例永远比形容词管用。

03上下文窗口:模型的桌面,不是记忆

上下文窗口是模型一次能看到多少 token,也就是它桌面有多大。一个二十万上下文的模型,桌上大概能摊开十五万个英文单词。关键在这儿:模型在两次对话之间没有记忆。每开一个新会话,桌面都是空的。而同一段对话里「它还记得我刚说的」,实际上是 App 每一轮都悄悄把整段历史重新发了一遍。

// what "the AI remembers our chat" actually is:
turn 1:  send [msg1]                    → answer1
turn 2:  send [msg1, answer1, msg2]     → answer2
turn 3:  send [msg1, answer1, msg2, answer2, msg3] → ...

// nothing is stored in the model. The app re-mails the
// entire correspondence with every new letter.
需要改掉的误解
「窗口越大,它就会把所有内容平均用上。」不会。模型的注意力分布不均,埋在超长上下文正中间的东西最容易被漏掉,英文管这个叫 lost in the middle。如果某条指令真的重要,把它放在开头或结尾,别放在你粘进去那份合同的第四十页。

04幻觉:自信的自动补全,不是撒谎

幻觉是模型带着十足的自信说出一件假事:一个不存在的判例,一个从来没被写出来的 API 函数。这不叫撒谎,撒谎需要意图。模型本质是个预测下一个词的机器:真答案不在它的知识里时,出来的就是统计上听起来最像那么回事的答案,而且语法漂亮得不像有问题。

// the classic failure shape:
Q: "What does the pandas function df.smooth_outliers() do?"
A: "df.smooth_outliers() applies rolling-window winsorization
   to columns exceeding 3 standard deviations..."   // ← does not exist.
                                                    // described beautifully.
真正有用的防守
第一,让它给出处,然后至少核对一条。第二,把参考材料直接喂给它,别指望它凭记忆,这就是第 07 节的 RAG。第三,一个说法越难核对,你就该越怀疑它:代码里的幻觉会当场报错,法律引注却能一路安静地混下去,直到法官读到它。最危险的幻觉,是那些你没法编译的。

05Temperature:掷骰子的旋钮

每一步,模型手里都有一份按概率排好的候选 token 列表。Temperature 决定它怎么挑:设成 0 就永远取排第一的那个,同一个问题几乎每次都给同一个答案;数值调高,排名靠后的 token 也有机会被选中,输出更多变、更有创意,也更容易跑偏。它不是「智力」旋钮,它是掷骰子的旋钮。

next token after "The capital of France is":
  " Paris"  92%   ← temperature 0 takes this, always
  " the"     3%
  " located" 2%   ← temperature 1.0 might wander here
  ...

// extraction, code, grading  → temperature 0
// brainstorming, naming, fiction → 0.7 - 1.0

06Embedding:把语义变成坐标

Embedding 把一段文本变成一串数字,也就是某个空间里的坐标,而意思相近的内容会落在相近的位置。「怎么重置密码」和「登录凭证忘了」几乎没有一个字相同,但它们的 embedding 是邻居。这就是「按语义搜索」的原理,也是下一节 RAG 的发动机。

embed("How do I reset my password?")  → [0.12, -0.98, 0.44, ...]  // ~1000 numbers
embed("forgot my login credentials")  → [0.11, -0.95, 0.47, ...]  // ← nearby!
embed("best pizza in Naples")         → [-0.71, 0.22, -0.30, ...] // ← far away

// a "vector database" is just a tool for finding
// nearest neighbors in this space, fast.

07RAG:开卷考试

检索增强生成,也就是 RAG:不让模型凭记忆答题,那是闭卷,容易出幻觉;而是先让程序在你的文档里搜出相关段落,通常用 embedding 来搜,再把这些段落贴进 prompt。模型是照着桌上的材料回答的。所有「和你的 PDF、文档、知识库对话」的产品,底子都是这一套。

user asks: "What's our refund policy for annual plans?"

1. embed the question, find nearest chunks in your docs
2. build the prompt:
   "Using ONLY these excerpts:
    [chunk 12: 'Annual plans may be refunded within 30 days...']
    [chunk 47: 'Refunds are prorated after...']
    Answer: What's our refund policy for annual plans?"
3. model answers from the excerpts — and can cite them
得说清楚的前提
RAG 的质量就是检索的质量。如果第一步取错了段落,模型会非常礼貌地照着错的那一页回答,那是一个带引注的幻觉。RAG 机器人不好用的时候,去查搜索,别去调模型。而且真正见效的修法往往很无聊:把文档切得更合理一点。

08微调:练的是反射,不是事实

微调是拿你自己的示例继续训练一个模型,改的是它默认的行为:语气、格式、风格、行业词汇。这里有个关键区分:微调教的是技能和习惯,RAG 提供的是事实。把这两件事搞混,是应用 AI 里最贵的一个误解。

// want the model to KNOW your product docs?     → RAG
// want it to WRITE in your support team's voice? → fine-tune
// want both? → both. they're not competitors.

✗ "We fine-tuned on our wiki so it knows our policies"
   // it now SOUNDS like your wiki. facts still fuzzy,
   // and last week's policy change? not in there.
✓ fine-tune the tone, RAG the knowledge

09智能体:带着工具在循环里跑的模型

聊天机器人回答一次就结束。智能体跑在一个循环里:看目标,挑一个工具,比如搜索、执行代码、读文件、调接口,然后看结果,决定下一步,一直重复到事情做完。这些工具就是开发者交给模型的函数,附带一段说明。智能体不是另一种模型,而是一个被给了手、又被允许反复试的模型。

goal: "Find why the deploy failed and fix it"

loop 1: tool=read_logs        → sees: ImportError in app.py
loop 2: tool=read_file(app.py) → sees the broken import
loop 3: tool=edit_file         → fixes the line
loop 4: tool=run_tests         → green ✓ → report & stop
需要改掉的误解
「智能体是自主的。」真正做到生产环境里,设计问题恰好相反:刹车装在哪。哪些动作可以放手让它跑,比如读取;哪些必须人点头,比如花钱、发邮件、删数据。一个智能体的水平体现在它怎么停下来,不在它怎么跑起来。

10MCP 与 skill:USB 接口和操作手册

MCP,全称 Model Context Protocol,是把 AI 应用接到工具和数据上的一个标准插口。以前每个应用都要给每个工具单独写对接代码,Slack、GitHub、你自己的数据库各写一份,是 M 乘 N 的工作量。有了 MCP,一个工具只要提供一个 MCP server,任何会说 MCP 的 AI 应用都能直接用。可以想成 USB:一个口,什么都能插。Skill 是另一回事,它是打包好的操作手册,通常就是一个文件夹,里面一份 markdown 加几个脚本,教模型按你们的方式怎么把某件具体的事做完。

// MCP = access to things:
your AI app ──MCP──> github server    (read PRs, file issues)
            ──MCP──> postgres server  (query the database)
            ──MCP──> slack server     (read/send messages)

// skill = knowing how to do a task:
skills/deploy-checklist/SKILL.md
  "Before deploying: run tests, check migrations,
   post in #deploys, then..."

// tool gives hands. skill gives the recipe.

11速查表:每个词一行

整页内容压成十一行。下次开会直接拿去用。

token           the model's syllable; everything is priced in these
prompt          everything you send: question + instructions + examples
system prompt   the hidden job description
context window  the desk, not the memory — chats re-send everything
hallucination   confident autocomplete filling a knowledge gap
temperature     the dice dial: 0 = same answer, 1 = adventurous
embedding       meaning as coordinates; neighbors = similar
RAG             open-book exam: search your docs, paste, then answer
fine-tuning     teaches habits & tone — NOT facts (that's RAG)
agent           a model in a loop with tools and a goal
MCP             the USB port: one standard plug for AI ↔ tools
skill           a packaged playbook: how to do one task, your way

词汇量本身就是杠杆:AI 圈一半的误会,都是同一个词各人各讲一套。现在这些能干活的定义你手上有了。下次有人说「我们直接拿公司文档微调一下就懂了」,你会知道该反问哪一句。

Tell me what missed

A correction is more useful than a compliment. This goes straight to the person who writes SwiftGrasp.

Was this page useful?
0/1000

Please do not include passwords, private keys, or personal information.