Level 7 · Artificial Intelligence and Intelligent Automation · Course 7.1 Foundations

Module 82: Large Language Models

Goal: understand how large language models work underneath: how they read text as tokens, how they're trained and then used, what transformers and attention do, how much they can hold in mind at once, and why their answers are uncertain.

You'll need: your ai-plan.md from Module 81 and an AI assistant. A free online tokenizer tool (most model providers publish one) helps for Lesson 1.

Lessons

  1. 1Tokens15–25 minutes✓
  2. 2Training and inference15–25 minutes✓
  3. 3Transformers and attention15–25 minutes✓
  4. 4Context windows15–25 minutes✓
  5. 5Uncertainty15–25 minutes✓

🛠️Module practice: How LLMs work, explained

Write llm-notes.md for your assistant project:

  1. Token estimates for your knowledge documents, and what that means for cost and context.
  2. Training versus inference, and why your assistant needs your documents at inference time.
  3. A simple diagram of next-token generation with attention.
  4. Context-window plan: what your assistant will include in each request.
  5. Uncertainty: three hallucination risks for your assistant and how you'll reduce each.

✅Module check

Explain in a few sentences, in your own words:

How does a large language model produce an answer, and why can't it be trusted blindly?

Show a good answer

A good answer mentions: text is split into tokens (which drive cost, limits and some odd mistakes); the model was pre-trained to predict the next token on huge text, then fine-tuned with feedback, and doesn't learn during use or know anything after its cutoff or private to you; a transformer uses attention to relate tokens and generates one token at a time from probabilities, with temperature controlling variety; everything it uses must fit in the context window, best filled with relevant material; and because it produces plausible rather than verified text, it can hallucinate, so answers are grounded in sources, uncertainty is allowed and tested, code handles calculations, and outputs are checked.

📝Module quiz

10 questions · 10 marks each · 100 marks in all · pass mark 70% · retry as often as you like ·

1. Roughly how many English words are in 1,000 tokens?

Why each option is right or wrong

  • “About 5,000, since each token is a single letter” (Incorrect): Tokens are usually bigger than single letters, often whole words.
  • “Exactly 1,000, since each token is one word” (Incorrect): Long words are split into several tokens, so it's fewer words than tokens.
  • “About 1,500, since spaces count as separate words” (Incorrect): Spaces are usually joined to the following word's token, not counted as words.
  • “About 750” is correct.

    A token is a chunk of text: often a whole short word, sometimes part of a longer word or a punctuation mark. For English, a common rule of thumb is that one token is about three-quarters of a word, so 1,000 tokens is roughly 750 words.

    • Other languages: often use more tokens per word, including many Indian languages.
    • Why it matters: costs and limits are counted in tokens.

📖 Revise: Lesson 1: Tokens

Question ID module-82-q1 · Report a mistake in this question
2. Why might a model struggle to count the letters in a word?

Why each option is right or wrong

  • “It reads English as a translation from another language” (Incorrect): Models work with English directly; the issue is how text is split into tokens.
  • “It has no memory, so it forgets the word while counting” (Incorrect): The word is in its context the whole time; it sees chunks, not letters.
  • “Counting is turned off by providers to save computing costs” (Incorrect): Nothing is switched off; tokenisation makes letter-level tasks tricky.
  • “It sees tokens (chunks), not individual letters” is correct.

    Before the model reads your text, it's split into tokens, so a word like "strawberry" might arrive as two or three chunks. The model doesn't directly see each letter, so counting them is harder than it looks.

    • Workaround: ask it to spell the word out letter by letter first.
    • Or: use code for exact counting.

📖 Revise: Lesson 1: Tokens

Question ID module-82-q2 · Report a mistake in this question
3. Does a model learn from the questions you ask it?

Why each option is right or wrong

  • “Yes, its weights update after every question you ask” (Incorrect): Weights stay fixed during use; it reads context instead.
  • “Yes, but only from questions that it answers correctly” (Incorrect): It doesn't learn from any question during normal use.
  • “Only once enough users ask the same question” (Incorrect): Popular questions don't change the model's weights while it's in use.
  • “Not during use; it only uses what's in its context” is correct.

    Training happens before release and fixes the model's weights. When you use it, the model reads your conversation as context and replies, but its weights don't change. Once the conversation ends, it doesn't carry that knowledge forward by itself.

    • Memory features: some apps store notes and add them to future prompts.
    • Providers: may use conversations for future training, depending on settings.

📖 Revise: Lesson 2: Training and inference

Question ID module-82-q3 · Report a mistake in this question
4. What's a knowledge cutoff?

Why each option is right or wrong

  • “The maximum number of words it can write in one answer” (Incorrect): That's the output limit, measured in tokens.
  • “A filter that blocks topics the provider considers unsafe” (Incorrect): That's a safety filter, not a knowledge cutoff.
  • “The date after which the provider stops offering the model” (Incorrect): That's a retirement or deprecation date; the cutoff is when its training data ends.
  • “The date its training data ends” is correct.

    A model learns from data collected up to a certain date. It knows little or nothing about events after that, and may confidently describe old information as current unless you give it newer facts.

    • Fix: supply recent information in the prompt or through search.
    • Check: the model's documentation for its cutoff date.

