Attention as a Hypernetwork

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Schug, Simon, Kobayashi, Seijin, Akram, Yassir, Sacramento, João, Pascanu, Razvan
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866929718129852416
author Schug, Simon
Kobayashi, Seijin
Akram, Yassir
Sacramento, João
Pascanu, Razvan
author_facet Schug, Simon
Kobayashi, Seijin
Akram, Yassir
Sacramento, João
Pascanu, Razvan
contents Transformers can under some circumstances generalize to novel problem instances whose constituent parts might have been encountered during training, but whose compositions have not. What mechanisms underlie this ability for compositional generalization? By reformulating multi-head attention as a hypernetwork, we reveal that a composable, low-dimensional latent code specifies key-query specific operations. We find empirically that this latent code is predictive of the subtasks the network performs on unseen task compositions, revealing that latent codes acquired during training are reused to solve unseen problem instances. To further examine the hypothesis that the intrinsic hypernetwork of multi-head attention supports compositional generalization, we ablate whether making the hypernetwork-generated linear value network nonlinear strengthens compositionality. We find that this modification improves compositional generalization on abstract reasoning tasks. In particular, we introduce a symbolic version of the Raven's Progressive Matrices human intelligence test, which gives us precise control over the problem compositions encountered during training and evaluation. We demonstrate on this task how scaling model size and data enables compositional generalization in transformers and gives rise to a functionally structured latent space.
format Preprint
id arxiv_https___arxiv_org_abs_2406_05816
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Attention as a Hypernetwork
Schug, Simon
Kobayashi, Seijin
Akram, Yassir
Sacramento, João
Pascanu, Razvan
Machine Learning
Transformers can under some circumstances generalize to novel problem instances whose constituent parts might have been encountered during training, but whose compositions have not. What mechanisms underlie this ability for compositional generalization? By reformulating multi-head attention as a hypernetwork, we reveal that a composable, low-dimensional latent code specifies key-query specific operations. We find empirically that this latent code is predictive of the subtasks the network performs on unseen task compositions, revealing that latent codes acquired during training are reused to solve unseen problem instances. To further examine the hypothesis that the intrinsic hypernetwork of multi-head attention supports compositional generalization, we ablate whether making the hypernetwork-generated linear value network nonlinear strengthens compositionality. We find that this modification improves compositional generalization on abstract reasoning tasks. In particular, we introduce a symbolic version of the Raven's Progressive Matrices human intelligence test, which gives us precise control over the problem compositions encountered during training and evaluation. We demonstrate on this task how scaling model size and data enables compositional generalization in transformers and gives rise to a functionally structured latent space.
title Attention as a Hypernetwork
topic Machine Learning
url https://arxiv.org/abs/2406.05816