Inside Transformers: An In-depth Look at the Game-Changing Machine Learning Architecture — Part 1

Isaac Kargar
6 min readMay 29, 2023

Note: AI tools are used as an assistant in this post!

Generated by Microsoft Bing Image Creator

As the field of artificial intelligence (AI) continues to change at a rapid pace, some designs have stood out for how much they have changed the field. The Transformer model has become a game-changer among these. It has changed not only natural language processing, but also many other parts of machine learning.

In their seminal work “Attention is All You Need” from 2017, Vaswani et al. introduced the Transformer, which changed the way we understand and process sequences. The attention system, which was the key innovation of the Transformer model, changed the way machine learning works by making sequence-to-sequence tasks easier to do and making it easier to deal with long-range dependencies in data.

But what is it that makes Transformers so strong? How does it use attention mechanisms to successfully store information about where things are and how they depend on other things? And why has it become the go-to architecture for many modern machine learning jobs, even outside of natural language processing?

In this blog post, we’ll take a close look at how the Transformer architecture works on the inside. We’ll look at its main parts, from inputs and embeddings to the multi-head attention system and positional encoding, all the way to outputs. We will figure out how it changed the way sequence modeling was done and how its design makes it useful for a wide range of machine learning jobs.

This guide aims to explain how the Transformer model works, whether you are an experienced machine learning engineer, a researcher, or someone new to the field who wants to learn about one of the most important designs in AI. Join us as we learn more about this new technology that is really changing the way artificial intelligence works.

Before I get into the transformer architecture blocks, I’ll quickly talk about the history of the attention mechanism.

Attention Mechanism Brief History

The history of attention mechanisms in deep learning can be traced back to the development of recurrent neural networks (RNNs) and has evolved…



Isaac Kargar

Co-Founder and CIO @ Resoniks | Ph.D. candidate at the Intelligent Robotics Group at Aalto University |