Relative Positional Encoding
A positional encoding method that directly models the relative distance between tokens by incorporating relative distance as part of the attention score. The same relative distance shares parameters across different absolute positions, making it more robust to changes in sequence length, though implementation is more complex.
Timeline (last 90 days)
Works such as Transformer-XL and T5 make relative distance part of the attention score, enabling the model to directly use the interval information between tokens.
The advantage of relative positional encoding is that the same relative distance shares one set of parameters across different absolute positions, making it friendlier to changes in sequence length; the cost is more complex implementation, with the relative position term requiring extra handling in attention computation and sometimes truncation or bucketing of distances beyond a certain range.
When training and inference lengths match, learnable absolute encodings are simple and effective; when inference on longer sequences is needed, relative encodings and RoPE are preferred.
No single positional-encoding scheme dominates across all dimensions: absolute encodings are simple to implement but extrapolate poorly, relative encodings are flexible but computationally complex, and RoPE expresses relative positions at the attention level but also requires additional extrapolation strategies.
Regarding the encoding of absolute physical position, the community is divided: some argue for direct normalized input, while others believe relative position encoding or learnable position embeddings should be used, because absolute position may introduce unnecessary bias.
Some comments mentioned that in robotics or physical simulation, relative position encoding is often more effective than absolute position encoding.
All Facts (6)
Works such as Transformer-XL and T5 make relative distance part of the attention score, enabling the model to directly use the interval information between tokens.
50%UnverifiedThe advantage of relative positional encoding is that the same relative distance shares one set of parameters across different absolute positions, making it friendlier to changes in sequence length; the cost is more complex implementation, with the relative position term requiring extra handling in attention computation and sometimes truncation or bucketing of distances beyond a certain range.
50%UnverifiedWhen training and inference lengths match, learnable absolute encodings are simple and effective; when inference on longer sequences is needed, relative encodings and RoPE are preferred.
50%UnverifiedNo single positional-encoding scheme dominates across all dimensions: absolute encodings are simple to implement but extrapolate poorly, relative encodings are flexible but computationally complex, and RoPE expresses relative positions at the attention level but also requires additional extrapolation strategies.
50%UnverifiedRegarding the encoding of absolute physical position, the community is divided: some argue for direct normalized input, while others believe relative position encoding or learnable position embeddings should be used, because absolute position may introduce unnecessary bias.
50%UnverifiedSome comments mentioned that in robotics or physical simulation, relative position encoding is often more effective than absolute position encoding.
50%