Saved in:
Bibliographic Details
Main Authors: Duan, Shaoxiong, Shi, Yining, Xu, Wei
Format: Preprint
Published: 2023
Subjects:
Online Access:https://arxiv.org/abs/2310.11984
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866914789635129344
author Duan, Shaoxiong
Shi, Yining
Xu, Wei
author_facet Duan, Shaoxiong
Shi, Yining
Xu, Wei
contents In this paper, we investigate the inherent capabilities of transformer models in learning arithmetic algorithms, such as addition and parity. Through experiments and attention analysis, we identify a number of crucial factors for achieving optimal length generalization. We show that transformer models are able to generalize to long lengths with the help of targeted attention biasing. In particular, our solution solves the Parity task, a well-known and theoretically proven failure mode for Transformers. We then introduce Attention Bias Calibration (ABC), a calibration stage that enables the model to automatically learn the proper attention biases, which we show to be connected to mechanisms in relative position encoding. We demonstrate that using ABC, the transformer model can achieve unprecedented near-perfect length generalization on certain arithmetic tasks. In addition, we show that ABC bears remarkable similarities to RPE and LoRA, which may indicate the potential for applications to more complex tasks.
format Preprint
id arxiv_https___arxiv_org_abs_2310_11984
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle From Interpolation to Extrapolation: Complete Length Generalization for Arithmetic Transformers
Duan, Shaoxiong
Shi, Yining
Xu, Wei
Machine Learning
Computation and Language
In this paper, we investigate the inherent capabilities of transformer models in learning arithmetic algorithms, such as addition and parity. Through experiments and attention analysis, we identify a number of crucial factors for achieving optimal length generalization. We show that transformer models are able to generalize to long lengths with the help of targeted attention biasing. In particular, our solution solves the Parity task, a well-known and theoretically proven failure mode for Transformers. We then introduce Attention Bias Calibration (ABC), a calibration stage that enables the model to automatically learn the proper attention biases, which we show to be connected to mechanisms in relative position encoding. We demonstrate that using ABC, the transformer model can achieve unprecedented near-perfect length generalization on certain arithmetic tasks. In addition, we show that ABC bears remarkable similarities to RPE and LoRA, which may indicate the potential for applications to more complex tasks.
title From Interpolation to Extrapolation: Complete Length Generalization for Arithmetic Transformers
topic Machine Learning
Computation and Language
url https://arxiv.org/abs/2310.11984