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编写原则高级优化技巧-大模型服务平台百炼-阿里云

网络参考资料:

相关推荐
轻松西西莱尔17 小时前
降低成本少花钱,模型调用量砍掉90%:缓存、分级、精简、批处理、流式,5个坑我全踩了一遍
llm·agent
桃西西呀17 小时前
我把网关限流配置成每秒 100 请求,大促一来照样被打挂,还把别人也拖垮了
人工智能·llm·ai编程
桃西西呀19 小时前
我把整本接口文档塞进 system prompt,前 3 轮答得准,第 8 轮开始胡说,账单还翻了 4 倍
人工智能·llm·ai编程
用户8371332007620 小时前
感觉终于把复杂的 RAG 技术整理明白了
人工智能·llm
自养Agent20 小时前
Agent Harness 从用到会造:Skill 不是一次 API 调用,是一段会复用的行为
人工智能·llm
stereohomology20 小时前
我对deepseek4.1flash, glm5.3及flash能力的感受与基准测试相同
人工智能·llm·测评分
用户31346721435420 小时前
learn-claude-code笔记5: TodoWrite — 没有计划的 Agent,做着做着就偏了
llm·agent
hackchen21 小时前
LangChain 学习第 3 课 - 输出解析器(Output Parser)
数据库·学习·langchain
goehou1 天前
模型量化部署实战:显存、精度与量化版本怎么选(附显存账)
llm·本地部署·awq·量化部署·显存优化
LMT流氓兔1 天前
第四单元——第17课:让回答边生成、边显示
服务器·数据库·人工智能·python·oracle·langchain