Large Language Model(LLM)应用开发学习实践(三)

一、LLM Prompt Engineering学习(Andrew Ng & OpenAI)

(一)Principles of Prompting

Write clear and specific instructions(clear ≠ short)

  1. Use delimiters.Such as Triple quotes """,Triple backticks ''',Triple dashes ---,Angle brackets<> and XML tags <tag></tag>.(可以让输入指令更为明确,内容与指令区分)

  2. Ask for structured output,Such as HTML and JSON.(可以让模型回答结果结构化输出)

  3. Check whether conditions are satisfied,Check assumptions required to do the task.(可以让模型根据提供的判断规则输出不同的回答)

  4. Few-shot prompting.Give successful examples of completing tasks,Then ask model to perform the task.(可以让模型根据提供的对话案例保持一致的风格回答问题)
    Give the model time to think

  5. Specify the steps to complete a task(Step 1:...,Step 2:...,...,Step N:...).

  6. Instruct the model to work out its own solution before rushing to a conclusion.

(二)Model Limitations

Hallucination(模型幻觉)

Makes statements that sound plausible but are not true.Reducing hallucinations:

  1. Find relevant information.
  2. Answer the question based on the relevant information.

二、Prompt Engineering Technology 部分总结

关键学习文档2-3中,已总结记录了更为完备的提示词工程技巧。下图仅展示常用的部分技巧及适用范围。
(引自关键学习文档1:whitepaper-prompt-engineering(Google))

关键学习文档:

1 whitepaper-prompt-engineering(Google)

2 提示简介 | Generative AI on Vertex AI | Google Cloud Documentation

3 Prompt-Engineering-Guide(dair-ai,GitHub)

4 Prompt编写原则高级优化技巧-大模型服务平台百炼-阿里云

网络参考资料:

相关推荐
冬奇Lab9 小时前
Agent 系列(19):Harness 完整体系——8 层防护框架全景
人工智能·llm·agent
逻极10 小时前
Hermes Agent深度探索:一个会自我沉淀经验的终端智能体
架构·llm·agent·rag·多智能体系统·hermes agent·hermes
不吃青椒!10 小时前
LangGraph 流式事件处理:从实战到体系
ai·langchain·状态模式
染指111012 小时前
24.RAG进阶(Advanced RAG)-摘要索引
langchain·rag
IManiy13 小时前
知识点之LangGraph 中的四个核心概念:State、Node、Edge 和Checkpoint
langchain
雮尘13 小时前
LangGraph 与 LangSmith 入门教程(JS/TS 版)
前端·人工智能·langchain
veminhe15 小时前
解决了使用langchain调用聊天模型报的错
langchain
颜酱15 小时前
LangChain上手 Agent:让大模型自己调用工具解决问题
langchain
stereohomology16 小时前
让AI精确修改视觉可见的细节是繁琐的
llm·多模态编辑
AndrewHZ16 小时前
【LLM技术全景】开源大模型生态:如何选择适合你的基座模型?
人工智能·深度学习·语言模型·开源·llm·transformer·基座模型