How LLMs Work: A Beginner's Guide to AI Prompts in GenerativeAI
Learn how large language models work and why prompts matter. Plain-English intro to LLMs for beginners - no technical background needed.
Picture this: you walk into a huge library that holds every book in every language. A friendly librarian waves and says, “Tell me what you want, and I will try my best to answer.” If you mumble something like “just tell me stuff about space,” the answer will be random. If you ask with care, you get a useful reply.
Large language models are like that librarian. They read your request, guess what comes next, and answer with words that follow your words. Your request is called a prompt. Good prompts make the model helpful, while vague prompts make the model guess.
What is an LLM?
A Large Language Model (LLM) is an AI system trained on massive amounts of text that can understand and generate human language. ChatGPT, Claude, and Gemini are all LLMs. A prompt is the instruction you give an LLM - and how well you write that prompt is the single biggest factor in the quality of your results.
In this first lesson of the Prompt Engineering Course, we build a simple picture of how this works. No fancy words or tricks, just a clear and easy-to-follow guide you can start using in your daily work.
👋 Julley, I’m Dheeraj and I’m an AI systems builder.
I build production-grade AI systems at work by day and ship my own products by night (9+). This newsletter is the bridge between those two worlds. Every system, every build, documented step by step.
Join 1,100+ builders getting the exact AI setups, prompts, and production configs that actually work in your business.
Prompt Engineering Course - Complete Series
How LLMs Work: A Beginner’s Guide to AI Prompts ← You are here
Get Reliable JSON from LLMs: Structured Output Prompting Guide
What Is an LLM (and Why Should You Care)?
An LLM (Large Language Model) is a Generative AI model that learned from enormous amounts of text. It learned patterns in how words appear together. When you type a message, the model predicts the next token again and again until it builds a full answer.
This is not magic. It is pattern recognition at a massive scale. The model has read more text than any human ever could, and it uses those patterns to respond to your prompt in a way that sounds natural and helpful.
ChatGPT, Claude, and Google Gemini are all LLMs. They each have different strengths, but they all work on this same core idea: predict the next piece of text based on everything that came before it.
Why does this matter for you? Because once you understand how an LLM reads your input, you can structure your prompts to work with those patterns rather than against them. That is the whole game.
What Are Tokens - And Why They Matter
A token is a tiny piece of text, think of it like a Lego brick. Some tokens look like full words, some look like parts of a word, and some are just punctuation marks or spaces. The model places these tiny bricks one by one to build sentences.
Here is a rough rule of thumb: 1,000 words is approximately 750 tokens. But that varies by language and by model. The important thing to understand is that everything - your prompt and the model’s response - gets measured in tokens.
This matters for two reasons:
Cost: Most AI APIs charge per token. Longer prompts cost more.
Context window: The model can only hold a certain number of tokens in memory at once. When that fills up, older parts of the conversation slide off. Keep prompts short and focused so the answer has room to breathe.
Important: The model never remembers anything between different conversations. Each time you start a new chat, it is like meeting the model for the first time. There is no ongoing memory unless you explicitly build one (which we cover later in the course when we get to RAG and agent memory).
How an LLM Reads Your Message
The model keeps your current conversation in short-term memory called the context window. Think of it like a notepad with limited space. When the notepad fills up, old messages slide off the top.
This is why shorter prompts work better - they use less space and leave more room for the answer. It is not just about cost. It is about giving the model enough room to think and respond well.
You control how much the model writes by setting a max output length. If the answer cuts off, you can ask it to continue, but the goal is to guide the model so it finishes in one go.
Here is the key habit: do not paste giant blocks of text unless needed. Give only the parts the model must read to do the job. This is called good context management.
The Six Parts of a Great Prompt
A prompt in Generative AI is the message that guides the model. Think of it as a note to the librarian. There are six helpful parts:
Role: Who should the model pretend to be? A teacher, editor, planner, or content creator.
Task: What should be done? Summarize, rewrite, compare, or plan.
Context: Any facts the model needs? Notes, data, or short passages.
Rules: Do this, do not do that. Keep it short, use simple words, cite sources if given.
Examples: Show the model what kind of output you want. This means giving it one or two sample inputs with the type of answer you expect. We dive deeper into this technique (called few-shot prompting) in a later lesson in this course.
Format: Tell the model how to shape the answer. Paragraphs, bullet list, JSON, or table.
Quick tip: The order matters. Put the most important parts first, make rules clear, and keep the whole thing short. Remove any kind of fluff.
Vague vs. Clear Prompts: The Difference in Practice
The model follows patterns, so small changes can push it in a new direction. Look at this example:
Vague Prompt: Write about photosynthesis.
Likely result: A long and generic school note.Clear Prompt: Act as a science teacher for grade five. Explain photosynthesis in four short paragraphs. Use simple words. Start with a one-line summary. End with three key facts as a bullet list.
Likely result: A tight and friendly lesson that matches your needs.Same topic. Completely different result. The real difference is the prompt.
Why AI Sometimes Makes Things Up
This is the question everyone asks eventually: why does AI give wrong answers with such confidence?
The answer comes back to how LLMs work. They predict what text should come next based on patterns - they do not verify truth. They do not search the web (unless you are using a tool-equipped version). They do not check facts against a database. They generate the most statistically likely continuation of your prompt.
When the model does not have reliable information on a topic, it sometimes generates plausible-sounding text that is simply wrong. This is called hallucination.
Some practical safety tips to work around this:
Treat the model like a helpful assistant, not an all-knowing expert. Ask “What are the general risks of cryptocurrency investing that financial experts talk about?” rather than “Should I invest my life savings in cryptocurrency?”
Give it clear tasks with boundaries. “What are common causes of chest pain that doctors typically consider?” is safer than “Diagnose my chest pain.” For anything medical, legal, or financial, always follow up with a real professional.
Ask for sources when they matter. Some model versions can cite sources or acknowledge uncertainty. Use that.
If the answer seems wrong or unsafe, stop and rethink the task. The model predicts patterns from text - it does not verify truth or legality.
Later in this course, we will learn strong prompts that ask for sources and set refusal rules for low-confidence answers.
Knowing the 6-part prompt framework is step one. Without ready-made prompts built on that structure, most people still spend 20-30 minutes per session rewriting vague attempts before getting output worth using.
PluggedIn members get the Prompt Engineering Mastery Bundle inside - 55+ prompts across 7 use cases, built on exactly this framework.
A Full Prompt That Pulls the Parts Together
Here is a complete prompt template you can reuse right now. Copy this and fill the blanks:
Role: You are a helpful [role].
Task: Do [verb] for [audience]. The topic is [topic]. The goal is [goal].
Rules: Use simple words. Keep it under [limit]. Include [must have items]. Ask one question if unclear and the task is complex.
Format: Return the answer as [format and sections].Here is what that looks like in practice:
System role: You are a clear writing coach. You explain ideas in plain language. You prefer short sentences.
User task: I will paste a messy paragraph about solar power. Clean it, keep all facts, and use simple words. Keep it under one hundred and fifty words. Ask one question first if anything is unclear. Return the final answer after the question. Use two sections named Question and Answer.This prompt sets a role, a task, rules, and a format. It even allows one clarifying question. Short, direct, and useful.
The Three-Step Fix for Any Weak Prompt
You can improve almost any prompt for models like ChatGPT, Claude, or Google Gemini by doing three things:
Step 1: Name the role. This sets style and intent.
Step 2: State the task with a verb. Summarize, compare, plan, rewrite, or check.
Step 3: Set rules and format. Word count, tone, structure, and output style.
Before and after:
Vague Prompt: Help me write a vacation plan.
Clear Prompt: Act as a travel planner for a family with two kids aged eight and ten. Create a three-day plan for Washington DC. Include morning and afternoon blocks. Keep daily walking under five miles. Add one indoor option for rain each day. Return the plan as a simple table with columns: Time Block, Place, Activity, Notes.Four Common Mistakes (And How to Fix Them)
Mistake 1: Prompt is vague and long. Fix: Cut fluff, state the task with a verb, add one or two rules, then stop there.
Mistake 2: No audience is set. Fix: Say who the reader is by specifying age, role, or skill level.
Mistake 3: No format is given. Fix: Ask for a structure like bullets, table, JSON, or clear sections.
Mistake 4: Too many goals in one ask. Fix: Split into small steps. First plan, then draft, then polish. (This becomes its own lesson - see the Plan-Draft-Critique method.)
Writing Prompts That Actually Work
In the next lesson, we will learn controls like temperature and top-p. These settings change how creative or cautious the model is. For now, stick with defaults and focus on the prompt. Clear prompts beat random tweaks every time.
Use this “good prompt” checklist before you hit send:
Is the task a single clear verb?
Did you set a role?
Did you name the audience?
Did you include only the facts that matter?
Did you set rules like length and tone?
Did you set a format?
Is the whole thing short and direct?
If you can answer yes to most items, your prompt is ready.
Key Takeaways
Large Language Models predict the next token and build answers one piece at a time - they do not “understand” language the way humans do
A prompt guides the model with role, task, context, rules, examples, and format
Order matters, and short prompts leave more room for better answers
Small wording changes can shift results significantly
Always set the audience and the format
The model never remembers between conversations - each session starts fresh
Hallucination happens because LLMs predict plausible text, not verified facts
Use the prompt checklist to catch common mistakes
Frequently Asked Questions
What is a large language model in simple terms?
An LLM is an AI that learned language patterns by reading billions of pages of text. When you type a prompt, it predicts the most helpful response based on those patterns, one token (word piece) at a time. Think of it as an extremely well-read assistant that generates answers word by word - not by looking things up, but by recognizing patterns.
What are tokens in AI language models?
Tokens are the small pieces of text that LLMs use to process language. A token might be a full word, part of a word, or a punctuation mark. Roughly 1,000 words equals around 750 tokens. Your prompt and the model’s response both count against the model’s context window limit.
Why does AI give different answers to the same question?
LLMs use a setting called temperature that adds controlled randomness to responses. At lower temperatures, the AI picks the most probable next word almost every time. At higher temperatures, it considers less likely words too. This is why you get creative variation - and also why factual tasks should use lower temperature. See the full explanation in our LLM settings guide.
How does ChatGPT understand my questions?
ChatGPT breaks your text into tokens, processes them through layers of pattern matching, and generates a response token by token. It does not look up answers in a database. It recognizes patterns from training on vast amounts of text and uses those patterns to generate what comes next.
What makes a good prompt for AI?
A good prompt is specific, provides context, and clearly states what you want. Instead of “write about marketing,” try “write 3 LinkedIn post ideas for a solo consultant who helps small businesses with SEO.” Specificity drives quality because it narrows the pattern space the model works within.
How do I write better prompts for AI?
Follow the three-step formula: (1) Name the role - who should the model be? (2) State the task with an action verb - summarize, compare, rewrite. (3) Set rules and format - word limit, tone, output structure. That structure alone will immediately improve your results compared to vague, open-ended requests.
Get PluggedIn
Stop rebuilding your prompts from scratch every time you open a new chat.
You will keep spending 20-30 minutes per session rewriting vague prompts instead of running a tested one on the first try.
Get PluggedIn to go from knowing the framework but still guessing at each prompt, to opening a niche-specific prompt pack and getting usable output in 60 seconds
What’s inside the Prompt Engineering Mastery Bundle:
Complete 9-lesson ebook (PDF)
7 niche-specific prompt packs (55+ prompts):
Customer support automation
Content creation on a budget
Client proposals & SOWs
Research & analysis
Email & communication
Sales & lead nurture
Operations & SOPs
What’s Next
You now have a simple picture of how prompts guide an LLM. You know the parts that matter, you have a checklist, and you have practice tasks. In the next lesson, we will learn how AI model settings shape these results. You will see how temperature and other controls affect style and accuracy. You will get simple recipes you can reuse.
For now, keep your prompts short, clear, and to the point. Think of the librarian: ask well, get good answers.







Amazing content, Dheeraj! I'm eager to learn more about AI Prompt Engineering from you.