lm-sys / FastChat

An open platform for training, serving, and evaluating large language models. Release repo for Vicuna and Chatbot Arena.
Apache License 2.0
35.6k stars 4.38k forks source link

Is it possible to introduce a new system message in the middle of a conversation? #631

Closed vedantroy closed 1 year ago

vedantroy commented 1 year ago

It looks like the default template is as follows:

A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.###Human: What are the key differences between renewable and non-renewable energy sources?###Assistant: Renewable energy sources are those that can be replenished naturally in a relatively short amount of time, such as solar, wind, hydro, geothermal, and biomass. Non-renewable energy sources, on the other hand, are finite and will eventually be depleted, such as coal, oil, and natural gas. Here are some key differences between renewable and non-renewable energy sources:
1. Availability: Renewable energy sources are virtually inexhaustible, while non-renewable energy sources are finite and will eventually run out.
2. Environmental impact: Renewable energy sources have a much lower environmental impact than non-renewable sources, which can lead to air and water pollution, greenhouse gas emissions, and other negative effects.
3. Cost: Renewable energy sources can be more expensive to initially set up, but they typically have lower operational costs than non-renewable sources.
4. Reliability: Renewable energy sources are often more reliable and can be used in more remote locations than non-renewable sources.
5. Flexibility: Renewable energy sources are often more flexible and can be adapted to different situations and needs, while non-renewable sources are more rigid and inflexible.
6. Sustainability: Renewable energy sources are more sustainable over the long term, while non-renewable sources are not, and their depletion can lead to economic and social instability.
###Human:

Where there is a single system message at the start of the prompt. I'm wondering, is it possible to to have multiple system messages?

vedantroy commented 1 year ago

Also, when formatting an input for Vicuna, do I always need to have the entire input be on a single line. (Since, presumably, this is how Vicuna was trained?)

merrymercy commented 1 year ago

The template you mentioned is for vicuna-v0 (https://github.com/lm-sys/FastChat/blob/73ea04dec7832de68783a68a424d374c85e3a29d/fastchat/conversation.py#L142) For vicuna-v1.1, we use a different one https://github.com/lm-sys/FastChat/blob/73ea04dec7832de68783a68a424d374c85e3a29d/fastchat/conversation.py#L181

I think you can play with different prompts and see how they work. Vicuna is trained on its default template, but I guess sometimes LLMs can generalize to other prompts well.