This work was done during one weekend by research workshop participants and does not represent the work of Apart Research.
ApartSprints
Mechanistic Interpretability Hackathon
Accepted at the 
 research sprint on 
Accepted at the 
Mechanistic Interpretability Hackathon
 research sprint on 
January 25, 2023

One Attention Head Is All You Need for Sorting Fixed-Length Lists

We trained a single layer attention-only transformer to sort a fixed-length list of non-repeating tokens. It turned out to implement an operation consisting of looking into the unsorted list and searching for tokens that are greater than the current token, giving greater weight to the ones that are closer in the ordering. This attention pattern was clearest in transformers with one attention head, whereas increasing the number of heads led to development of more complex algorithms. We further explored how the same task was accomplished by zero-layer models as well as how varying list length, vocabulary size, and model complexity impacts the results.

By 
Mateusz Bagiński, Gabin Kolly
🏆 
4th place
3rd place
2nd place
1st place
 by peer review