for this formulas PE(pos,2i)=sin(pos/(10000^(2i/modelDimension)))
and PE(pos,2i+1)=cos(pos/(10000^(2i/modelDimension)))
we know PE for position i
follows: [sin(i/denominator[0]),cos(i/denominator[0]), sin(i/denominator[1]),cos(i/denominator[1]), sin(i/denominator[2]),cos(i/denominator[2]),...]
. note each element here is a proposed positional embedding element for an embedding element.
let's assume our embedding size is 1. so positional embedding for position i is sin(i/denominator[0])
. also assume denominator[0] value is 0.2
. so
PE(0,0)=sin(0)=0,
PE(1,0)=sin(5)=sin(1.59*Pi)=-.958,
PE(2,0)=sin(10)=sin(3.184*Pi)=-.544,
PE(3,0)=sin(15)=sin(4.777*Pi)=.6502
...
this just circulates the 2Pi. so in the sense of trying to assign a meaningful values for positional embeddings I dont realize how does it make sense. its not confined to sth like (i/max_sequence_length*pi/denominator[0])
, that way if we used only cosine
, the last words were assigned to -1 and first words assigned to 1. I mean some more understandable shifting embedding values into the space. if its not confined the positional embeddings dont obey a pattern the positional embeddings seem to be just random. how can not confining it makes sense?