Files
ALwrity/lib/prompts/README.md

4.8 KiB

Prompting settings for LLMs

Model: Choose which LLM model to use. Different models have different strengths and weaknesses. For example, some models are better at generating creative text formats, while others are better at answering questions in an informative way.

Temperature: The temperature setting controls how creative and varied the text the LLM generates is. A higher temperature setting will result in more creative and varied text, but it may also be less accurate. A lower temperature setting will result in more accurate text, but it may also be less creative and varied.

Top P: The top P setting controls how likely the LLM is to generate the most likely words. A higher top P setting will result in more predictable and grammatically correct text, but it may also be less interesting. A lower top P setting will result in more interesting and creative text, but it may also be less predictable and grammatically correct.

Frequency penalty: The frequency penalty setting controls how likely the LLM is to generate words that are common in the text it is trained on. A higher frequency penalty setting will result in less repetitive text, but it may also be less fluent. A lower frequency penalty setting will result in more fluent text, but it may also be more repetitive.

Presence penalty: The presence penalty setting controls how likely the LLM is to generate words that are already present in the prompt. A higher presence penalty setting will result in more creative text, but it may also be less relevant to the prompt. A lower presence penalty setting will result in more relevant text, but it may also be less creative.

These settings can help you get better results from LLMs, depending on what you are trying to do. For example, if you are trying to generate a creative poem, you might want to use a higher temperature setting and a lower presence penalty setting. If you are trying to get an answer to a technical question, you might want to use a lower temperature setting and a higher presence penalty setting.

Experiment with the different settings to see what works best for you.

Components of a prompt

Instruction: The specific task or instruction that you want the LLM to perform. For example, you might want it to generate a poem, translate a sentence, or answer a question.

Context: External information or additional context that can help the LLM to better understand your request and generate a better response. For example, if you are asking the LLM to generate a poem, you might provide it with the topic of the poem or the style of poem that you want.

Input data: The input or question that you are asking the LLM to respond to. For example, if you are asking the LLM to translate a sentence, you would provide it with the sentence that you want translated.

Output indicator: The type or format of the output that you want the LLM to generate. For example, you might want the LLM to generate a poem, translate a sentence, or answer a question in a specific format.

You don't need to include all four of these components in a prompt, but the more information you can provide to the LLM, the better it will be able to understand your request and generate a good response.

Tips for prompting large language models

Be clear and concise in your prompt. The LLM should be able to understand exactly what you are asking it to do.

Provide context for your prompt. This can help the LLM to generate a better response. For example, if you are asking the LLM to write a poem, you might provide it with the topic of the poem or the style of poem that you want.

Break down complex tasks into smaller steps. This can help the LLM to better understand what you are asking it to do and to generate a more accurate response.

Use examples to illustrate your prompt. This can help the LLM to understand what you are asking for and to generate a more relevant response.

Test your prompts on different LLMs. Different LLMs have different strengths and weaknesses, so some prompts may work better with certain LLMs than others.

Additional tips:

  • Use the right model. Different LLMs are better at different tasks. For example, some LLMs are better at generating creative text formats, while others are better at answering questions in an informative way.
  • Tune the prompting settings. There are a number of prompting settings that you can adjust to get better results from LLMs. For example, you can adjust the temperature setting to control how creative the LLM is, or the top P setting to control how likely the LLM is to generate the most likely words.
  • Experiment with different prompts. The best way to find out what works for you is to experiment with different prompts. Try different ways of phrasing your prompt and see what works best.