Large Language Models from scratch

2026-2027

General Information

Course Code XM_0188
Credits 6 EC
Period P4
Course Level 400
Language of Tuition English
Faculty Faculty of Science
Course Coordinator prof. dr. S. Bhulai
Examiner prof. dr. S. Bhulai
Teaching Staff prof. dr. S. Bhulai
Part of programme(s)

Practical Information

You need to register for this course yourself. The (de)registration deadlines can be found on VU.nl

Teaching Methods Seminar, Lecture

Target audiences

This course is also available as:

Course Objective

There are several learning objectives for this course. After completion of this course, the student should be able to:

  • explain how modern large language models (LLMs) represent text, using tokenization schemes such as Byte Pair Encoding, token embeddings, and positional encodings;
  • derive and implement the core components of a transformer from scratch, including (self-)attention, multi-head attention, causal masking, normalization layers, and gated activations;
  • compare encoder-decoder, decoder-only, and encoder-only transformer architectures and motivate design choices in terms of tasks, scaling laws, and hardware constraints;
  • describe and apply inference strategies for LLMs, including greedy decoding, beam search, temperature, top-k and top-p sampling, and speculative decoding;
  • explain the full training pipeline of a modern LLM, pre-training, supervised fine-tuning, and reinforcement learning, and the role of data curation and learning-rate schedules in each stage;
  • apply reinforcement-learning methods used for LLMs, including policy gradient, PPO, DPO, GRPO, and training with verifiable rewards;
  • analyze the capabilities and limitations of reasoning models, tool use, safety, and alignment approaches such as RLHF;
  • discuss techniques that make LLMs efficient at scale, including distillation, Mixture-of-Experts, and efficient attention variants (sparse attention, GQA, MLA);
  • critically read state-of-the-art research papers on LLMs and judge design trade-offs made in modern systems (e.g., Llama, DeepSeek, OLMo).

Course Content

Large language models have become a central technology in artificial intelligence, powering systems that write, reason, translate, and interact in natural language. In this course, students build up an LLM from the ground up. Starting from raw text, we cover tokenization and embeddings, move through the transformer architecture and the attention mechanism, and continue with inference, pre-training, supervised fine-tuning, and reinforcement learning with human and verifiable rewards. The final lectures address current research themes: reasoning, safety and alignment, efficiency (Mixture-of-Experts, efficient attention), and multimodal and agentic models. Throughout the course, it emphasizes both the theoretical foundations (risk minimization, scaling laws, policy gradient) and the practical engineering choices that distinguish modern open and closed LLMs.

Additional Information Teaching Methods

Lectures (14 x 2 hours), possibly combined with programming exercises and a hands-on project.

Method of Assessment

Written exam potentially including a programming project. When a programming project is included,

  • the exact weights of the exam and project towards the final grade will be specified on Canvas but the weight of the exam is in any case at least 80%;
  • in addition to a weighted average of at least 5.5, the exam grade must be at least 5.5 in order to pass the course.


In the exams, no gen-AI use is allowed (i.e., level 1 of gen-AI use). When a programming project is included, gen-AI assisted idea generation and structuring is allowed (i.e., level 2a of gen-AI use).

Entry Requirements

The VU courses "Mathematical Foundations of Machine Learning" and "Deep Learning" are preferred.

Literature

Slides and additional material will be posted on Canvas. Reading consists of a curated selection of recent research papers.

Additional Information Target Audience

mBA, mAI, mCS, mMath, mEOR.

Additional Information

In the exams, no gen-AI use is allowed (i.e., level 1 of gen-AI use). When a programming project is included, gen-AI assisted idea generation and structuring is allowed (i.e., level 2a of gen-AI use).

Recommended background knowledge

The VU courses "Mathematical Foundations of Machine Learning" and "Deep Learning" are preferred.