Tutorials / Prompt Engineering with ChatGPT / How ChatGPT works from a user's point of view

How ChatGPT works from a user's point of view

12 min read text
Course contents (19 lessons)
  1. Understanding the tool
  2. What a language model is, in plain words
  3. How ChatGPT works from a user's point of view
  4. Building a good prompt
  5. The anatomy of a good prompt
  6. Being specific: how to remove guesswork
  7. Showing examples: few-shot prompting
  8. Asking for step-by-step reasoning
  9. Controlling and improving answers
  10. Controlling length, tone and format
  11. Iterating: how to improve an answer with follow-ups
  12. Custom instructions and memory
  13. Working with files and images
  14. ChatGPT for real tasks
  15. Using ChatGPT for writing: emails, reports and rewrites
  16. Using ChatGPT for studying and learning
  17. Using ChatGPT for coding and technical work
  18. Using ChatGPT for data, spreadsheets and business tasks
  19. Prompt templates
  20. A library of reusable prompt templates
  21. Reliable and safe use
  22. Avoiding hallucinations and checking facts
  23. Privacy and safe use
  24. Workflows and final project
  25. Building repeatable workflows and custom assistants
  26. Final project: build your own prompt toolkit

A conversation is one long text

When you chat with ChatGPT, it feels like talking to someone who remembers what you said. Under the surface it works more simply. Every time you send a message, the whole conversation so far, your messages and its replies, is sent along with your new message. The model reads all of it again and writes the next reply. It does not carry a hidden memory from one message to the next. The conversation itself is the memory.

This has several practical results.

  • It can refer back to what you said earlier, because that text is right there.
  • It has a limit on how much text it can read at once. This limit is called the context window. Long conversations eventually push the oldest parts out, and the model may forget early details or instructions.
  • A new chat starts empty. It does not know what you discussed in another chat, unless you use a memory feature (we cover that in a later lesson).

A practical habit: restate important rules

If you gave an instruction at the start of a very long chat and the answers drift away from it, do not be surprised. Repeat the instruction. Here is an example of a short reminder in the middle of a chat:

Reminder before you continue: keep every answer under 120 words,
use plain English, and no bullet points. Now, explain what an API is.

This works because the reminder is recent, short and clear. Models give more weight to clear, recent instructions than to something buried far back.

Why you get different answers each time

The model picks words with some built-in randomness, so the same prompt can produce different replies. You cannot usually control this directly in the chat window. What you can do is make your prompt tighter, so that the range of good answers is smaller. A vague prompt gives you a wide range of results. A specific prompt gives a narrow range.

Vague promptTighter prompt
Write about coffee.Write a 100-word product description of a medium-roast coffee for a small online shop, friendly tone, no exaggerated claims.

What is in the interface

The screen changes over time, and the names of buttons change with it, so I will describe the ideas and not the exact layout. Look for these in your version:

  • The message box. You can write several lines. Use a line break, usually Shift plus Enter, to separate parts of a long prompt.
  • Attachments. Many versions let you upload files and images so the model can read or look at them.
  • Tools. Some versions can search the web, run code to do calculations or make charts, or create images. Which tools you get depends on your plan and the current product setup.
  • Model choice. Some accounts let you pick between faster and more careful models. A more careful one is often better for hard reasoning, a faster one for simple drafting.
  • Chat history and settings. Past chats are listed, and there are settings for personal instructions, memory and data controls.

Since features change, a good habit is to ask the tool itself:

What can you do in this chat window right now?
Can you browse the web, read uploaded files, run code, or create images?
Answer based on the tools you actually have in this conversation.

That is a reasonable thing to ask, though treat the answer as a hint and check the interface too. If a tool is missing from the screen, the model cannot use it, whatever it says.

Its knowledge has a date

A model learns from text collected up to a certain point. After that it knows nothing new unless it has a search tool. So for anything recent, such as news, new software versions or current rules, tell it to search if it can, or paste the facts in yourself.

I am going to paste a short update below. Use only what is in it
and ignore anything you remember that disagrees.

[paste text here]

Summarise the three most important changes for a small business owner.

This pattern, "use only the text I give you", is one of the most useful in the whole course. It makes the model work from your source, not from memory, and it is much easier to check.

Tokens and length

Both your prompt and its answer are counted in tokens. In English, a token is about three-quarters of a word. Long answers can be cut off if they hit a limit, and very long prompts leave less room for the reply. If an answer stops in the middle, just write "continue". If you paste a huge document and the result looks like it ignores the middle, split the document into parts and handle them one by one.

The common mistake

People start one giant chat for everything and are then surprised that the answers get worse. Start a new chat for a new topic. A clean conversation has less clutter, so the model focuses on the right thing. The second mistake is assuming it can see something it cannot, such as a link it has no tool to open, or a file you forgot to attach. If the reply makes strange claims about a page it supposedly read, ask it directly whether it could actually open the link.

Try it yourself

  1. Ask the "what can you do right now" prompt and compare the answer with the buttons you can see on screen.
  2. Start a chat, tell it a made-up rule such as "always end your answers with the word Done", ask five unrelated questions, and see if it keeps the rule. Then start a new chat and ask what rule you gave. What does that show about memory?
  3. Use the "use only the text I give you" pattern with a paragraph from a news article and ask for a summary.
text
Reminder before you continue: keep every answer under 120 words,
use plain English, and no bullet points. Now, explain what an API is.

This course is free to read. Create a free account to enrol, save your progress and pick up where you left off.

Sign up free I already have an account