Transformers learn search algorithms but struggle as graph size increases, revealing fundamental limitations.
This paper investigates transformers' ability to learn search algorithms, using graph connectivity as a testbed and developing a novel mechanistic interpretability technique.
-----
https://arxiv.org/abs/2412.04703
π Original Problem:
LLMs struggle with robust search capabilities, but it's unclear if this is due to lack of data, insufficient parameters, or architectural limitations.
-----
π‘ Solution in this Paper:
β The researchers use graph connectivity as a testbed to generate unlimited high-coverage data for training small transformers.
β They develop a novel mechanistic interpretability technique to extract computation graphs from trained models.
β The study explores three distributions of DAG search problems: naΓ―ve, star, and balanced.
β They analyze the algorithm learned by transformers through this new interpretability method.
β The paper also investigates whether in-context exploration (chain-of-thought) improves search capabilities.
-----
π§ Key Insights from this Paper:
β Transformers can learn to search effectively when given the right training distribution.
β Models learn an exponential path-merging algorithm for search.
β Increasing model scale does not help overcome difficulties with larger input graphs.
β In-context exploration (chain-of-thought) does not resolve scaling limitations.
-----
π Results:
β Models achieve near-perfect accuracy on test sets with balanced distribution.
β Performance degrades as input graph size increases, even with more parameters.
β Constant number of layers required for depth-first search, but still struggles with larger graphs.
β Selection-inference approach does not overcome scaling limitations.