Back

Rishabh Raj Pathak

Polymath • 17h

She dumped me last night. Not because I don't listen. Not because I'm always on my phone. Not even because I forgot our anniversary (twice). But because, in her exact words: "You only pay attention to the parts of what I say that you think are important." I stared at her for a moment and realized... She just perfectly described the attention mechanism in transformers. Turns out I wasn't being a bad boyfriend. I was being mathematically optimal. See, in conversations (and transformers), you don't give equal weight to every word. Some words matter more for understanding context. Attention figures out exactly HOW important each word should be. Here's the beautiful math: Attention(Q, K, V) = softmax(QK^T / √d_k)V Breaking it down: Q (Query): "What am I looking for?" K (Key): "What info is available?" V (Value): "What is that info?" d_k: Key dimension (for scaling) Think library analogy: You have a question (Query). Books have titles (Keys) and content (Values). Attention finds which books are most relevant. Step-by-step with "The cat sat on the mat": Step 1: Create Q, K, VEach word → three vectors via learned matrices W_Q, W_K, W_V For "cat": Query: "What should I attend to when processing 'cat'?" Key: "I am 'cat'" Value: "Here's cat info" Step 2: Calculate scoresQK^T = how much each word should attend to others Processing "sat"? High similarity with "cat" (cats sit) and "mat" (where sitting happens). Step 3: Scale by √d_kPrevents dot products from getting too large, keeps softmax balanced. Step 4: SoftmaxConverts scores to probabilities: "cat": 0.4 (subject) "sat": 0.3 (action) "mat": 0.2 (location) "on": 0.1 (preposition) "the": 0.1 (article) Step 5: Weight valuesMultiply each word's value by attention weight, sum up. Now "sat" knows it's most related to "cat" and "mat". Multi-Head Magic:Transformers do this multiple times in parallel: Head 1: Subject-verb relationships Head 2: Spatial ("on", "in", "under") Head 3: Temporal ("before", "after") Head 4: Semantic similarity Each head learns different relationship types. Why This Changed Everything: Before: RNNs = reading with flashlight (one word at a time, forget the beginning) After: Attention = floodlights on entire sentence with dimmer switches This is why ChatGPT can: Remember 50 messages ago Know "it" refers to something specific Understand "bank" = money vs river based on context The Kicker:Models learn these patterns from data alone. Nobody programmed grammar rules. It figured out language structure just by predicting next words. Attention is how AI learned to read between the lines. Just like my therapist helped me understand my focus patterns, maybe understanding transformers helps us see how we decide what matters. Now if only I could implement multi-head attention in dating... 🤖 Still waiting for "scaled dot-product listening" to be invented.

Reply
1

More like this

Recommendations from Medial

Image Description
Image Description

Jaswanth Jegan

Founder-Hexpertify.c... • 1y

"Anyone else feel like their attention span is taken a hit from TikTok & Reels? I do Struggling to focus? Share your tips to reclaim attention span Step 1-uninstall those apps

13 Replies
1
4

Deepak Singh

Still growing • 5m

I want to pursue MBA next year .Can somebody suggest me anything related to any college for MBA in finance ,or related with CAT ,XMAT,MAT,GMAT,etc exams related with MBA entrance.You can also suggest me any strategy,plan,books, platform,etc.

Reply
3
Image Description

sahil

Code. Create. Innova... • 5m

hello everyone, Is there any platform exiting that provides a step by step guide to the query of students instead of giving them direct answers.? I am thinking of building something like an expert (not just another generic llm) in just one domain (s

See More
4 Replies
9
Image Description
Image Description

Vishu Bheda

 • 

Medial • 9m

I bet that Logan Paul will be a billionaire by 2029. Not because he created the #1 sports drink brand or has 7.36 BILLION views on YouTube. But because he cracked the code of Gen Z attention (it's so simple, you'll laugh): 2013: While classmates f

See More
12 Replies
7
19
Image Description
Image Description

Kaustubh Bhatter

Founder, Sharpener |... • 1y

How did I get my first 1000 users on my platform? My last post starting trending on Medial because I shared something valuable. Today I will tell you how I got my first 1000 users by spending Rs. 0 on marketing. I have an edtech product and needed

See More
19 Replies
20
48
Image Description
Image Description

redefinedbyai

Hey I am on Medial • 2m

This morning, I sat at my desk - right here at home - with a journal open, a pen in my hand and thinking. A small whisper in my head: "𝙈𝙖𝙮𝙗𝙚 𝙞𝙩'𝙨 𝙩𝙞𝙢𝙚 𝙩𝙤 𝙨𝙩𝙖𝙧𝙩 𝙤𝙫𝙚𝙧" I paused and looked at my blank page and realised, "𝙄 𝙠𝙣

See More
15 Replies
6
Image Description

Mehul Fanawala

 • 

The Clueless Company • 10m

I once asked a founder how often they do a sales audit. They looked at me like I asked them to solve a math equation in their head. Understand this: You can’t improve what you don’t measure. Here’s a simple process to get started: 1) Gather your

See More
1 Reply
7
18
Image Description
Image Description

SHEETAL SHARMA

Not an entrepreneur,... • 1m

✅ Day 1 of my Power BI journey – Done! Today, I finally completed the first day of my 7-day Power BI learning plan. I installed Power BI Desktop, explored the interface, and learned the basics about datasets, reports, and dashboards. Honestly, it

See More
23 Replies
3
20
Image Description
Image Description

Chirag

 • 

&OTHERS • 3m

“He was the loudest guy in every room. Now he quietly runs a ₹200 Cr business.” A childhood friend of mine loved the spotlight. Loud, expressive, always chasing attention. Back in school, he once said — “If people aren’t watching, what’s the point?”

See More
2 Replies
1

Download the medial app to read full posts, comements and news.