Meaning
Numerical vectors added to word representations allow a transformer model to understand where text is located on a two dimensional page. Integration of a spatial positional embedding encodes the vertical and horizontal coordinates of each word to supplement the standard sequential order of the text.
Coordinate Injection
Predefined mathematical functions or learned vectors transform raw pixel locations into a format the network can process. When a spatial positional embedding is applied, it provides a frame of reference that is independent of the reading order. A word at the bottom right corner of a page receives a different signature than a word at the top left.
Attention Mechanism
Relational weights between different tokens are adjusted based on their proximity in the physical layout. The spatial positional embedding helps the model focus on groups of words that form a single entity, such as an address block. Without this information, the network would only see a flat list of words and might struggle with multi column layouts.
Semantic Context
Layout information acts as a powerful signal for determining the function of a text segment. Utilizing a spatial positional embedding allows the system to distinguish between a page number and a monetary value.