KERPLE (Kernelized Relative Positional Embedding for Length Extrapolation) is a relative position scheme that adds a learned penalty, defined as a function of the position difference, to the attention scores, so that accuracy holds on sequences longer than in training. It was proposed by Chi, Fan, Ramadge, and Rudnicky in 2022 (NeurIPS 2022).
ALiBi showed that simply subtracting a distance-proportional penalty from the scores makes a model robust on sequences longer than in training. The KERPLE paper views this penalty as a kind of kernel (a function measuring how close two positions are) and works out "what shapes of penalty are theoretically sound and robust on long sequences." As a result, ALiBi becomes a special case of the framework, and two new variants are derived: a logarithmic variant and a power variant.
The practical conclusion is that the logarithmic variant works best. With only two learned parameters per head, it achieved lower perplexity than ALiBi, the T5 relative position bias, and RoPE on three large datasets at lengths of 8x the training length (4096) and beyond.
The left side of the figure at the top of the article shows where position information is injected. It uses the same layout as the figure in the ALiBi article; only the shape of the penalty added to the scores differs. The upper right shows the penalty matrix of the logarithmic variant, and the lower right is a plot comparing the penalty by distance with the ALiBi shape (the power variant with ). The parameters in the figure are illustrative examples; the actual values are determined by training.

