完整教程:吴恩达【prompt提示词工程】学习笔记

两种类型llm

  • base llm预测下一个此
  • instruction tuned llm 根据指令回答

在大量文本上训练的基本LLM,接着用输入和输出的指令微调它,更好地遵循这些指令

RLHF:用人类反馈强化学习

pip install openai
import openai
openai.api_key = "sk-" #设置openapi的密钥,openai网站得到api密钥

原则

1. principle 1:write clear and specific instruction.

  • use delimiters:''', <>;
  • ask for structured output:json, html规定格式,输出的内容python可读可用;
  • check the conditions are satisfied,检查条件或假设是否满足
  • few-shot prompting, 少量的示例是模型遵循

2. principle 2: give the model time to think

  1. specify the steps to complete a task
  2. instruct the model to work out its own solution before rushing to a conclusion模型在给出答案之前先给出自己的分析

3. Limitations

幻觉hallucination。找到相关的引用,并基于引用回答问题

迭代

根据需求不断完善

摘要

summrize

prompt为特定对象,具体特定长度(数量在可接受范围)

构建循环处理多个内容

推理

收集标签,对不同的任务训练不同的模型。但对llm,可以用一个模型,通过提示完成不同的任务

posted on 2025-08-06 20:57  ljbguanli  阅读(42)  评论(0)    收藏  举报