GENERATIVE AI • LESSON 3

What Is an LLM?

LLM stands for Large Language Model. Simply put, an LLM is an AI model trained on a huge amount of text so it can understand language patterns and generate human-like text.

CORE IDEA

An LLM learns language patterns and uses them to generate text.

ChatGPT, Gemini, Claude, and Llama are examples of systems built using large language models.

01

A Simple Example

Imagine you ask an LLM:

USER PROMPT "Explain Magento 2 dependency injection in simple English."

The LLM processes your request and generates an explanation based on the language patterns it learned during training.

YOU Question
LLM Processes the prompt
OUTPUT Generated answer
02

How an LLM Fits Into an AI Application

An LLM is usually not the entire application. It is the language-generation part of the system.

A real application can send a user's prompt to the model, receive the generated response, and then show that response to the user.

SIMPLE LLM ARCHITECTURE
INPUT User Prompt "What is Magento 2?"
TOKENIZATION Text → Tokens The prompt is converted into smaller pieces.
LLM Language Model Processes learned language patterns.
OUTPUT Generated Text The model produces the response.

This is a simplified view. Later lessons will explain tokens, embeddings, transformers, attention, inference, and model parameters in more detail.

03

Real-World Example — Customer Support

Consider an e-commerce website where a customer asks:

CUSTOMER "Where is my order?"

The LLM can understand that the customer is asking about an order status. But there is an important developer concept here:

IMPORTANT

The LLM does not automatically know the customer's latest order status. Your application must retrieve that information from your order system.

01 Customer "Where is my order?"
02 Backend Gets order status from database/API
03 LLM Converts the data into natural language
04 Customer "Your order has shipped..."

This is how an LLM becomes useful in a real product: the application provides the right information, and the LLM turns that information into a natural-language response.

04

Practical: Call an LLM From Python

As a developer, you normally access an LLM through an API. The basic flow is simple: send a prompt, receive the generated response, and display it.

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY"
)

question = "What is Magento 2?"

response = client.responses.create(
    model="YOUR_MODEL",
    input=question
)

print(response.output_text)

The important part is not memorizing the code. Understand the flow:

01 question User input
02 API request Sends prompt
03 LLM Generates response
04 output_text Your application receives it
05

What Happens Behind the Scenes?

When your application sends a prompt, the LLM does not receive the sentence as one magical block. The text is processed into tokens and then passed through the model.

INPUT "Explain APIs"
TOKENS Text pieces
LLM Predicts likely next tokens
OUTPUT Generated explanation

The model generates the response step by step by predicting what token should come next based on the context it has received.

06

What You Should Remember

  • LLM means Large Language Model.
  • An LLM learns language patterns from large amounts of training data.
  • It can generate text based on the input and context it receives.
  • An LLM is only one part of a complete AI application.
  • Real applications can connect an LLM with databases, APIs, tools, and business logic.
QUICK CHECK

Test Your Understanding

What does LLM stand for?

Answer: Large Language Model.

Does an LLM automatically know a customer's latest order status?

Answer: No. The application normally retrieves the current order information and provides it to the LLM.

What does an LLM generate?

Answer: It generates text by predicting tokens based on the input and context.

LESSON 3 • TOPIC COMPLETE

You now understand what an LLM is.

You understand the basic idea of an LLM, how a prompt reaches the model, how the model generates text, and how developers connect LLMs to real applications.