Prompting Generative AI
Prompting Generative AI
Learn how an instruction requests an output, why small wording changes can reshape a response, and when to use zero-shot, one-shot, few-shot, character and structured reasoning prompts.
Explain cloud computing.
Cloud computing provides computing services over a network.
The Role of Prompts
A prompt is the instruction given by a user to a generative AI model. It tells the model what output is being requested. A prompt might ask for an explanation, summary, list, recommendation or creative response. The model uses the prompt as immediate context while its transformer also considers patterns learned from training data and the content generated so far.
To Request an Output
The prompt starts the interaction. Without a useful instruction, the model does not know the task, subject or expected form of the response.
- Task: what the model should do.
- Topic: what the response should discuss.
- Direction: details such as audience, tone or format.
- Output: the generated completion returned to the user.
Powering the Transformer
The transformer examines the prompt, connects it with learned patterns from training data, and considers each part of the response as it is generated. The prompt therefore guides predictions about what content should come next.
- The words in the prompt establish context.
- The transformer uses that context during generation.
- Each newly generated element becomes additional context.
- A different instruction can lead to a different output.
Refining Instructions for a Better Output
Prompt engineering is the art of altering and refining prompts to reach a desired or better-quality output. It is often iterative: the user reviews the response, notices what is missing or unsuitable, and rewrites the instruction with clearer direction.
A broad first prompt
“Explain cybersecurity.”
This requests an explanation but gives little direction about audience, length or focus.
A refined prompt
“Explain cybersecurity to a beginner in three short paragraphs and include one everyday example.”
The refined wording gives the model a clearer target.
Explain artificial intelligence to a beginner using three short bullet points.
Types of Prompts and Their Uses
Prompt types differ mainly in the guidance supplied to the model. Zero-shot provides no example, one-shot provides one example, and few-shot provides several. Character prompts define a viewpoint, tone or style. Structured reasoning prompts ask the model to work through a complex problem in stages. Select each type to compare its purpose and construction.
| Prompt type | Examples supplied | Main use | Key distinction |
|---|---|---|---|
| Zero-shot | None | A direct, basic task | The model receives an instruction but no demonstration. |
| One-shot | One | Show the expected pattern once | One example guides the desired form. |
| Few-shot | Several | Make a pattern clearer | Multiple examples provide stronger guidance. |
| Character | Not defined by examples | Set tone, style or viewpoint | Uses characteristics such as a character, time period or location. |
| Structured reasoning | May vary | Handle a multi-level problem | Requests a staged, organised solution. |
Prompt Pattern Builder
Choose a prompt type, enter a task and generate a model prompt. The lab shows how the same request can be framed with different kinds of guidance.
Remember the Distinctions
Instruction
A prompt requests an output and gives the transformer immediate context.
Refinement
Prompt engineering alters wording and direction to seek a desired or better output.
Number of Examples
Zero means none, one means one, and few means several examples.
Tone or Style
Characteristics can be based on a character, period or geographical location.
Complex Problems
A structured prompt breaks multi-level reasoning into organised stages.
Guidance, Not Guarantee
Clearer prompts can improve relevance, but generated output must still be checked.