ChatPaper.aiChatPaper

Quand les Transformers apprennent-ils les heuristiques pour la connectivité des graphes ?

When Do Transformers Learn Heuristics for Graph Connectivity?

October 22, 2025
papers.authors: Qilin Ye, Deqing Fu, Robin Jia, Vatsal Sharan
cs.AI

papers.abstract

Les Transformers échouent souvent à apprendre des algorithmes généralisables, se reposant plutôt sur des heuristiques fragiles. En utilisant la connectivité des graphes comme banc d'essai, nous expliquons ce phénomène à la fois théoriquement et empiriquement. Nous considérons une architecture simplifiée de Transformer, le Transformer désentrelacé, et prouvons qu'un modèle à L couches a la capacité de résoudre des graphes dont les diamètres atteignent exactement 3^L, implémentant un algorithme équivalent au calcul des puissances de la matrice d'adjacence. Nous analysons la dynamique d'apprentissage et montrons que la stratégie apprise dépend de si la plupart des instances d'entraînement se situent dans cette capacité du modèle. Les graphes dont le diamètre est inférieur ou égal à 3^L favorisent l'apprentissage d'une solution algorithmique correcte, tandis que les graphes dépassant cette capacité conduisent à l'apprentissage d'une heuristique simple basée sur les degrés des nœuds. Enfin, nous démontrons empiriquement que restreindre les données d'entraînement à la capacité d'un modèle permet à la fois aux Transformers standard et désentrelacés d'apprendre l'algorithme exact plutôt que l'heuristique basée sur les degrés.
English
Transformers often fail to learn generalizable algorithms, instead relying on brittle heuristics. Using graph connectivity as a testbed, we explain this phenomenon both theoretically and empirically. We consider a simplified Transformer architecture, the disentangled Transformer, and prove that an L-layer model has capacity to solve for graphs with diameters up to exactly 3^L, implementing an algorithm equivalent to computing powers of the adjacency matrix. We analyze the training-dynamics, and show that the learned strategy hinges on whether most training instances are within this model capacity. Within-capacity graphs (diameter leq 3^L) drive the learning of a correct algorithmic solution while beyond-capacity graphs drive the learning of a simple heuristic based on node degrees. Finally, we empirically demonstrate that restricting training data within a model's capacity leads to both standard and disentangled transformers learning the exact algorithm rather than the degree-based heuristic.
PDF11October 23, 2025