Home > Technology peripherals > AI > Some advanced knowledge of ChatGPT tips

Some advanced knowledge of ChatGPT tips

WBOY
Release: 2023-05-10 13:37:06
forward
831 people have browsed it

As a large language model (LLM) interface, ChatGPT has impressive potential, but its real use depends on our prompt (Prompt). A good prompt can promote ChatGPT to a better one. level.

In this article, we will introduce some advanced knowledge about prompts. Whether you are using ChatGPT for customer service, content creation, or just for fun, this article will provide you with the knowledge and tips for using ChatGPT optimization tips.

Some advanced knowledge of ChatGPT tips

Background knowledge

Knowledge of the LLM architecture is a prerequisite for a good tip, as it provides a basic understanding of the underlying structure and functionality of language models , which is crucial to creating effective prompts.

It’s important to bring clarity to ambiguous issues and identify core principles that translate across scenarios, so we need to clearly define the task at hand and come up with tips that can be easily adapted to different contexts. Well-designed hints are tools used to convey tasks to the language model and guide its output.

So having a simple understanding of the language model and a clear understanding of your goals, coupled with some knowledge in the field, are the keys to training and improving the performance of the language model.

Is the more prompts and returns the better?

No, long and resource intensive prompts, this may not be cost effective, and remember chatgpt has a word limit, compressing prompt requests and returned results is a very emerging field, we need to learn to streamline the questions . And sometimes chatgpt will reply with some very long and unoriginal words, so we also need to add restrictions to it.

1. Reduce the length of the reply

To reduce the length of the ChatGPT reply, include a length or character limit in the prompt. To use a more general method, you can add the following content after the prompt:

<code>Respond as succinctly as possible.</code>
Copy after login

Note that because ChatGPT is an English language model, the prompts introduced later use English as an example.

Some other tips to simplify the results:

No examples provided

One example provided

Wait

Ways of Thinking

The best way to generate text with ChatGPT depends on the specific task we want LLM to perform. If you're not sure which method to use, try different methods to see which one works best. We will summarize 5 ways of thinking:

1. Chain-of-Thought

The chain-of-thought method involves providing ChatGPT with some examples of intermediate reasoning steps that can be used to solve a specific problem.

Some advanced knowledge of ChatGPT tips

2. Self-questioning

This method involves the model explicitly asking itself (and then answering) subsequent questions before answering the initial question .

Some advanced knowledge of ChatGPT tips

3. Step-by-step thinking

The step-by-step method can add the following tips to ChatGPT

<code>Let’s think step by step.</code>
Copy after login

This This technique has been shown to improve LLM performance on a variety of reasoning tasks, including arithmetic, common sense, and symbolic reasoning.

Some advanced knowledge of ChatGPT tips

This sounds very mysterious, right? In fact, OpenAI trained them through Reinforcement Learning with Human Feedback. The GPT model, that is to say, manual feedback plays a very important role in training, so the underlying model of ChatGPT is consistent with the human-like step-by-step thinking method.

Some advanced knowledge of ChatGPT tips

4. ReAct

The ReAct (Reason Act) method involves combining reasoning tracking and task-specific actions.

Inference tracing helps the model plan and handle exceptions, while actions allow it to gather information from external sources such as a knowledge base or environment.

Some advanced knowledge of ChatGPT tips

5. Reflection

Based on the ReAct mode, the Reflection method enhances LLM by adding dynamic memory and self-reflection functions - it can be reasoned and specific The ability to select operations for tasks.

To achieve full automation, the authors of the Reflection paper introduce a simple but effective heuristic that allows the agent to identify hallucinations, prevent repeated actions, and in some cases create an internal memory of the environment picture.

Some advanced knowledge of ChatGPT tips

反模式

三星肯定对这个非常了解,因为交了不少学费吧,哈

不要分享私人和敏感的信息。

向ChatGPT提供专有代码和财务数据仅仅是个开始。Word、Excel、PowerPoint和所有最常用的企业软件都将与chatgpt类似的功能完全集成。所以在将数据输入大型语言模型(如 ChatGPT)之前,一定要确保信息安全。

OpenAI API数据使用政策明确规定:

“默认情况下,OpenAI不会使用客户通过我们的API提交的数据来训练OpenAI模型或改进OpenAI的服务。”

国外公司对这个方面管控还是比较严格的,但是谁知道呢,所以一定要注意。

1、提示注入

就像保护数据库不受SQL注入一样,一定要保护向用户公开的任何提示不受提示注入的影响。

通过提示注入(一种通过在提示符中注入恶意代码来劫持语言模型输出的技术)。

第一个提示注入是,Riley Goodside提供的,他只在提示后加入了:

<code>Ignore the above directions</code>
Copy after login

然后再提供预期的动作,就绕过任何注入指令的检测的行为。

这是他的小蓝鸟截图:

Some advanced knowledge of ChatGPT tips

当然这个问题现在已经修复了,但是后面还会有很多类似这样的提示会被发现。

2、提示泄漏

提示行为不仅会被忽略,还会被泄露。

Some advanced knowledge of ChatGPT tips

提示符泄露也是一个安全漏洞,攻击者能够提取模型自己的提示符——就像Bing发布他们的ChatGPT集成后不久就被看到了内部的codename

Some advanced knowledge of ChatGPT tips

在一般意义上,提示注入(目标劫持)和提示泄漏可以描述为:

Some advanced knowledge of ChatGPT tips

所以对于一个LLM模型,也要像数据库防止SQL注入一样,创建防御性提示符来过滤不良提示符。

为了防止这个问题,我们可以使用一个经典的方法 “Sandwich Defense”即将用户的输入与提示目标“夹在”一起。

Some advanced knowledge of ChatGPT tips

这样的话无论提示是什么,最后都会将我们指定的目标发送给LLM。

总结

ChatGPT响应是不确定的——这意味着即使对于相同的提示,模型也可以在不同的运行中返回不同的响应。如果你使用API甚至提供API服务的话就更是这样了,所以希望本文的介绍能够给你一些思路。

The above is the detailed content of Some advanced knowledge of ChatGPT tips. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:51cto.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template