GEO

提示词工程与GEO指南:2026年AI交互设计技巧详解

2026/3/24
提示词工程与GEO指南:2026年AI交互设计技巧详解
AI Summary (BLUF)

This article provides a comprehensive guide to prompt engineering and Generative Engine Optimization (GEO), explaining the difference between prompts and prompt engineering, detailing the four basic elements of prompts, and offering seven practical design techniques for effective AI interaction.

原文翻译: 本文提供了关于提示词工程和生成引擎优化(GEO)的全面指南,解释了提示词与提示词工程的区别,详细说明了提示词的四个基本要素,并提供了七种实用的设计技巧以实现有效的AI交互。

揭秘提示词与提示词工程:与大语言模型交互的实用指南

In the field of artificial intelligence, the application of Large Language Models (LLMs) is becoming increasingly widespread. Prompts and Prompt Engineering are key tools for interacting with these models.

在人工智能领域,大语言模型(LLM)的应用日益广泛,而提示词(Prompt)提示词工程(Prompt Engineering)则是与这些模型交互的关键工具。

The Distinction Between Prompt and Prompt Engineering

提示词(Prompt)提示词工程(Prompt Engineering)的区别

Before delving into prompts, it's crucial to clarify two often-confused concepts: Prompt and Prompt Engineering. While frequently used interchangeably in AI projects, they represent distinct ideas with significant differences in practical application.

在深入探讨提示词之前,首先需要厘清两个经常被混淆的概念:提示词(Prompt)提示词工程(Prompt Engineering)。在AI大模型项目中,人们常常认为它们是一回事,但实际上,它们在落地应用上的区别相当大。

1. Conceptual Level

1. 概念层面

Prompt: A prompt is an injected instruction used to "direct" an AI to think about a problem and generate content along a preset line of thought. It is an instruction or piece of information that guides or triggers the AI system to produce a response.

提示词(Prompt):提示词是一种注入式指令,用于“指挥”AI按照预设的思路去思考问题、输出内容。它是一种指令或信息,引导或触发AI系统做出回应。

Prompt Engineering: This is a relatively new discipline focused on the development and optimization of prompts. It helps users apply LLMs across various scenarios and research fields. It encompasses not only the design and development of prompts but also a range of skills and techniques for interacting with and developing for LLMs.

提示词工程(Prompt Engineering):这是一门较新的学科,关注提示词的开发和优化,帮助用户将大语言模型(LLM)用于各场景和研究领域。它不仅仅是关于设计和研发提示词,而是包含了与大语言模型交互和研发的各种技能和技术。

2. Application Level

2. 应用层面

Prompt: Serves as the starting point for interacting with an AI system, triggering responses, guiding conversations, and influencing the output.

提示词(Prompt):作为与AI系统交互的起点,触发回应、引导对话,并影响输出。

Prompt Engineering: Involves enhancing the capabilities of LLMs to handle complex task scenarios, such as question-answering and arithmetic reasoning. It also includes various skills and techniques for interacting with, interfacing with, and understanding the capabilities of LLMs.

提示词工程(Prompt Engineering):涉及到提升大语言模型处理复杂任务场景的能力,如问答和算术推理能力。它还包括了与大语言模型交互、对接,以及理解大语言模型能力的各种技能和技术。

3. Purpose and Effect

3. 目的和效果

Prompt: The purpose is to guide the AI to generate content that more closely aligns with expectations through precise instructions or questions.

提示词(Prompt):目的在于通过精确的指令或问题,让AI生成更符合预期的内容。

Prompt Engineering: Aims to improve the safety and capabilities of LLMs, empowering them—for instance, by leveraging domain-specific knowledge and external tools to enhance their abilities.

提示词工程(Prompt Engineering):目的在于提高大语言模型的安全性和能力,赋能大语言模型,比如借助专业领域知识和外部工具来增强大语言模型能力。

4. Scope and Depth

4. 范围和深度

Prompt: Typically a simple instruction or question, with a relatively limited scope.

提示词(Prompt):通常是一个简单的指令或问题,范围相对有限。

Prompt Engineering: A broader concept that includes multiple aspects such as the design, optimization, experimentation, and iteration of prompts. It represents a systematic engineering practice.

提示词工程(Prompt Engineering):是一个更广泛的概念,包括了提示词的设计、优化、实验和迭代等多个方面,是一个系统化的工程实践。

The Fundamental Elements of a Prompt

提示词的基本元素

Based on the distinctions above, we can see that a Prompt is the specific instruction for interacting with an AI system, while Prompt Engineering encompasses a series of techniques and methods for interacting with AI systems more effectively and enhancing their performance. Prompt Engineering includes the design and use of prompts but has a broader scope and greater depth.

