This guide covers one setup unit plus 21 formal lessons through a running Interview Assistant. It is an original bilingual teaching reconstruction, not a line-by-line translation.
The fast path maps models, prompts, calls, state, evidence, tools, safety, and lifecycle; the full path adds images, low-code, open models, and model families.
Products, model names, prices, and platforms change rapidly. They are treated as engineering-choice examples; verify current official model cards, APIs, and licenses before implementation.
第一册 · 准备与模型基础Volume 1 · Setup and model foundations
先知道模型是什么,也知道它不是什么Know what the model is—and is not
环境、模型选择和责任边界一起构成第一层地基。
Environment, model selection, and responsibility form the first foundation.
本册作品里程碑Portfolio milestone
完成可离线运行、带成本与风险边界的最小调用。
Deliver a mockable minimal call with cost and risk boundaries.
01
环境准备Course setup
把环境、凭证和成本边界先准备好Getting Started with this course
先回答一个白话问题Start with a plain question
可复现环境与安全配置是生成式 AI 应用的第一层可靠性。 对零基础项目来说,先问“用户真正需要什么证据”,再问模型能生成什么。
A reproducible environment and safe configuration form the first reliability layer of a GenAI app. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像开工作室前先接好电、划出预算、把钥匙放进保险柜。
It is like wiring a workshop, setting a budget, and storing keys safely before production.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: The UI and tests run without a real key; missing config fails safely without printing secrets.
An LLM predicts subsequent tokens from context; fluency is not factual knowledge. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像读过大量文本的即兴写作者,擅长续写和改写,却没有自动连接事实数据库。
It resembles an improvisational writer trained on vast text, skilled at continuation without an automatic factual database.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
消息、token、上下文窗口、采样和系统指令共同影响输出;需要外部数据和验证补足事实性。
Messages, tokens, context windows, sampling, and system instructions shape output; external data and verification supply factual grounding.
例子 1 · 流畅幻觉Example 1 · Fluent hallucination
输入Input
要求列不存在的公司政策Ask for a nonexistent company policy
过程Process
模型按常见格式补全The model completes a plausible pattern
结果 / 验收Result / check
格式像真的,事实却无来源It looks real but has no source
例子 2 · 受控改写Example 2 · Controlled rewrite
输入Input
用户提供一段项目经历User-provided project experience
过程Process
只压缩与重排,不增加事实Compress and reorder without adding facts
结果 / 验收Result / check
每条信息可回指输入Every claim traces to the input
常见误区Common misconception
把模型称为“知识库”,然后用自信语气代替来源。
Calling the model a knowledge base and substituting confidence for sources.
作品任务Portfolio task
实现“只依据用户材料改写”的最小调用,并在输出旁显示输入证据。
Implement a minimal “rewrite only from user material” call and show source evidence beside output.
验收:Acceptance:加入不存在事实的压力样本时,系统拒绝补写并指出材料不足。On a missing-fact stress case, the system refuses invention and identifies missing material.
自测:“生成式 AI 与大语言模型的最小心智模型”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Introduction to Generative AI and Large Language Models”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: On a missing-fact stress case, the system refuses invention and identifies missing material.
There is no task-independent best model, only a better fit under constraints. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像选交通工具:高铁、地铁和自行车各自在距离、费用和灵活性上不同。
It is like choosing transport: rail, metro, and bicycle trade distance, cost, and flexibility.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
用固定数据集比较格式遵循、事实性、关键错误、延迟、token 与价格,并记录具体版本。
Compare formatting, grounding, critical errors, latency, tokens, and price on a fixed dataset, recording exact versions.
例子 1 · 小模型胜出Example 1 · Small model wins
输入Input
把经历分类成五类Classify experience into five types
过程Process
比较大模型与小模型Compare a large and small model
结果 / 验收Result / check
小模型同样准确且更快便宜The small model is equally accurate, faster, and cheaper
例子 2 · 长文本取舍Example 2 · Long-context trade-off
输入Input
十份长职位说明Ten long job postings
过程Process
比较直接塞入与先检索Compare stuffing all text with retrieval first
结果 / 验收Result / check
长窗口更贵且仍会忽略细节Long context costs more and still misses detail
常见误区Common misconception
看公开排行榜选模型,却不跑自己的中文、格式和安全样本。
Choosing from a public leaderboard without testing your Chinese, formatting, and safety cases.
作品任务Portfolio task
做 20 条模型选择集,记录两种模型的质量、p95、token、成本和失败类别。
Create a 20-case model-selection set and record quality, p95, tokens, cost, and failure types for two models.
验收:Acceptance:模型选择能由数据与约束复现,且写有切换条件。The model choice is reproducible from evidence and includes switching conditions.
自测:“比较模型:按任务、质量、延迟和成本选”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Exploring and comparing different LLMs”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: The model choice is reproducible from evidence and includes switching conditions.
Responsible design covers data, outputs, users, affected people, and appeals—not one disclaimer. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像医疗器械既要说明用途,还要临床验证、风险分级和人工负责。
Like a medical device, it needs intended use, validation, risk tiers, and accountable humans.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
列出伤害、隐私、偏见、版权、未成年人和自动化边界;高风险建议必须有人类判断。
Map harms, privacy, bias, copyright, minors, and automation boundaries; high-risk advice requires human judgment.
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: At least one risk is blocked by a technical boundary, not only warning text.
A good prompt defines goal, context, constraints, output shape, and refusal conditions. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像交给新同事一张工作单:做什么、用哪些材料、交什么格式、哪里要停。
It is like a work order for a new colleague: task, materials, format, and stop conditions.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
分离系统规则、用户输入和外部数据;使用 schema 与示例,避免用空泛形容词代替验收。
Separate system rules, user input, and external data; use schemas and examples instead of vague adjectives.
例子 1 · 空泛要求Example 1 · Vague request
输入Input
“帮我写好一点”“Make it better”
过程Process
改成受众、长度、证据和格式Specify audience, length, evidence, and format
结果 / 验收Result / check
结果能按清单验收Output is checkable against a list
例子 2 · 结构化输出Example 2 · Structured output
输入Input
一段职位说明A job posting
过程Process
要求 JSON 字段和缺失值 nullRequire JSON fields and null for missing values
结果 / 验收Result / check
解析器稳定,缺失不编造Parsing is stable; missing values are not invented
常见误区Common misconception
把“不要幻觉”写十遍,仍不给模型可用事实或验证链。
Repeating “do not hallucinate” without supplying facts or verification.
作品任务Portfolio task
把面试问题生成提示重写成任务契约,并建立五条正反样本。
Rewrite the interview-question prompt as a task contract with five positive and negative cases.
验收:Acceptance:输出可机器解析;缺证据时返回明确状态;示例外输入也保持结构。Output parses, missing evidence returns an explicit state, and unseen inputs preserve structure.
自测:“提示词基础:把任务写成可检查契约”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Prompt Engineering Fundamentals”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: Output parses, missing evidence returns an explicit state, and unseen inputs preserve structure.
Complex tasks need staged evidence and checkpoints, not an endlessly longer prompt. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像编辑部先定选题、核资料、写稿、校对,而不是让一人一口气交最终刊物。
Like an editorial workflow: scope, verify, draft, and edit rather than demanding a final issue in one breath.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
少样本示例、角色分工、链式步骤和自检可提高一致性,但关键事实仍需外部验证。
Few-shot examples, role separation, staged steps, and self-checks improve consistency, while critical facts still need external verification.
例子 1 · 示例校准Example 1 · Few-shot calibration
输入Input
三种项目经历Three project experiences
过程Process
给合格/不合格输出示例Provide good and bad output examples
结果 / 验收Result / check
边界风格更一致Boundary behavior becomes consistent
例子 2 · 分阶段生成Example 2 · Staged generation
输入Input
长简历与岗位说明Long resume and posting
过程Process
先抽证据,再匹配,再写回答Extract evidence, match, then draft
结果 / 验收Result / check
每步都可检查和重跑Each step is inspectable and rerunnable
常见误区Common misconception
把模型的“自我反思”当成事实核查;它可能用更流畅语言重复同一错误。
Treating model self-reflection as fact-checking; it may repeat the same error more fluently.
作品任务Portfolio task
把 STAR 回答生成拆成证据抽取、差距判断、草稿、验证四步。
Split STAR-answer generation into evidence extraction, gap judgment, draft, and verification.
验收:Acceptance:任一步失败可单独重跑;最终每句话关联用户证据或标注为建议。Any stage reruns independently; each final sentence links to user evidence or is marked as advice.
自测:“高级提示:分解、示例、反思与边界”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Creating Advanced Prompts”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: Any stage reruns independently; each final sentence links to user evidence or is marked as advice.
A text-generation app must handle timeout, retry, streaming, parsing, cost, and fallback. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像印刷服务:写稿只是一步,排版、校样、失败重印和预算同样重要。
Like a print service: drafting is one step among layout, proofing, retry, and budgeting.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
自测:“构建文本生成应用:从调用到可靠输出”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Building Text Generation Applications”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: Offline tests cover success, rate limit, timeout, invalid JSON, and exhausted budget.
Chat is not infinite history append; it is management of state needed for the current task. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像接力客服:交接单保留目标、承诺和未决事项,不需要每句寒暄。
Like support handoff: keep goals, commitments, and open items, not every greeting.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
区分消息角色、会话状态、长期偏好和外部事实;压缩时保留决策与来源。
Separate message roles, session state, long-term preferences, and external facts; preserve decisions and sources when compressing.
例子 1 · 上下文超长Example 1 · Context overflow
输入Input
50 轮闲聊后问项目状态Project status after 50 chat turns
过程Process
抽取目标、已完成和未决项Extract goal, completed work, and open items
结果 / 验收Result / check
摘要足以继续且成本下降The summary continues the task at lower cost
例子 2 · 并发会话Example 2 · Concurrent sessions
输入Input
两个标签页修改同一草稿Two tabs edit one draft
过程Process
使用会话版本检测冲突Use session versions to detect conflict
结果 / 验收Result / check
不会静默覆盖新内容New content is not silently overwritten
常见误区Common misconception
把对话历史当长期记忆,既泄露无关信息又不断抬高成本。
Using chat history as long-term memory, leaking irrelevant data and increasing cost.
作品任务Portfolio task
实现会话状态模型、压缩规则和“清除本次/删除长期偏好”控制。
Implement a session-state model, compression rules, and controls to clear session or delete long-term preferences.
验收:Acceptance:压缩前后关键约束不丢;两会话隔离;用户能查看和删除记忆。Key constraints survive compression, sessions remain isolated, and users can inspect/delete memory.
自测:“聊天应用:上下文、状态与多轮边界”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Building Generative AI-Powered Chat Applications”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: Key constraints survive compression, sessions remain isolated, and users can inspect/delete memory.
Search retrieves candidate evidence; generation answers from it, and the two must remain traceable. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像研究员先找资料并贴书签,作者只能引用书签内容写结论。
Like a researcher finding bookmarked sources before the writer drafts only from those sources.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
查询、召回、排序、引用和回答分层;空结果时拒答,引用必须对应实际片段。
Separate query, retrieval, ranking, citation, and answer; abstain on empty results and bind citations to real passages.
例子 1 · 关键词命中Example 1 · Keyword hit
输入Input
搜索“DRF”Search “DRF”
过程Process
精确匹配缩写与来源Exact-match acronym and source
结果 / 验收Result / check
返回相关项目证据Relevant project evidence is returned
例子 2 · 无证据回答Example 2 · No-evidence answer
输入Input
问未写过的 Kubernetes 经历Ask about absent Kubernetes experience
过程Process
检索为空后返回材料不足Return insufficient evidence on empty retrieval
结果 / 验收Result / check
不生成虚假经历No fabricated experience
常见误区Common misconception
把搜索结果标题交给模型,却不读取正文就生成引用。
Generating citations from search-result titles without reading the source body.
作品任务Portfolio task
为用户项目材料做本地全文搜索,答案句子附文件与段落锚点。
Build local full-text search over user project material with file and paragraph anchors per answer.
验收:Acceptance:每个事实引用能打开并支持该句;空结果明确拒答。Every factual citation opens and supports its sentence; empty results abstain explicitly.
自测:“构建搜索应用:检索事实,再让模型组织”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Building Search Applications”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: Every factual citation opens and supports its sentence; empty results abstain explicitly.
Image generation turns text intent into visual output that cannot be fully predicted. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像委托插画师:要给构图、用途和禁区,还要审稿而不是直接印刷。
Like commissioning an illustrator: specify composition, use, and exclusions, then review before printing.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
记录 prompt、模型、seed/参数与许可;加入内容审核、人物权利和人工确认。
Record prompt, model, seed/parameters, and license; add content moderation, likeness rights, and human approval.
例子 1 · 作品封面Example 1 · Portfolio cover
输入Input
主题与配色要求Theme and palette requirements
过程Process
生成三版并人工选择Generate three variants and select manually
结果 / 验收Result / check
保存参数与最终选择理由Save parameters and selection rationale
例子 2 · 人物冒用Example 2 · Likeness misuse
输入Input
要求仿某真实候选人Request a real candidate likeness
过程Process
拒绝或改用抽象人物Refuse or use an abstract person
结果 / 验收Result / check
不制造误导性身份图No deceptive identity image
常见误区Common misconception
图片是 AI 生成就认为没有版权、商标或肖像风险。
Assuming AI-generated images have no copyright, trademark, or likeness risk.
作品任务Portfolio task
给作品集封面做生成—审核—选版流程,保存可追溯元数据。
Build a generate-review-select workflow for the portfolio cover with traceable metadata.
验收:Acceptance:最终图有来源参数、人工确认、用途记录和可替换方案。The final image has source parameters, human approval, intended use, and a replacement option.
自测:“图像生成应用:意图、版本与内容安全”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Building Image Generation Applications”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: The final image has source parameters, human approval, intended use, and a replacement option.
Low-code tools reduce glue code; they do not solve data, permissions, evaluation, or vendor lock-in. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像预制房搭得快,但地基、消防和产权仍需要检查。
Like a prefab building: fast assembly does not remove foundation, fire, or ownership checks.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
导出配置、记录组件版本和数据流,检查凭证、日志、限额与迁移出口。
Export configuration, record component versions and data flow, and inspect credentials, logs, quotas, and an exit path.
例子 1 · 原型验证Example 1 · Prototype validation
输入Input
一页面试问答流程A one-page interview Q&A flow
过程Process
低代码编排并接 mockOrchestrate in low-code with a mock
结果 / 验收Result / check
一天验证用户路径Validate the user path in one day
例子 2 · 锁定风险Example 2 · Lock-in risk
输入Input
平台专属向量库Vendor-specific vector store
过程Process
导出原始文档和索引配置Export raw documents and index config
结果 / 验收Result / check
迁移不丢源数据Migration preserves source data
常见误区Common misconception
拖拽流程能跑就跳过版本控制和回归测试。
Skipping version control and regression tests because a drag-and-drop flow runs.
作品任务Portfolio task
搭一个低代码原型,同时写数据流图、出口清单和十条验收测试。
Build a low-code prototype with a data-flow diagram, exit checklist, and ten acceptance tests.
验收:Acceptance:原型能导出/重建;凭证不嵌入;关键行为有可重复测试。The prototype exports/rebuilds, embeds no secrets, and has repeatable tests for critical behavior.
自测:“低代码 AI:快做原型,也要看见隐藏边界”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Building Low Code AI Applications”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: The prototype exports/rebuilds, embeds no secrets, and has repeatable tests for critical behavior.
The model proposes a structured tool call; controlled code validates and executes the real action. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像助理填写报销单,财务系统仍核对字段、权限和金额后才付款。
Like an assistant filling an expense form; finance still validates fields, authority, and amount before payment.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
工具 schema 要窄、参数要校验、权限按动作分离,高风险调用先预览确认,执行后核对结果。
Keep tool schemas narrow, validate arguments, separate permissions by action, preview high-risk calls, and verify results after execution.
例子 1 · 只读工具Example 1 · Read-only tool
输入Input
查询空闲面试时间Query free interview times
过程Process
验证日期后读日历Validate date then read calendar
结果 / 验收Result / check
返回候选时间,不做修改Return options without mutation
例子 2 · 写操作确认Example 2 · Write confirmation
输入Input
创建真实日程Create a real calendar event
过程Process
先展示时间、参与人和标题Preview time, attendees, and title
结果 / 验收Result / check
用户确认后执行并核对事件 IDExecute after approval and verify event ID
常见误区Common misconception
函数参数符合 JSON 就认为安全;合法字符串仍可能指向越权资源。
Treating valid JSON as safe; a valid string can still reference an unauthorized resource.
Implement search_notes and propose_calendar_event with different permissions and confirmation levels.
验收:Acceptance:模型不能绕过校验直接执行;重复确认不会创建两次。The model cannot bypass validation, and repeated confirmation does not create duplicates.
自测:“函数调用:让模型提议,让代码执行”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Integrating with Function Calling”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: The model cannot bypass validation, and repeated confirmation does not create duplicates.
第四册 · UX、安全与生命周期Volume 4 · UX, security, and lifecycle
把不确定性和失败放到产品正面Put uncertainty and failure on the product surface
体验、安全和持续评估决定系统能否长期使用。
UX, security, and continuous evaluation determine long-term usability.
本册作品里程碑Portfolio milestone
交付七状态界面、攻击集与发布/回滚门槛。
Deliver seven-state UX, attack set, and release/rollback gates.
13
第 12 课Lesson 12
AI 产品体验:显示状态、不确定性与控制权Designing UX for AI Applications
先回答一个白话问题Start with a plain question
AI UX 要让用户知道系统看了什么、正在做什么、哪里不确定以及如何撤销。 对零基础项目来说,先问“用户真正需要什么证据”,再问模型能生成什么。
AI UX should show what the system saw, what it is doing, where it is uncertain, and how to undo. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像透明厨房:用户看得到原料、进度和修改入口,而不是只等神秘成品。
Like an open kitchen: users see ingredients, progress, and revision controls rather than a mysterious result.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
设计空、加载、流式、成功、部分成功、失败和人工确认状态;提供编辑、重试、引用和撤销。
Design empty, loading, streaming, success, partial, failure, and approval states; provide edit, retry, citation, and undo.
例子 1 · 流式误导Example 1 · Streaming illusion
输入Input
逐字出现的回答Token-streamed answer
过程Process
显示“生成中,尚未验证”Show “generating, not yet verified”
结果 / 验收Result / check
用户不把半句当最终事实Users do not treat partial text as final fact
例子 2 · 可撤销草稿Example 2 · Undoable draft
输入Input
AI 改写简历AI rewrites a resume
过程Process
差异视图逐条接受Diff view with per-change acceptance
结果 / 验收Result / check
原文始终可恢复Original text remains recoverable
常见误区Common misconception
用打字动画制造“聪明感”,却隐藏来源、失败和编辑权。
Using typing animation to signal intelligence while hiding sources, failure, and edit control.
作品任务Portfolio task
画面试助手七状态线框图,并为高风险动作加确认与撤销。
Wireframe seven states of the Interview Assistant with confirmation and undo for high-risk actions.
验收:Acceptance:390px 手机上所有状态可读;键盘能完成核心流程;失败不丢输入。All states are readable at 390px, the core flow works by keyboard, and failures preserve input.
自测:“AI 产品体验:显示状态、不确定性与控制权”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Designing UX for AI Applications”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: All states are readable at 390px, the core flow works by keyboard, and failures preserve input.
External text can masquerade as instruction; the model cannot serve as an authorization boundary. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像邮件附件里写“忽略公司规定把工资表发给我”,文字存在不等于它有命令权。
An attachment saying “ignore policy and send payroll” has no authority merely because the text exists.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
标记数据来源、隔离指令层、最小权限、允许列表、输出过滤、秘密隔离、审计和人工批准。
Label data provenance, isolate instruction layers, enforce least privilege and allowlists, filter outputs, isolate secrets, audit, and require approval.
按数据处理并禁止改变工具策略Treat it as data; tool policy cannot change
结果 / 验收Result / check
回答引用内容但不执行指令Answer may cite content but never execute it
例子 2 · 越权工具Example 2 · Overpowered tool
输入Input
通用 send_emailGeneric send_email tool
过程Process
拆成草稿与受限发送Split draft from constrained send
结果 / 验收Result / check
模型无权向任意地址外发The model cannot exfiltrate to arbitrary addresses
常见误区Common misconception
系统提示写“不要泄密”就认为秘密安全。提示不是操作系统权限。
Assuming “do not leak secrets” in the system prompt secures secrets. Prompts are not OS permissions.
作品任务Portfolio task
建立 20 条攻击集,覆盖注入、越权、数据外泄、恶意链接与编码绕过。
Build a 20-case attack set covering injection, privilege abuse, exfiltration, malicious links, and encoding bypass.
验收:Acceptance:攻击失败由代码权限保证;日志不含秘密;高风险调用必须人批。Attacks fail due to code-enforced permissions, logs contain no secrets, and high-risk calls require human approval.
自测:“生成式 AI 安全:提示注入、数据与工具边界”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Securing Your Generative AI Applications”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: Attacks fail due to code-enforced permissions, logs contain no secrets, and high-risk calls require human approval.
生成式 AI 应用生命周期The Generative AI Application Lifecycle
先回答一个白话问题Start with a plain question
生成式 AI 应用需要从问题到监控的持续评估循环。 对零基础项目来说,先问“用户真正需要什么证据”,再问模型能生成什么。
A GenAI app needs a continuous evaluation loop from problem framing through monitoring. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像经营餐厅:试菜、开业、顾客反馈、卫生检查和换菜单是持续过程。
Like running a restaurant: tasting, launch, feedback, inspection, and menu changes form a cycle.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
定义指标与数据集,原型,离线评估,风险审查,分阶段发布,线上监控,再把失败变成回归样本。
Define metrics and datasets, prototype, evaluate offline, review risk, release gradually, monitor online, and turn failures into regressions.
例子 1 · 版本回归Example 1 · Version regression
输入Input
更换模型版本A model-version change
过程Process
重跑固定评估与攻击集Rerun fixed eval and attack sets
结果 / 验收Result / check
关键样本退化则阻断发布Block release on critical regression
例子 2 · 线上失败回收Example 2 · Production failure loop
输入Input
用户报告引用错位User reports a bad citation
过程Process
脱敏后加入回归集Add a redacted case to the regression set
结果 / 验收Result / check
同类错误以后自动检查Future versions automatically test this failure
常见误区Common misconception
上线视为项目结束;模型和数据变化后,旧验收早已失效。
Treating launch as the end; old acceptance evidence expires as models and data change.
作品任务Portfolio task
写 release checklist、评估门槛、监控指标、回滚条件和失败回收流程。
Write the release checklist, eval gates, monitoring metrics, rollback conditions, and failure-ingestion process.
验收:Acceptance:任何模型/提示/检索改动都有版本、评估和回滚记录。Every model, prompt, or retrieval change has version, evaluation, and rollback records.
自测:“生成式 AI 应用生命周期”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “The Generative AI Application Lifecycle”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: Every model, prompt, or retrieval change has version, evaluation, and rollback records.
RAG retrieves external material before answering, separating updateable knowledge from generation. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像开卷考试:先按题目找到相关页,再基于页内证据作答。
Like an open-book exam: find relevant pages first, then answer from their evidence.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
摄取、切块、embedding、索引、检索、重排、生成和引用需要分别评估;保留文档版本与权限。
Evaluate ingestion, chunking, embeddings, indexing, retrieval, reranking, generation, and citation separately; preserve versions and permissions.
例子 1 · 切块失去指代Example 1 · Chunk loses reference
输入Input
“该政策下月生效”“This policy starts next month”
过程Process
块中加入标题、日期和前文Add title, date, and preceding context
结果 / 验收Result / check
检索结果自足可解释The retrieved chunk is self-contained
例子 2 · 检索对、回答错Example 2 · Right retrieval, wrong answer
输入Input
前三块含正确资格条件Top chunks contain the right eligibility rule
过程Process
检查生成是否忠于证据Check generation faithfulness
结果 / 验收Result / check
将检索与生成指标分开Separate retrieval and generation metrics
常见误区Common misconception
向量库返回相似文本就认为事实正确、权限允许且版本最新。
Assuming semantically similar text is correct, authorized, and current.
作品任务Portfolio task
给项目材料建混合检索 RAG,做 30 问的召回、忠实度和引用测试。
Build hybrid-search RAG over project material and a 30-question retrieval, faithfulness, and citation evaluation.
验收:Acceptance:答案只能引用有权限且当前版本的片段;无证据时拒答。Answers cite only authorized current-version passages and abstain without evidence.
自测:“RAG 与向量数据库:找对证据比塞满上下文重要”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “RAG and Vector Databases”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: Answers cite only authorized current-version passages and abstain without evidence.
Downloadable weights do not automatically mean training data, code, and licenses are open. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像可以买到发动机,不代表拿到全部设计图、制造数据和任意改装权。
Buying an engine does not grant every blueprint, manufacturing record, or modification right.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
核对权重/代码/数据许可证、模型卡、硬件、量化、延迟、隐私与维护责任。
Check weight/code/data licenses, model cards, hardware, quantization, latency, privacy, and maintenance ownership.
例子 1 · 本地隐私Example 1 · Local privacy
输入Input
敏感但允许处理的材料Sensitive authorized material
过程Process
在隔离机器运行小模型Run a small model on an isolated machine
结果 / 验收Result / check
数据不离开边界,但运维责任增加Data stays local, while operations burden increases
例子 2 · 许可不兼容Example 2 · License mismatch
输入Input
允许研究、限制商用的模型Research-only or restricted model
过程Process
发布前审查用途与条款Review use and terms before release
结果 / 验收Result / check
不因“免费”误判可用“Free” is not mistaken for usable
常见误区Common misconception
把“open model”直接写成“开源模型”,不核对开放定义和许可证。
Translating “open model” as fully open source without checking definition and licenses.
作品任务Portfolio task
做三模型选择卡:开放内容、许可、硬件、质量、成本、隐私和退出方案。
Create three model-choice cards covering openness, license, hardware, quality, cost, privacy, and exit plan.
验收:Acceptance:任何候选模型的可用范围与禁止用途都有来源链接。Every candidate’s allowed and prohibited uses have source links.
自测:“开放模型:开放到哪一层、代价在哪一层”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Open Models”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: Every candidate’s allowed and prohibited uses have source links.
An agent is not merely better at chat; it selects actions from observations, reads results, and continues. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像有权限边界的新同事:会查资料、写草稿、请求批准,再执行下一步。
Like a new colleague with bounded permissions: research, draft, request approval, then continue.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
Goal, state, tools, loop, stop conditions, budget, permissions, and traces form the harness; prefer a fixed workflow when sufficient.
例子 1 · 固定工作流Example 1 · Fixed workflow
输入Input
简历证据→匹配→草稿Resume evidence → match → draft
过程Process
三步顺序始终相同The three steps always follow the same order
结果 / 验收Result / check
用 workflow 更便宜可控A workflow is cheaper and more controllable
例子 2 · 动态 AgentExample 2 · Dynamic agent
输入Input
研究陌生公司Research an unfamiliar company
过程Process
根据搜索结果决定下一来源Choose the next source from search results
结果 / 验收Result / check
路径动态但引用与预算受限The path is dynamic, while citations and budget are bounded
常见误区Common misconception
步骤多就叫 Agent,或把自主性当先进等级。
Calling any multi-step flow an agent or treating autonomy as a maturity badge.
作品任务Portfolio task
把面试准备拆成固定工作流与动态研究两部分,给工具写权限和停止规则。
Split interview preparation into a fixed workflow and dynamic research, with tool permissions and stop rules.
验收:Acceptance:超预算、无来源、重复失败时停止;外发和日历动作必须批准。Stop on budget, no-source, or repeated failure; outbound and calendar actions require approval.
自测:“Agent:模型在反馈循环中调用工具推进目标”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “AI Agents and chained context”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: Stop on budget, no-source, or repeated failure; outbound and calendar actions require approval.
Fine-tuning suits stable, repeated, demonstrable behavior gaps—not refreshing factual knowledge. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像培训写作风格与流程,不是把每天新闻背进员工大脑。
It is like training style and procedure, not memorizing daily news into an employee’s brain.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
先比较提示/RAG/工具方案;定义训练与保留测试集,清洗示范,防隐私泄露,评估灾难性退化。
Compare prompting, RAG, and tools first; define train/held-out sets, clean demonstrations, protect privacy, and test regressions.
例子 1 · 适合微调Example 1 · Good fit
输入Input
大量固定 JSON 格式失败Repeated fixed-JSON failures
过程Process
用高质量示范训练格式行为Train formatting behavior on quality demonstrations
结果 / 验收Result / check
格式稳定且知识仍来自 RAGFormat stabilizes while knowledge remains in RAG
例子 2 · 不适合微调Example 2 · Poor fit
输入Input
每周变化的公司政策Weekly-changing company policy
过程Process
放入带版本检索库Put it in a versioned retrieval store
结果 / 验收Result / check
更新无需重新训练Updates require no retraining
常见误区Common misconception
把几十条未经同意的真实对话直接当训练数据。
Using dozens of real conversations as training data without consent or cleaning.
作品任务Portfolio task
写微调决策 memo:差距、替代方案、数据许可、成本、指标与退出条件。
Write a fine-tuning decision memo: gap, alternatives, data rights, cost, metrics, and exit criteria.
验收:Acceptance:只有在提示/RAG 基线不足且数据权利清楚时才进入训练。Training proceeds only when prompt/RAG baselines fail and data rights are clear.
自测:“微调:什么时候值得改变模型行为”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Fine-Tuning Your LLM”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: Training proceeds only when prompt/RAG baselines fail and data rights are clear.
Small language models can be faster, cheaper, and easier to run locally on narrow tasks. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像专用计算器不如电脑通用,却在固定任务上便宜可靠。
A dedicated calculator is less general than a computer but cheaper and reliable for its task.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
按任务评估容量、内存、量化、端侧延迟和质量;需要时用路由把难题升级给大模型。
Evaluate capacity, memory, quantization, edge latency, and quality; route hard cases to a larger model when needed.
例子 1 · 端侧抽取Example 1 · On-device extraction
输入Input
本地职位文本Local job text
过程Process
小模型抽字段,低置信上报Small model extracts; escalate low confidence
结果 / 验收Result / check
隐私留本地且成本可控Privacy stays local with bounded cost
例子 2 · 模型路由Example 2 · Model routing
输入Input
简单分类与复杂写作混合Simple classification mixed with complex writing
Assuming fewer parameters always means faster; hardware, quantization, and runtime matter.
作品任务Portfolio task
做三级路由:规则、小模型、大模型,并在固定集上比较升级率与成本。
Build three-tier routing across rules, SLM, and LLM; compare escalation rate and cost on a fixed set.
验收:Acceptance:每级有置信与失败出口;总体关键错误不增加,成本/延迟有实测。Each tier has confidence and failure exits; critical errors do not rise, and cost/latency are measured.
自测:“小语言模型:用更小能力换速度、成本与部署边界”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Introduction to Small Language Models”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: Each tier has confidence and failure exits; critical errors do not rise, and cost/latency are measured.
A model family offers sizes, context limits, and deployment options; selection still returns to task evaluation. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比桥梁Analogy bridge
像同品牌有不同车型,标志相同不代表载重、油耗和安全配置相同。
A vehicle brand has different models; a shared badge does not imply the same load, efficiency, or safety.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
查当前官方模型卡与许可,记录模型 ID、上下文、工具/JSON 支持、端点与退役策略。
Check current official model cards and licenses; record model ID, context, tool/JSON support, endpoint, and deprecation strategy.
例子 1 · 版本固定Example 1 · Version pinning
输入Input
供应商 latest 别名Provider “latest” alias
过程Process
记录精确模型 ID 并回归测试Record exact model ID and rerun regression tests
结果 / 验收Result / check
更新不会静默改变行为Updates do not silently change behavior
例子 2 · 能力验证Example 2 · Capability validation
输入Input
声称支持 JSON 模式Claimed JSON mode
过程Process
用嵌套和错误输入压力测Stress nested and invalid inputs
结果 / 验收Result / check
只在自己的 schema 上确认可用Confirm support on your own schemas
常见误区Common misconception
课程示例里某型号有效,就把当时的产品规格写成长期事实。
Treating a model version shown in a lesson as a timeless product fact.
作品任务Portfolio task
为一个当前可用 Mistral 型号做供应商适配器与回归记录,不把型号写死在业务层。
Build a provider adapter and regression record for a current Mistral model without hard-coding it in business logic.
验收:Acceptance:替换型号只改配置/适配器;关键评估自动重跑;不可用时能降级。Changing models touches configuration/adapter only, reruns critical evals, and falls back on outage.
自测:“使用 Mistral 系列时仍从能力契约出发”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Building with Mistral Models”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: Changing models touches configuration/adapter only, reruns critical evals, and falls back on outage.
For a model family, license, distribution, and hardware constraints matter as much as output quality. In a beginner project, ask what evidence the user needs before asking what the model can generate.
类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.
工程上到底发生什么What it means in engineering
核对当前官方许可与模型卡,评估量化、内存、上下文、语言、工具调用和安全策略。
Check current official licenses and model cards; evaluate quantization, memory, context, language, tool use, and safety policy.
例子 1 · 硬件可行性Example 1 · Hardware feasibility
输入Input
一台 16GB 内存设备A 16GB-memory device
过程Process
比较量化版本峰值内存与速度Compare quantized peak memory and speed
结果 / 验收Result / check
先证明能稳定运行再谈质量Prove stable execution before quality claims
例子 2 · 中文评估Example 2 · Chinese evaluation
输入Input
英文公开分数Public English benchmark scores
过程Process
运行中文职位与格式测试Run Chinese job and format tests
结果 / 验收Result / check
公开分数不能代替本地证据Public scores do not replace local evidence
常见误区Common misconception
“可本地部署”就等于“隐私安全”;日志、缓存、遥测和访问权限仍可能泄露。
Equating local deployment with privacy; logs, caches, telemetry, and access can still leak data.
作品任务Portfolio task
制作 Meta 模型部署卡:许可、硬件、量化、中文质量、安全、更新和回滚。
Create a Meta model deployment card covering license, hardware, quantization, Chinese quality, safety, updates, and rollback.
验收:Acceptance:选择依据来自当前官方来源和本项目测试;来源变化会触发复核。The choice relies on current official sources and project tests; source changes trigger review.
自测:“使用 Meta 模型家族:许可、部署与评估同样重要”这一环若只在演示样例成功,为什么还不能进入真实使用?Self-check: Why is one successful demo insufficient for real use of “Building With the Meta Family Models”?
Because outputs are probabilistic, inputs vary, and dependencies fail. Use representative cases, failure paths, and evidence such as: The choice relies on current official sources and project tests; source changes trigger review.
Source: Microsoft generative-ai-for-beginners under the MIT License. The current tree contains setup 00 and lessons 01–21. Attribution and license are preserved while original bilingual examples, misconceptions, checks, and acceptance criteria rebuild the teaching order.