Files
nexus/wiki/concepts/Prompt-Engineering.md

59 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Prompt Engineering"
type: concept
tags: [generative-ai, llm, prompt, aws, amazon-bedrock]
sources: [public-cloud-learning-sessions-opentext-generative-ai-prompt-engineering-2024111]
last_updated: 2026-05-12
---
## Aliases
- 提示词工程
- Prompt Design
- 提示工程
## Summary
**Prompt Engineering**提示词工程是创建、设计和优化提示词Prompt以引导大语言模型LLM产生准确、相关输出的技术实践。它是一个迭代过程需要针对具体用例反复测试和调整提示词。
## Key Properties
- **类型**:方法 / 技术实践
- **核心目标**:确保 LLM 输出的准确性和相关性
- **过程性质**:迭代式(测试 → 调整 → 优化)
## Prompt 四大组件
1. **指令Instruction**:明确告诉模型要执行什么任务
2. **上下文Context**:提供背景信息,帮助模型理解场景
3. **用户输入User Input**:具体的问题或请求
4. **输出指示器Output Indicator**:指定期望的输出格式或风格
## 基础技巧
### One-shot Prompting单样本提示
- 提供一个示例,让模型理解任务模式
- 适合简单、结构清晰的任务
### Few-shot Prompting少样本提示
- 提供 2~5 个示例,帮助模型理解多样性
- 适合需要格式一致性但示例丰富的场景
### Chain-of-Thought思维链
- 在提示词中引导模型逐步思考
- 提供 step-by-step 推理示例
- 适合复杂推理和多步骤任务
## 最佳实践
- **清晰准确**:指令应具体、无歧义
- **结构化**:使用明确的分隔符组织各组件
- **考虑人类响应**LLM 训练数据来自人类,因此提示词应符合人类沟通习惯
- **迭代优化**:针对具体用例持续测试和调整
## Connections
- 核心技术:[[GenerativeAI]]LLM 是 Prompt Engineering 的载体)
- 应用平台:[[AmazonBedrock]]Bedrock 上的基础模型均支持 Prompt Engineering
- 相关工具:[[AmazonQ]]Amazon Q Developer 利用 Prompt Engineering 优化代码生成)
- 相关概念:[[RAG从入门到精通系列1基础RAG]]RAG 系统中的 Prompt Engineering 是关键调优点)