This note is a summary of Master Positional Encoding: Part I

Think about the position encoder first as our normal binary encoding: 000, 001, 010, 011, etc. That’s not continuous. It cannot be interpolated, and has jump. So that’s why there is sin there. Why do we have both cosine and sin though? That’s to make sure there’s a nice property:

and with both sin and cos, we have this:

and we can find such a as