podcasts / The attention family / episode / question
Question

How do sinusoidal position embeddings work?

Answered from Position Embeddings: Learned, Sinusoidal, Relative | The attention family series - Lecture 9 · The attention family · 2026-10-09

Vizuara's Lecture 9 walks through the formula from the 2017 Attention Is All You Need paper: even dimensions take the sine, and odd dimensions the cosine, of the position divided by 10,000 raised to 2i over d. Each sine-cosine pair shares one frequency, and frequencies drop as dimensions rise. Sreedath Panat works it by hand for position 2 in 8 dimensions: dimension 0 is sin(2), about 0.91, and dimension 1 is cos(2), about -0.42. Because it is a formula, not a table, it gives a vector for any position, however long the context.

Source: our own transcription of the episode. The full conversation is on The attention family (2026-10-09). Read the whole episode summary →

▸More from this episode

Q1Why do transformers need position embeddings, according to Vizuara?Q2Does adding a position embedding change a word's meaning in a transformer?Q3How do learned absolute position embeddings work in GPT-2?Q5Why does every position get a unique sinusoidal embedding if sine waves repeat?Q6How does Shaw et al.'s relative position representation work?Q7What is T5's relative position bias and how is it different from a position embedding?Q8What happens to a small language model trained without position embeddings?
Transcribe your links. Paste a YouTube, Google Drive or podcast link and WhipScribe gives you the transcript. Transcribe a link →