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)](https://www.kaggle.com/whitepaper-prompt-engineering "whitepaper-prompt-engineering(Google)") \[2\] [提示简介 \| Generative AI on Vertex AI \| Google Cloud Documentation](https://docs.cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/introduction-prompt-design?hl=zh-cn "提示简介  |  Generative AI on Vertex AI  |  Google Cloud Documentation") \[3\] [Prompt-Engineering-Guide(dair-ai,GitHub)](https://github.com/dair-ai/Prompt-Engineering-Guide?tab=readme-ov-file "Prompt-Engineering-Guide(dair-ai,GitHub)") \[4\] [Prompt编写原则高级优化技巧-大模型服务平台百炼-阿里云](https://help.aliyun.com/zh/model-studio/prompt-engineering-guide "Prompt编写原则高级优化技巧-大模型服务平台百炼-阿里云") ## 网络参考资料: * [ChatGPT Prompt Engineering for Developer](https://www.youtube.com/watch?v=aaAiUIMA7d4&list=PL_VBedMuZDwACHDeJe_-GBoWJG1B2jyq6&index=1 "ChatGPT Prompt Engineering for Developer") * [提示词工程(Prompt Engineering)- Andrew Ng联合OpenAI](https://www.bilibili.com/video/BV1173jzNELG/?spm_id_from=333.788.videopod.episodes&vd_source=a17b26e6f5dce43e0b4b220aeb13a517&p=2 "提示词工程(Prompt Engineering)- Andrew Ng联合OpenAI") * [2.LangChain提示词工程应用实践_哔哩哔哩_bilibili](https://www.bilibili.com/video/BV1w9yEBNESz?spm_id_from=333.788.videopod.episodes&vd_source=a17b26e6f5dce43e0b4b220aeb13a517&p=3 "2.LangChain提示词工程应用实践_哔哩哔哩_bilibili")

相关推荐
薛定谔的猫36933 分钟前
LLM Agents: 从大语言模型到自主智能体的演进与架构解析
ai·llm·agent·machine learning·architecture
冬奇Lab1 小时前
RAG 系列(一):大模型为什么需要「外挂记忆」
人工智能·llm
冬奇Lab1 小时前
一天一个开源项目(第86篇):VibeVoice —— 微软开源的前沿语音 AI,单次处理 90 分钟多说话人音频
人工智能·llm
Flynt5 小时前
微软OpenAI终止独家合作:多云部署背后的技术架构变化
llm
量子位6 小时前
银河通用LDA定义全域数据利用范式,跨本体世界动作大模型开启具身GPT-2时刻
llm
猫头虎6 小时前
如何搭建 24 小时 AI 直播平台:魔珐星云数字人打造无人值守 “AI 销冠” 全流程实战教程
人工智能·langchain·开源·prompt·aigc·embedding·agi
带娃的IT创业者6 小时前
深度解析:从零构建高性能 LLM API 中转网关与成本优化实战
开发语言·gpt·llm·php·高性能·成本优化·api网关
Flittly6 小时前
【LangGraph新手村系列】(1)LangGraph 入门:StateGraph 与带记忆的 ReAct 循环
python·langchain
DigitalOcean7 小时前
DigitalOcean 打造 AI 原生云,帮助 AI 应用大幅降低成本与运维复杂度
llm·agent
熊猫钓鱼>_>7 小时前
大型复杂远程AI Agent应用:从架构困局到进化突围
人工智能·ai·架构·开源·大模型·llm·agent