Files
myWiki/concepts/prompt-engineering.md

1.8 KiB
Raw Permalink Blame History

title, created, updated, type, tags, sources, confidence
title created updated type tags sources confidence
Prompt Engineering提示词工程 2026-06-29 2026-06-29 concept
prompt-engineering
LLM
methodology
prompt-to-loop-engineering-2026
high

Prompt Engineering

AI 开发范式四次浪潮的第一阶段20222024核心问题是"如何跟 AI 沟通"。

经典方法论

  • Zero-shot / Few-shot:不给或给少量示例
  • Instruction Prompting:结构化指令引导
  • Chain-of-Thought / Tree-of-Thought:多步推理提示策略
  • APEAutomatic Prompt Engineering:自动搜索最优 Prompt

Prompt Engineering ≠ Blind Prompting

正确的 Prompt Engineering 是一套包含"定义问题 → demonstration set → 候选 prompt → 实测准确率 → 成本/精度权衡 → 持续迭代"的工程方法论。blind-prompting 则是纯 trial-and-error、缺乏测试的反模式。

声明式框架DSPy

dspy 将 Prompt 从"人工手写"变为"可编译、可学习的程序":开发者声明输入输出签名,优化器自动搜索最优 Prompt + Few-shot 组合。底座模型切换时一键重新编译。

瓶颈

  1. 上下文窗口限制,无法承载海量上下文
  2. 缺乏记忆与工具调用,无法多步执行
  3. 容错率极低,需不断人工介入
  4. 技术债务:应用规模稍大就需维护成百上千条模板,模型升级时集体失效

嵌套定位

Prompt ⊂ context-engineeringharness-engineeringloop-engineering

相关概念