Skip to main content

Prompt Engineering

Key definition

A prompt is “a specific input or query provided to the large language model (LLM) to guide its response or generate desired output” (Hernández et al., 2024). Prompt engineering involves “optimizing textual input to effectively communicate with large language models” (Acar, 2023).  

Why is it important?

To more effectively get the output that matches your expectations from LLMs, there are considerations that you can give to crafting your prompts. Factors such as specifying context, dictating tone or formality levels, and being explicitly direct and clear all matter in the process of using prompts effectively to communicate with LLMs (prompt engineering) to get the output that you want.

Considerations and techniques when writing prompts

Context: By specifying the context that you want for the output, you can better match the output from the LLM to your academic needs. Context includes aspects such as intended audience, setting (e.g., workplace, professional settings) or even language level or complexity of concepts/ideas.

Clarity and conciseness of language: Being clear and direct in your choice of language is important when prompting. Word choice, particularly choice of instructive verbs (e.g., give, recommend, write, suggest), is an important consideration in the types of output that you will receive from the LLM.

Format: Specifying the format of your output (e.g., an annotated bibliography, a literature review) is an important consideration when prompting, especially for academic work, which tends to follow specific conventions or formats in terms of assignments. The more specific you can be on the format (e.g., word count, type of assignment), the more likely you are to end up with output meeting your needs.

Instruction giving/role: With most major LLMs at present, you can specify the role that GAI takes in your interactions. For instance, you can instruct GAI to take on the role of an instructor, tutor, or even a colleague or peer. You can also specify how information in outputs will be delivered to you (e.g., in small chunks/pieces, in stages) to better help determine how much information is given to you.

Common pitfalls and mistakes when writing prompts

Being too complex, unclear or vague: Using language to guide prompts that is overly complex or wordy, lacks clarity, or does not contain specific enough information to effectively guide a prompt can result in output that fails to meet your expectations. Please review some examples below to consider.

Not refining or “trying again”: Often, effective prompting requires multiple attempts to attain the output that you need. Iteration is an important part of prompt engineering. Try simplifying language or instructions, or adding more information as a first step. Please review some examples below of refining prompts.

Expecting too much: As discussed in this resource, there are limitations with LLMs in terms of their output. LLMs may “hallucinate” outputs, especially when the LLM is prompted to output information that it is not trained on or false. There is no guarantee that the prompt you craft will lead to information that is reliable, available, or accurate. Being aware of these limitations is important when engaging in prompting and the use of LLMs.

Information overload: Unless otherwise specified, LLMs can output a great deal of text or information. Learning to specify how much information you want is critical to having to avoid sifting through large amounts of information that may not be useable or relevant to you.

Examples

  • Context

    Vague prompt: Write a paragraph about why technology is important for learning.


    More refined prompt: Write a short academic paragraph about why technology is important for learning, using formal/academic language suited for a university.

  • Clarity and conciseness of language

    Vague prompt: Give me something about AI in post-secondary learning.


    More refined prompt: Write down some suggestions about how AI can be utilized in post-secondary learning.

  • Format

    Vague prompt: Write a sample essay about applications for AI in healthcare systems.


    More refined prompt: Write a sample 4-page academic essay that takes a position supporting the value of AI in modern healthcare systems.