B1-I2 · Inline explainer · preview in article context
The encoder reads text with bidirectional attention. Each token can use context from both sides, which matters when a later word changes the meaning of an earlier one. A sentence representation needs that context before it can be compared with another sentence or passage.
Figure
Bidirectional attention lets a token representation use context from earlier and later positions. Connections are illustrative, not recorded attention weights.