# Poster 28933

- Kind: Poster
- Talk page and recording: https://iclr.cc/virtual/2025/poster/28933

> Transcript of the talk's recording (session_asr), made by speech recognition or taken from the host's captions. It may contain errors. The words are the speakers'; listen to the recording on the talk's page before quoting it.

Hi, my name is Han-Soo Cho and let me talk about our recent work on Transformers Length Generalization in Arithmetic Tasks. Even though several state-of-the-art language models have shown remarkable reasoning capabilities, they often struggle with arithmetic tasks like long multiplications.
However, humans can break down complex calculations into smaller ones and then focus on specific intermediate steps to generate the final correct answer. This raises some interesting questions. Can we train a transformer to do these without training across the full range of context lengths? So here is a spoiler.
We propose a method that significantly improves the length realization of transformers in, but not limited to, the multiple location task. In this work, we focus on two arithmetic tasks. One is multi-operant addition where the number of operants and their lengths can be both longer at test time. Another one is integer multiplication where the lengths of both operants can be longer.
To solve these tasks, we used decoder-only transformers trained with next-token prediction. The key challenge? Standard transformers struggle to maintain their consistent reasoning capability as context length increases. To address this problem, we introduced a novel combination of two techniques, namely
Scratchpad and position coupling. Let's look at a concrete example. Our scratchpad for multi -operant addition is constructed by recording the intermediate calculations step by step.
Thanks to our scratch pad, the model might be able to generate every intermediate step by exploiting the previous calculations, ensuring that the number of tokens required to be attended is bounded by a constant at every next token prediction step. However, when the context gets longer, Transformers don't naturally recognize which tokens to focus on.
So this is where position coupling comes in, which is a task-specific position ID assignment rule that guides the model's attention to the correct positions for task solving regardless of the sequence length. And here we introduce a bi-level position coupling. In level 1 of position IDs, we assign the same IDs to identically significant digits in every number.
On the other hand, level two is for distinguishing the numbers. We can apply a similar method to the long multiplication task. Think about how we perform n digit by m digit multiplication. First, we compute n digit by one digit multiplication several times, and then we take the sum of these results, aligning the digits properly. So basically the second stage...
It's just a multi-open addition. This insight led us to design a two-stage scratch pad, breaking the multiplication into several steps just as humans do. Also, here we introduce tri -level version coupling. Now, here's our main experimental results. First, we observe that our scratch pads alone provide a mild boost in language generalization.
However, combining them with our multi-level approximation coupling significantly improves the performances. And we observe the strengths of our method in the multi-location as well. In addition to these numerical results, we provide a theoretical insight into why our method is so effective for long arithmetic.
Extending the expressiveness result proved in our previous work, we show that there exists a one -layer forehand decoder-only transformer using our method that entirely solves the addition task with exponentially many and exponentially long summons in terms of its embedding dimension.
To summarize, our work shows that explicitly structuring intermediate calculations and rewiring positional relationships with position IDs enables significant language generalization in arithmetic tasks. Thank you for your time and please visit our poster and GitHub.
