AIExplainer
Large Language Models Intermediate 2 min read

What is positional encoding?

A technique used in AI to preserve the order of input data

Positional encoding is a way to add information about the position of each element in a sequence of data, such as a sentence or a list, to help AI models understand the relationships between elements

Imagine trying to understand a story without knowing the order of the events - it would be confusing. Positional encoding is like adding timestamps to each event, so the AI model can understand the sequence and make sense of the story

For example, in a language translation model, positional encoding helps the model understand that the word 'bank' can have different meanings depending on its position in the sentence - 'I went to the bank' vs 'I bank online'

Positional encoding is used in transformer-based AI models, such as those used for language translation and text summarization, to help the model understand the context and relationships between words or elements in the input data

Some people think that positional encoding is only used for language models, but it can be applied to any type of sequential data, such as time series data or audio signals

Positional encoding was introduced in the paper 'Attention is All You Need' by Vaswani et al. in 2017, which introduced the transformer model

positional embedding sequence encoding

Three products for different needs — explore what’s relevant to you.