Large language models (LLMs) have become as ordinary a tool for programmers as a code editor, Git or the terminal. They explain errors, draft functions and tests, help you make sense of someone else's code, and through an API they become part of your own applications. In this topic we will look at what an LLM is, where it fits among other AI concepts and how the course is structured.
From AI to LLM: nested concepts
The terms AI, machine learning and neural networks are often mixed up, although they are nested inside each other like Russian dolls:
| Concept | What it is | Example |
|---|---|---|
| Artificial intelligence (AI) | the whole field of programs that solve "human" tasks | a chess program, a navigation app |
| Machine learning (ML) | part of AI: rules are learned from examples instead of being written by hand | a spam filter |
| Neural networks | part of ML: models made of connected "neurons" with adjustable numbers called weights | face recognition |
| Generative AI | neural networks that create new content: text, images, audio, code | an image generator |
| Large language model (LLM) | a generative neural network trained on a huge amount of text and code | chat assistants, code completion |
The difference between ordinary programming and machine learning is easy to see with a spam filter. In the classic approach, the programmer writes the rule:
# classic approach: a human invents the rule
def is_spam(subject):
text = subject.lower()
return "win money" in text or "free prize" in text
print(is_spam("WIN MONEY now!")) # → True
print(is_spam("W1N M0NEY now!")) # → False — the rule is easy to bypassIn machine learning you give the program thousands of emails labelled "spam / not spam", and it finds the patterns on its own. An LLM is the same idea at a gigantic scale: the model was trained on an enormous corpus of text and code to do one thing — predict the next piece of text. To continue code well, you have to capture syntax, common patterns and the meaning of names, which is why impressive abilities grow out of such a simple task.
💡 Analogy: an LLM is a very advanced autocomplete, like the suggestions on your phone keyboard, only trained on trillions of words and able to continue whole pages of text and code.
Two ways a developer uses AI
The whole course is built on this split:
- AI as a tool in your work. You talk to an assistant in a chat, an editor or the terminal. The model helps you write, understand and check code, but you make the decisions.
- AI as a component of your application. Your code sends a request to a model through an API and uses the response: it classifies support requests, answers questions from documentation, extracts data from text.
The first way makes you faster; the second lets you build new product features. Let's look at four examples.
Example 1: explaining an error in a chat
The most common scenario is pasting code and an error message into a chat assistant:
Why does this code crash and how do I fix it?
user = {"name": "Aysel"}
print(user["email"])
KeyError: 'email'KeyError is raised because the user dictionary has no "email" key.
Ways to fix it:
1. user.get("email") — returns None instead of raising an exception.
2. user.get("email", "not set") — returns a default value.
3. Check first: if "email" in user: ...The model did not run the code: it recognised a familiar pattern and generated a typical explanation. For rare and tangled errors, such an explanation needs to be checked.
Example 2: completion in the editor
An AI assistant in the IDE (GitHub Copilot, Cursor and similar tools) sees the open file and suggests a continuation right in the code as grey "ghost" text. You type the signature and a comment, the assistant suggests the function body, and you accept it with Tab:
def average_price(products):
# average price of the products; return 0 for an empty list
if not products: # ← assistant's
return 0 # ← suggestion
return sum(p["price"] for p in products) / len(products)
print(average_price([{"price": 10}, {"price": 20}])) # → 15.0
print(average_price([])) # → 0The model does exactly what it was trained to do — it continues text: the function name and the comment point to the most likely continuation. The code looks right, but checking it is your job: what happens if a product has no "price" key?
Example 3: an API call in 10 lines
The same model is available from your code. Here is a minimal request with one provider's official Python SDK (other providers' SDKs look similar):
from anthropic import Anthropic
client = Anthropic() # the key is read from the ANTHROPIC_API_KEY environment variable
response = client.messages.create(
model="claude-opus-5-5", # an example; current model names are in the docs
max_tokens=1024,
messages=[{"role": "user", "content": "Explain Python list comprehensions in two sentences."}],
)
for block in response.content:
if block.type == "text":
print(block.text)A list comprehension is a compact way to build a new list by applying an
expression to each item of an iterable, optionally filtering items with a
condition. For example, [x * 2 for x in range(5) if x % 2 == 0] returns [0, 4, 8].The response arrives as a list of blocks, so we print only the text ones. In essence this is an ordinary HTTP request: text in, text out. Keys, parameters and error handling are covered in the API section.
⚠️ Your run will produce a slightly different answer: the model generates the text anew on every request. We will see why in the topic on temperature.
Example 4: a documentation chatbot
The model has never seen your company's internal documents, so the bot first finds a relevant fragment and inserts it into the request:
Answer only from the documentation below. If the answer is not there, reply "I don't know".
<docs>
A vacation request is submitted in the HR portal at least 14 days in advance.
Sick leave is confirmed with a doctor's note within 3 working days.
</docs>
Question: How many days in advance must a vacation request be submitted?A vacation request must be submitted in the HR portal at least 14 days in advance.This approach is called RAG (Retrieval-Augmented Generation — generation grounded in retrieved data). The key idea: the model does not "know" your rules — it composes the answer from the text you passed to it.
What an LLM is not
The most dangerous misconception is believing that a model understands and knows things the way a person does, or stores facts like a database.
- It is not a database. There is no table of facts inside the model: knowledge is "smeared" across billions of weights, and each answer is generated anew. That is why a model can confidently name a function that does not exist.
- It is not a person. The model does not remember you between chats and does not learn from your corrections.
- It is not a search engine. Without web search, the model knows the world only up to the end of its training data.
The right mental model: an LLM is a powerful generator of plausible text and code, and your job is to give it context and check the result.
What you will learn in the course
- Foundations: how LLMs work and how to write prompts.
- AI as a tool: Copilot, Cursor, Claude Code; explaining code, debugging, tests, refactoring and code review with AI.
- AI as a component: model APIs, JSON responses, tool calling, chatbots, RAG, agents and MCP.
- Quality and security: evals, protection against prompt injection, cost control and the final project.
Common mistakes
Trusting an answer without checking it. Code from a model is a draft from a fast but careless colleague. Run it, read it and put it through tests.
Asking about fresh facts as if the model were a search engine. Versions, release dates and prices may be "remembered" out of date or simply made up. Check them in official sources, for example with pip index versions requests.
Assuming the model remembers the previous conversation. A new chat starts from a clean slate: yesterday's explanations have to be repeated.
Pasting secrets into a chat. Passwords, keys and personal data go to the provider's server. Replace them with placeholders:
Wrong:
Why can't I connect to the database? My .env:
DB_PASSWORD=S3cr3t-2026
Right:
Why can't I connect to the database? My .env (password hidden):
DB_PASSWORD=***Summary
- AI → machine learning → neural networks → generative AI → LLM: each concept is part of the previous one.
- An LLM is trained to predict the next piece of text and, thanks to its scale, can write and explain code.
- A developer uses AI as a tool in their work and as a component of their own application via an API.
- Typical scenarios: explaining errors, code completion, calling a model from code, answering from documentation.
- An LLM is not a database, a person or a search engine: checking the result is up to you.
- Secrets and personal data never go into a chat.
Practice
- Ask a chat assistant to explain an error from your own project (or the
KeyErrorfrom the example) and compare the answer with the language's official documentation. - Ask a model for the latest version of your favourite library and check the answer on PyPI or npm. Note whether it matched.
- Ask an assistant to write
average_pricefrom the example, come up with three inputs that could break the function, and check them by running the code. - List five tasks from your studies or work and decide for each: AI as a tool, AI as an application component, or plain code without AI. Consider where accuracy and repeatability matter.