Concept

Sinusoidal Positional Encoding

A simple and dominant scheme for fixed positional encodings relies on sine and cosine functions. Suppose the input representation XRnimesd\mathbf{X} \in \mathbb{R}^{n imes d} contains the dd-dimensional embeddings for nn sequence tokens. The sinusoidal positional encoding outputs X+P\mathbf{X} + \mathbf{P} using a positional embedding matrix PRnimesd\mathbf{P} \in \mathbb{R}^{n imes d} of the exact same shape, seamlessly adding the positional information directly to the token embeddings.

Image 0

0

1

Updated 2026-05-14

Tags

Ch.2 Generative Models - Foundations of Large Language Models

Foundations of Large Language Models

Foundations of Large Language Models Course

Computing Sciences

D2L

Dive into Deep Learning @ D2L