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

[Request] Gemini 模型现在已经支持 system role prompt(systemInstruction) #2553

Open
m-guo opened this issue May 18, 2024 · 15 comments
Labels
🌠 Feature Request New feature or request | 特性与建议

Comments

@m-guo
Copy link

m-guo commented May 18, 2024

🥰 Feature Description

现在官方SDK已经支持“System Instructions”设定 system role的prompt

🧐 Proposed Solution

希望可以添加该特性,Gemini 在中文某些方面的训练预料明显优于其他模型

📝 Additional Information

No response

@m-guo m-guo added the 🌠 Feature Request New feature or request | 特性与建议 label May 18, 2024
@lobehubbot
Copy link
Member

👀 @m-guo

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@arvinxx
Copy link
Contributor

arvinxx commented May 18, 2024

现在的 system message 是会作为 role=user 注入的,理论上也是有 instruction 的效果。

你能给出相同 prompt 下,按照 system Instruction 来改的话,效果会比 role=user 好的案例吗?

不然感觉改了好像意义不大

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The current system message will be injected as role=user, which theoretically also has the effect of instruction.

Can you give an example of how the effect will be improved if it is modified according to the system instructions? Otherwise, it feels like the change doesn’t mean much.

@m-guo
Copy link
Author

m-guo commented May 19, 2024

这个对个人来说很难验证吧,严格的证明需要跑大量的case。

个人认为既然 Gemini 提供的这个参数他们肯定会对使用这个参数的输出做优化吧,不仅仅是对齐其他AI厂商的API。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This is difficult for individuals to verify. Strict proof requires running a large number of cases.

Personally, I think that since Gemini provides this parameter, they will definitely optimize the output using this parameter, not just align it with the APIs of other AI manufacturers.

@arvinxx
Copy link
Contributor

arvinxx commented May 19, 2024

这个对个人来说很难验证吧,严格的证明需要跑大量的case。

你只要给出几个你自己用的 case ,能给我证明是效果更好的即可。如果你自己用下来都没啥区别,那我也没有改的必要对吧

个人认为既然 Gemini 提供的这个参数他们肯定会对使用这个参数的输出做优化

不一定,gemini 本身吹的天花乱坠,但我实测下来效果拉的一批。 Google 在大模型领域挺草台的,还是得看实际效果

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This is difficult for individuals to verify. Strict proof requires running a large number of cases.

You just need to give a few cases that you use yourself and prove to me that it is more effective. If you don’t see any difference after using it yourself, then there’s no need for me to change it, right?

@muamua33
Copy link

muamua33 commented May 20, 2024

将提示词放入系统角色和放入用户角色会对结果产生显著不同的影响。系统角色用于设定对话的整体基调和模型的行为,而用户角色用于提出具体问题或请求信息。根据具体需求选择合适的角色来放置提示词,可以更好地控制生成的结果。

根据gpt-4o的回复,系统角色和用户角色对大模型的影响是不同的,gemini即使差到比不过国内大模型,它提供了参数,现在看不出来,也会在以后参数影响,作者现在不该不强求,但建议标记成待开发

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


In the OpenAI API, putting prompt words into the system role and putting them into the user role will have significantly different effects on the generated results. Here are the main differences between the two:

1. **System Role**:
   - **Definition and Purpose**: System roles are used to set the behavior and tone of the model. It is often used to provide background information or set the overall tone of the conversation.
   - **Impact**: The prompt words of the system role will affect the context of the entire dialogue and the way the model behaves. For example, if the system role prompt is "You are a friendly assistant," the model will maintain a friendly and helpful tone throughout the conversation.
   - **Usage Scenarios**: Suitable for scenarios where you need to set the conversation style, tone or provide background information.

2. **User Role**:
   - **Definition and Purpose**: User roles are used to simulate user input or questions. It is typically used to ask questions or request information directly from the model.
   - **Impact**: The prompt words of the user role will be regarded by the model as input that requires direct response. For example, if the user role prompt is "Tell me about today's weather," the model will directly try to answer that question.
   - **Usage Scenarios**: Suitable for scenarios where you need to obtain information directly or answer specific questions.

### Example comparison

