Table of Contents
Background knowledge
Is the more prompts and returns the better?
1. Reduce the length of the reply
Ways of Thinking
1. Chain-of-Thought
2. Self-questioning
3. Step-by-step thinking
4. ReAct
5. Reflection
反模式
1、提示注入
2、提示泄漏
总结
Home Technology peripherals AI Some advanced knowledge of ChatGPT tips

Some advanced knowledge of ChatGPT tips

May 10, 2023 pm 01:37 PM
chatgpt language model

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

ChatGPT now allows free users to generate images by using DALL-E 3 with a daily limit ChatGPT now allows free users to generate images by using DALL-E 3 with a daily limit Aug 09, 2024 pm 09:37 PM

DALL-E 3 was officially introduced in September of 2023 as a vastly improved model than its predecessor. It is considered one of the best AI image generators to date, capable of creating images with intricate detail. However, at launch, it was exclus

Understand Tokenization in one article! Understand Tokenization in one article! Apr 12, 2024 pm 02:31 PM

Language models reason about text, which is usually in the form of strings, but the input to the model can only be numbers, so the text needs to be converted into numerical form. Tokenization is a basic task of natural language processing. It can divide a continuous text sequence (such as sentences, paragraphs, etc.) into a character sequence (such as words, phrases, characters, punctuation, etc.) according to specific needs. The units in it Called a token or word. According to the specific process shown in the figure below, the text sentences are first divided into units, then the single elements are digitized (mapped into vectors), then these vectors are input to the model for encoding, and finally output to downstream tasks to further obtain the final result. Text segmentation can be divided into Toke according to the granularity of text segmentation.

The perfect combination of ChatGPT and Python: creating an intelligent customer service chatbot The perfect combination of ChatGPT and Python: creating an intelligent customer service chatbot Oct 27, 2023 pm 06:00 PM

The perfect combination of ChatGPT and Python: Creating an Intelligent Customer Service Chatbot Introduction: In today’s information age, intelligent customer service systems have become an important communication tool between enterprises and customers. In order to provide a better customer service experience, many companies have begun to turn to chatbots to complete tasks such as customer consultation and question answering. In this article, we will introduce how to use OpenAI’s powerful model ChatGPT and Python language to create an intelligent customer service chatbot to improve

How to install chatgpt on mobile phone How to install chatgpt on mobile phone Mar 05, 2024 pm 02:31 PM

Installation steps: 1. Download the ChatGTP software from the ChatGTP official website or mobile store; 2. After opening it, in the settings interface, select the language as Chinese; 3. In the game interface, select human-machine game and set the Chinese spectrum; 4 . After starting, enter commands in the chat window to interact with the software.

Three secrets for deploying large models in the cloud Three secrets for deploying large models in the cloud Apr 24, 2024 pm 03:00 PM

Compilation|Produced by Xingxuan|51CTO Technology Stack (WeChat ID: blog51cto) In the past two years, I have been more involved in generative AI projects using large language models (LLMs) rather than traditional systems. I'm starting to miss serverless cloud computing. Their applications range from enhancing conversational AI to providing complex analytics solutions for various industries, and many other capabilities. Many enterprises deploy these models on cloud platforms because public cloud providers already provide a ready-made ecosystem and it is the path of least resistance. However, it doesn't come cheap. The cloud also offers other benefits such as scalability, efficiency and advanced computing capabilities (GPUs available on demand). There are some little-known aspects of deploying LLM on public cloud platforms

To provide a new scientific and complex question answering benchmark and evaluation system for large models, UNSW, Argonne, University of Chicago and other institutions jointly launched the SciQAG framework To provide a new scientific and complex question answering benchmark and evaluation system for large models, UNSW, Argonne, University of Chicago and other institutions jointly launched the SciQAG framework Jul 25, 2024 am 06:42 AM

Editor |ScienceAI Question Answering (QA) data set plays a vital role in promoting natural language processing (NLP) research. High-quality QA data sets can not only be used to fine-tune models, but also effectively evaluate the capabilities of large language models (LLM), especially the ability to understand and reason about scientific knowledge. Although there are currently many scientific QA data sets covering medicine, chemistry, biology and other fields, these data sets still have some shortcomings. First, the data form is relatively simple, most of which are multiple-choice questions. They are easy to evaluate, but limit the model's answer selection range and cannot fully test the model's ability to answer scientific questions. In contrast, open-ended Q&A

How to develop an intelligent chatbot using ChatGPT and Java How to develop an intelligent chatbot using ChatGPT and Java Oct 28, 2023 am 08:54 AM

In this article, we will introduce how to develop intelligent chatbots using ChatGPT and Java, and provide some specific code examples. ChatGPT is the latest version of the Generative Pre-training Transformer developed by OpenAI, a neural network-based artificial intelligence technology that can understand natural language and generate human-like text. Using ChatGPT we can easily create adaptive chats

RoSA: A new method for efficient fine-tuning of large model parameters RoSA: A new method for efficient fine-tuning of large model parameters Jan 18, 2024 pm 05:27 PM

As language models scale to unprecedented scale, comprehensive fine-tuning for downstream tasks becomes prohibitively expensive. In order to solve this problem, researchers began to pay attention to and adopt the PEFT method. The main idea of ​​the PEFT method is to limit the scope of fine-tuning to a small set of parameters to reduce computational costs while still achieving state-of-the-art performance on natural language understanding tasks. In this way, researchers can save computing resources while maintaining high performance, bringing new research hotspots to the field of natural language processing. RoSA is a new PEFT technique that, through experiments on a set of benchmarks, is found to outperform previous low-rank adaptive (LoRA) and pure sparse fine-tuning methods using the same parameter budget. This article will go into depth

See all articles