Abstract

The transformer architecture has become the dominant paradigm in modern machine learning, used in virtually every large language model (LLM) in use today. Despite their ubiquity, transformers are often treated as black boxes, making them difficult to understand for students who are early in their study of machine learning. This thesis provides a comprehensive and accessible explanation of the transformer architecture as originally introduced in the 2017 paper Attention Is All You Need\cite{vaswani2017attention}, covering the mathematical foundations and machine learning techniques behind each of its core components: input embedding, positional encoding, multi-head self-attention, position-wise feed-forward networks, residual connections, layer normalization, masked attention, and cross attention.

The thesis covers the history behind the transformer’s creation. It then examines both the encoder and decoder components of the original transformer, explaining how together they enable powerful sequence-to-sequence tasks such as machine translation. The thesis walks through how transformers are trained. It then traces how the field evolved from the original encoder-decoder design into specialized architectures: encoder-only models such as BERT\cite{devlin2019bert}, which excel at language understanding tasks, and decoder-only models such as GPT\cite{radford2018gpt}, which excel at language generation. Throughout the thesis there are examples of how the mathematics and machine learning techniques are applied. The goal throughout is to demystify a complex and important architecture for the next generation of students especially those interested in computer science.

Advisor

Visa, Sofia

Department

Computer Science

Disciplines

Artificial Intelligence and Robotics | Science and Mathematics Education | Theory and Algorithms

Keywords

Transformer, AI, LLM, Encoder, Decoder

Publication Date

2026

Degree Granted

Bachelor of Arts

Document Type

Senior Independent Study Thesis

Share

COinS
 

© Copyright 2026 Boden W. Retherford