New Jobs Simplified, AI University
← Back to courses

Prompts & Prompt Engineering

Prompt Basics & Structure

This lesson covers the basics of building effective prompts for Large Language Models (LLMs). We'll explore how to structure prompts to get improved results and understand the importance of breaking down complex tasks into smaller, manageable components. We'll also discuss how to use LLMs sequentially to get improved results.

Why It Matters

Understanding prompt basics and structure is crucial in the real world of AI because it enables us to solve complex problems by breaking them down into smaller, manageable tasks. This allows us to leverage the power of LLMs to generate high-quality results. By mastering prompt structure, we can automate tasks such as content creation, data analysis, and decision-making.

Key Points

A prompt is a prediction machine that tries to predict the words that might follow it based on a certain input.
The basic ingredients of a prompt are instruction, data, and output indicators, but it can be built up to be more complex.
Advanced components of a prompt can include things like parallel prompts, which create multiple prompts in parallel and merge them to get a final result.
LLMs can be chained together to get improved results by using the output of one LLM as the input for the next.
Breaking down complex tasks into smaller components allows us to use LLMs more effectively and get better results.
We can use a seven-step process to develop an ontology and knowledge base that allows us to reason about complex domains like digital circuits.
LLMs can forget what was being said in a conversation, so we need to use techniques like memory to help them remember.

Key Concepts

LLM

A Large Language Model that tries to predict the words that might follow it based on a certain input.

Prompt

A prediction machine that tries to predict the words that might follow it based on a certain input.

Instruction-based prompting

A technique for asking specific questions of an LLM to get a specific result.

Parallel prompts

A technique for creating multiple prompts in parallel and merging them to get a final result.

Memory

A technique for helping LLMs remember what was being said in a conversation.

Code Examples

Create a prompt template with the 'input_prompt' variable

template = "<s><|user|> {input_prompt}<|end|> <|assistant|>"

Create a chain for the character description using the summary and title

template = "<s><|user|> Describe the main character of a story about {summary} with the title {title}. Use only two sentences.<|end|> <|assistant|>"
From the books
“using LLMs sequentially to get improved results. Eventually, we will even build up to advanced reasoning techniques. The Potential Complexity of a Prompt As we explored in the intro to prompt engineer…”
“be in a prompt? The Basic Ingredients of a Prompt An LLM is a prediction machine. Based on a certain input, the prompt, it tries to predict the words that might follow it. At its core (illustrated in …”
“Figure 6-9 illustrates a number of use cases in which instruction-based prompting plays an important role. We already did one of these in the previous example, namely supervised classification. Figure…”

Quick Quiz

1. What is a basic ingredient of a prompt?

Instruction
Data
Output indicators
All of the above

2. What is a technique for creating multiple prompts in parallel and merging them to get a final result?

Chaining LLMs
Parallel prompts
Memory
Instruction-based prompting

3. Why do LLMs need help remembering what was being said in a conversation?

Because they are too slow
Because they are too complex
Because they forget
Because they are too simple