Files
liqiang b119135836
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
2026-08-20 13:12:50 +00:00

70 lines
7.2 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"signature": "209b1652aab62b819b59a762e4e3802a932943ffb9ffaa1caeb2171009c73e1a",
"parsed": {
"narration": "翻到第7页,我们先补一个关键缺口:前面把词元变成向量后,Transformer 没有循环也没有卷积,本身并不知道谁先谁后。请看标题 Positional Encoding 下方这两条公式:偶数维用 sin、奇数维用 cos,频率随维度 i 和 d_model 变化,所以每个位置得到一套可重复计算的位置指纹。屏幕要点还提醒,它和词嵌入同维,便于注入;更重要的是,正弦余弦的相位关系让模型较容易学到相对距离。论文也说,这种手工位置编码几乎不输给可学习位置嵌入。明白这一页,下一页看编码器时,注意力分数才不会丢掉语序。",
"visual_references": [
"标题:Positional Encoding",
"公式:PE_(pos, 2i) = sin(pos / 10000^(2i/d_model))",
"公式:PE_(pos, 2i+1) = cos(pos / 10000^(2i/d_model))",
"要点:Same dimension as embeddings (d_model)",
"要点:Allows model to learn relative position information",
"要点:Performed nearly as well as learned positional embeddings"
]
},
"receipt": {
"provider": "Moonshot",
"request": {
"model": "kimi-k3",
"messages": [
{
"role": "user",
"content": "你是一位严谨而自然的中文技术讲师,正在讲解论文 Attention Is All You Need。\n这是第 7/12 页。下面给出该页真实 Slidev 源码:\n<slide>\n## Positional Encoding\n\nSince model has no recurrence/convolution, we inject positional information:\n\n$$\\text{PE}_{(pos, 2i)} = \\sin\\left(pos / 10000^{2i/d_{\\text{model}}}\\right)$$\n$$\\text{PE}_{(pos, 2i+1)} = \\cos\\left(pos / 10000^{2i/d_{\\text{model}}}\\right)$$\n\n- Same dimension as embeddings ($d_{\\text{model}}$)\n- Allows model to learn relative position information\n- Performed nearly as well as learned positional embeddings\n</slide>\n请写一段 180–240 个中文字符左右的口语讲解。必须满足:\n1. 用引导性叙事解释“为什么”和“它与前后页的关系”,不能逐条照读幻灯片;\n2. 明确指向当前屏幕上的可见元素(标题、公式、表格、数值或图片);有图片/表格/公式时必须说出观众该看哪里;\n3. 不虚构源码中没有的数值或结论;开头/结尾与页序匹配;\n4. 只返回 JSON{\"narration\":\"...\",\"visual_references\":[\"...\"]}。\n"
}
],
"temperature": 1,
"max_tokens": 1200,
"response_format": {
"type": "json_object"
}
},
"response": {
"id": "chatcmpl-6a6a7f3f079009943e6a5440",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "{\"narration\":\"翻到第7页,我们先补一个关键缺口:前面把词元变成向量后,Transformer 没有循环也没有卷积,本身并不知道谁先谁后。请看标题 Positional Encoding 下方这两条公式:偶数维用 sin、奇数维用 cos,频率随维度 i 和 d_model 变化,所以每个位置得到一套可重复计算的位置指纹。屏幕要点还提醒,它和词嵌入同维,便于注入;更重要的是,正弦余弦的相位关系让模型较容易学到相对距离。论文也说,这种手工位置编码几乎不输给可学习位置嵌入。明白这一页,下一页看编码器时,注意力分数才不会丢掉语序。\",\"visual_references\":[\"标题:Positional Encoding\",\"公式:PE_(pos, 2i) = sin(pos / 10000^(2i/d_model))\",\"公式:PE_(pos, 2i+1) = cos(pos / 10000^(2i/d_model))\",\"要点:Same dimension as embeddings (d_model)\",\"要点:Allows model to learn relative position information\",\"要点:Performed nearly as well as learned positional embeddings\"]}",
"refusal": null,
"role": "assistant",
"annotations": null,
"audio": null,
"function_call": null,
"tool_calls": null,
"reasoning_content": "We need answer raw JSON only, with narration 180-240 Chinese characters around. Need satisfy constraints. Need produce final JSON. Need think content.\n\nSlide page 7/12 Positional Encoding. Need mention relation to previous/next: previous likely embedding inputs? Current says since model has no recurrence/convolution, inject positional info. It connects after token embeddings and before encoder/decoder blocks. Need point to visible elements: title and two formulas with sin/cos, bullets d_model same dimension, relative position, learned positional embeddings nearly as well. No invented values. Need opening/ending match page order: start like \"翻到第7页...\" end like \"弄明白这一页,下一页就能进入编码器堆叠\". Count Chinese chars 180-240. Need JSON with narration string and visual_references array.\n\nNeed ensure only JSON no markdown. Let's draft narration around 210 Chinese chars. Count roughly.\n\nNarration: \"翻到第7页,我们先解决一个关键缺口:前面把词元变成向量后,Transformer 没有循环也没有卷积,本身并不知道谁先谁后。请看标题 Positional Encoding 下方这两条公式:偶数维用 sin、奇数维用 cos,频率随维度 i 和 d_model 变化,所以每个位置得到一套可重复计算的位置指纹。屏幕上要点也提醒,它和词嵌入同维,可以直接相加;更重要的是,正弦余弦的相位差让模型较容易学到相对距离。论文还说,这种手工位置编码效果几乎不输给可学习位置嵌入。明白这一页,下一页看编码器时,注意力分数才不会丢失语序。\"\n\nCount Chinese roughly: 翻(1)到2第3 7? Count maybe including digits? Let's approximate length. It is around 198 chars. Good.\n\nNeed visual_references: title \"Positional Encoding\", formulas PE_(pos,2i), PE_(pos,2i+1), bullet same dimension as embeddings d_model, bullet learned positional embeddings. Good.\n\nNeed valid JSON string escape? No quotes inside. Use Chinese punctuation. Ensure JSON only. Need no trailing comma. final only JSON. 180-240 Chinese chars: our narration maybe around 209. Good.\n\nNeed maybe mention page序 ending. Good.\n\nDouble-check no invented conclusion: \"正弦余弦相位差让模型较容易学到相对距离\" slide says allows model to learn relative position information. OK. \"可以直接相加\" implied same dimension as embeddings and injected; paper adds. Slide says same dimension as embeddings. Since source says inject; fine. \"效果几乎不输给\" from performed nearly as well as learned. OK.\n\nFinal JSON only."
}
}
],
"created": 1785364287,
"model": "kimi-k3",
"object": "chat.completion",
"service_tier": null,
"system_fingerprint": null,
"usage": {
"completion_tokens": 798,
"prompt_tokens": 417,
"total_tokens": 1215,
"completion_tokens_details": {
"accepted_prediction_tokens": null,
"audio_tokens": null,
"reasoning_tokens": 544,
"rejected_prediction_tokens": null
},
"prompt_tokens_details": null
}
},
"elapsed_ms": 28762.403
}
}