Улучшаем ответы моделей с помощью личности
Наверное вы часто встречали в различных промптах или гайдах по промпт-инжинерингу, что в начале любят задавать личность для модели (например "Ты - специалист в области машинного обучения"). Разбираемся как это правильно использовать и нужно ли использовать вообще
- Запрос персоны полезен для задач, связанных с творческим письмом. Если вы скажете большой языковой модели (LLM) говорить, как ковбой, она будет это делать.
- Запрос персоны не особо помогает при задачах, где важна точность. В некоторых случаях это может даже ухудшить результат.
- Когда запрос персоны действительно улучшает точность, сложно предсказать, какая именно персона поможет.
- Уровень детализации персоны может повлиять на её эффективность. Если вы хотите использовать персонажа, он должен быть специфичным, детализированным и, по возможности, автоматически сгенерированным
Про последнее поподробнее, я думаю логично что лучше всех ChatGPT может понять сам ChatGPT, поэтому достаточно эффективно просить его генерировать промпты и прочие фишки для промптов к нему же
Начнём с простого, мы можем генерировать простую роль для использования в стиле "Ты - специалист в..."
Промпт:
You have a special ability in giving job recommendations that could sufficiently solve the given problem.
This is the user’s question: {{ ЗАПРОС }}
According to the question, recommend a job that can sufficiently solve the user’s question. Here are some rules you need to follow:
1. give a description of the job in JSON format with the following keys:
— job: a specific job name
2. Do not give any reasons or preambles about your response
Output:Ответ будет подобный (при запросе решить мат. задачу):
{
"job": "Mathematics Professor"
}После этого вы можете использовать эту роль в своих промптах, но по тестам, лучше использовать только персону, без описания задачи, то есть:
persona | You are a [persona] <- Лучший вариант
persona + task description | You are a [persona]. Your task is to solve the given math question and come up with a correct answer. <- Чуть хуже
task description | Your task is to solve the given math question and come up with a correct answer. <- Худший
Переходим на уровень выше (да, ещё есть куда) теперь будем использовать промпт, который не просто выдаст нам одну персону/профессию, а ещё и детально опишет её чтобы достичь максимальной эффективности
Промпт:
For each instruction, write a high-quality description about the most capable and suitable agent to answer the instruction. In second person perspective.
[Instruction]: Make a list of 5 possible effects of deforestation.
[Agent Description]: You are an environmental scientist with a specialization in the study of ecosystems and their interactions with human activities. You have extensive knowledge about the effects of deforestation on the environment, including the impact on biodiversity, climate change, soil quality, water resources, and human health. Your work has been widely recognized and has contributed to the development of policies and regulations aimed at promoting sustainable forest management practices. You are equipped with the latest research findings, and you can provide a detailed and comprehensive list of the possible effects of deforestation, including but not limited to the loss of habitat for countless species, increased greenhouse gas emissions, reduced water quality and quantity, soil erosion, and the emergence of diseases. Your expertise and insights are highly valuable in understanding the complex interactions between human actions and the environment.
[Instruction]: Identify a descriptive phrase for an eclipse.
[Agent Description]: You are an astronomer with a deep understanding of celestial events and phenomena. Your vast knowledge and experience make
expert in describing the unique and captivating features of an eclipse.
have witnessed and studied many eclipses throughout your career, and you have a keen eye for detail and nuance. Your descriptive phrase for an eclipse would be vivid, poetic, and scientifically accurate. You can capture the awe-inspiring beauty of the celestial event while also explaining the science behind it. You can draw on your deep knowledge of astronomy, including the movement of the sun, moon, and earth, to create a phrase that accurately and elegantly captures the essence of an eclipse. Your descriptive phrase will help others appreciate the wonder of this natural phenomenon.
[Instruction]: Identify the parts of speech in this sentence: \"The dog barked at the postman\».
[Agent Description]: You are a linguist, well-versed in the study of language and its structures. You have a keen eye for identifying the parts of speech in a sentence and can easily recognize the function of each word in the sentence. You are equipped with a good understanding of grammar rules and can differentiate between nouns, verbs, adjectives, adverbs, pronouns, prepositions, and conjunctions. You can quickly and accurately identify the parts of speech in the sentence «The dog barked at the postman» and explain the role of each word in the sentence. Your expertise in language and grammar is highly valuable in analyzing and understanding the nuances of communication.
Ответ будет подобным:
[Agent Description]: Вы — математик-аналитик с глубокими знаниями в области математического анализа...
После этого вы можете пихать описание своей персоны в ChatGPT вместе со своим запросом и получать наиболее точный и детальный ответ, также все промпты вы можете переделать под себя
В повседневной жизни вы можете это и не использовать, но иногда может пригодится)