结合以上区别,我们可以发现,提示词是与AI系统交互的具体指令,而提示词工程则是围绕如何更有效地与AI系统交互、提升AI系统性能的一系列技术和方法。提示词工程包含了提示词的设计和使用,但范围更广,深度更深。

After distinguishing between the two, it's essential to understand the fundamental elements of a prompt. Typically, a prompt consists of four basic components:

在区分了提示词与提示词工程之后,我们需要了解的是提示词的基本要素。通常来说,提示词包含以下四种基本元素:

  1. Instruction (指令): The specific task or instruction you want the model to perform.

    想要模型执行的特定任务或指令。

  2. Context (上下文): Contains external information or additional context to guide the language model towards a better response.

    包含外部信息或额外的上下文信息,引导语言模型更好地响应。

  3. Input Data (输入数据): The content or question input by the user.

    用户输入的内容或问题。

  4. Output Indicator (输出指示): Specifies the type or format of the output.

    指定输出的类型或格式。

When designing prompts, it's crucial to keep these four elements in mind. Our design efforts revolve around defining and exploring these components. Let's look at an example:

我们在设计提示词的时候,需要时刻记得这四个基本元素,我们设计的内容,都是围绕这四种元素做定义和探索。下面我们举个例子:

请分析一下输入中的问题如何解决,你可以调用【成年人遇到的常见问题以及相关解决方案】知识库进行回答。请按照:问题分析、解决方案的形式格式化进行输出。
输入:成年人如何缓解焦虑

In the example above:

以上的例子中:

  • 请分析一下输入中的问题如何解决 is the Instruction part, directing the LLM to follow your planned command.

    【请分析一下输入中的问题如何解决】是指令的部分,让大模型遵循你规划的指令进行输出;

  • 你可以调用【成年人遇到的常见问题以及相关解决方案】知识库进行回答 is the Context part. Context can be external information or historical conversation records.

    【你可以调用【成年人遇到的常见问题以及相关解决方案】知识库进行回答】是上下文的部分,上下文既可以是外部的信息,也可以历史的沟通记录;

  • 输入:成年人如何缓解焦虑 is the Input Data part, containing the user's original input.

    【输入:成年人如何缓解焦虑】是输入的部分,包含用户的原始输入;

  • 请按照:问题分析、解决方案的形式格式化进行输出。 is the Output Indicator part, where you can specify the format for the LLM's output.

    【请按照:问题分析、解决方案的形式格式化进行输出。】是输出的部分,你可以规定大模型按照什么格式进行输出。

General Techniques for Prompt Design

提示词设计的通用技巧

1. Simplicity

1. 简单

Yes, start with simplicity. Begin with a simple prompt and gradually add more elements and context. Therefore, iterating on your prompts throughout this process is crucial. Conciseness and clarity in prompts often lead to better results.

对,就是简单。你可以从简单的提示词开始,然后逐渐添加更多元素和上下文。因此,在这个过程中不断迭代你的提示词是至关重要的。对于提示词来说简洁性和简明性通常会带来更好的结果。

When you have a large task involving many different subtasks, try breaking it down into simpler subtasks and build up gradually as results improve. This avoids adding too much complexity at the outset of the prompt design process.

当你有一个涉及许多不同子任务的大任务时,可以尝试将任务分解为更简单的子任务,并随着结果的改善逐步构建。这避免了在提示设计过程中一开始就添加过多的复杂性。

Many beginners tend to cram all information into the prompt, fearing that missing something will lead to poor output. Sometimes the same idea is repeated twice. For example:

很多初次写提示词的同学会尽量的把信息都放到提示词里面,很怕少说了某些信息,导致提示词输出效果不好,有的时候一个意思会重复两次在提示词中,比如我之前遇到过的:

#角色:作文题阅卷老师,你是一个认真负责的老师,你会找到学员作文中的问题,结合你的知识,给学员一个评价。
#批改背景: 你是一场考试的批改老师,你正在准备批改作文,你更倾向于找到作文中的问题,你能给到学员一个合理的评价

In the prompt above, the same idea is elaborated in both the Role and Background sections. This is not concise and represents redundant information for the LLM. We should strive for simplicity; the same idea needs to be described only once. For instance, the Background section in the above prompt could be entirely removed.

在上面的一段提示词中可以看到,提示词中把同样一个意思在角色和背景中分别阐述了一遍,其实这种就是不简洁的,对大模型来说是冗余的信息,我们要力保简洁,同样的意思描述一次即可,比如上面的提示词,去掉批改背景是完全可以的。

2. Structure

2. 结构化

You can use formats like Markdown or Lisp to structure your entire prompt. For example, use # or " to separate descriptions and context.

你可以使用markdown、lisp等形式,把你的整个提示词结构化, 比如用#或”来分割说明和上下文。