📖 Revise: Lesson 2: Training and inference

Question ID module-82-q4 · Report a mistake in this question
5. What does attention let a transformer do?

Why each option is right or wrong

  • “Focus only on the last few words and skip the rest” (Incorrect): Attention can look across the whole context, not just the end.
  • “Ignore long prompts so that answers come back faster” (Incorrect): It processes long prompts; it doesn't skip them.
  • “Remember earlier conversations from previous days” (Incorrect): Attention works within the current context only; it isn't long-term memory.
  • “Weigh how relevant each token is to the others” is correct.

    For every token, attention looks at all the other tokens in the context and decides which matter most for understanding it. In "the bank of the river", attention links "bank" with "river", so the model reads it as a riverside, not a building.

    • Why transformers won: attention handles long-range links and trains in parallel.
    • Cost: more context means more comparisons.

📖 Revise: Lesson 3: Transformers and attention

Question ID module-82-q5 · Report a mistake in this question
6. When would you choose a low temperature?

Why each option is right or wrong

  • “For brainstorming lots of different slogan ideas” (Incorrect): Brainstorming benefits from variety, which a higher temperature gives.
  • “For writing poems that sound fresh each time” (Incorrect): Creative writing usually benefits from a higher temperature.
  • “When you want the model to produce longer answers” (Incorrect): Temperature affects randomness, not length.
  • “For predictable, factual tasks like extraction” is correct.

    Temperature controls how much randomness goes into choosing each token. Low temperature makes the model stick to the most likely choices, so answers are more consistent, which suits pulling data from text, classifying, or following a fixed format.

    • Higher temperature: more variety, for brainstorming or creative writing.
    • Still check: low temperature reduces variation, not mistakes.

📖 Revise: Lesson 5: Uncertainty

Question ID module-82-q6 · Report a mistake in this question
7. What counts toward the context window?

Why each option is right or wrong

  • “Only the model's answer, since that's what it writes” (Incorrect): Your input counts too: instructions, history and documents.
  • “Only uploaded images and files attached to the chat” (Incorrect): Text instructions and history count as well.
  • “Only your latest question, as earlier ones are forgotten” (Incorrect): Earlier messages are resent and count, until they're trimmed.
  • “Instructions, history, documents, tool results and the reply” is correct.

    The context window is the total number of tokens the model can handle in one request. Everything counts: the system instructions, the conversation so far, any documents or tool results you add, and the reply it writes.

    • Long chats: older messages may need trimming or summarising.
    • Leave room: for the reply.

📖 Revise: Lesson 4: Context windows

Question ID module-82-q7 · Report a mistake in this question
8. Why not always put every document in the context?

Why each option is right or wrong

  • “Sharing documents with AI models is illegal in India” (Incorrect): It isn't illegal in general, though personal and confidential data needs care.
  • “It makes the model so accurate that answers become too long” (Incorrect): More text doesn't reliably improve accuracy; it often hurts it.
  • “Models reject any request that contains documents” (Incorrect): Models accept documents; the issue is cost, speed and focus.
  • “It costs more, is slower, and distracts the model” is correct.

    Every token costs money and time. Large amounts of loosely related text can also bury the useful part, so the model may miss it or mix in irrelevant details. Sending only the most relevant passages usually gives better, cheaper answers.

    • Better: search for the relevant passages first (retrieval).
    • Limit: documents can also exceed the context window.

📖 Revise: Lesson 4: Context windows

Question ID module-82-q8 · Report a mistake in this question
9. What's a hallucination?

Why each option is right or wrong

  • “A slow response that takes a long time to appear” (Incorrect): Speed isn't the issue; hallucinations are about wrong content.
  • “A refusal to answer a question it considers unsafe” (Incorrect): A refusal is the model declining; a hallucination is it making something up.
  • “An answer that's correct but written in an odd style” (Incorrect): Odd style isn't a hallucination; invented or wrong content is.
  • “A fluent, confident answer that's wrong or invented” is correct.

    A model predicts likely-sounding text, so it can produce made-up facts, quotes, references or code functions that read convincingly. It doesn't usually signal when it's unsure, which is why hallucinations are easy to miss.

    • Common examples: fake citations, wrong dates, invented APIs.
    • Defence: grounding, citations and checking.

📖 Revise: Lesson 5: Uncertainty

Question ID module-82-q9 · Report a mistake in this question
10. Which reduces hallucinations in an application?

Why each option is right or wrong

  • “Making prompts longer, without adding any source material” (Incorrect): Length alone doesn't give the model facts to rely on.
  • “Raising the temperature so the model explores more answers” (Incorrect): Higher temperature adds randomness, which can increase made-up content.
  • “Removing the instructions so the model answers freely” (Incorrect): Clear instructions help; removing them gives the model less guidance.
  • “Grounding answers in provided documents with citations” is correct.

    Giving the model the relevant source text and asking it to answer only from that, citing where each fact came from, keeps answers tied to real information. Users and your tests can then check each claim against its source.

    • Also tell it: to say "I don't know" when the documents don't cover it.
    • Check: citations really support the answer.

📖 Revise: Lesson 5: Uncertainty

Question ID module-82-q10 · Report a mistake in this question

ProLearners Assist