LESSON 7 · UNDERSTANDING LLMs

What is an LLM?

An LLM is a Large Language Model: a neural network trained on large amounts of text so it can process token sequences and generate useful language one token at a time.

15 min readBeginnerGenerative AI

By the end of this lesson, you will be able to:

  • Explain what “Large Language Model” means.
  • Describe the basic next-token prediction idea behind language models.
  • Understand the relationship between tokens, parameters, training data, and an LLM.
  • Recognize what LLMs are good at and where they need safeguards or additional systems.
  • Make a real LLM API call from Python and inspect the generated response.
1

The simple definition

A Large Language Model (LLM) is a machine-learning model designed to work with language. It receives a sequence of tokens as input and predicts what token or tokens should come next.

LARGEMany parameters

The model contains a very large number of learned numerical values.

LANGUAGEWorks with token sequences

Text is converted into tokens before the model processes it.

MODELLearned patterns

Training adjusts parameters so the model becomes better at predicting token sequences.

Important: “Large” does not mean the model stores a searchable copy of every sentence it was trained on. The training process changes model parameters that encode statistical patterns.
2

Where does an LLM fit?

In the AI hierarchy you learned earlier, an LLM is a type of deep-learning model used for language tasks. Modern LLMs are typically built with neural-network architectures based on the Transformer family.

Artificial IntelligenceBroad field
Machine LearningLearn patterns from data
Deep LearningNeural networks with many layers
Large Language ModelLanguage-focused neural network
3

The key idea: predict the next token

Suppose the input is:

INPUT“The capital of France is”

The model assigns probabilities to possible next tokens. A simplified view might look like this:

Parishigh probability
Londonlower probability
bananavery low probability
Input tokensThe · capital · of · France · is
LLMscores possible next tokens
Next tokenParis

Key idea: Generation happens repeatedly. The selected token is added to the sequence, and the model predicts the next token again. A full answer is built step by step.

4

Tokens, parameters, and training data

01

Tokens

The pieces of text the model processes. A token can be a word, part of a word, punctuation, or another text fragment.

02

Parameters

Learned numerical values inside the neural network. Training adjusts them to capture useful patterns.

03

Training data

Large collections of examples used during training so the model can learn patterns in language and other content.

Mental model: training data provides examples → optimization changes parameters → the trained model uses those parameters to process new token sequences.
5

What can an LLM do?

The same basic language-generation capability can be used in many applications when the prompt and surrounding software are designed well.

GenerateDraft emails, stories, product copy
SummarizeTurn long text into concise notes
ExplainTeach concepts at different levels
TransformRewrite, translate, extract, classify
CodeGenerate, explain, test, and refactor code
InteractPower conversational interfaces
Useful pattern

Give the model a clear task, relevant context, and an output format that your application can use.

Not a guarantee

A fluent answer can still be wrong. LLM output needs evaluation, and high-impact applications need appropriate controls.

6

What an LLM is not

“It is a database.”

An LLM is a neural network with learned parameters. A database is a system designed to store and retrieve structured records.

“It always knows the truth.”

No. An LLM can produce confident but incorrect output, often called a hallucination.

“It has human-like understanding.”

Be careful with this wording. LLMs can perform sophisticated language tasks, but that does not establish human consciousness or human-like understanding.

“It can see my private data automatically.”

No. An application must provide data to the model through its input or connected tools. Access is a system-design and permission question.

7

Real example: ask an LLM from Python

Now move from the idea to a real API call. The application sends an instruction and receives generated text.

</> Python
from openai import OpenAI

client = OpenAI(api_key=input("Enter your API key: "))

response = client.responses.create(
    model="gpt-5.6-luna",
    input="Explain what an LLM is in two simple sentences."
)

print(response.output_text)
Typical resultAn LLM is a neural-network model trained to work with language. It generates text by repeatedly predicting the next token based on the input context.

What happened? Your Python program created a client, sent an input to the model, and printed the generated text. The application controls the instruction; the LLM generates the response.

API key safety: For a real project, do not put a secret API key directly into public source code, Git repositories, or a client-side web page. Use environment variables or a secure secret store.
8

Change the input, change the output

Try the same model with different instructions. This makes the input → model → output relationship concrete.

</> Python
from openai import OpenAI

client = OpenAI(api_key=input("Enter your API key: "))

prompt = "Explain APIs to a 10-year-old using a restaurant analogy."

response = client.responses.create(
    model="gpt-5.6-luna",
    input=prompt
)

print(response.output_text)
Original“Explain what an LLM is in two simple sentences.”Short technical explanation
Changed“Explain APIs to a 10-year-old using a restaurant analogy.”Audience + format + analogy changes the response
Experiment: Change only one part of the prompt at a time: audience, length, format, topic, or tone. Then compare the responses.
9

An LLM is usually one component, not the whole application

A useful production mental model is to place the LLM inside a larger system.

Userquestion or task
Applicationinstructions, permissions, validation
LLMgenerate or transform
Applicationcheck, format, store, or call tools
Useruseful result

This becomes especially important when an application needs private company knowledge, live information, databases, calculators, APIs, or business rules. Those capabilities are usually supplied by the surrounding system rather than magically appearing inside the model.

10

Mini-project: Build a simple LLM explainer

Build a tiny Python program that asks an LLM to explain any technical concept at a chosen level.

1AskRead a concept from the user.
2ChooseLet the user choose beginner or advanced.
3PromptBuild an instruction with the concept and audience.
4GenerateSend it to the LLM API.
5ImproveChange the prompt and compare answers.
Challenge: Add a requirement that every answer must include one simple example and one common mistake. Then test the program with “vector database”, “API”, and “neural network”.
PRACTICE

Check your understanding

Answer first, then reveal the explanation.

1What is the basic prediction task an LLM performs during generation?It predicts the next token given the tokens/context it has received so far.
2Are an LLM's parameters the same thing as its training data?No. Training data provides examples; parameters are learned numerical values adjusted during training.
3Can an LLM produce a fluent answer that is incorrect?Yes. Fluent language does not guarantee factual correctness.
4Why might a production app need more than an LLM?It may need private data, retrieval, tools, permissions, business rules, validation, monitoring, and other software.
QUICK QUIZ

Which statement best describes an LLM?

30-second recap

  • An LLM is a Large Language Model built to process and generate language.
  • During generation, the model repeatedly predicts the next token from the current sequence.
  • Tokens are inputs to the model; parameters are learned numerical values shaped during training.
  • LLMs can generate, summarize, explain, transform, code, and power conversational applications.
  • An LLM can be wrong, so useful applications need evaluation and appropriate safeguards.
  • Production systems commonly combine an LLM with application logic, data, retrieval, tools, permissions, and validation.