设计 AI 驱动的应用程序涉及选择正确的 AI 方法、处理 AI 的独特特性(非确定性、成本、延迟、错误),以及围绕本质上不完美的 AI 进行可靠性设计。它结合了软件工程与 AI 特定的考虑因素。
选择 AI 方法
→ PROMPTING (LLM APIs) → for most LLM tasks (simplest); good prompts go far
→ RAG → to ground answers in your own/current DATA (reduce hallucination)
→ FINE-TUNING → for specific behavior/style prompting can't achieve
→ TRADITIONAL ML → for structured prediction/classification with data
→ PRE-BUILT services → vision, speech, etc. (don't reinvent)
→ match the approach to the problem (often: prompting + RAG for LLM apps)
围绕 AI 特性进行设计
⚠️ AI is IMPERFECT/non-deterministic → design for it:
✓ VALIDATE AI output → don't blindly trust; structured output + validation; guardrails
✓ HANDLE ERRORS/failures → fallbacks; AI may be wrong, unavailable, or slow
✓ HALLUCINATION → ground (RAG), verify, cite, human review for important decisions
✓ HUMAN-IN-THE-LOOP → for high-stakes decisions (don't fully automate critical choices)
✓ NON-DETERMINISM → design for variability (don't assume identical outputs)
