Introduction to Sequence Modeling with Transformers

Joni-Kristian Kämäräinen
2/26/2025
cs.LG

No official code found. Best implementation: kamarain/transformer_intro (0 stars, MIT, last commit 2025-03-06).

Abstract

Understanding the transformer architecture and its workings is essential for machine learning (ML) engineers. However, truly understanding the transformer architecture can be demanding, even if you have a solid background in machine learning or deep learning. The main working horse is attention, which yields to the transformer encoder-decoder structure. However, putting attention aside leaves several programming components that are easy to implement but whose role for the whole is unclear. These components are 'tokenization', 'embedding' ('un-embedding'), 'masking', 'positional encoding', and 'padding'. The focus of this work is on understanding them. To keep things simple, the understanding is built incrementally by adding components one by one, and after each step investigating what is doable and what is undoable with the current model. Simple sequences of zeros (0) and ones (1) are used to study the workings of each step.

View on arXivView PDF

Code Implementations(1)

MIT

Introductory code to the transformer architecture

00TeX, MakefileFeb 19, 20251 years agoMIT

Similar Papers

Cite this paper

@article{kmrinen2025introduction,
  title  = {Introduction to Sequence Modeling with Transformers},
  author = {Joni-Kristian Kämäräinen},
  year   = {2025},
  eprint = {2502.19597},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.19597v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.19597.svg)](https://codeofpaper.com/paper/2502.19597)

Discussion