Skip to content
UdemyIT & SoftwarePaid courseBeginner levelCertificate

Math Behind LLMs, Transformers and Modern Computer Vision (Udemy.com)

From Multi Head Attention and Embeddings to Transformers, Vision Transformers, Modern Image Segmentation + LLMs and SAM

Created by: Patrik Szepesi

Last updated June 2026

icon
What you will learn

  • Mathematics Behind Large Language Models
  • Modern Image Segmentation
  • Positional Encodings
  • Compare CNNs and Vision Transformers mathematically
  • Compute prompt self-attention and image–prompt cross-attention
  • Multi Head Attention
  • Query, Value and Key Matrix
  • Attention Masks
  • Masked Language Modeling
  • Dot Products and Vector Alignments
  • Nature of Sine and Cosine functions in Positional Encodings
  • How models like ChatGPT work under the hood
  • Bidirectional Models
  • Context aware word representations
  • Vision Transformers
  • Word Embeddings
  • How dot products work
  • Modern Computer Vision
  • Understand quadratic complexity in Vision Transformers
  • Matrix multiplication
  • Programatically Create tokens
  • Derive self-attention, multi-head attention, and cross-attention from scratch
  • Analyze the full Vision Transformer pipeline

How it compares

Against the other 1,182 rated Udemy courses in IT & Software on CourseDuck:

  • Rating4.6 out of 5higher than 67% of them
  • Reviews1,229#353 of 1,183 by number of reviews
  • Length11.6 hourslonger than 75% of them
  • Last updatedJune 2026more recently than 79% of them

icon
Course Description

Welcome to Math Behind LLMs, Transformers and Modern Computer Vision, a rigorous deep dive into the mathematical foundations powering today’s most advanced AI systems.

This course is designed for learners who want more than intuition. We derive and analyze the core equations behind Large Language Models, Vision Transformers, and modern image segmentation systems.

You will begin with tokenization and embedding mathematics, understanding how raw text becomes high-dimensional vector representations through algorithms like WordPiece. From there, we mathematically unpack the heart of transformer architectures: query, key, and value matrices, attention score computation, scaling behavior, and multi-head attention.

We examine attention masks, contextual encoding, and positional encodings — including the sine and cosine formulations that preserve sequence structure. You’ll build strong geometric intuition around vectors, dot products, cosine similarity, and dense embeddings.

The course then expands beyond language.

You’ll compare Convolutional Neural Networks with Vision Transformers, analyze quadratic attention operations, and walk through the complete Vision Transformer pipeline from patch embeddings to final predictions.

In an advanced section, we dissect the mathematics behind Meta’s Segment Anything Model (SAM). You will explore prompt encoders, self-attention, cross-attention between prompts and images, attention score computation in segmentation models, and how these systems are trained at scale.

By the end of this course, you won’t just understand how transformers work — you will understand why they work at the equation level across language and vision.

If you aim to build deep technical mastery and develop the mathematical intuition required for cutting-edge AI research and engineering, this course will elevate your expertise.

icon
Udemy Discount

The discount is applied through our link. Open the course from here and Udemy's current promotional price is applied at checkout on most courses, no code to type.

Some courses are excluded from Udemy's promotions. If the price does not drop, clear your browser cookies and use the button again.

icon
Instructor Details

Patrik Szepesi

Patrik Szepesi is a senior Machine Learning Engineer/Data Scientist with a career spanning across academia, Silicon Valley tech companies, and leading global financial institutions. Patrik has leveraged his expertise to pioneer cutting-edge machine learning solutions in various domains, including autonomous vehicles, banking, and healthcare. His versatile skill set has enabled him to work at companies like Morgan Stanley and John Deere, where he helped create the first fully autonomous agricultural vehicles in the world. Patrik's contributions to the field are not just limited to the professional sphere; as a Machine Learning Researcher at Óbuda University, he has developed innovative deep convolutional neural networks for medical image classification, with his work published in esteemed journals such as Biocybernetics and Biomedical Engineering. Currently, he works as a senior machine learning engineer for a large California-based healthcare company. He has worked as an AWS tech evangelist before and currently holds the following AWS certifications: AWS Machine Learning Specialty and AWS Solutions Architect Associate.



