Petar Veličković, Kimon Fountoulakis, Shenghao Yang, Artur Back De Luca, George Giapitzakis
We lifted 6 functions out of this paper's own repositories and ran 6 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.
| Repository | Role | Ran |
|---|---|---|
| opallab/positional_attention | canonical | 6 of 6 |
| Function | Status | Where it lives |
|---|---|---|
| append_positional_encoding | Ran | opallab/positional_attention/utils.py pointer only (licence: NONE) · get_code("35355129d33f1392") |
| generate_data_basic | Ran | opallab/positional_attention/data.py pointer only (licence: NONE) · get_code("cb8caf2a218f6d18") |
| get_loss | Ran | opallab/positional_attention/utils.py pointer only (licence: NONE) · get_code("57ea2937f20c00a2") |
| identity_pe | Ran | opallab/positional_attention/utils.py pointer only (licence: NONE) · get_code("877ac34b922959e6") |
| max_subarray | Ran | opallab/positional_attention/data.py pointer only (licence: NONE) · get_code("3ca064ce4e332ae9") |
| reverse_cumsum | Ran | opallab/positional_attention/data.py pointer only (licence: NONE) · get_code("251c9d9b7bf3aa4c") |
Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.
There is a growing interest in the ability of neural networks to execute algorithmic tasks (e.g., arithmetic, summary statistics, and sorting). The goal of this work is to better understand the role of attention in Transformers for algorithmic execution. Its importance for algorithmic execution has been studied theoretically and empirically using parallel computational models. Notably, many parallel algorithms communicate between processors solely using positional information. Inspired by this observation, we investigate how Transformers can execute algorithms using positional attention, where attention weights depend exclusively on positional encodings. We prove that Transformers with positional attention (positional Transformers) maintain the same expressivity of parallel computational models, incurring a logarithmic depth cost relative to the input length. We analyze their in-distribution learnability and explore how parameter norms in positional attention affect sample complexity. Our results show that positional Transformers introduce a learning trade-off: while they exhibit better theoretical dependence on parameter norms, certain tasks may require more layers, which can, in turn, increase sample complexity. Finally, we empirically explore the out-of-distribution performance of positional Transformers and find that they perform well in tasks where their underlying algorithmic solution relies on positional information.
The same record, over MCP at https://syntology.ai/mcp:
get_harvested_code_for_paper("2410.01686")
get_code_for_paper("2410.01686")
have("2410.01686")
Connect an agent — have() is free.