Prompt crafting

How to craft prompts with clarity and relevance for more reliable results

Writing effective prompts is essential for obtaining high-quality results from the Large Language Model (LLM). Well-crafted prompts provide clear instructions to the LLM, ensuring it comprehends the proposed task and generates coherent outcomes.

Investing time and effort in crafting well-defined prompts minimizes the risk of generating evasive or irrelevant outputs. By improving the prompt quality, you enhance the model's ability to provide desired information, resulting in more valuable and accurate responses.

Elements of a prompt

Before we start exploring examples of good prompt engineering, note that prompts may include any of the following elements:

  • Instruction: Specific task or instruction that you want the model to execute

  • Context: Additional information that can guide the model towards better outcomes

  • Input data: Input or question for which we are interested in finding an answer

  • Output indicator: Desired type or format of the response that the cell will generate

Good practices

To maximize LLM resources and achieve the desired results. You can create effective prompts for various simple tasks using commands to instruct the model about what you want to achieve, such as Write, Classify, Summarize, Translate, Sort, etc.

We recommend you follow some effective prompt-crafting practices, as follows:

Be clear

A skillfully crafted prompt should be clear and precise, defining the task you want the LLM to perform. This includes providing information about the expected format of the response, relevant context, and any specific constraints. A clear prompt helps to avoid misunderstandings and undesired results.

For example, if you want the model to return a list of items, explicit that in the prompt. Be clear and concise.

Example:

❌ Instead of:

Generate options for summer footwear that can be used during the summer

✔️ Prefer:

Provide me with a list of shoes suitable for the summer season

Be specific

The LLM is trained on a wide range of data, allowing it to generate responses in various styles and levels of detail. By providing a specific prompt, you can effectively guide the model to produce a response that better aligns with your specific requirements.

Example:

❌ Instead of:

Suggest cheap shoe models for the summer

✔️ Prefer:

Provide me with a list of the top 10 summer shoes that are most suitable for the season. Additionally, suggest shoe models for each option that are priced under $200 dollars.

Note that the first prompt is not specific enough and can generate varied and unfocused responses. The model can interpret the task in different ways, leading to generic or even irrelevant answers. The lack of details or purpose can confuse the model and result in inaccurate or unsatisfactory output.

In the second prompt, there is a clear specification of the task and more details about format (list) and price (under $200). The model now has a clear direction and can generate a more precise response.

Last updated