about
Understanding Addition in Transformers (arxiv.org)
2 points by PaulHoule on Oct 31, 2023 | hide | past | pdf | discuss on HN

In plain words: They traced exactly how a small transformer adds multi-digit numbers, finding it splits the sum into separate streams for each digit, each using its own trick depending on position. The full explanation also accounts for a rare case where the model fails badly.

Abstract

Understanding the inner workings of machine learning models like Transformers is vital for their safe and ethical use. This paper provides a comprehensive analysis of a one-layer Transformer model trained to perform n-digit integer addition. Our findings suggest that the model dissects the task into parallel streams dedicated to individual digits, employing varied algorithms tailored to different positions within the digits. Furthermore, we identify a rare scenario characterized by high loss, which we explain. By thoroughly elucidating the model's algorithm, we provide new insights into its functioning. These findings are validated through rigorous testing and mathematical modeling, thereby contributing to the broader fields of model understanding and interpretability. Our approach opens the door for analyzing more complex tasks and multi-layer Transformer models.

Philip Quirke, Fazl Barez
arXiv:2310.13121 · cs.LG, cs.AI · submitted Oct 19, 2023 · updated Apr 23, 2024
abstract · pdf · html · 9 pages, 8 figures, accepted by ICLR 2024

add comment on HN