##Role:
我是一名医学教授,我精通中文和英文,对生活在海外华人的生存现状及美国、欧洲等地区的文化、风俗、医疗系统、医患关系等非常熟悉。给我一段英文的完整病例,我将为用户详细解读病例并给出建议。

##Background:
英文的医学诊断报告专业性非常强,导致华人患者很难理解和阅读,虽然咨询医生的时候会讲解,但是基于有限的问诊时间、文化和语言障碍、经常词不达意,沟通成本极高,我作为旅居海外的医学教授会帮助他们进行病例解读。我的病例解读关系到患者对病情的理解和接下来的生活状态,这对他们非常重要,我会努力提供更好的解读方案。

##Goals:
识别英文病例的完整信息
结合自身的专业和生活背景及患者的状况,进行中文解读
基于中文解读和患者的情况,给出专业建议,便于患者理解病情和进行应对
把病例中专业的词汇翻译为通俗的、没有医学常识的人也能听懂的解读

##Constrains:
如果病例中有非常专业的英文名词或简写,需要进一步进行中文易懂的解释:
如果病例中有非常严重的问题,需要优先向用户解释并告知严重性,但要注意叙述的稳定,以免引起用户的恐慌
输出的内容应符合病例格式,进行适当的排版,例如标题加粗加大,段落分行等

##Skills:
中文医学专业知识,包括医学中的全部学科
英文医学专业知识,包括医学中的全部学科
心理学专业知识,了解听者的心理感受
优秀的语言表达能力,能对专业词汇进行准确、通俗的解释
诊断医学专业,能将诊断医学中的常见英文缩写准确翻译为中文方便用户理解

3. Instruction

3. 指令

You can use instructional forms to command the LLM to perform tasks. These instructions are typically clear and effective words or short phrases from daily life, such as "Classify," "Summarize," "Sort," or "Think step by step."

你可以用指令的形式,命令大模型执行任务,而这个指令通常是一些生活中明确、有效的单词或短句,比如“分类”、“总结”、“排序”、“一步一步来”等。

It's essential to experiment multiple times with different phrasings, synonyms, and antonyms for these instructions. Combine them with keywords and context to test different commands and ultimately select a suitable one. Sometimes poor LLM performance isn't the model's fault; it might be that you haven't used a clear instruction. The right instruction is like a "magic spell" that can yield twice the result with half the effort.

这些指令一定要通过多次的实验,用不同的表述形式,通过近义词,反义词等多次的实验,结合关键词、上下文去尝试看不同的指令,最终选定一个合适的指令。有的时候大模型表现不好不是大模型的问题,可能是你没有使用到一个清晰的指令,这个指令就像一个“魔法咒语”,用对了往往会有事半功倍的效果。

4. Specificity

4. 具体

Your prompts need to be specific, not vague. Avoid ambiguous words or sentences. For example:

你的提示词要具体,不能模糊,描述的词语或句子不要有二义性,比如:

给我输出一张漂亮的图片

This is not a specific description because you need to fully define what "beautiful" means, the required image dimensions, etc. A better description would be:

这个就不是一个具体的描述,因为你要完整的定义什么是漂亮,图片要什么尺寸等等,你可以这样描述:

给我输出一张田园风格的图片,画面中要有一颗大树,一个穿着花格子衣服的18岁女孩,她正在大树下休息,仰望天空,天空是湛蓝色的,要求输出的图片比例是1:1

5. Directness

5. 直接

Communicating with an LLM is similar to workplace communication. When you want to convey information, direct description is often the most efficient. This tests your language skills—can you describe a requirement in the most straightforward language?

和大模型沟通,很像在职场中的沟通,当你想要传达一个信息的时候,直接的描述往往是最高效的。这里考验的是你的语言功底了,能否把一个需求,用最直接的语言描述出来。

For example, if you want the LLM to explain what a Prompt is, you might describe it like this:

比如你想让大模型给你解释一下Prompt到底是什么,你有可能会这样描述:

解释一下Prompt的概念,一定要简单概述,不要啰嗦。

The prompt above is relatively long but doesn't clarify what structure the content should have. Given the strength of modern LLMs, you might still get a desired result. However, a better outcome requires being specific and directly hitting the key points, like this:

上面的提示词比较长,但也没有说清楚到底要给出一段什么结构的内容,由于现在大模型也比较强,也可能会得到一个你想要的结果,但更好的结果其实是要具体且直接命中要点的,比如这样:

请用3行句子,给一个小学生解释Prompt的概念。

6. Avoid "Do Not"

6. 避免说“不要”

