Large Language Models
Last updated on 2026-04-15 | Edit this page
Overview
Questions
- What does a language model actually predict?
- Why is tokenization necessary for LLMs?
- How does a decoder-only transformer generate text?
- What role does self-attention play in LLMs?
- Why are LLMs considered “large”?
Objectives
- Understand what Large Language Models (LLMs) are and how they work
- Explain how language models generate text using probabilities
- Describe tokenization and its role in processing language
- Recognize the architecture behind modern LLMs
Large Language Models (LLMs)
Large Language Models (LLMs) are AI systems built on the Transformer architecture that understand and generate human language. They are trained on massive datasets and power applications like chatbots, code generation, summarization, and translation. Their key feature is scale, with billions or more parameters.
3. Architecture
Most LLMs use decoder-only transformers:
Input → Embeddings → Transformer layers (self-attention) → Output probabilities
self-attention enables models to capture context across tokens.
4. Training
Training occurs in stages:
-
Pretraining: Learn general language patterns
-
Fine-tuning: Adapt to specific tasks
-
Instruction tuning: Improve responses to
prompts
- RLHF: Align outputs with human preferences
5. Scaling Laws
Performance improves with more parameters, data, and compute. Larger models can show emergent abilities like reasoning and code generation.
6. Context Windows
Defines how many tokens a model can process at once, affecting handling of long inputs.
7. Capabilities
- Text generation
- Summarization
- Translation
- Question answering
- Code generation
- Reasoning
11. Future Directions
- Multimodal models
- Retrieval-Augmented Generation (RAG)
- Efficient models (quantization, distillation)
- Agentic systems

One demo notebooks are available for this lesson.
- Google_gemini.ipynb: explores how to connect to google gemini in python.
- LLMs are built on Transformer architectures and trained at massive scale
- Core idea: predict the next token given previous tokens
- Language modelling is based on probability of sequences
- Tokenization breaks text into manageable units: word-level or subword-level (BPE, WordPiece, SentencePiece)
- Most LLMs use decoder-only transformers: embeddings → self-attention → output probabilities
- Self-attention enables context-aware predictions across tokens