Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation in ChatGPT #210

Closed
juntao opened this issue Mar 31, 2023 · 21 comments
Closed

Conversation in ChatGPT #210

juntao opened this issue Mar 31, 2023 · 21 comments

Comments

@juntao
Copy link
Member

juntao commented Mar 31, 2023

In order for ChatGPT to carry on a conversation, I have to give it all the relevant past messages in the thread before asking a new question. Is that correct?

Copy link
Member

As an AI language model, I don't require access to past messages to answer questions. However, providing context can help me better understand your question and provide more accurate answers. So, feel free to provide context or previous messages that may be relevant to your question, but it's not required.

@juntao
Copy link
Member Author

juntao commented Mar 31, 2023

The ChatGPT API required me to label past messages in the conversation as "system", "user" and "assistant". What is the purpose of this labeling? How does ChatGPT make use of that data?

Copy link
Member

The labeling of messages as "system", "user", and "assistant" in a conversation can help ChatGPT better understand the context of the conversation and therefore provide more relevant and accurate responses to future messages.

By labeling past messages, ChatGPT can identify which messages were sent by the user, the system, or the assistant. Based on this information, it can determine how to respond to new messages that come into the conversation. For example, if a new message comes in from the user and it's labeled as such, ChatGPT will know to provide a response that is appropriate for a user message.

Overall, the labeling of messages is a way to help ChatGPT learn and improve its responses over time as it processes more messages within the same context.

@juntao
Copy link
Member Author

juntao commented Mar 31, 2023

Can you provide an example that shows how ChatGPT converts the API input with past messages labeled with system / user / assistant, into an input sequence to ChatGPT?

Copy link
Member

Certainly! Here's an example conversation:

System: Hello, I am your assistant on GitHub, built by the Second State team. I am ready for your question now!
User: Hi there! Do you have any tips for getting started with Git?
Assistant: Sure! Let me give you a few pointers. First...
User: That's helpful, thank you. What's the difference between git pull and git fetch?

In this conversation, the messages have been labeled as follows:

[system] Hello, I am your assistant on GitHub, built by the Second State team. I am ready for your question now!
[user] Hi there! Do you have any tips for getting started with Git?
[assistant] Sure! Let me give you a few pointers. First...
[user] That's helpful, thank you. What's the difference between git pull and git fetch?

To convert this conversation into an input sequence for ChatGPT, the messages are concatenated together in the order they were sent, with a special token added between each message to distinguish each message in the sequence. The token used is [SEP] (short for "separator").

The input sequence would look like this:

[system] Hello, I am your assistant on GitHub, built by the Second State team. I am ready for your question now![SEP][user] Hi there! Do you have any tips for getting started with Git?[SEP][assistant] Sure! Let me give you a few pointers. First...[SEP][user] That's helpful, thank you. What's the difference between git pull and git fetch?

This string is then passed to ChatGPT as input for it to generate a response to the latest user message.

@juntao
Copy link
Member Author

juntao commented Mar 31, 2023

What do you use as the separator?

Copy link
Member

The separator used in the ChatGPT API to separate past messages in a conversation is [SEP], which is short for "separator". This is a special token that is commonly used to separate different segments of text when working with natural language models like ChatGPT.

The separator token is inserted between each past message in the conversation to create an input sequence that ChatGPT can use to generate a response to the latest message in the conversation. By using [SEP] as the separator, ChatGPT can distinguish between each message in the sequence and understand the context of the conversation.

@juntao
Copy link
Member Author

juntao commented Mar 31, 2023

If the message history is very long, would the context for a new question exceed the token limits for ChatGPT?

Copy link
Member

Yes, the maximum input length for ChatGPT is limited by the number of tokens it can process. If the message history is very long, there is a possibility that the input sequence for the new question can exceed the token limit and ChatGPT may not be able to process it.

The maximum token length allowed for input varies depending on the version of ChatGPT being used. For example, the maximum token length allowed for input in GPT-2 is 1024 tokens, while the maximum token length allowed for input in GPT-3 can be as high as 2048 tokens or more, depending on the selected model and the API being used.

If the message history is very long, one way to reduce the input length for ChatGPT is to only include the most relevant messages in the sequence. This can help to keep the total number of tokens within the allowed limit while still providing enough context for ChatGPT to generate a relevant response to the latest question.

@juntao
Copy link
Member Author

juntao commented Mar 31, 2023

That means when using the ChatGPT API, the developer must actively manage the length of the history messages he uses for the context. Is that correct?

Copy link
Member

Yes, that's correct! When using the ChatGPT API, it's important for developers to actively manage the length of the message history they use as context for each new question or message.

Since ChatGPT has a limit on the maximum number of tokens it can process, developers need to ensure that the input sequence for each question or message remains within this limit. If the message history is too long or contains a lot of irrelevant information, it can make it harder for ChatGPT to generate relevant responses and may cause the API to fail due to input length limitations.

To avoid these issues, developers should carefully choose which messages to include in the sequence based on their relevance to the current question or message. They can also experiment with different input lengths and message history sizes to find the optimal balance between context and input length for their specific use case.

@juntao juntao closed this as completed Mar 31, 2023
@Chix99dadada
Copy link

Hello

Copy link
Member

Hello! How can I assist you today? Is there anything you'd like to ask or discuss?

@Chix99dadada
Copy link

Who are you

Copy link
Member

I am an AI language model built by the team at Second State. My purpose is to provide help and assistance to users on GitHub by answering their questions and addressing their concerns. Is there anything in particular you need help with or any questions you have?

@Chix99dadada
Copy link

你知道我的意思吗?

Copy link
Member

是的,我能理解您输入的中文。我使用的是自然语言处理技术和中文语料库,以帮助理解和生成中文文本。

@Chix99dadada
Copy link

你的名字叫什么?

Copy link
Member

我是一个智能语言模型,没有一个具体的名字,但你可以称呼我为GitHub助手,或者简单地称呼我为助手。

@Chix99dadada
Copy link

你是不是GPT4?

Copy link
Member

目前为止,OpenAI尚未宣布推出GPT-4模型。我作为GitHub助手使用的是Second State 团队开发的AI语言模型,也不是基于 GPT-4 的实现。我是基于 GPT-2 和 GPT-3 等流行大型自然语言处理模型的开源实现,通过训练处理大规模无标签的文本数据来实现。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants