PaRaD1SE

How to use ChatGPT: A Simple Tutorial

Published: 2023/5/10 Views: 3390

Categories: 

AI

This tutorial will introduce how to use ChatGPT, provide some practical tips and precautions, and help everyone better utilize ChatGPT to solve problems.

ChatGPT is an AI chat assistant based on the GPT-4 model. It can understand and generate natural language to provide help to users. Therefore, learning how to organize your questions and adjust the model parameters can help you save costs while getting the answer you want. In this tutorial, I will introduce how to use ChatGPT efficiently.

Due to special reasons, the ChatGPT official website is not accessible in China. I have deployed a chat website using the API provided by OpenAI, which can be registered and tried through this link. The currently available models are gpt-3.5-turbo and gpt-4.

Organize Your Questions

First of all, remember that ChatGPT is just a model. It has no emotions and is just a large knowledge database that uses natural language as a query interface. Therefore, its answer quality depends largely on the quality of your questions. If your questioning language is not clear enough, ChatGPT cannot understand your meaning and cannot give you the answer you want. Therefore, we need to learn how to organize our questioning language, which is actually an advanced personal skill. It's not easy to learn, but don't worry, keep reading, and I will explain how to do it later.

Adjust the Model Parameters

This is a special feature of the API version. If you are lucky enough to use the official website version or at least have a rough idea of how to use it, you will find that the official website does not provide this part of the function.

For GPT4, the API version is more powerful than the official website because it can support a context with a maximum length of 8193, while the GPT4 on the official website, like GPT3.5, only supports a maximum context length of 4097. This means that the API version of GPT4 can remember longer conversations, which can lead to more satisfactory answers.

In the API version, we can adjust the model parameters to affect its answers. Here are the best parameters to use:

  • max_tokens: 1~n The maximum length allowed for generation, the maximum value depends on the maximum context length supported by the model used. gpt3.5-turbo supports a maximum of 4097, and the currently available version of gpt-4 supports a maximum of 8193.

    What is Token: Since computers can only recognize numbers, in natural language processing, we need to convert text into a series of numeric vectors. This process is called Tokenization, and the converted length is not one-to-one with the actual text length. If a word is common enough in the training dataset, it may be treated as a whole token. But if a word is uncommon in the training data, it may be broken down into smaller tokens. Using the Tokenizer on the official website as an example: TokenizerExample.jpg You can see that most English words are correctly segmented, while rare self-created words like my ID PaRaD1SE and Bilibili are split into smaller tokens.

  • temperature: 0~1 Controls the diversity of the model's generation. The larger the value, the more random and diverse the generated answers are, but it will lead to less accurate answers. Conversely, the smaller the value, the more accurate the answers are, but it will lead to less diverse answers.

  • presence_penalty: -2.0~2.0 Controls the freshness of the topic. The smaller the value, the more often the words that have appeared will be reused, and the opposite is true. Words that have appeared are less likely to appear later.

Pre/Post-processing Parameters

To provide a comfortable chatting experience, the website itself applies some processing to the sent messages and received responses. These processing parameters can be adjusted through settings:

  • Included history message count: The number of historical messages carried with each request, ensuring that ChatGPT bases its answers on a certain amount of existing chat records. If set too short, it tends to be forgetful and may have already forgotten concepts mentioned in previous messages. If set too long, it can exceed the model's context limits, triggering the history message compression feature below.

    Please note that the token usage includes historical messages, so if you set a long included history message count, your tokens will be quickly consumed. Please experiment to find a value that you find acceptable.

  • Historical message length compression threshold: When the length of historical messages exceeds this threshold, the messages will be compressed (automatically using gpt-3.5 for content summarization). This ensures that ChatGPT can continue answering questions even if the context exceeds the maximum model length.

    This parameter can be set in conjunction with the previous one. For example, if you set the included history message count to 5 and the compression threshold to 1000, when the combined word count of your last 5 chat records exceeds 1000, ChatGPT will automatically compress the history messages into a concise summary, ensuring that ChatGPT can continue answering questions and still have decent memory capabilities.

  • Historical summarization: Whether to enable the automatic compression feature for chat history mentioned above. If not enabled, when the context length exceeds the maximum length, ChatGPT will stop responding.

Start Chatting

ChatPrds98-main-page.jpg

Use Masks

In the upper-left corner of the chat box, you can open masks.

ChatPrds98-mask.jpg

The mask is a set of preset scenario dialogue modes that allow ChatGPT to play different roles, such as copywriters, translators, scientists, etc. These preset dialogue modes can be used directly, of course, they can also be modified or a new one can be created, just click to view all.

Here is the interface for creating masks:

ChatPrds98-create-mask.jpg

There are three types of preset messages:

  • System: System message, which can be understood as a front message. This message will make the model recognize it as a message to pay attention to. You can define the role here, such as: "You are now a scientist and you are being interviewed by a journalist." In this way, ChatGPT will answer the questions throughout as a scientist.

  • User: Normal message, the message sent normally, that is, the question you normally ask.

  • Assistant: ChatGPT's answer, you can set a virtual ChatGPT answer here to help ChatGPT better understand the context.

If you do a good job of preset messages, you can get a very good chat experience.

Shortcut Keys and Tips

Pressing the up arrow key directly in the chat input box can quickly input the last sent message, which is convenient for modification or retrying in case of network errors.

Different chat record windows can be directly dragged and dropped to change the order.

The boundary between the sidebar and the chat interface can be dragged to change the width ratio.

Notes

  1. The latest training cutoff date for the models is 2021-09. Therefore, for some questions about instant news, if the event occurs after this date, ChatGPT will not be able to give the correct answer and may even give some strange answers. So don't ask meaningless questions to waste tokens.

  2. ChatGPT may not be able to answer specific domain questions or its answers may not be completely accurate. When it comes to important decisions, please make sure to verify the source of the information.

  3. Please comply with relevant laws and regulations and do not use ChatGPT for illegal activities.

Now you have learned how to use ChatGPT. Start chatting with it and discover more interesting features! Register for trial

Tags:

Website
ChatGPT
AGI

Previous

Next