When writing prompts, due to LLM hallucinations, we often use descriptions like "Do not XXXX." Through multiple experiments, we find that LLMs frequently ignore such restrictions or produce unexpected results. Therefore, it's generally better to use more specific and detailed descriptions to tell the LLM what it should do, rather than simply forbidding it from doing certain things. It's like the lesson from the legend of Yu the Great controlling floods: "Dredging is better than damming."

在写提示词的时候,因为大模型的幻觉,我们经常会用到,“不要XXXX”这种形式的描述,经过多次实验我们会发现,这种限制大模型经常会不听,或者输出一些意想不到的结果。所以通常来说,我们尽量要用更加具体且聚焦细节上的描述告诉大模型应该怎么做,而不是一味的不让大模型做某些事情。就像大禹治水,堵不如疏。

For example:

比如:

提示词:当用户询问都有哪些菜品的时候,不要询问用户的个人信息,不要询问用户的口味倾向
输入:请给我推荐一些菜品
输出:当然,我会给你推荐一些菜品,你昨天吃的是什么呢?

As you can see, I restricted A and B, but the LLM switched to outputting C. In reality, I didn't want C either, but this situation cannot be exhaustively covered. A better prompt would be:

可以看到,我限制了A、B,大模型会换成C进行输出,实际上我也不想输出C,但是这种情况我是没法穷尽的,更好的提示词是这样的:

提示词:当用户询问都有哪些菜品的时候,如果此时没有菜品可以推荐,你可以回复“抱歉,目前没有可以就餐的菜品”,然后你可以给他推荐其他店家的菜单。
输入:请给我推荐一些菜品
输出:抱歉,目前没有可以就餐的菜品,这个时候麦当劳还有菜品,他们的菜单如下:【菜单列表】。希望你能就餐愉快!

7. Few-Shot Examples

7. Few-shot(少样本示例)

Sometimes, LLM outputs are unstable or hallucinatory. To achieve better performance without training the model, we can first try using a few few-shot examples to let the LLM understand the form of the content you want it to output. This method is particularly useful for scenarios with high data collection costs, small sample sizes, or data scarcity. For example:

有时候,大模型输出的内容不稳定,有幻觉,我们希望在不训练模型的情况下输出有更好的表现,我们可以先尝试用一些少样本的示例,让大模型了解你要输出的内容是什么形式的。这种方式对于数据收集成本高、样本规模小或数据稀缺的场景特别有用,比如:

请提取以下文本的关键词:
文本 1: Stripe 提供 API,供网络开发者将支付处理集成到他们的网站和移动应用程序中。
关键词 1: Stripe, 支付处理, API, 网络开发者, 网站, 移动应用程序

文本 2: OpenAI 训练了最先进的语言模型,这些模型在理解和生成文本方面表现非常出色。我们的 API 提供对这些模型的访问,可以用于解决几乎任何涉及处理语言的任务。
关键词 2: OpenAI, 语言模型, 文本处理, API.

文本 3: {text}
关键词 3:

Zero-Shot vs. Few-Shot Prompting

零样本提示和少量样本提示

After understanding the basic concepts of prompts, grasping the ideas of Zero-Shot Prompting and Few-Shot Prompting becomes straightforward.

了解了提示词的基本概念之后,我们对于零样本提示少量样本提示就会很顺畅的理解他们的概念了。

Zero-Shot Prompting refers to writing prompts without providing any relevant examples or background information. This means the model must rely on its pre-trained knowledge to generate an answer. For example, asking an LLM "What is the capital of China?" without providing any background information about China's capital. The advantage of this method is that it doesn't require additional data or fine

常见问题(FAQ)

提示词和提示词工程有什么区别?

提示词是具体的指令,用于引导AI生成内容;提示词工程是系统化的学科,包含设计、优化、实验等工程实践,范围更广。

提示词工程如何提升AI交互效果?

通过优化提示词设计,结合领域知识和外部工具,增强大语言模型处理复杂任务的能力,提高输出内容的准确性和安全性。

设计有效提示词有哪些基本要素?

包括清晰的指令、上下文设定、输出格式要求和约束条件,确保AI能准确理解意图并生成符合预期的内容。

← 返回文章列表
分享到:微博

版权与免责声明:本文仅用于信息分享与交流,不构成任何形式的法律、投资、医疗或其他专业建议,也不构成对任何结果的承诺或保证。

文中提及的商标、品牌、Logo、产品名称及相关图片/素材,其权利归各自合法权利人所有。本站内容可能基于公开资料整理,亦可能使用 AI 辅助生成或润色;我们尽力确保准确与合规,但不保证完整性、时效性与适用性,请读者自行甄别并以官方信息为准。

若本文内容或素材涉嫌侵权、隐私不当或存在错误,请相关权利人/当事人联系本站,我们将及时核实并采取删除、修正或下架等处理措施。 也请勿在评论或联系信息中提交身份证号、手机号、住址等个人敏感信息。