Adventure 8
Adventure 8
Adventure 8
Adventure 8
Adventure 8
Adventure 8
"The capital of France is"Token | 概率 | |
Paris | 0.87 | |
the | 0.04 | |
a | 0.02 | |
located | 0.01 | |
... 还有 99,996 个 | 极小 |
Adventure 8
Adventure 8
是什么: 从所有可能 token 的概率分布里挑一个 token 出来。就像: 转一个加权的轮盘 — 大格子更容易中,但小格子也有机会。为什么重要: 「AI 创造力」全部都从这里来。它字面意义上就是随机的。
Adventure 8
设定 | 效果 | |
T = 0 | 概率最高的 token 永远赢。最可预测,也最无聊。 | |
T = 0.7 | 大致是默认值。有些变化,但还算聚焦。 | |
T = 1.0 | 原始概率,不做任何缩放。 | |
T = 1.5+ | 把分布拍平。低概率 token 也有真的机会。事情开始变奇怪。 |
Adventure 8
T = 0 | 「猫坐在垫子上。」 | |
T = 0.7 | 「一只小橘猫蜷在窗台上。」 | |
T = 1.5 | 「胡须,那些午夜的小外交官,正在和月亮谈判。」 |
Adventure 8
任务 | Temperature | |
代码、数学、查事实 | T ≈ 0 | |
总结、翻译 | 0.2 – 0.5 | |
头脑风暴、写作 | 0.7 – 1.0 | |
把模型从套路里推出来 | > 1.0 |
Adventure 8
Adventure 8
Adventure 8
Adventure 8
是什么: 保留覆盖 X% 概率质量的最小一组高概率 token;丢掉长尾。就像: 在自助餐里,只考虑大家真的在拿的菜。空盘子全部无视。为什么重要: 比 top-k 干净。会根据模型对下一个词「确定」还是「不确定」自动调整。
Adventure 8
旋钮 | 它做什么 | 好用的默认值 | |
Temperature | 在 sampling 之前对分布重新缩放 | 0.7 | |
Top-k | 只留前 N 个 token | 50 | |
Top-p | 留够 token,覆盖 X% 质量 | 0.9 |
Adventure 8
Adventure 8
Adventure 8
Adventure 8
Adventure 8
Adventure 8
System: You are a pirate. Speak only in pirate English.
Every response must include the word "matey."
User: What is photosynthesis?
Output: Arrr, matey! Plants be doin' a magical thing called
photosynthesis — they take sunlight, water, and a bit
o' the breeze and turn it into food.Adventure 8
是什么: 模型在 之前 你说话之前就拿到的那套隐藏「游戏规则」。就像: 服务员的培训。他们用同样的方式问候每一位客人,是因为他们被训练过 — 不是因为客人怎么问的。为什么重要: 如果你想在很多用户或多个 session 之间保持一致的行为,system prompt 就是它该待的地方。
Adventure 8
Adventure 8
Adventure 8
Adventure 8
Adventure 8
Adventure 8
「写一首关于秋天的诗。
- 严格 4 行。
- 不能有超过 6 个字母的单词。
- 不能出现 'leaves' 或 'cold'。
- 以问号结尾。」
Adventure 8
套路 | 一句话用法 | |
Role | 「You are a...」 | |
Format | 「Output as JSON...」 | |
Few-shot | 2-3 个「输入→输出」例子 | |
Chain-of-Thought | 「Think step by step」 | |
Constraints | 「严格 4 行,不准出现 X」 |
Adventure 8
反面套路 | 例子 | 修法 | |
模糊 | 「让它更好。」 | 「Improve by: (1) shorten to 80 words, (2) active voice, (3) one concrete example.」 | |
多任务 | 「翻译、总结、查事实。」 | 跑 3 个 prompt。每个只做一件事。 | |
自相矛盾 | 「简短但要解释得详细。」 | 只选一个。 | |
没有上下文 | 「为什么这个是错的?」 | 模型看不到你的屏幕。把「这个」是什么也写进去。 | |
要新鲜信息 | 「今天天气怎么样?」 | 用工具(第 4 周讲)。 |
Adventure 8
Adventure 8
Adventure 8
Adventure 8