icon
More courses by Patrik Szepesi

$84.99

$74.99

icon
More IT & Software courses

$49.99

$10.99

$124.99

$19.99

$11.99

$19.99

icon
Reviews

4.6

1,229 ratings on Udemy

Select a bar to show only those reviews.Select the bar again to show every rating.

By Alex Chase on 9/20/2026

I love how simply Patrik teaches about Image Segmentation with Vision Transformers, very clear and easy to follow as always. update: just finished the course. Amazing explanation of partial derivatives, gradients and backprop

By Vinay Prashanth on 6/22/2026

A thorough and well-structured course that does an excellent job of demystifying the attention mechanism. What I appreciated most was the step-by-step approach - nothing felt rushed or skipped over. Whether you're a complete beginner or someone looking to solidify your foundations, this course delivers.

By Sergio Fernández on 6/8/2026

I think the first 5 sections were great, clearly explained, but the last section was too messy. I feel it was ok to give the interpretation after each main step using the computed matrices, but the rest of the explanation was confusing. Maybe the instructor can rely on a diagram to explain the conforming blocks of the architecture and to connect each one of them. More diagrams and images would be useful during the explanation.

By Abhishek Kumar singh on 5/6/2026

Clear explanations and strong intuition-building around the math behind Transformers, LLMs, and computer vision. The instructor breaks down complex topics in a digestible way, and I feel more confident reading ML papers now. Recommended.

By Myenel00 on 4/25/2026

I think LLM side is perfect! Last chapter is more complex and so I cant focus. I have a lot of questions inside my brain about LLM. I should solve them. I want you to explain more detail for LLM as a GPT or basic features etc. You are a really good teacher. I enjoy absolutely and I got it. If you keep going tell us step by step, everything will be impeccable.

By Aishwary Dhare on 2/5/2026

Brilliant wrap of 4.5 hours around Attention and Transformers in LLM. Course is worthy of its price and the duration. But there's much more that I wanted to learn, like neural networks and the maths behind them as well which were not covered here. But still a worthy course to start your mathematical journey around AI. I'd recommed to start from this one and then continue learning through other sources and courses as well.

By Aditya Bhosarekar on 1/15/2026

In depth coverage of mathematics. Till now I have only covered the math for positional encoding, based on the experience I am sure the attention math will also be covered in depth. Please make more courses on math of deep learning/ML in general too, I will subscribe to those.

By Rajeev Krishnamurthi on 1/14/2026

This was one of the first course in Udemy where I completed the course. In the past, I have taken courses and with some interruption, I lost the motivation to resume. The best thing about this instructor is that he hammers the main points repeatedly so even if your interest is flagging due to not remembering some important details after a hiatus, the instructor is able to nudge you back to resume your learning.

By Manu Satsangi on 1/5/2026

I appreciate this course and learning a lot from it. But there are a few areas where I wished to receive more empathy from the instructor. For example in section 4, chapter 16 where you define key matrix and take an example of 3 by 3 (I think in chapter 17), I did not understand what value add does key matrix (or key vector) bring that embeddings vector does not. I checked online and found that key matrix often "tones-down" the complexity of the embeddings to lower dimension (often to suit the task at hand). Otherwise the embeddings vector is an large 768 dimension vectors geared for all scenarios and key/query and value vectors are lower dimension. The example you should have taken is not 3 by 3, but probably 4 by 3 or 3 by 2 to illustrate this idea.

By Frederic Gillot on 12/29/2025

It's a very detailed (maybe too much at some point) explanation of math behind the transformer learning mechanisms. The course has a lot of repeats from one lecture to the other though, so I fast forwarded most of it and played only the parts when Patrick refers to his underlying document, sometimes not even playing but only reading it. What I liked the most is Patrick's ability to make complex things easy to understand thanks to relevant images and metaphors he uses to explain. It's in the Q&A part that things became crystal clear.

Showing all 10 reviews on CourseDuck

Read all 1,229 reviews on Udemy

icon
Quality Score

No CourseDuck member has rated this course yet. Taken it? Give each part a thumbs up or down.

Content Quality
/
Video Quality
/
Qualified Instructor
/
Course Pace
/
Course Depth & Coverage
/

Overall Score : 92 / 100