**System role prompt words**:
```json
{
  "role": "system",
  "content": "You are a knowledgeable assistant who is good at answering technical questions."
}

User role prompt words:

{
  "role": "user",
  "content": "Please explain the basic principles of quantum computing."
}

In this example, the system role cue words set the model's behavior and tone, making it appear knowledgeable and professional throughout the conversation. The user role prompt word is a specific question, and the model will directly try to answer this question.

Difference in results

  • System role prompt words will affect the tone of the entire conversation and the way the model behaves, but will not directly generate specific answers.
  • User role prompt words will be regarded by the model as input that requires direct response and generate specific answers.

Summarize

Putting the prompt words into a system role and putting them into a user role can have a significantly different impact on the results. System roles are used to set the overall tone of the conversation and the behavior of the model, while user roles are used to ask specific questions or request information. Choosing the right character to place your prompt words based on your specific needs gives you more control over the generated results.


According to gpt-4o's reply, system roles and user roles have different impacts on large models. Even if gemini is so bad that it cannot compare with domestic large models, it provides parameters that cannot be seen now and will affect the parameters in the future. The author is now It’s not mandatory, but it’s recommended to mark it as pending development.  
      

@arvinxx
Copy link
Contributor

arvinxx commented May 20, 2024

根据gpt-4o的回复,系统角色和用户角色对大模型的影响是不同的

这个就是最大的问题。比如 GPT 系列我之前自己测过, system Role 和 user message 的差异是挺大的。system role 对回答的影响能力会更大,那么我自然有动机做这个更新。

但是 Gemini 系列我目前并没有精力测试,所以只要你们给出一例用 system role 的效果比用 user message 好的,我自然愿意改。但如果你们日常在用 gemini 的情况下,都找不到设了 system role 比 user role 效果要好的 case 。为何我要在现在这个时间节点来做这件事呢?

或者如果有人愿意 PR 我举双手欢迎。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


According to gpt-4o's reply, the impact of system roles and user roles on large models is different

This is the biggest problem. For example, I have tested the GPT series myself before, and the difference between system Role and user message is quite big. The system role will have a greater impact on the answer, so I am naturally motivated to make this update.

But I don’t have the energy to test the Gemini series at the moment, so as long as you give an example where using system role is better than using user message, I will naturally be willing to change it. But if you use gemini every day, you will not find a case where system role is better than user role. Why should I do this at this time?

Or if anyone wants to PR I welcome it with both hands.

@muamua33
Copy link

根据gpt-4o的回复,系统角色和用户角色对大模型的影响是不同的

这个就是最大的问题。比如 GPT 系列我之前自己测过, system Role 和 user message 的差异是挺大的。system role 对回答的影响能力会更大,那么我自然有动机做这个更新。

但是 Gemini 系列我目前并没有精力测试,所以只要你们给出一例用 system role 的效果比用 user message 好的,我自然愿意改。但如果你们日常在用 gemini 的情况下,都找不到设了 system role 比 user role 效果要好的 case 。为何我要在现在这个时间节点来做这件事呢?

或者如果有人愿意 PR 我举双手欢迎。

gemini用的少,主要是用gpt4,看到这个issue就回复了一下,也许什么时候转用gemini时可以帮忙提pr,但目前没动力

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


According to gpt-4o's reply, the impact of system roles and user roles on large models is different.

This is the biggest problem. For example, I have tested the GPT series myself before, and the difference between system Role and user message is quite big. The system role will have a greater impact on the answer, so I am naturally motivated to make this update.

But I don’t have the energy to test the Gemini series at the moment, so as long as you give an example where using system role is better than using user message, I will naturally be willing to change it. But if you use gemini every day, you will not find a case where system role is better than user role. Why should I do this at this time?

Or if anyone wants to PR I welcome it with both hands.

Gemini is rarely used, mainly gpt4. I replied to this issue when I saw it. Maybe I can help with PR when I switch to gemini, but I have no motivation at the moment.

@arvinxx
Copy link
Contributor

arvinxx commented May 20, 2024

@muamua33 我也一样,主力 claude + gpt4 。 claude 的 systemRole 我早做掉了。 Gemini 就是太拉了,完全没有动力给他去适配 🤷‍♂️

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@muamua33 Me too, main claude + gpt4. I have already done away with claude's systemRole. Gemini is just too stretched, there is no motivation to adapt it 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌠 Feature Request New feature or request | 特性与建议
Projects
None yet
Development

No branches or pull requests

4 participants